changeset 54926:93b42eb5f3fc

8218881: C2: StaticFinalFieldPrinter doesn't handle T_ARRAY values in T_OBJECT fields Reviewed-by: thartmann, kvn, neliasso
author vlivanov
date Thu, 14 Feb 2019 15:27:12 -0800
parents 65deccd64f3a
children 8bf7e0823202
files src/hotspot/share/ci/ciInstanceKlass.cpp
diffstat 1 files changed, 12 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- 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();
           }