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

Smart Max Stack, Max Locals, and Frames Computation #539

Merged
merged 7 commits into from
Apr 3, 2024

Conversation

volodya-lombrozo
Copy link
Member

@volodya-lombrozo volodya-lombrozo commented Apr 3, 2024

In this PR I fixed the problem with automatic computation of max stack, max locals, and frames per method basis.
The solution is quite suboptimal since Java ASM library doesn't provide this functionality.
You can read more about this problem here.

In order to solve this problem I used reflection which has some risks for the future maintainability of CustomClassWriter:

  • it might work incorrectly in a concurrent environment
  • it's rather slow since constantly changes ClassWriter class definition in runtime (reflection)
    It's better to find the proper solution for this problem in the future.

Closes: #528.

History:


PR-Codex overview

This PR refactors bytecode generation in the project. It introduces a CustomClassWriter and improves method writing logic.

Detailed summary

  • Introduces CustomClassWriter for bytecode generation
  • Updates method writing logic in BytecodeMethodProperties
  • Replaces ClassVisitor with CustomClassWriter in BytecodeMethod
  • Improves bytecode generation in BytecodeClass

The following files were skipped due to too many changes: src/main/java/org/eolang/jeo/representation/bytecode/CustomClassWriter.java

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

@volodya-lombrozo
Copy link
Member Author

@rultor merge

@rultor
Copy link
Contributor

rultor commented Apr 3, 2024

@rultor merge

@volodya-lombrozo OK, I'll try to merge now. You can check the progress of the merge here

@rultor rultor merged commit e462828 into objectionary:master Apr 3, 2024
8 checks passed
@rultor
Copy link
Contributor

rultor commented Apr 3, 2024

@rultor merge

@volodya-lombrozo Done! FYI, the full log is here (took me 16min)

@volodya-lombrozo
Copy link
Member Author

@rultor release, tag is 0.4.0, title is 0.4.0.

@rultor
Copy link
Contributor

rultor commented Apr 5, 2024

@rultor release, tag is 0.4.0, title is 0.4.0.

@volodya-lombrozo OK, I will release it now. Please check the progress here

@rultor
Copy link
Contributor

rultor commented Apr 5, 2024

@rultor release, tag is 0.4.0, title is 0.4.0.

@volodya-lombrozo Done! FYI, the full log is here (took me 17min)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CustomClassWriter.java:48-52: Disable automatic frame...
2 participants