changeset 58050:7ec4118062f9 lworld

8235254: [lworld] TestNativeClone crashes in PhaseMacroExpand::expand_arraycopy_node() with ZGC
author thartmann
date Tue, 03 Dec 2019 17:52:16 +0100
parents 31bfb68ec5ca
children d6ecf9333bc1
files src/hotspot/share/opto/macroArrayCopy.cpp
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/opto/macroArrayCopy.cpp	Tue Dec 03 08:35:58 2019 -0500
+++ b/src/hotspot/share/opto/macroArrayCopy.cpp	Tue Dec 03 17:52:16 2019 +0100
@@ -1202,8 +1202,10 @@
   } else if (ac->is_copyof() || ac->is_copyofrange() || ac->is_clone_oop_array()) {
     const Type* dest_type = _igvn.type(dest);
     const TypeAryPtr* top_dest = dest_type->isa_aryptr();
-
-    BasicType dest_elem = top_dest->klass()->as_array_klass()->element_type()->basic_type();
+    BasicType dest_elem = T_OBJECT;
+    if (top_dest != NULL && top_dest->klass() != NULL) {
+      dest_elem = top_dest->klass()->as_array_klass()->element_type()->basic_type();
+    }
     if (dest_elem == T_ARRAY || (dest_elem == T_VALUETYPE && top_dest->klass()->is_obj_array_klass())) {
       dest_elem = T_OBJECT;
     }
@@ -1218,14 +1220,13 @@
       assert(alloc != NULL, "expect alloc");
     }
     assert(dest_elem != T_VALUETYPE || alloc != NULL, "unsupported");
-    Node* dest_length = alloc != NULL ? alloc->in(AllocateNode::ALength) : NULL;
+    Node* dest_length = (alloc != NULL) ? alloc->in(AllocateNode::ALength) : NULL;
 
     const TypePtr* adr_type = NULL;
-
     if (dest_elem == T_VALUETYPE) {
       adr_type = adjust_parameters_for_vt(top_dest, src_offset, dest_offset, length, dest_elem, dest_length);
     } else {
-      adr_type = _igvn.type(dest)->is_oopptr()->add_offset(Type::OffsetBot);
+      adr_type = dest_type->is_oopptr()->add_offset(Type::OffsetBot);
       if (ac->_dest_type != TypeOopPtr::BOTTOM) {
         adr_type = ac->_dest_type->add_offset(Type::OffsetBot)->is_ptr();
       }