RFR 8220118 [lworld] Fix C1 handling of unloaded Q classes

Ioi Lam ioi.lam at oracle.com
Tue Mar 5 20:06:42 UTC 2019


https://bugs.openjdk.java.net/browse/JDK-8220118
http://cr.openjdk.java.net/~iklam/valhalla/8220118-fix-unloaded-q-class-handling.v01/

JDK-8214689 [1] introduced unloaded ciValueKlass for cases like:

       anewarray #3 // class "QV;"

... where the class V has not yet been loaded. However, ciObjectFactory 
stores
unloaded classes using their unadorned (?) names -- i.e., any leading 
"L" or "Q" are
stripped. This leads to confusion when both "Q" and "L" references are 
made to the same
unloaded class:

     static Object[] test5(int n) {
         if (n == 0) {
             return null;
         } else if (n == 1) {
             MyValue5.box[] arr = new MyValue5.box[10];
             arr[1] = MyValue5.make(22345);
             return arr;
         } else {
             MyValue5[] arr = new MyValue5[10];
             arr[1] = MyValue5.make(12345);
             return arr;
         }
     }

The above method would cause C1 to assert.

A proper fix would be to revert the JDK-8214689 changes in unloaded
classes handling. Instead, we should determine the Q-ness using
ciBytecodeStream::is_klass_never_null().

I also fixes some minor bugs discovered by the new test cases.

(a) improper assertions with runtime_call new_object_array
(b) runtime_call store_flattened_array  would corrupt RAX

Thanks
- Ioi


[1] http://hg.openjdk.java.net/valhalla/valhalla/rev/b890823b8dc6
https://bugs.openjdk.java.net/browse/JDK-8214689


More information about the valhalla-dev mailing list