RFR: 8258032: Reconsider LEAF entry restrictions [v2]

Coleen Phillimore coleenp at openjdk.java.net
Wed Jan 6 20:03:04 UTC 2021


On Wed, 6 Jan 2021 17:16:39 GMT, Daniel D. Daugherty <dcubed at openjdk.org> wrote:

>> Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Fix copyrights.
>
> So these changes boil down to:
> - remove ResetNoHandleMark and NoHandleMark helpers in favor of having them in the appropriate interfaceSupport.inline.hpp macros and helpers
> - ThreadInVMfromNative now has a ResetNoHandleMark helper
> - VM_LEAF_BASE no longer needs a NoHandleMark helper
> - VM_ENTRY_BASE_FROM_LEAF no longer needs a ResetNoHandleMark helper
> - JNI_LEAF now has a NoHandleMark helper
> - JVM_LEAF now has a NoHandleMark helper
> - JVM_ENTRY_FROM_LEAF now has a ResetNoHandleMark helper
> 
> Okay, I think I grok these changes and they look good to me.
> I would like to see Tier7 and Tier8 testing done since longer
> stress runs are done in those tiers.

Answering Dan's questions made me realize that the compiler runtime changes are incorrect.

There were some runtime functions that were made to not have transitions from Java, but then call some function that has a JRT_ENTRY.  The JRT_ENTRY has a HandleMarkCleaner which resets the handlers to where the Java code is called (just before call_stub in javaCalls.cpp) so if you create a Handle in these special non-transitioning functions, they’ll get wiped out by the JRT_ENTRY and not collected.
So the pattern in the code like this makes sense (except two instances that has a ResetNoHandleMark rather than NoHandleMark).

  NoHandleMark nhm;  // any handles created here and used after the function call to
                                       // handle_exception_C_helper will be wiped out by the HandleMarkCleaner in the JRT_ENTRY.
  {
    // Enter the VM
    ResetNoHandleMark rnhm;
    handler_address = handle_exception_C_helper(thread, nm);
  }

I messed up my git repo trying to revert files, so I'm withdrawing this PR for now.  Thanks for your attention, Dan!

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

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


More information about the serviceability-dev mailing list