changeset 55532:41d46f42527c lworld

[lworld] Improved klass loading from [V? and reverted now unnecessary fix for 8224036
author thartmann
date Tue, 21 May 2019 10:54:02 +0200
parents 9458389d5187
children f5bc35131607
files src/hotspot/share/opto/library_call.cpp src/hotspot/share/opto/memnode.cpp
diffstat 2 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/opto/library_call.cpp	Tue May 21 09:08:51 2019 +0200
+++ b/src/hotspot/share/opto/library_call.cpp	Tue May 21 10:54:02 2019 +0200
@@ -5130,7 +5130,6 @@
         }
         if (could_have_dest && !dest_spec) {
           dest = maybe_cast_profiled_obj(dest, dest_k, true);
-          dest_type = _gvn.type(dest);
         }
       }
     }
@@ -5199,7 +5198,8 @@
       assert(stopped(), "Should be stopped");
     }
 
-    const Type* toop = TypeOopPtr::make_from_klass(dest_type->make_oopptr()->klass());
+    const TypeKlassPtr* dest_klass_t = _gvn.type(dest_klass)->is_klassptr();
+    const Type* toop = TypeOopPtr::make_from_klass(dest_klass_t->klass());
     src = _gvn.transform(new CheckCastPPNode(control(), src, toop));
     src_type = _gvn.type(src);
     top_src  = src_type->isa_aryptr();
--- a/src/hotspot/share/opto/memnode.cpp	Tue May 21 09:08:51 2019 +0200
+++ b/src/hotspot/share/opto/memnode.cpp	Tue May 21 10:54:02 2019 +0200
@@ -2260,15 +2260,17 @@
       ciArrayKlass* ak = tary_klass->as_array_klass();
       // Do not fold klass loads from [V?. The runtime type might be [V due to [V <: [V?
       // and the klass for [V is not equal to the klass for [V?.
-      bool can_be_null_free = !tary->is_known_instance() && ak->is_obj_array_klass() && !ak->storage_properties().is_null_free() && ak->element_klass()->is_valuetype();
-
-      if (tary->klass_is_exact() && !can_be_null_free) {
+      if (!tary->is_known_instance() && ak->is_obj_array_klass() &&
+          !ak->storage_properties().is_null_free() && ak->element_klass()->is_valuetype()) {
+        // Fall back to Object array
+        ak = ciArrayKlass::make(phase->C->env()->Object_klass());
+      } else if (tary->klass_is_exact()) {
         return TypeKlassPtr::make(tary_klass);
       }
 
       // If the klass is an object array, we defer the question to the
       // array component klass.
-      if (ak->is_obj_array_klass() && !can_be_null_free) {
+      if (ak->is_obj_array_klass()) {
         assert(ak->is_loaded(), "");
         ciKlass *base_k = ak->as_obj_array_klass()->base_element_klass();
         if (base_k->is_loaded() && base_k->is_instance_klass()) {