RFR: 8264149 BreakpointInfo::set allocates metaspace object in VM thread

Coleen Phillimore coleenp at openjdk.java.net
Fri Mar 26 23:08:40 UTC 2021


On Thu, 25 Mar 2021 22:14:37 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> This change creates a Metaspace::allocate function that doesn't pass TRAPS to be used by MethodCounters.  TRAPS and exceptions shouldn't be thrown from non-JavaThreads.
>> 
>> Tested with tier1-7.
>
> src/hotspot/share/memory/metaspace.cpp line 816:
> 
>> 814:   }
>> 815: 
>> 816:   return result;
> 
> Shouldn't we still try to find more memory by calling Universe::heap()->satisfy_failed_metadata_allocation before giving up? Or can that not work if called from the VMThread?

It can't work from the VMThread.   Patricio and I were chatting yesterday and he pointed out neither of these VM operations can nest (VM_ChangeBreakpoints and VM_MetaspaceGC) making up names but you get the point.

> src/hotspot/share/memory/metaspace.hpp line 127:
> 
>> 125:                             MetaspaceObj::Type type, TRAPS);
>> 126: 
>> 127:   // Nothrow version of allocate which can be called by a non-Java thread.
> 
> "Nothrow" is a C++ concept. I would just say "Non-TRAPS version ... Returns NULL on failure."

Yes, true.  Particularly since it had to be declared with throws().

> src/hotspot/share/oops/method.cpp line 571:
> 
>> 569:     CompileBroker::log_metaspace_failure();
>> 570:     ClassLoaderDataGraph::set_metaspace_oom(true);
>> 571:     return NULL;   // return the exception (which is cleared)
> 
> Comment needs updating

got it.

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

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


More information about the hotspot-dev mailing list