RFR: 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking

Kim Barrett kim.barrett at oracle.com
Thu Feb 16 18:03:14 UTC 2017


> On Feb 16, 2017, at 9:13 AM, Erik Helin <erik.helin at oracle.com> wrote:
> 
> On 02/15/2017 10:08 PM, coleen.phillimore at oracle.com wrote:
> 
>> Why is
>> 
>> 629 void ClassLoaderData::remove_handle_unsafe(jobject h) {
>> 
>> 
>> it called unsafe?  It is safe to zero the element in the block, isn't it?
> 
> Because code using remove_handle_unsafe should be cautious. It is only safe to write NULL to the *((oop*) op) if:
> - the jobject originates from a call to ClassLoaderData::add_handle
>  (the assert verifies this).
> - *op is the sole remaining pointer to **op (the object).
> - The native memory backing the chunked linked list is not freed.
> 
> It is unfortunate that we even need to have the remove_handle_unsafe at all. An alternative is to let the only code using remove_handle_unsafe (ModuleEntry) do *((oop*) op) = NULL on its own.
> 
> Would you prefer that?

I think I prefer the (hopefully temporary?) API wart of this special function.  



More information about the hotspot-dev mailing list