8218881: C2: StaticFinalFieldPrinter doesn't handle T_ARRAY values in T_OBJECT fields
authorvlivanov
Thu, 14 Feb 2019 15:27:12 -0800
changeset 53763 93b42eb5f3fc
parent 53762 65deccd64f3a
child 53764 8bf7e0823202
8218881: C2: StaticFinalFieldPrinter doesn't handle T_ARRAY values in T_OBJECT fields Reviewed-by: thartmann, kvn, neliasso
src/hotspot/share/ci/ciInstanceKlass.cpp
--- a/src/hotspot/share/ci/ciInstanceKlass.cpp	Thu Feb 14 15:17:03 2019 -0800
+++ b/src/hotspot/share/ci/ciInstanceKlass.cpp	Thu Feb 14 15:27:12 2019 -0800
@@ -669,11 +669,21 @@
           _out->print_cr(INT64_FORMAT, *(int64_t*)&d);
           break;
         }
-        case T_ARRAY: {
+        case T_ARRAY:  // fall-through
+        case T_OBJECT: {
           oop value =  mirror->obj_field_acquire(fd->offset());
           if (value == NULL) {
             _out->print_cr("null");
-          } else {
+          } else if (value->is_instance()) {
+            assert(fd->field_type() == T_OBJECT, "");
+            if (value->is_a(SystemDictionary::String_klass())) {
+              const char* ascii_value = java_lang_String::as_quoted_ascii(value);
+              _out->print("\"%s\"", (ascii_value != NULL) ? ascii_value : "");
+            } else {
+              const char* klass_name  = value->klass()->name()->as_quoted_ascii();
+              _out->print_cr("%s", klass_name);
+            }
+          } else if (value->is_array()) {
             typeArrayOop ta = (typeArrayOop)value;
             _out->print("%d", ta->length());
             if (value->is_objArray()) {
@@ -682,21 +692,6 @@
               _out->print(" %s", klass_name);
             }
             _out->cr();
-          }
-          break;
-        }
-        case T_OBJECT: {
-          oop value =  mirror->obj_field_acquire(fd->offset());
-          if (value == NULL) {
-            _out->print_cr("null");
-          } else if (value->is_instance()) {
-            if (value->is_a(SystemDictionary::String_klass())) {
-              const char* ascii_value = java_lang_String::as_quoted_ascii(value);
-              _out->print("\"%s\"", (ascii_value != NULL) ? ascii_value : "");
-            } else {
-              const char* klass_name  = value->klass()->name()->as_quoted_ascii();
-              _out->print_cr("%s", klass_name);
-            }
           } else {
             ShouldNotReachHere();
           }