From 1673d7b8098a7b3d8008a77d4df9ff657ba8df56 Mon Sep 17 00:00:00 2001 From: Quan Anh Mai Date: Fri, 6 Jun 2025 13:02:03 +0700 Subject: [PATCH 1/4] Implement Unsafe::flatValue accesses --- src/hotspot/share/classfile/vmIntrinsics.cpp | 2 + src/hotspot/share/classfile/vmIntrinsics.hpp | 5 + src/hotspot/share/opto/c2compiler.cpp | 3 + src/hotspot/share/opto/library_call.cpp | 159 ++++++++++++++++++ src/hotspot/share/opto/library_call.hpp | 1 + .../classes/jdk/internal/misc/Unsafe.java | 2 + .../valhalla/inlinetypes/TestIntrinsics.java | 9 +- 7 files changed, 175 insertions(+), 6 deletions(-) diff --git a/src/hotspot/share/classfile/vmIntrinsics.cpp b/src/hotspot/share/classfile/vmIntrinsics.cpp index 32092dc5cd2..b2d398c6efe 100644 --- a/src/hotspot/share/classfile/vmIntrinsics.cpp +++ b/src/hotspot/share/classfile/vmIntrinsics.cpp @@ -340,6 +340,7 @@ bool vmIntrinsics::disabled_by_jvm_flags(vmIntrinsics::ID id) { case vmIntrinsics::_getFloat: case vmIntrinsics::_getDouble: case vmIntrinsics::_getValue: + case vmIntrinsics::_getFlatValue: case vmIntrinsics::_putReference: case vmIntrinsics::_putBoolean: case vmIntrinsics::_putByte: @@ -350,6 +351,7 @@ bool vmIntrinsics::disabled_by_jvm_flags(vmIntrinsics::ID id) { case vmIntrinsics::_putFloat: case vmIntrinsics::_putDouble: case vmIntrinsics::_putValue: + case vmIntrinsics::_putFlatValue: case vmIntrinsics::_getReferenceVolatile: case vmIntrinsics::_getBooleanVolatile: case vmIntrinsics::_getByteVolatile: diff --git a/src/hotspot/share/classfile/vmIntrinsics.hpp b/src/hotspot/share/classfile/vmIntrinsics.hpp index e63b334722d..cddcbd3de09 100644 --- a/src/hotspot/share/classfile/vmIntrinsics.hpp +++ b/src/hotspot/share/classfile/vmIntrinsics.hpp @@ -739,6 +739,8 @@ class methodHandle; do_signature(putDouble_signature, "(Ljava/lang/Object;JD)V") \ do_signature(getValue_signature, "(Ljava/lang/Object;JLjava/lang/Class;)Ljava/lang/Object;") \ do_signature(putValue_signature, "(Ljava/lang/Object;JLjava/lang/Class;Ljava/lang/Object;)V") \ + do_signature(getFlatValue_signature, "(Ljava/lang/Object;JILjava/lang/Class;)Ljava/lang/Object;") \ + do_signature(putFlatValue_signature, "(Ljava/lang/Object;JILjava/lang/Class;Ljava/lang/Object;)V") \ \ do_name(getReference_name,"getReference") do_name(putReference_name,"putReference") \ do_name(getBoolean_name,"getBoolean") do_name(putBoolean_name,"putBoolean") \ @@ -750,6 +752,7 @@ class methodHandle; do_name(getFloat_name,"getFloat") do_name(putFloat_name,"putFloat") \ do_name(getDouble_name,"getDouble") do_name(putDouble_name,"putDouble") \ do_name(getValue_name,"getValue") do_name(putValue_name,"putValue") \ + do_name(getFlatValue_name,"getFlatValue") do_name(putFlatValue_name,"putFlatValue") \ do_name(makePrivateBuffer_name,"makePrivateBuffer") \ do_name(finishPrivateBuffer_name,"finishPrivateBuffer") \ \ @@ -763,6 +766,7 @@ class methodHandle; do_intrinsic(_getFloat, jdk_internal_misc_Unsafe, getFloat_name, getFloat_signature, F_RN) \ do_intrinsic(_getDouble, jdk_internal_misc_Unsafe, getDouble_name, getDouble_signature, F_RN) \ do_intrinsic(_getValue, jdk_internal_misc_Unsafe, getValue_name, getValue_signature, F_RN) \ + do_intrinsic(_getFlatValue, jdk_internal_misc_Unsafe, getFlatValue_name, getFlatValue_signature, F_RN) \ do_intrinsic(_putReference, jdk_internal_misc_Unsafe, putReference_name, putReference_signature, F_RN) \ do_intrinsic(_putBoolean, jdk_internal_misc_Unsafe, putBoolean_name, putBoolean_signature, F_RN) \ do_intrinsic(_putByte, jdk_internal_misc_Unsafe, putByte_name, putByte_signature, F_RN) \ @@ -773,6 +777,7 @@ class methodHandle; do_intrinsic(_putFloat, jdk_internal_misc_Unsafe, putFloat_name, putFloat_signature, F_RN) \ do_intrinsic(_putDouble, jdk_internal_misc_Unsafe, putDouble_name, putDouble_signature, F_RN) \ do_intrinsic(_putValue, jdk_internal_misc_Unsafe, putValue_name, putValue_signature, F_RN) \ + do_intrinsic(_putFlatValue, jdk_internal_misc_Unsafe, putFlatValue_name, putFlatValue_signature, F_RN) \ \ do_intrinsic(_makePrivateBuffer, jdk_internal_misc_Unsafe, makePrivateBuffer_name, object_object_signature, F_RN) \ do_intrinsic(_finishPrivateBuffer, jdk_internal_misc_Unsafe, finishPrivateBuffer_name, object_object_signature, F_RN) \ diff --git a/src/hotspot/share/opto/c2compiler.cpp b/src/hotspot/share/opto/c2compiler.cpp index 0ea1778b23f..3d0f09a762b 100644 --- a/src/hotspot/share/opto/c2compiler.cpp +++ b/src/hotspot/share/opto/c2compiler.cpp @@ -23,6 +23,7 @@ */ #include "classfile/vmClasses.hpp" +#include "classfile/vmIntrinsics.hpp" #include "compiler/compilationMemoryStatistic.hpp" #include "compiler/compilerDefinitions.inline.hpp" #include "runtime/handles.inline.hpp" @@ -663,6 +664,7 @@ bool C2Compiler::is_intrinsic_supported(vmIntrinsics::ID id) { case vmIntrinsics::_getFloat: case vmIntrinsics::_getDouble: case vmIntrinsics::_getValue: + case vmIntrinsics::_getFlatValue: case vmIntrinsics::_putReference: case vmIntrinsics::_putBoolean: case vmIntrinsics::_putByte: @@ -673,6 +675,7 @@ bool C2Compiler::is_intrinsic_supported(vmIntrinsics::ID id) { case vmIntrinsics::_putFloat: case vmIntrinsics::_putDouble: case vmIntrinsics::_putValue: + case vmIntrinsics::_putFlatValue: case vmIntrinsics::_getReferenceVolatile: case vmIntrinsics::_getBooleanVolatile: case vmIntrinsics::_getByteVolatile: diff --git a/src/hotspot/share/opto/library_call.cpp b/src/hotspot/share/opto/library_call.cpp index 17e60beef5c..4f6b8dbabf6 100644 --- a/src/hotspot/share/opto/library_call.cpp +++ b/src/hotspot/share/opto/library_call.cpp @@ -23,17 +23,21 @@ */ #include "asm/macroAssembler.hpp" +#include "ci/ciArrayKlass.hpp" #include "ci/ciFlatArrayKlass.hpp" +#include "ci/ciInstanceKlass.hpp" #include "ci/ciUtilities.inline.hpp" #include "ci/ciSymbols.hpp" #include "classfile/vmIntrinsics.hpp" #include "compiler/compileBroker.hpp" #include "compiler/compileLog.hpp" #include "gc/shared/barrierSet.hpp" +#include "gc/shared/c2/barrierSetC2.hpp" #include "jfr/support/jfrIntrinsics.hpp" #include "memory/resourceArea.hpp" #include "oops/accessDecorators.hpp" #include "oops/klass.inline.hpp" +#include "oops/layoutKind.hpp" #include "oops/objArrayKlass.hpp" #include "opto/addnode.hpp" #include "opto/arraycopynode.hpp" @@ -42,16 +46,20 @@ #include "opto/cfgnode.hpp" #include "opto/convertnode.hpp" #include "opto/countbitsnode.hpp" +#include "opto/graphKit.hpp" #include "opto/idealKit.hpp" #include "opto/library_call.hpp" +#include "opto/inlinetypenode.hpp" #include "opto/mathexactnode.hpp" #include "opto/mulnode.hpp" #include "opto/narrowptrnode.hpp" #include "opto/opaquenode.hpp" +#include "opto/opcodes.hpp" #include "opto/parse.hpp" #include "opto/runtime.hpp" #include "opto/rootnode.hpp" #include "opto/subnode.hpp" +#include "opto/type.hpp" #include "opto/vectornode.hpp" #include "prims/jvmtiExport.hpp" #include "prims/jvmtiThreadState.hpp" @@ -60,6 +68,7 @@ #include "runtime/objectMonitor.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/stubRoutines.hpp" +#include "utilities/globalDefinitions.hpp" #include "utilities/macros.hpp" #include "utilities/powerOfTwo.hpp" @@ -411,6 +420,9 @@ bool LibraryCallKit::try_to_inline(int predicate) { case vmIntrinsics::_putFloatOpaque: return inline_unsafe_access( is_store, T_FLOAT, Opaque, false); case vmIntrinsics::_putDoubleOpaque: return inline_unsafe_access( is_store, T_DOUBLE, Opaque, false); + case vmIntrinsics::_getFlatValue: return inline_unsafe_flat_access(!is_store, Relaxed); + case vmIntrinsics::_putFlatValue: return inline_unsafe_flat_access( is_store, Relaxed); + case vmIntrinsics::_compareAndSetReference: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap, Volatile); case vmIntrinsics::_compareAndSetByte: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap, Volatile); case vmIntrinsics::_compareAndSetShort: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap, Volatile); @@ -2704,6 +2716,153 @@ bool LibraryCallKit::inline_unsafe_access(bool is_store, const BasicType type, c return true; } +bool LibraryCallKit::inline_unsafe_flat_access(bool is_store, AccessKind kind) { +#ifdef ASSERT + { + ResourceMark rm; + // Check the signatures. + ciSignature* sig = callee()->signature(); + assert(sig->type_at(0)->basic_type() == T_OBJECT, "base should be object, but is %s", type2name(sig->type_at(0)->basic_type())); + assert(sig->type_at(1)->basic_type() == T_LONG, "offset should be long, but is %s", type2name(sig->type_at(1)->basic_type())); + assert(sig->type_at(2)->basic_type() == T_INT, "layout kind should be int, but is %s", type2name(sig->type_at(3)->basic_type())); + assert(sig->type_at(3)->basic_type() == T_OBJECT, "value klass should be object, but is %s", type2name(sig->type_at(4)->basic_type())); + if (is_store) { + assert(sig->return_type()->basic_type() == T_VOID, "putter must not return a value, but returns %s", type2name(sig->return_type()->basic_type())); + assert(sig->count() == 5, "flat putter should have 5 arguments, but has %d", sig->count()); + assert(sig->type_at(4)->basic_type() == T_OBJECT, "put value should be object, but is %s", type2name(sig->type_at(5)->basic_type())); + } else { + assert(sig->return_type()->basic_type() == T_OBJECT, "getter must return an object, but returns %s", type2name(sig->return_type()->basic_type())); + assert(sig->count() == 4, "flat getter should have 4 arguments, but has %d", sig->count()); + } + } +#endif // ASSERT + + assert(kind == Relaxed, "Only plain accesses for now"); + if (callee()->is_static()) { + // caller must have the capability! + return false; + } + C->set_has_unsafe_access(true); + + const TypeInstPtr* value_klass_node = _gvn.type(argument(5))->isa_instptr(); + if (value_klass_node == nullptr || value_klass_node->const_oop() == nullptr) { + // parameter valueType is not a constant + return false; + } + ciInlineKlass* value_klass = value_klass_node->const_oop()->as_instance()->java_mirror_type()->as_inline_klass(); + + const TypeInt* layout_type = _gvn.type(argument(4))->isa_int(); + if (layout_type == nullptr || !layout_type->is_con()) { + // parameter layoutKind is not a constant + return false; + } + assert(layout_type->get_con() >= static_cast(LayoutKind::REFERENCE) && + layout_type->get_con() <= static_cast(LayoutKind::UNKNOWN), + "invalid layoutKind %d", layout_type->get_con()); + LayoutKind layout = static_cast(layout_type->get_con()); + assert(layout == LayoutKind::REFERENCE || layout == LayoutKind::NON_ATOMIC_FLAT || + layout == LayoutKind::ATOMIC_FLAT || layout == LayoutKind::NULLABLE_ATOMIC_FLAT, + "unexpected layoutKind %d", layout_type->get_con()); + + null_check(argument(0)); + if (stopped()) { + return true; + } + + Node* base = must_be_not_null(argument(1), true); + Node* offset = argument(2); + const Type* base_type = _gvn.type(base); + + Node* ptr; + bool immutable_memory = false; + DecoratorSet decorators = C2_UNSAFE_ACCESS | IN_HEAP | MO_UNORDERED; + if (base_type->isa_instptr()) { + ptr = basic_plus_adr(base, ConvL2X(offset)); + const TypeLong* offset_type = _gvn.type(offset)->isa_long(); + if (offset_type == nullptr || !offset_type->is_con()) { + // Offset into a non-array should be a constant + decorators |= C2_MISMATCHED; + } else { + int offset_con = checked_cast(offset_type->get_con()); + ciInstanceKlass* base_klass = base_type->is_instptr()->instance_klass(); + ciField* field = base_klass->get_non_flat_field_by_offset(offset_con); + if (field == nullptr) { + assert(!base_klass->is_final(), "non-existence field at offset %d of class %s", offset_con, base_klass->name()->as_utf8()); + decorators |= C2_MISMATCHED; + } else { + assert(field->type() == value_klass, "field at offset %d of %s is of type %s, but valueType is %s", + offset_con, base_klass->name()->as_utf8(), field->type()->name(), value_klass->name()->as_utf8()); + immutable_memory = field->is_strict() && field->is_final(); + } + } + } else if (base_type->isa_aryptr()) { + decorators |= IS_ARRAY; + if (layout == LayoutKind::REFERENCE) { + if (!base_type->is_aryptr()->is_not_flat()) { + const TypeAryPtr* array_type = base_type->is_aryptr()->cast_to_not_flat(); + Node* new_base = _gvn.transform(new CastPPNode(control(), base, array_type, ConstraintCastNode::StrongDependency)); + replace_in_map(base, new_base); + base = new_base; + } + ptr = basic_plus_adr(base, ConvL2X(offset)); + } else { + // Flat array must have an exact type + bool is_null_free = layout != LayoutKind::NULLABLE_ATOMIC_FLAT; + bool is_atomic = layout != LayoutKind::NON_ATOMIC_FLAT; + Node* new_base = cast_to_flat_array(base, value_klass, is_null_free, !is_null_free, is_atomic); + replace_in_map(base, new_base); + base = new_base; + ptr = basic_plus_adr(base, ConvL2X(offset)); + const TypeAryPtr* ptr_type = _gvn.type(ptr)->is_aryptr(); + if (ptr_type->field_offset().get() != 0) { + ptr = _gvn.transform(new CastPPNode(control(), ptr, ptr_type->with_field_offset(0), ConstraintCastNode::StrongDependency)); + } + } + } else { + decorators |= C2_MISMATCHED; + ptr = basic_plus_adr(base, ConvL2X(offset)); + } + + if (is_store) { + Node* value = argument(6); + const Type* value_type = _gvn.type(value); + if (!value_type->is_inlinetypeptr()) { + value_type = Type::get_const_type(value_klass)->filter_speculative(value_type); + Node* new_value = _gvn.transform(new CastPPNode(control(), value, value_type, ConstraintCastNode::StrongDependency)); + new_value = InlineTypeNode::make_from_oop(this, new_value, value_klass); + replace_in_map(value, new_value); + value = new_value; + } + + assert(value_type->inline_klass() == value_klass, "value is of type %s while valueType is %s", value_type->inline_klass()->name()->as_utf8(), value_klass->name()->as_utf8()); + if (layout == LayoutKind::REFERENCE) { + const TypePtr* ptr_type = (decorators & C2_MISMATCHED) != 0 ? TypeRawPtr::BOTTOM : _gvn.type(ptr)->is_ptr(); + access_store_at(base, ptr, ptr_type, value, value_type, T_OBJECT, decorators); + } else { + bool atomic = layout != LayoutKind::NON_ATOMIC_FLAT; + bool null_free = layout != LayoutKind::NULLABLE_ATOMIC_FLAT; + value->as_InlineType()->store_flat(this, base, ptr, atomic, immutable_memory, null_free, decorators); + } + + return true; + } else { + decorators |= (C2_CONTROL_DEPENDENT_LOAD | C2_UNKNOWN_CONTROL_LOAD); + InlineTypeNode* result; + if (layout == LayoutKind::REFERENCE) { + const TypePtr* ptr_type = (decorators & C2_MISMATCHED) != 0 ? TypeRawPtr::BOTTOM : _gvn.type(ptr)->is_ptr(); + Node* oop = access_load_at(base, ptr, ptr_type, Type::get_const_type(value_klass), T_OBJECT, decorators); + result = InlineTypeNode::make_from_oop(this, oop, value_klass); + } else { + bool atomic = layout != LayoutKind::NON_ATOMIC_FLAT; + bool null_free = layout != LayoutKind::NULLABLE_ATOMIC_FLAT; + result = InlineTypeNode::make_from_flat(this, value_klass, base, ptr, atomic, immutable_memory, null_free, decorators); + } + + set_result(result); + return true; + } +} + bool LibraryCallKit::inline_unsafe_make_private_buffer() { Node* receiver = argument(0); Node* value = argument(1); diff --git a/src/hotspot/share/opto/library_call.hpp b/src/hotspot/share/opto/library_call.hpp index 03063687f78..1faae3baf44 100644 --- a/src/hotspot/share/opto/library_call.hpp +++ b/src/hotspot/share/opto/library_call.hpp @@ -249,6 +249,7 @@ class LibraryCallKit : public GraphKit { typedef enum { Relaxed, Opaque, Volatile, Acquire, Release } AccessKind; DecoratorSet mo_decorator_for_access_kind(AccessKind kind); bool inline_unsafe_access(bool is_store, BasicType type, AccessKind kind, bool is_unaligned, bool is_flat = false); + bool inline_unsafe_flat_access(bool is_store, AccessKind kind); static bool klass_needs_init_guard(Node* kls); bool inline_unsafe_allocate(); bool inline_unsafe_newArray(bool uninitialized); diff --git a/src/java.base/share/classes/jdk/internal/misc/Unsafe.java b/src/java.base/share/classes/jdk/internal/misc/Unsafe.java index b86d1c4855f..d2ed2283393 100644 --- a/src/java.base/share/classes/jdk/internal/misc/Unsafe.java +++ b/src/java.base/share/classes/jdk/internal/misc/Unsafe.java @@ -334,6 +334,7 @@ public native Object[] newSpecialArray(Class componentType, * @throws RuntimeException No defined exceptions are thrown, not even * {@link NullPointerException} */ + @IntrinsicCandidate public native V getFlatValue(Object o, long offset, int layoutKind, Class valueType); @@ -377,6 +378,7 @@ public native Object[] newSpecialArray(Class componentType, * @throws RuntimeException No defined exceptions are thrown, not even * {@link NullPointerException} */ + @IntrinsicCandidate public native void putFlatValue(Object o, long offset, int layoutKind, Class valueType, V v); /** diff --git a/test/hotspot/jtreg/compiler/valhalla/inlinetypes/TestIntrinsics.java b/test/hotspot/jtreg/compiler/valhalla/inlinetypes/TestIntrinsics.java index d0572f738b2..5fdf8554273 100644 --- a/test/hotspot/jtreg/compiler/valhalla/inlinetypes/TestIntrinsics.java +++ b/test/hotspot/jtreg/compiler/valhalla/inlinetypes/TestIntrinsics.java @@ -66,9 +66,6 @@ public static void main(String[] args) { .addScenarios(scenarios) .addFlags("--add-exports", "java.base/jdk.internal.misc=ALL-UNNAMED", "--add-exports", "java.base/jdk.internal.value=ALL-UNNAMED", - // Disable FlatValue intrinsics check until JDK-8349110 is fixed - "-DExclude=test30,test31,test32,test33,test34,test35,test36,test37," + - "test38,test55,test71,test72,test73,test80", // Don't run with DeoptimizeALot until JDK-8239003 is fixed "-XX:-DeoptimizeALot") .addHelperClasses(MyValue1.class, @@ -746,7 +743,7 @@ public void test37_verifier() { // putValue to set flattened field in object, non inline argument // to store @Test - @IR(counts = {CALL_UNSAFE, "= 1"}) + @IR(failOn = {CALL_UNSAFE}) public void test38(Object o) { if (TEST31_VT_FLATTENED) { U.putFlatValue(this, TEST31_VT_OFFSET, TEST31_VT_LAYOUT, MyValue1.class, o); @@ -1621,9 +1618,9 @@ public static value class Test80Value2 { NonValueClass obj = new NonValueClass(rI); } - // Test that unsafe access is not incorrectly classified as mismatched + // layout is not a constant @Test - @IR(failOn = {CALL_UNSAFE}) + @IR(counts = {CALL_UNSAFE, "1"}) public Test80Value2 test80(Test80Value1 v, boolean flat, int layout, long offset) { if (flat) { return U.getFlatValue(v, offset, layout, Test80Value2.class); From 0edc1de67d10fc8c02752926383bb415ded9b819 Mon Sep 17 00:00:00 2001 From: Quan Anh Mai Date: Sat, 14 Jun 2025 06:26:20 +0700 Subject: [PATCH 2/4] Buffer an InlineTypeNode on mismatched access --- src/hotspot/share/opto/library_call.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/hotspot/share/opto/library_call.cpp b/src/hotspot/share/opto/library_call.cpp index 4f6b8dbabf6..bc3b3ea1a40 100644 --- a/src/hotspot/share/opto/library_call.cpp +++ b/src/hotspot/share/opto/library_call.cpp @@ -2777,7 +2777,6 @@ bool LibraryCallKit::inline_unsafe_flat_access(bool is_store, AccessKind kind) { bool immutable_memory = false; DecoratorSet decorators = C2_UNSAFE_ACCESS | IN_HEAP | MO_UNORDERED; if (base_type->isa_instptr()) { - ptr = basic_plus_adr(base, ConvL2X(offset)); const TypeLong* offset_type = _gvn.type(offset)->isa_long(); if (offset_type == nullptr || !offset_type->is_con()) { // Offset into a non-array should be a constant @@ -2793,8 +2792,20 @@ bool LibraryCallKit::inline_unsafe_flat_access(bool is_store, AccessKind kind) { assert(field->type() == value_klass, "field at offset %d of %s is of type %s, but valueType is %s", offset_con, base_klass->name()->as_utf8(), field->type()->name(), value_klass->name()->as_utf8()); immutable_memory = field->is_strict() && field->is_final(); + + if (base->is_InlineType()) { + assert(!is_store, "Cannot store into a non-larval value object"); + set_result(base->as_InlineType()->field_value_by_offset(offset_con, false)); + return true; + } } } + + if (base->is_InlineType()) { + assert(!is_store, "Cannot store into a non-larval value object"); + base = base->as_InlineType()->buffer(this, true); + } + ptr = basic_plus_adr(base, ConvL2X(offset)); } else if (base_type->isa_aryptr()) { decorators |= IS_ARRAY; if (layout == LayoutKind::REFERENCE) { From cf137ea944db03df481286d28b05cd22c2520b2f Mon Sep 17 00:00:00 2001 From: Quan Anh Mai Date: Sat, 14 Jun 2025 06:48:56 +0700 Subject: [PATCH 3/4] Revisit TODOs in TestIntrinsics --- .../valhalla/inlinetypes/TestIntrinsics.java | 33 +------------------ 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/test/hotspot/jtreg/compiler/valhalla/inlinetypes/TestIntrinsics.java b/test/hotspot/jtreg/compiler/valhalla/inlinetypes/TestIntrinsics.java index 5fdf8554273..9bb4da63275 100644 --- a/test/hotspot/jtreg/compiler/valhalla/inlinetypes/TestIntrinsics.java +++ b/test/hotspot/jtreg/compiler/valhalla/inlinetypes/TestIntrinsics.java @@ -1060,31 +1060,6 @@ public void test53_verifier() { test53(MyValue1[].class, MyValue1[].class, len, 4); } - // TODO 8239003 Re-enable - /* - // Same as test39 but Unsafe.putInt to buffer is not intrinsified/compiled - @DontCompile - public void test54_callee(Object v) { // Use Object here to make sure the argument is not scalarized (otherwise larval information is lost) - U.putInt(v, X_OFFSET, rI); - } - - @Test - public MyValue1 test54(MyValue1 v) { - v = U.makePrivateBuffer(v); - test54_callee(v); - v = U.finishPrivateBuffer(v); - return v; - } - - @Run(test = "test54") - @Warmup(10000) // Fill up the TLAB to trigger slow path allocation - public void test54_verifier() { - MyValue1 v = MyValue1.createWithFieldsInline(rI, rL); - MyValue1 res = test54(v.setX(v, 0)); - Asserts.assertEQ(res.hash(), v.hash()); - } - */ - @Strict @NullRestricted static final MyValue1 test55_vt = MyValue1.createWithFieldsInline(rI, rL); @@ -1585,8 +1560,6 @@ public void test78_verifier() { } } - // TODO 8284443 Fix this in GraphKit::gen_checkcast - /* @Test public Object test79(MyValue1 vt) { Object tmp = vt; @@ -1603,7 +1576,6 @@ public void test79_verifier() { } catch (ClassCastException cce) { } } - */ @LooselyConsistentValue public static value class Test80Value1 { @@ -1694,10 +1666,8 @@ public void test83_verifier(RunInfo info) { } } - /* - TODO: 8335256: Properly handle merging of value object oops @Test - @IR(failOn = {CALL_UNSAFE, ALLOC}) + @IR(failOn = {CALL_UNSAFE}) public MyValue1 test84(MyValue1 v) { v = U.makePrivateBuffer(v); for (int i = 0; i < 10; i++) { @@ -1714,7 +1684,6 @@ public void test84_verifier() { MyValue1 v2 = test84(MyValue1.setX(v1, 0)); Asserts.assertEQ(v1.hash(), v2.hash()); } - */ static value class MyValueClonable implements Cloneable { int x; From 743782339eab6e7d43206e3646ec3a46d903017b Mon Sep 17 00:00:00 2001 From: Quan Anh Mai Date: Mon, 16 Jun 2025 19:39:34 +0700 Subject: [PATCH 4/4] remove -DeoptimizeALot --- .../jtreg/compiler/valhalla/inlinetypes/TestIntrinsics.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/hotspot/jtreg/compiler/valhalla/inlinetypes/TestIntrinsics.java b/test/hotspot/jtreg/compiler/valhalla/inlinetypes/TestIntrinsics.java index 9bb4da63275..2202c5b29ba 100644 --- a/test/hotspot/jtreg/compiler/valhalla/inlinetypes/TestIntrinsics.java +++ b/test/hotspot/jtreg/compiler/valhalla/inlinetypes/TestIntrinsics.java @@ -65,9 +65,7 @@ public static void main(String[] args) { InlineTypes.getFramework() .addScenarios(scenarios) .addFlags("--add-exports", "java.base/jdk.internal.misc=ALL-UNNAMED", - "--add-exports", "java.base/jdk.internal.value=ALL-UNNAMED", - // Don't run with DeoptimizeALot until JDK-8239003 is fixed - "-XX:-DeoptimizeALot") + "--add-exports", "java.base/jdk.internal.value=ALL-UNNAMED") .addHelperClasses(MyValue1.class, MyValue2.class, MyValue2Inline.class)