RFR: 8264149 BreakpointInfo::set allocates metaspace object in VM thread [v2]

David Holmes dholmes at openjdk.java.net
Tue Mar 30 01:20:44 UTC 2021


On Mon, 29 Mar 2021 21:22:06 GMT, Coleen Phillimore <coleenp 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.
>
> Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Only allow non-TRAPS version of Metaspace::allocate at a safepoint (or by non-Java thread)

Changes requested by dholmes (Reviewer).

src/hotspot/share/oops/method.cpp line 570:

> 568:   if (current->is_Java_thread()) {
> 569:     // For when TRAPS is JavaThread.
> 570:     counters = MethodCounters::allocate(mh, current->as_Java_thread());

I'm not at all clear what we are doing here and it seems premature to anticipate the TRAPS change to JavaThread. The code will need reworking for that change because you still check for a pending exception regardless of what type of Thread current is.
I don't see why we need to call a TRAPS version of allocate when we are going to clear any exception - just call the non-traps version (and remove the assert you added). Just because we are in a JavaThread it doesn't mean we have to throw exceptions.

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

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


More information about the hotspot-dev mailing list