[lworld] RFR: 8373608: [lworld] Remove ObjBufferAllocator

Paul Hübner phubner at openjdk.org
Fri Dec 12 16:26:18 UTC 2025


On Fri, 12 Dec 2025 15:43:25 GMT, Frederic Parain <fparain at openjdk.org> wrote:

>> src/hotspot/share/prims/unsafe.cpp line 520:
>> 
>>> 518:   Handle vh(THREAD, v);
>>> 519:   InlineKlass* vk = InlineKlass::cast(v->klass());
>>> 520:   instanceOop new_value = vk->allocate_instance(CHECK_NULL);
>> 
>> This changes one instance in a function named Unsafe_MakePrivateBuffer. Is that also dead code now? I don't see any Java usage of that API:
>> 
>> $ grep -r akePrivateBuffer src/
>> src/hotspot/share/prims/unsafe.cpp:UNSAFE_ENTRY(jobject, Unsafe_MakePrivateBuffer(JNIEnv *env, jobject unsafe, jobject value)) {
>> src/hotspot/share/prims/unsafe.cpp:    {CC "makePrivateBuffer",     CC "(" OBJ ")" OBJ,      FN_PTR(Unsafe_MakePrivateBuffer)},
>> src/hotspot/share/classfile/vmIntrinsics.hpp:  do_name(makePrivateBuffer_name,"makePrivateBuffer")                                                                   \
>> src/hotspot/share/classfile/vmIntrinsics.hpp:  do_intrinsic(_makePrivateBuffer,  jdk_internal_misc_Unsafe,     makePrivateBuffer_name, object_object_signature, F_RN)   \
>> src/hotspot/share/classfile/vmIntrinsics.cpp:  case vmIntrinsics::_makePrivateBuffer:
>> src/hotspot/share/opto/doCall.cpp:  if (callee->intrinsic_id() == vmIntrinsics::_makePrivateBuffer || callee->intrinsic_id() == vmIntrinsics::_finishPrivateBuffer) {
>> src/hotspot/share/opto/doCall.cpp:    if (!rtype->is_void() && cg->method()->intrinsic_id() != vmIntrinsicID::_makePrivateBuffer) {
>> src/hotspot/share/opto/c2compiler.cpp:  case vmIntrinsics::_makePrivateBuffer:
>> src/hotspot/share/opto/graphKit.cpp:    // language, Unsafe::makePrivateBuffer returns an Object that is checkcast-ed to the concrete
>> src/hotspot/share/opto/library_call.cpp:  case vmIntrinsics::_makePrivateBuffer:        return inline_unsafe_make_private_buffer();
>> src/hotspot/share/opto/library_call.cpp:    C->record_method_not_compilable("value passed to Unsafe::makePrivateBuffer is not of a constant value type");
>> src/hotspot/share/opto/library_call.cpp:    C->record_method_not_compilable("value passed to Unsafe::finishPrivateBuffer must be allocated by Unsafe::makePrivateBuffer");
>> src/java.base/share/classes/jdk/internal/misc/Unsafe.java:    public native <V> V makePrivateBuffer(V value);
>
> Unsafe_MakePrivateBuffer is used by the VectorAPI, which is a branch that depends on the `lworld` branch.
> More details here: https://github.com/openjdk/valhalla/pull/1593

In addition to what Fred said, we have `runtime/valhalla/inlinetypes/LarvalMarkWordTest.java` (and possibly others) which makes use of it.

-------------

PR Review Comment: https://git.openjdk.org/valhalla/pull/1794#discussion_r2614838354


More information about the valhalla-dev mailing list