RFR 8214689 [lworld][c1] aaload cannot handle unloaded class

Ioi Lam ioi.lam at oracle.com
Tue Dec 11 05:34:25 UTC 2018


https://bugs.openjdk.java.net/browse/JDK-8214689
http://cr.openjdk.java.net/~iklam/valhalla/8214898-c1-aaload-on-unloaded-class.v01/

I added support for unloaded value klasses for the aaload/aastore 
bytecodes in C1. As suggested by Tobias, when C1 compiles an aaload on 
an array that has a "Q" signature, it emits code to check if the array 
is a flattened array. If so, we deoptimize. When the deopt happens, the 
target array type would be loaded already, so we can recompile(*1) the 
method to emit correct code with flattened array access.

The guard code looks like this:

   0x00007f9afceff283: mov    0x8(%rsi),%eax
   0x00007f9afceff286: mov    $0x800000000,%r12
   0x00007f9afceff290: add    %r12,%rax
   0x00007f9afceff293: xor    %r12,%r12
   0x00007f9afceff296: mov    0xc(%rax),%eax
   0x00007f9afceff299: sar    $0x1d,%eax
   0x00007f9afceff29c: cmp    $0xfffffffffffffffd,%eax
  ;;   30 branch [EQ] [DeoptimizeStub: 0x00007f9aac031e90] [bci:6]
   0x00007f9afceff29f: je     0x00007f9afceff4ef


   0x00007f9afceff2a5: mov    0x14(%rsi),%eax     //<< non-flattened load


I'll add a couple of test cases before pushing.

(*1)
My next step is to fix https://bugs.openjdk.java.net/browse/JDK-8215201, 
so we can actually recompile on deoptimization.

Thanks
- Ioi



More information about the valhalla-dev mailing list