RFR: change verifier for withfield to check that value types match instead of doing an is_assignable check

harold seigel harold.seigel at oracle.com
Tue Mar 27 13:59:56 UTC 2018


Hi,

Please review this small verifier change for the withfield opcode to 
check that the reference on the stack is the same as the class pointed 
to by withfield's constant pool fieldref.  Previously, the verifier did 
an is_assignable_from() check, but this potentially caused some class 
loads and returned true if the fieldref's class was java.lang.Object.

Open Webrev: 
http://cr.openjdk.java.net/~hseigel/valueTypes_lworld.wfield.jlo/webrev/index.html

Here's a sample error message emitted when the two references are not 
the same:

    Exception in thread "main" java.lang.VerifyError: Bad value type on
    operand stack in withfield
    Exception Details:
       Location:
         wthFldBadFldRef2.makeValue(I)LwthFldBadFldRef2; @6: withfield
       Reason:
         Type 'otherVT' (current frame, stack[0]) and type
    'wthFldBadFldRef2' (constant pool 2) must be identical value types.
       Current Frame:
         bci: @6
         flags: { }
         locals: { integer, 'otherVT' }
         stack: { 'otherVT', integer }
       Bytecode:
         0000000: cb00 1b4c 2b1a cc00 024c 2bb0

This webrev was tested with hotspot JTReg tests and multiple JDK JTReg 
tests.

Thanks, Harold





More information about the valhalla-dev mailing list