-
Notifications
You must be signed in to change notification settings - Fork 211
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
Fix the bug that wrongly trims local vars in a stack #146
Conversation
Could you please elaborate on why we need to remove only |
yea, I've checked the section, the 4.10.1.2. Verification Type System section, and the janino implementation before opening this PR. IIUC the other verification types seem to have coresponding local vars in janino/janino/src/main/java/org/codehaus/janino/UnitCompiler.java Lines 13226 to 13230 in f16db69
|
Thank you for the check, @aunkrig ! |
Janino 3.1.4 is just out the door. |
### What changes were proposed in this pull request? This PR proposes to bump up the janino version from 3.0.16 to v3.1.4. The major changes of this upgrade are as follows: - Fixed issue #131: Janino 3.1.2 is 10x slower than 3.0.11: The Compiler's IClassLoader was initialized way too eagerly, thus lots of classes were loaded from the class path, which is very slow. - Improved the encoding of stack map frames according to JVMS11 4.7.4: Previously, only "full_frame"s were generated. - Fixed issue #107: Janino requires "org.codehaus.commons.compiler.io", but commons-compiler does not export this package - Fixed the promotion of the array access index expression (see JLS7 15.13 Array Access Expressions). For all the changes, please see the change log: http://janino-compiler.github.io/janino/changelog.html NOTE1: I've checked that there is no obvious performance regression. For all the data, see a link: https://docs.google.com/spreadsheets/d/1srxT9CioGQg1fLKM3Uo8z1sTzgCsMj4pg6JzpdcG6VU/edit?usp=sharing NOTE2: We upgraded janino to 3.1.2 (#27860) once before, but the commit had been reverted in #29495 because of the correctness issue. Recently, #32374 had checked if Spark could land on v3.1.3 or not, but a new bug was found there. These known issues has been fixed in v3.1.4 by following PRs: - janino-compiler/janino#145 - janino-compiler/janino#146 ### Why are the changes needed? janino v3.0.X is no longer maintained. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? GA passed. Closes #32455 from maropu/janino_v3.1.4. Authored-by: Takeshi Yamamuro <[email protected]> Signed-off-by: Sean Owen <[email protected]>
This PR intends to fix the bug where
CodeContext#restoreLocalVariables
wrongly trims local vars in a stack;janino/janino/src/main/java/org/codehaus/janino/CodeContext.java
Lines 231 to 238 in f16db69
The number of
sm.locals()
is not always the same with the number ofallLocalVars
becausesm.locals()
might contain the verification typeTOP_VARIABLE_INFO
. So, this PR excludes the type insm.locals()
when checking whether we could trimsm.locals()
or not. Since the logic to trimsm.locals()
was merged in the commit 66af9f2, this issue can happen in janino-master/v3.1.3. Note that janino does not trimsm.locals()
before the commit, so janino-v3.1.2 and the earlier versions does not have the issue.This PR adds a new test in
ReportedBugsTest
and the test throws an exception below without this fix;The code tries to reference the already-trimmed local var in a stack then it fails. I've checked that all the existing tests can pass with this fix merged.
SIDE NOTE: I found this bug when checking whether Spark can land on the latest janino. For example, a query below fails when using spark-master + janino-master/v3.1.3;
See this link for the fully-generated code by Spark.