Could we get rid of the code implementing the optimization to share finally block ? #3246
Closed
srikanth-sankaran
started this conversation in
General
Replies: 4 comments 1 reply
-
I do not see any corresponding UI/code for this option. |
Beta Was this translation helpful? Give feedback.
0 replies
-
No objections from me. |
Beta Was this translation helpful? Give feedback.
1 reply
-
Thanks! I will merge a patch to master on Friday unless in the interim I hear any counter opinions. |
Beta Was this translation helpful? Give feedback.
0 replies
-
PR here: #3281 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Background: https://bugs.eclipse.org/bugs/show_bug.cgi?id=404146
More than a decade ago, we disabled the optimization to "share" code emitted for finally blocks. This is because, it emerged that our infrastructure has some gaps in analysis that would lead to bad code generation in some cases. The fundamental problem was that, the precise knowledge of the initialization status of secret variables synthesized by various parts of the compiler was not known to the flow analysis phase. (Note: The number of secret variables have increased in the past decades with the implementation of many JEPs in the interim resulting in these to increase in number)
So we decided to disable this optimization but per suggestion in https://bugs.eclipse.org/bugs/show_bug.cgi?id=404146#c21 we still had this behavior under an option
org.eclipse.jdt.internal.compiler.impl.CompilerOptions.OPTION_ShareCommonFinallyBlocks
I believe this option was never documented and is not exposed in the UI (@noopur2507 - can you confirm ? TIA)
The only tests that seem to care are
org.eclipse.jdt.core.tests.compiler.regression.XLargeTest.test015()
which will fail with an error
The code of method foo(int) is exceeding the 65535 bytes limit
- if this sharing behavior is completely removed - this is as predicted by https://bugs.eclipse.org/bugs/show_bug.cgi?id=404146#c15.As the same comment mentions, javac doesn't implement this optimization and so compiling this test case with javac also fails with:
X.java:3: error: code too large for try statement
org.eclipse.jdt.core.tests.compiler.regression.TryStatementTest.test042()
: This failure is not a real functionality test. It is checking that the bytecodes produced do share the finally blocksI would like to hear any objections to getting rid of this code against these considerations:
The code involved is not huge, but it is like a death by a thousand cuts if we don't clear up the clutter in various places each being small.
@stephan-herrmann @jarthana @mpalat @iloveeclipse : Thoughts ?
Beta Was this translation helpful? Give feedback.
All reactions