Re: 答复: 答复: 答复: HotSpot and IBM's J9 behave quite differently when processing monitorenters and monitorexits

David Holmes david.holmes at oracle.com
Mon May 22 00:28:25 UTC 2017


Hi Yuting,

This invokeinterface issue really should be discussed in a separate 
thread - this email chain is already quite unstructured.

On 20/05/2017 7:25 AM, 陈雨亭 wrote:
> HotSpot's verifyerror is given here. I read the specification (https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.10.1.9.invokeinterface) and did not get the hints. Not quite sure whether isAssignable should be enforced for verifying the invokeinterface instruction.

What version of the JDK did you use to check this? There have been some 
very recent changes with regard to verification of invokeinterface.

More generally these kinds of verifier queries, and discussions of 
difference between verifiers should be taken to 
jls-jvms-spec-comments at openjdk.java.net

http://mail.openjdk.java.net/mailman/listinfo/jls-jvms-spec-comments

I am not fluent at reading and understanding the prolog rules for this, 
and this is an area where we need to be very precise.

Thanks,
David

> 
> Location:
>      org/dacapo/h2/TPCC.loadData()V @3: invokeinterface
>    Reason:
>      Type uninitialized 0 (current frame, stack[0]) is not assignable to 'org/apache/derbyTesting/system/oe/client/Load'
>    Current Frame:
>      bci: @3
>      flags: { }
>      locals: { 'org/dacapo/h2/TPCC' }
>      stack: { uninitialized 0 }
>    Bytecode:
>      0x0000000: bb00 13b9 0018 0100 b1
> 
> -----邮件原件-----
> 发件人: 陈雨亭 [mailto:chenyt at cs.sjtu.edu.cn]
> 发送时间: 2017年5月19日 14:11
> 收件人: 'David Holmes' <david.holmes at oracle.com>
> 抄送: 'hotspot-runtime-dev at openjdk.java.net' <hotspot-runtime-dev at openjdk.java.net>
> 主题: 答复: 答复: 答复: HotSpot and IBM's J9 behave quite differently when processing monitorenters and monitorexits
> 
> Hi, David,
> Hi, I saw the discussions (about the verification) at https://bugs.openjdk.java.net/browse/JDK-8180581. If the specification needs to be clarified, please also include a similar example. Similarly, an object is not initialized before the " invokeinterface" instruction. At this time, HotSpot's verifier reports a verifyerror, while J9 normally runs the code.
> 
> A verifier takes a def-use analysis to verify the bytecode, while when an object is really ready to use is not very clear.
> 
>    public void loadData() throws java.lang.Exception;
>      descriptor: ()V
>      flags: ACC_PUBLIC
>      Code:
>        stack=1, locals=1, args_size=1
>           0: new           #19                 // class org/apache/derbyTesting/system/oe/load/ThreadInsert
>           3: invokeinterface #24,  1           // InterfaceMethod org/apache/derbyTesting/system/oe/client/Load.populateAllTables:()V
>           8: return
>      Exceptions:
>        throws java.lang.Exception
> 
> Regards,
> Yuting
> 
> -----------------------
> public class org.dacapo.h2.TPCC
>    minor version: 0
>    major version: 52
>    flags: ACC_PUBLIC, ACC_SUPER
> Constant pool:
>     #1 = Utf8               org/dacapo/h2/TPCC
>     #2 = Class              #1             // org/dacapo/h2/TPCC
>     #3 = Utf8               java/lang/Object
>     #4 = Class              #3             // java/lang/Object
>     #5 = Utf8               <clinit>
>     #6 = Utf8               ()V
>     #7 = Utf8               <init>
>     #8 = Utf8               (Lorg/dacapo/parser/Config;Ljava/io/File;ZZ)V
>     #9 = Utf8               java/lang/Exception
>    #10 = Class              #9             // java/lang/Exception
>    #11 = NameAndType        #7:#6          // "<init>":()V
>    #12 = Methodref          #4.#11         // java/lang/Object."<init>":()V
>    #13 = Utf8               loadData
>    #14 = NameAndType        #13:#6         // loadData:()V
>    #15 = Methodref          #2.#14         // org/dacapo/h2/TPCC.loadData:()V
>    #16 = Utf8               iteration
>    #17 = Utf8               (Ljava/lang/String;)V
>    #18 = Utf8               org/apache/derbyTesting/system/oe/load/ThreadInsert
>    #19 = Class              #18            // org/apache/derbyTesting/system/oe/load/ThreadInsert
>    #20 = Utf8               org/apache/derbyTesting/system/oe/client/Load
>    #21 = Class              #20            // org/apache/derbyTesting/system/oe/client/Load
>    #22 = Utf8               populateAllTables
>    #23 = NameAndType        #22:#6         // populateAllTables:()V
>    #24 = InterfaceMethodref #21.#23        // org/apache/derbyTesting/system/oe/client/Load.populateAllTables:()V
>    #25 = Utf8               make
>    #26 = Utf8               (Lorg/dacapo/parser/Config;Ljava/io/File;Ljava/lang/Boolean;Ljava/lang/Boolean;)Lorg/dacapo/h2/TPCC;
>    #27 = NameAndType        #7:#8          // "<init>":(Lorg/dacapo/parser/Config;Ljava/io/File;ZZ)V
>    #28 = Methodref          #2.#27         // org/dacapo/h2/TPCC."<init>":(Lorg/dacapo/parser/Config;Ljava/io/File;ZZ)V
>    #29 = Utf8               postIteration
>    #30 = Utf8               preIteration
>    #31 = Utf8               Code
>    #32 = Utf8               Exceptions
> {
>    static {};
>      descriptor: ()V
>      flags: ACC_STATIC
>      Code:
>        stack=0, locals=0, args_size=0
>           0: return
> 
>    public org.dacapo.h2.TPCC(org.dacapo.parser.Config, java.io.File, boolean, boolean) throws java.lang.Exception;
>      descriptor: (Lorg/dacapo/parser/Config;Ljava/io/File;ZZ)V
>      flags: ACC_PUBLIC
>      Code:
>        stack=1, locals=5, args_size=5
>           0: aload_0
>           1: invokespecial #12                 // Method java/lang/Object."<init>":()V
>           4: aload_0
>           5: invokespecial #15                 // Method loadData:()V
>           8: return
>      Exceptions:
>        throws java.lang.Exception
> 
>    public void iteration(java.lang.String) throws java.lang.Exception;
>      descriptor: (Ljava/lang/String;)V
>      flags: ACC_PUBLIC
>      Code:
>        stack=0, locals=2, args_size=2
>           0: return
>      Exceptions:
>        throws java.lang.Exception
> 
>    public void loadData() throws java.lang.Exception;
>      descriptor: ()V
>      flags: ACC_PUBLIC
>      Code:
>        stack=1, locals=1, args_size=1
>           0: new           #19                 // class org/apache/derbyTesting/system/oe/load/ThreadInsert
>           3: invokeinterface #24,  1           // InterfaceMethod org/apache/derbyTesting/system/oe/client/Load.populateAllTables:()V
>           8: return
>      Exceptions:
>        throws java.lang.Exception
> 
>    public static org.dacapo.h2.TPCC make(org.dacapo.parser.Config, java.io.File, java.lang.Boolean, java.lang.Boolean) throws java.lang.Exception;
>      descriptor: (Lorg/dacapo/parser/Config;Ljava/io/File;Ljava/lang/Boolean;Ljava/lang/Boolean;)Lorg/dacapo/h2/TPCC;
>      flags: ACC_PUBLIC, ACC_STATIC
>      Code:
>        stack=6, locals=4, args_size=4
>           0: new           #2                  // class org/dacapo/h2/TPCC
>           3: dup
>           4: aload_0
>           5: aload_1
>           6: iconst_1
>           7: iconst_1
>           8: invokespecial #28                 // Method "<init>":(Lorg/dacapo/parser/Config;Ljava/io/File;ZZ)V
>          11: areturn
>      Exceptions:
>        throws java.lang.Exception
> 
>    public void postIteration(java.lang.String) throws java.lang.Exception;
>      descriptor: (Ljava/lang/String;)V
>      flags: ACC_PUBLIC
>      Code:
>        stack=0, locals=2, args_size=2
>           0: return
>      Exceptions:
>        throws java.lang.Exception
> 
>    public void preIteration(java.lang.String) throws java.lang.Exception;
>      descriptor: (Ljava/lang/String;)V
>      flags: ACC_PUBLIC
>      Code:
>        stack=0, locals=2, args_size=2
>           0: return
>      Exceptions:
>        throws java.lang.Exception
> }
> 


More information about the hotspot-runtime-dev mailing list