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

Andrew Haley aph at redhat.com
Thu May 21 10:03:40 UTC 2015


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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: deopt.log
Type: text/x-log
Size: 65408 bytes
Desc: not available
URL: <http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20150521/47c84d1a/deopt-0001.log>


More information about the hotspot-compiler-dev mailing list