RFR: 8259374: Make ThreadInVMfromNative have ResetNoHandleMark [v2]

David Holmes dholmes at openjdk.java.net
Fri Jan 8 06:55:56 UTC 2021


On Thu, 7 Jan 2021 22:21:07 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> Please review this straightforward change to add a ResetNoHandleMark in the ThreadInVMfromNative transition class so that callers don't have to do this.  Tested with tier1-3.
>> This was broken out of a larger change for JDK-8258032 Reconsider LEAF entry restrictions.
>
> Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
> 
>   fix grammar

src/hotspot/share/runtime/handles.hpp line 293:

> 291: // ResetNoHandleMark is called in a context where there is an enclosing
> 292: // NoHandleMark. A thread in _thread_in_native must not create handles so
> 293: // this is used when transitioning via ThreadInVMfromNative.

This comment still doesn't clearly (to me) explain the use of RNHM. Basically it is intended to "disable" a NHM further up the stack but why do we not force the caller up the stack to correctly scope the NMH? This seems to be a way to allow sloppy coding further up the stack, or worse it allows code to be called that might use Handles completely unexpectedly wrt the code up the stack. Should a NHM not mean "this code and all code called from it must not use Handles"?

And can't this be used in a range of contexts not just this ThreadInVMFromNative transition?

Thanks,
David

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

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


More information about the hotspot-dev mailing list