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

[4.35+][Internal] TryStatement's secret return value location is useless #3251

Open
srikanth-sankaran opened this issue Nov 5, 2024 · 2 comments
Assignees
Milestone

Comments

@srikanth-sankaran
Copy link
Contributor

org.eclipse.jdt.internal.compiler.ast.TryStatement creates a secret variable where a return statement in the the try block can stash away the value to be returned which can then be picked up by the finally block.

This mechanism is for the jsr/ret days and has no place in the JDK6+ code generation scheme.

Only impediment to this significant clean up will likely be many test failures due to bytecode disassembly differences and comparator differences :(

@srikanth-sankaran srikanth-sankaran self-assigned this Nov 5, 2024
@srikanth-sankaran srikanth-sankaran added this to the MilestoneNxt milestone Nov 5, 2024
@srikanth-sankaran
Copy link
Contributor Author

See that neither org.eclipse.jdt.internal.compiler.ast.TryStatement.generateFinallyBlock(BlockScope, CodeStream, Object, int, LocalVariableBinding) nor org.eclipse.jdt.internal.compiler.ast.SynchronizedStatement.generateFinallyBlock(BlockScope, CodeStream, Object, int, LocalVariableBinding) touches the last parameter corresponding to the secret variable.

ReturnStatement goes to some lengths to process and plumb this secret variable through to finally code generation, all for nothing!

@iloveeclipse
Copy link
Member

Only impediment to this significant clean up will likely be many test failures due to bytecode disassembly differences and comparator differences :(

Shouldn't be a problem, we've managed to fo through this in the past. So this shouldn't be a reason to not cleanup code generation.

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

No branches or pull requests

2 participants