-
Notifications
You must be signed in to change notification settings - Fork 728
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
Should OpenJ9 throw a verifyerror for my test class? #1404
Comments
Hi, in case that OpenJ9 correctly processes this corner case, please also let me know. :) |
I just got another test case. Run CTest.class on HotSpot and OpenJ9. OpenJ9 reports JVMCFRE068, while HotSpot reports a verify error (Inconsistent stackmap frames). Is JVMCFRE068 also related with verify errors (e.g., Bad local variable type/Inconsistent stackmap frames)? OpenJ9: HotSpot:
javap -verbose CTest.class |
@pdbain-ibm Can you take a look at this? |
@myspringchen would you please indicate which HotSpot build you used? I tested with the latest build from OpenJDK: $ java ATest With OpenJ9: I get the same result with CTest. All tests use Java 9. |
I do, however, see that HotSpot Java 8 has different behaviour: $ jdk1.8.0_60/jre/bin/java ATest |
Got the same format errors when HotSpot (build 9.0.4+11) is used, :) It seems to be a minor defect in HotSpot for Java 8. |
I believe the OpenJ9 behaviour is reasonable and correct. The verifier is checking a classname "Ljava/lang/Object;" and throwing an error on the
@DanHeidinga would you kindly check my findings? Thanks. |
@myspringchen does this answer your question? Thanks |
@pdbain-ibm Thanks. Regression details8uxx - Pass This issue is introduced by JDK-8160699 |
Thank you. I suggest we close this issue as it seems to be a problem with OpenJDK Java 8 only. |
Thanks for the analysis on this @pdbain-ibm. OpenJ9's behaviour is correct. There was OpenJDK changed their behaviour under https://bugs.java.com/view_bug.do?bug_id=JDK-8161224 to. Quoting:
|
I was recently confused by a test class. When run on OpenJDK's HotSpot, the class triggers a verify error; when run on OpenJ9, it triggers a class format error (JVMCFRE068). I wonder whether OpenJ9 throws an incorrect error here. (Some class variable is not correctly defined, while the format should be correct)
How to reproduce: download ATest.class/BTest.class (https://jbox.sjtu.edu.cn/l/WuCI1G) and run java ATest
OpenJ9:
Error: LinkageError occurred while loading main class ATest
java.lang.ClassFormatError: JVMCFRE068 class name is invalid; class=ATest, offset=0
HotSpot:
Exception in thread "main" java.lang.VerifyError: Bad local variable type
Exception Details:
Location:
ATest.put()V @9: aload_1
Reason:
Type top (current frame, locals[1]) is not assignable to reference type
Current Frame:
bci: @9
flags: { }
locals: { 'ATest' }
stack: { }
Bytecode:
0x0000000: 2ac7 0008 2ab4 000a 4c2b 0332 4b2a b400
0x0000010: 104b a7ff fb
Stackmap Table:
same_frame(@9)
full_frame(@13,{Object[#18]},{})
javap -verbose ATest.class
public class ATest
minor version: 0
major version: 52
flags: ACC_PUBLIC, ACC_SUPER
Constant pool:
#1 = Utf8 ATest
#2 = Class #1 // ATest
#3 = Utf8 java/lang/Object
#4 = Class #3 // java/lang/Object
#5 = Utf8 table
#6 = Utf8 [LBTest;
#7 = Utf8 put
#8 = Utf8 ()V
#9 = NameAndType #5:#6 // table:[LBTest;
#10 = Fieldref #2.#9 // ATest.table:[LBTest;
#11 = Utf8 BTest
#12 = Class #11 // BTest
#13 = Utf8 next
#14 = Utf8 LBTest;
#15 = NameAndType #13:#14 // next:LBTest;
#16 = Fieldref #12.#15 // BTest.next:LBTest;
#17 = Utf8 Ljava/lang/Object;
#18 = Class #17 // "Ljava/lang/Object;"
#19 = Utf8 Code
#20 = Utf8 StackMapTable
{
BTest[] table;
descriptor: [LBTest;
flags:
public void put();
descriptor: ()V
flags: ACC_PUBLIC
Code:
stack=2, locals=2, args_size=1
0: aload_0
1: ifnonnull 9
4: aload_0
5: getfield #10 // Field table:[LBTest;
8: astore_1
9: aload_1
10: iconst_0
11: aaload
12: astore_0
13: aload_0
14: getfield #16 // Field BTest.next:LBTest;
17: astore_0
18: goto 13
StackMapTable: number_of_entries = 2
frame_type = 9 /* same /
frame_type = 255 / full_frame */
offset_delta = 3
locals = [ class "Ljava/lang/Object;" ]
stack = []
}
The text was updated successfully, but these errors were encountered: