RFR(L): 6484965: G1: piggy-back liveness accounting phase on marking

Bengt Rutisson bengt.rutisson at oracle.com
Tue Nov 29 08:28:44 UTC 2011


Hi John,

Thanks for incorporating my suggested changes.

Cutting to your last question:

[...]

>> Since both VerifyLiveObjectDataHRClosure and a Mux2HRClosure are 
>> StackObjs I assume it is not possible to get around the issue with a 
>> ResourceMark.
>
> I'm not sure I get what you mean. That they are allocated on stack 
> should mean that we don't need to reclaim resource memory and so no 
> need for a ResourceMark. Can you clarify a bit?

Now that I read my statement I realize that I was skipping all kinds of 
explanations to what I was trying to say. ;-) Anyway, here's what I was 
thinking:

You don't want to allocate the two extra closures on the C heap so you 
stack allocate them. That's fine, but that means that they can't be 
placed inside the if(VerifyDuringGC) statement since they will go out of 
scope at the end of the if statement and we need them after.

I figured that this was the reason why we always allocate them even 
though we won't need them most of the time. One way to allocate them 
inside the if, but still have fast allocation would be to use a 
ResourceMark outside the if and then use new inside the if to allocate 
the closure only when they are needed. However, this is probably not 
possible since the closures are StackObjs that don't allow the use of new.

Any clearer? Is this reasoning even correct? I am not that good with the 
internals of ResourceMark and StackObjs.

Bengt



More information about the hotspot-gc-dev mailing list