RFR(s): 8077415: Remove duplicate variables holding the CollectedHeap

Per Liden per.liden at oracle.com
Wed Apr 15 08:13:19 UTC 2015


Hi Kim,

On 2015-04-13 18:13, Kim Barrett wrote:
> On Apr 13, 2015, at 11:55 AM, Per Liden <per.liden at oracle.com> wrote:
>>
>> Good point. I wouldn't mind using FakeRtti here, but I'd like us to massage its interface a bit first. My main concern is that using it today requires a fair bit of ceremony. But let me continue that discussion in a separate mail thread, where I can expand a bit more on what I'm thinking.
>
> Sure.  Some of the ceremony might be just to support some of the strangeness in current BarrierSet usage, some of which really ought to be done differently.  I’ll be interested to see what you suggest.
>
>> For now I'd like to just do the kind() check before the cast, to avoid doing something with undefined behavior, like this:
>>
>> G1CollectedHeap* G1CollectedHeap::heap() {
>>   CollectedHeap* heap = Universe::heap();
>>   assert(heap != NULL, "Uninitialized access to G1CollectedHeap::heap()");
>>   assert(heap->kind() == CollectedHeap::G1CollectedHeap, "Not a G1CollectedHeap");
>>   return (G1CollectedHeap*)heap;
>> }
>>
>> Ok?
>
> Yes.

Great, here's an updated webrev:
http://cr.openjdk.java.net/~pliden/8077415/webrev.1/

And a diff against the initial webrev:
http://cr.openjdk.java.net/~pliden/8077415/webrev.1-diff_0vs1/

cheers,
/Per


More information about the hotspot-gc-dev mailing list