From 6592eb66e8beeddbea92f8ce9d89e6682d9c48f4 Mon Sep 17 00:00:00 2001 From: Marc Chevalier Date: Wed, 22 Jul 2026 10:09:10 +0200 Subject: [PATCH] revering replay part --- src/hotspot/share/ci/ciInstanceKlass.cpp | 50 +++++--------------- src/hotspot/share/ci/ciReplay.cpp | 58 ++++++++---------------- src/hotspot/share/memory/oopFactory.cpp | 2 +- 3 files changed, 33 insertions(+), 77 deletions(-) diff --git a/src/hotspot/share/ci/ciInstanceKlass.cpp b/src/hotspot/share/ci/ciInstanceKlass.cpp index cce69921de4..41adc7de96b 100644 --- a/src/hotspot/share/ci/ciInstanceKlass.cpp +++ b/src/hotspot/share/ci/ciInstanceKlass.cpp @@ -863,21 +863,8 @@ void StaticFieldPrinter::do_field_helper(fieldDescriptor* fd, oop mirror, bool i break; } case T_ARRAY: // fall-through - case T_OBJECT: { - InstanceKlass* k = nullptr; - ResetNoHandleMark rnhm; - Thread* THREAD = Thread::current(); - SignatureStream ss(fd->signature(), false); - Symbol* name = ss.as_symbol(); - assert(!HAS_PENDING_EXCEPTION, "can resolve klass?"); - InstanceKlass* holder = fd->field_holder(); - if (field_type == T_OBJECT) { - k = SystemDictionary::find_instance_klass(THREAD, name, Handle(THREAD, holder->class_loader())); - // handling of null free inline type - guarantee(k != nullptr && !HAS_PENDING_EXCEPTION, "can resolve klass?"); - } - - if (k == nullptr || !k->is_inline_klass()) { + case T_OBJECT: + if (!fd->is_null_free_inline_type()) { _out->print("%s ", fd->signature()->as_quoted_ascii()); oop value = mirror->obj_field_acquire(fd->offset()); if (value == nullptr) { @@ -899,28 +886,6 @@ void StaticFieldPrinter::do_field_helper(fieldDescriptor* fd, oop mirror, bool i _out->print("%d", a->length()); if (value->is_objArray()) { objArrayOop oa = (objArrayOop)value; - if (value->is_flatArray()) { - FlatArrayKlass* klass = ((flatArrayOop)oa)->klass(); - LayoutKind lk = klass->layout_kind(); - _out->print(" flat"); - if (LayoutKindHelper::is_nullable_flat(lk)) { - _out->print(" nullable"); - } else { - _out->print(" null-free"); - } - if (LayoutKindHelper::is_atomic_flat(lk)) { - _out->print(" atomic"); - } else { - _out->print(" non-atomic"); - } - } else { - _out->print(" ref"); - if (oa->klass()->is_null_free_array_klass()) { - _out->print(" null-free"); - } else { - _out->print(" nullable"); - } - } const char* klass_name = value->klass()->name()->as_quoted_ascii(); _out->print(" %s", klass_name); } @@ -929,6 +894,16 @@ void StaticFieldPrinter::do_field_helper(fieldDescriptor* fd, oop mirror, bool i } break; } else { + // handling of null free inline type + ResetNoHandleMark rnhm; + Thread* THREAD = Thread::current(); + SignatureStream ss(fd->signature(), false); + Symbol* name = ss.as_symbol(); + assert(!HAS_PENDING_EXCEPTION, "can resolve klass?"); + InstanceKlass* holder = fd->field_holder(); + InstanceKlass* k = SystemDictionary::find_instance_klass(THREAD, name, + Handle(THREAD, holder->class_loader())); + guarantee(k != nullptr && !HAS_PENDING_EXCEPTION, "can resolve klass?"); InlineKlass* vk = InlineKlass::cast(k); oop obj; if (is_flat) { @@ -941,7 +916,6 @@ void StaticFieldPrinter::do_field_helper(fieldDescriptor* fd, oop mirror, bool i vk->do_nonstatic_fields(&print_field); break; } - } default: ShouldNotReachHere(); } diff --git a/src/hotspot/share/ci/ciReplay.cpp b/src/hotspot/share/ci/ciReplay.cpp index e58a878799e..be55687cca4 100644 --- a/src/hotspot/share/ci/ciReplay.cpp +++ b/src/hotspot/share/ci/ciReplay.cpp @@ -514,14 +514,15 @@ class CompileReplay : public StackObj { return k; } obj = ciReplay::obj_field(obj, field); - if (obj != nullptr && obj->is_objArray()) { - objArrayOop arr = oop_cast(obj); + // TODO 8350865 I think we need to handle null-free/flat arrays here + if (obj != nullptr && obj->is_refArray()) { + refArrayOop arr = oop_cast(obj); int index = parse_int("index"); if (index >= arr->length()) { report_error("bad array index"); return nullptr; } - obj = arr->obj_at(index, THREAD); + obj = arr->obj_at(index); } } while (obj != nullptr); if (obj == nullptr) { @@ -1138,26 +1139,12 @@ class CompileReplay : public StackObj { value = oopFactory::new_longArray(length, CHECK_(true)); } else if (field_signature[0] == JVM_SIGNATURE_ARRAY && field_signature[1] == JVM_SIGNATURE_CLASS) { - const char* flatness = parse_string(); - if (strcmp(flatness, "ref") == 0) { - const char* nullability = parse_string(); - bool null_restricted = (strcmp(nullability, "null-free") == 0); - Klass* actual_array_klass = parse_klass(CHECK_(true)); - Klass* kelem = ObjArrayKlass::cast(actual_array_klass)->element_klass(); - ArrayProperties props = ArrayProperties::Default().with_non_atomic(false).with_null_restricted(null_restricted); - value = oopFactory::new_refArray(kelem, length, props, CHECK_(true)); - } else if (strcmp(flatness, "flat") == 0) { - const char* nullability = parse_string(); - const char* atomicity = parse_string(); - bool null_restricted = (strcmp(nullability, "null-free") == 0); - bool non_atomic = (strcmp(atomicity, "non-atomic") == 0); - Klass* actual_array_klass = parse_klass(CHECK_(true)); - Klass* kelem = ObjArrayKlass::cast(actual_array_klass)->element_klass(); - ArrayProperties props = ArrayProperties::Default().with_non_atomic(non_atomic).with_null_restricted(null_restricted); - value = oopFactory::new_flatArray(InlineKlass::cast(kelem), length, props, CHECK_(true)); - } else { - report_error("unrecognized array kind"); - } + Klass* actual_array_klass = parse_klass(CHECK_(true)); + // TODO 8350865 I think we need to handle null-free/flat arrays here + // This handling will change the array property argument passed to the + // factory below + Klass* kelem = ObjArrayKlass::cast(actual_array_klass)->element_klass(); + value = oopFactory::new_objArray(kelem, length, CHECK_(true)); } else { report_error("unhandled array staticfield"); } @@ -1247,22 +1234,17 @@ class CompileReplay : public StackObj { const char* string_value = parse_escaped_string(); double value = atof(string_value); java_mirror->double_field_put(fd.offset(), value); + } else if (fd.is_null_free_inline_type()) { + Klass* kelem = resolve_klass(field_signature, CHECK); + InlineKlass* vk = InlineKlass::cast(kelem); + oop value = vk->allocate_instance(CHECK); + InlineTypeFieldInitializer init_fields(value, this); + vk->do_nonstatic_fields(&init_fields); + java_mirror->obj_field_put(fd.offset(), value); } else { - Klass* kelem = nullptr; - if (fd.field_type() == T_OBJECT) { - kelem = resolve_klass(field_signature, CHECK); - } - if (kelem != nullptr && kelem->is_inline_klass()) { - InlineKlass* vk = InlineKlass::cast(kelem); - oop value = vk->allocate_instance(CHECK); - InlineTypeFieldInitializer init_fields(value, this); - vk->do_nonstatic_fields(&init_fields); - java_mirror->obj_field_put(fd.offset(), value); - } else { - bool res = process_staticfield_reference(field_signature, java_mirror, &fd, CHECK); - if (!res) { - report_error("unhandled staticfield"); - } + bool res = process_staticfield_reference(field_signature, java_mirror, &fd, CHECK); + if (!res) { + report_error("unhandled staticfield"); } } } diff --git a/src/hotspot/share/memory/oopFactory.cpp b/src/hotspot/share/memory/oopFactory.cpp index c1f9f8dacc8..d7fdffb6c32 100644 --- a/src/hotspot/share/memory/oopFactory.cpp +++ b/src/hotspot/share/memory/oopFactory.cpp @@ -117,7 +117,7 @@ objArrayOop oopFactory::new_objArray(Klass* klass, int length, ArrayProperties p } objArrayOop oopFactory::new_objArray(Klass* klass, int length, TRAPS) { - return new_objArray(klass, length, ArrayProperties::Default(), THREAD); + return new_objArray(klass, length, ArrayProperties::Default(), THREAD); } refArrayOop oopFactory::new_refArray(Klass* klass, int length, ArrayProperties properties, TRAPS) {