-
Notifications
You must be signed in to change notification settings - Fork 857
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
java.lang.VerifyError in language/statements/try of test262 #915
Comments
This is an excerpt of a dump of a class file output by
|
No expert here, but:
|
Thanks! |
What if you take that try.class file and try to decompile it, for example using http://www.javadecompilers.com/? Maybe if it decompiles, some sense can be made of the resulting Java code |
I tried all the decompilers, but none of them output the correct |
As I said, no expert here on bytecode stuff, but that would be my guess as well, that the class is corrupt due to bad bytecode generation. One thing to try is to create a try2.class from a similar snippet of JavaScript, but one that doesn't display this VerifyError and see if that one does decompile. If that is the case, I think its fairly safe to say that the bytecode generation for JS snippet above is wrong. |
These kinds of bugs are painful to find. My guess would be that the noops
are a symptom and not the cause of the problem, but it's going to take some
work to unravel this. I'll see if I have any ideas, but I think it's
important that we fix this and I hope that some others have ideas too.
…On Tue, Jun 29, 2021 at 5:45 AM Paul Bakker ***@***.***> wrote:
As I said, no expert here on bytecode stuff, but that would be my guess as
well, that the class is corrupt due to bad bytecode generation.
One thing to try is to create a try2.class from a similar snippet of
JavaScript, but one that doesn't display this VerifyError and see if that
one does decompile. If that is the case, I think its fairly safe to say
that the bytecode generation for JS snippet above is wrong.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#915 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAD7I274XFIL4XPEABMTVELTVG55XANCNFSM45YEDHEA>
.
|
"git bisect" tells me unhelpfully that this bug started happening when we
switched the target of the bytecode generation from 1.6 to 1.8, which
happened in 2017 with commit f3fff47.
(Literally all it does is change the version of the generated bytecode.)
That would result in a change in the header that's in the generated
bytecode that specifies the version and that would be it. I imagine maybe
the JVM tightened up the verification rules at that point. Unfortunately
that doesn't really help.
…On Tue, Jun 29, 2021 at 8:45 AM Gregory Brail ***@***.***> wrote:
These kinds of bugs are painful to find. My guess would be that the noops
are a symptom and not the cause of the problem, but it's going to take some
work to unravel this. I'll see if I have any ideas, but I think it's
important that we fix this and I hope that some others have ideas too.
On Tue, Jun 29, 2021 at 5:45 AM Paul Bakker ***@***.***>
wrote:
> As I said, no expert here on bytecode stuff, but that would be my guess
> as well, that the class is corrupt due to bad bytecode generation.
>
> One thing to try is to create a try2.class from a similar snippet of
> JavaScript, but one that doesn't display this VerifyError and see if that
> one does decompile. If that is the case, I think its fairly safe to say
> that the bytecode generation for JS snippet above is wrong.
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <#915 (comment)>, or
> unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAD7I274XFIL4XPEABMTVELTVG55XANCNFSM45YEDHEA>
> .
>
|
No idea if at all related, but found the following in https://www.oracle.com/java/technologies/javase/8-compatibility-guide.html:
And in https://www.oracle.com/java/technologies/compatibility.html there's talk about stackmaps and verification Hope this helps |
I think it's just that before Java 7, stack maps weren't required, and
after that they were. I think that Rhino may have always been generating an
invalid stack map for this case. It's going to take some thinking to figure
it out though.
…On Tue, Jun 29, 2021 at 10:12 AM Paul Bakker ***@***.***> wrote:
No idea if at all related, but found the following in
https://www.oracle.com/java/technologies/javase/8-compatibility-guide.html
:
Verification of the invokespecial instruction has been tightened when the
instruction refers to an instance initialization method ("").
And in https://www.oracle.com/java/technologies/compatibility.html
there's talk about stackmaps and verification
Hope this helps
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#915 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAD7I2YW65GKUOG67ZF5ADTTVH5JPANCNFSM45YEDHEA>
.
|
Maybe it's that As if this stuff wasn't already a mess, turns out that the |
I'd like to move towards an RC for 1.7.14. This bug has been in there since 2017, and so far no one has picked it up or had an idea how to fix it. I think that there are enough benefits to doing a release to move this bug out of the 1.7.14 release. |
@carlosame |
I've moved this case to the v1.7.15 milestone, so it no longer blocks the v1.7.14 rc/release (can always move it back if a PR solving the issue comes around very quickly that doesn't look too risky to include for v1.7.14 :-) ) |
I generated code to reproduce @tuchida's $ java -cp "asm-9.2.jar;asm-util-9.2.jar;buildGradle/libs/rhino-1.7.14-SNAPSHOT.jar" org.objectweb.asm.util.ASMifier try.class>try_js_1Dump.java then executed this: byte[] dump = try_js_1Dump.dump();
FileOutputStream oStream = new FileOutputStream("try.class.asm");
oStream.write(dump);
oStream.close(); I "textified" that dump (with ASM's $ java -cp "asm-9.2.jar;asm-util-9.2.jar;buildGradle/libs/rhino-1.7.14-SNAPSHOT.jar" org.objectweb.asm.util.Textifier try.class>try.txt Then I edited the ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES); and repeated the dump. The No fix for the issue so far, but I thought that sharing these results could be interesting. |
When I enable language/statements/try in test262, I get the following error.
With JavaScript code like this
I got an error like the following
https://app.circleci.com/pipelines/github/mozilla/rhino/394/workflows/06f40ab3-873d-4ffd-b26f-753722081c8a/jobs/400/tests
I investigated the cause of this, but could not find it. If there is any way to find out, please let me know. For example, is there any way to isolate whether the StackMapTable is wrong or the bytecode itself is wrong?
The text was updated successfully, but these errors were encountered: