RFR: 8259375: JvmtiExport::jni_Get/SetField_probe calls do not need ResetNoHandleMark

Coleen Phillimore coleenp at openjdk.java.net
Fri Jan 8 13:08:01 UTC 2021


On Fri, 8 Jan 2021 07:03:28 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> src/hotspot/share/prims/jvmtiExport.cpp line 1891:
>> 
>>> 1889:     // At least one field access watch is set so we have more work
>>> 1890:     // to do. This wrapper is used by "quick" entry points that don't
>>> 1891:     // allow us to create handles in post_field_access_by_jni(). We
>> 
>> This part of the comment should have remained - no? It is what distinguishes the _nh version from the regular version. (Though this code seems so confused it may be that we don't even need a _nh version?)
>> 
>> Cheers,
>> David
>
> Looking closer this code is broken - both the _nh and regular version actually create Handles! The _nh version should be read as being used  when "the caller does not allow handles" and hence it needed the RNHM. So either the RHNM remains necessary or else all calls to x_nh() should be changed to x().
> 
> David

Calls to x_nh() should be changed to x().  QUICK_ENTRY was removed in https://bugs.openjdk.java.net/browse/JDK-8228758 and this was called via JNI_QUICK_ENTRY back then.
All this complex machinery makes me want to remove HandleMarks completely in favor of having Handles be RAII objects like methodHandles.  I can file a bug to remove the _nh version of this function.

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

PR: https://git.openjdk.java.net/jdk/pull/1975


More information about the serviceability-dev mailing list