RFR (S) 8220350: Refactor ShenandoahHeap::initialize

Aleksey Shipilev shade at redhat.com
Fri Mar 8 19:14:03 UTC 2019


On 3/8/19 7:57 PM, Roman Kennke wrote:
> Instead of re-formatting the constructor call here, I'd probably rather extract the arguments into
> local variables:
> 
> -      ShenandoahHeapRegion* r = new ShenandoahHeapRegion(this,
> -                                                         (HeapWord*) pgc_rs.base() + reg_size_words
> * i,
> -                                                         reg_size_words,
> +      ShenandoahHeapRegion* r = new ShenandoahHeapRegion(
> +              this,
> +              (HeapWord*) sh_rs.base() + ShenandoahHeapRegion::region_size_words() * i,
> +              ShenandoahHeapRegion::region_size_words(),
>                                                           i,
> -                                                         i < num_committed_regions);
> +              i < num_committed_regions
> +      );

Would this be better?

    for (size_t i = 0; i < _num_regions; i++) {
      HeapWord* start = (HeapWord*)sh_rs.base() + size_words * i;
      bool is_committed = i < num_committed_regions;
      ShenandoahHeapRegion* r = new ShenandoahHeapRegion(this, start, size_words, i, is_committed);


> Also, your webrev seems inconsistent:

Not sure what happened there. Trying again:
  http://cr.openjdk.java.net/~shade/8220350/webrev.02/

-Aleksey

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://mail.openjdk.java.net/pipermail/hotspot-gc-dev/attachments/20190308/b52b1261/signature.asc>


More information about the hotspot-gc-dev mailing list