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

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


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.

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

- Ioi

More information about the valhalla-dev mailing list