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

Kim Barrett kim.barrett at oracle.com
Mon Apr 13 16:13:27 UTC 2015


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.




More information about the hotspot-gc-dev mailing list