Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge 1.8.0 update #91

Merged
merged 120 commits into from
Apr 5, 2022
Merged

Merge 1.8.0 update #91

merged 120 commits into from
Apr 5, 2022

Conversation

jaskarth
Copy link
Member

@jaskarth jaskarth commented Apr 5, 2022

The contents of the 1.8.0 update.

Changelog:

The changelog for this version is very long, so here are the highlights:

  • Improved the quality and cleanliness of the output
  • Many fixes to generics
  • Many fixes to loops
  • Dozens of bugs and crashes fixed
Click here to expand the full changelog
  • Added ++/-- inlining when possible
  • Added variable renaming when there's multiple variables with the same name
  • Added switch statement brace enclosing when the multiple variables are in different case branches
  • Added switch expression in assert support
  • Added Implementation-Name: Quiltflower to jar manifest (thanks jnp!)
  • Added formatting on complex if-else chains (thanks Earthcomputer!)
  • Changed some default options: generic signatures and synthetic members are now hidden by default, pattern matching is enabled, and ternary-in-if is disabled
  • Improved default branch hiding on switches when it's an empty fallthrough
  • Improved generic casts on ternaries
  • Improved generic casts on assigns
  • Improved ternary type inference when one branch is null
  • Improved detection of explicit generic invocations, such as Comparator.<...>comparing()
  • Improved variable merging in loops (improved variable liveness calculation)
  • Improved if-else statement structure to prevent highly nested if-else statements
  • Improved conversion of labeled continues to breaks to produce correct but cleaner code
  • Improved if statements with a single labeled sequence by lifting the label to the if statement, making it clearer what is being jumped to by the label
  • Improved the experimental try loop fix, now works better and doesn't break on random code
  • Improved the IResultSaver API (thanks zml!)
  • Improved pattern matching significantly
  • Improved string concat support, now supports makeConcat as well as makeConcatWithConstants
  • Improved infinite loop with return at the end condensing significantly better
  • Improved labeled break -> continue resugaring
  • Optimized excess memory usage
  • Fixed variables in foreach loops
  • Fixed null being cast when it doesn't need to be
  • Fixed constructor invocations having extra parenthesis
  • Fixed switch expressions not having parenthesis around them when they should
  • Fixed instances where variables were cast twice
  • Fixed switch statements in finally blocks causing issues
  • Fixed synchronized statements having a null argument when object is being assigned to null
  • Fixed synchronized statements removing autoboxing
  • Fixed method()[i] += 0; not being properly inlined
  • Fixed copying files to directories not working properly
  • Fixed boxing issues with field initializers
  • Fixed rare crashes with inconsistent idom sequences
  • Fixed continues becoming implicit when they should be explicit
  • Fixed local classes not decompiling breaking entire file
  • Fixed double brace initializers in java 17 placing extra modifiers on the braces
  • Fixed some cases where stack variables created by the dup bytecode family were not simplified
  • Fixed swap based constructor invocations
  • Fixed cases where while loops were improperly created, moving a continue out of the loop
  • Fixed case when there are 2 pops after a jump (thanks Kroppeb!)
  • Fixed expression reordering in array initializes resulting in semantically different code (thanks Kroppeb!)
  • Fixed phantom continue or break at the end of a loop
  • Fixed statement graph ordering being incorrect in certain cases
  • Fixed IndexOutOfBounds in ternary processing
  • Fixed statement graph not discovering all nodes, leading to variables
  • Fixed improper loop elimination when the loop was required to make the output correct
  • Fixed generics not casting on super keyword (contravariance)
  • Fixed open file systems not being closed (thanks CoolMineman!)

jaskarth and others added 30 commits December 7, 2021 08:18
Not sure if this is doing everything correctly, but it does fix the test- will keep until more complexity reveals itself or other problems are discovered
- Fix instances where lack of cast or improper cast will cause methods to not recompile properly
* Add test for ugly if-else chain

* Add todo
I tried my best to analyze this with as many different test cases as I could, to get a grasp of the full algorithm. This thing is frighteningly complex and this is just a start in  understanding what is going on here
jaskarth and others added 23 commits January 15, 2022 12:21
- Adds baseline support for pattern matching switch expressions, which require some more custom support. This can eventually be refactored and added onto the switch expression helper, to consolidate the logic.
- I just forgot to push them, here they are now.
* Close opened file systems

* cleanup

* fix

* make jrt lazy again

* fix for real
- Fix pattern matching with loops, now properly assigned to
- Significantly improve pattern matching with nested if statements, now creates && properly
- If statements are now not reordered if they contain pattern matches, as that requires further complex analysis
- Small improvements to Experent#getAllExprents api

Further work: `Conditional` interface for if statements and loop, as well as hooking all this up to SSA/U
- Adds minimal support for pattern matching variables to used in var dependency graphs (should not change anything)
- Adds a bit more debug for ssau dot exporting
- Some preferences were excluded as it's not intended for users to modify them, such as unit test mode
…r the most common use case

- Synthetic members are now hidden by default
- Generic signatures are decompiled by default, as there is usually no case where you don't want that
- Pattern matching is now enabled by default
- Ternary conditions in if statements are now disabled by default as they cause many issues
…#84)

* Adjust IResultSaver to support both Fabricflower and Forgeflower APIs

* build: remove deprecated gradle api

* whitespace
@jaskarth jaskarth self-assigned this Apr 5, 2022
@jaskarth jaskarth added Priority: High High priority Version Update A pull request that merges a new version into main labels Apr 5, 2022
@github-actions
Copy link

github-actions bot commented Apr 5, 2022

Test Results

     12 files  ±0       12 suites  ±0   38s ⏱️ ±0s
   416 tests ±0     416 ✔️ ±0  0 💤 ±0  0 ❌ ±0 
1 251 runs  ±0  1 251 ✔️ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit d0cdda0. ± Comparison against base commit d0cdda0.

♻️ This comment has been updated with latest results.

- It now properly decompiles more things, and doesn't cause extra problems and decompilation failures as a side effect. It specifically targets when if statements are built and triggers a full postdominator set calculation and general statement finding, which properly decomposes the graph.
@jaskarth jaskarth merged commit d0cdda0 into master Apr 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: High High priority Version Update A pull request that merges a new version into main
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants