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 14:52:36 UTC 2018


David, thanks for the review!

Harold

On 3/27/2018 10:50 AM, David Simms wrote:
>
> Looks good Harold, thanks for the comments in the tests (helps with 
> the raw bytecode)
>
> On 27/03/18 15:59, harold seigel wrote:
>> 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