8054492: compiler/intrinsics/classcast/NullCheckDroppingsTest.java is an invalid test

Vladimir Kozlov vladimir.kozlov at oracle.com
Wed Jun 17 23:55:38 UTC 2015


Filed bug before I forgot:

https://bugs.openjdk.java.net/browse/JDK-8129092

Vladimir

On 6/5/15 7:06 PM, Vladimir Kozlov wrote:
>  > We either need some code in WhiteBox to check for a deoptimization
>  > event properly or we should just remove this altogether.
>
>  > So, thoughts?  Just delete the check?
>
> No, we have to check that uncommon trap was hit. This is the main
> purpose of that test.
>
> May be we should add an other method WHITE_BOX.wasMethodDeopted(method)
> which checks if method was deoptimized at least once.
>
> Vladimir
>
> On 5/21/15 3:03 AM, Andrew Haley wrote:
>> On 05/20/2015 11:02 PM, Vladimir Kozlov wrote:
>>> testVarClassCast tests deoptimization for javaMirror == null:
>>>
>>> void testVarClassCast(String s) {
>>>       Class cl = (s == null) ? null : String.class;
>>>       try {
>>>           ssink = (String)cl.cast(svalue);
>>>
>>> Which is done in LibraryCallKit::inline_Class_cast() by:
>>>
>>> mirror = null_check(mirror);
>>>
>>> which has Deoptimization::Action_make_not_entrant.
>>>
>>> Unfortunately currently the test also pass because unstable_if is
>>> generated for the first line:
>>>
>>> (s == null) ? null : String.class;
>>>
>>> If you run the test with TraceDoptimization (or LogCompilation) you will
>>> see:
>>>
>>> Uncommon trap occurred in NullCheckDroppingsTest::testVarClassCast
>>> (@0x000000010b0670d8) thread=26883 reason=unstable_if action=reinterpret
>>> unloaded_class_index=-1
>>
>> Not quite the same.  I get a reason=null_check:
>>
>> Uncommon trap occurred in NullCheckDroppingsTest::testVarClassCast
>> (@0x000003ff8d253e54) thread=4396243677696 reason=null_check
>> action=maybe_recompile unloaded_class_index=-1
>>
>> Which comes from a SEGV here:
>>
>>    0x000003ff89253ca4: ldr    x0, [x10,#72]   ; implicit exception:
>> dispatches to 0x000003ff89253e40
>>
>> which is the line
>>
>>              ssink = (String)cl.cast(svalue);
>>
>> I don't get a trap for unstable_if because there isn't one.  I just get
>>
>>    0x000003ff89253c90: cbz    x2, 0x000003ff89253e00   (this is
>> java/lang/String  s)
>>
>> -->
>>
>>    0x000003ff89253e00: mov    x10, xzr
>>    0x000003ff89253e04: b    0x000003ff89253ca0
>>
>> -->
>>
>>    0x000003ff89253ca0: lsl    x11, x11, #3    ;*getstatic svalue
>>                                                  ; -
>> NullCheckDroppingsTest::testVarClassCast at 13 (line 181)
>>    0x000003ff89253ca4: ldr    x0, [x10,#72]   ; implicit exception:
>> dispatches to 0x000003ff89253e40
>>
>> ... and then the trap for the null pointer exception.
>>
>> Andrew.
>>


More information about the hotspot-compiler-dev mailing list