Perf: excess store in allocation fast path?

Roman Kennke rkennke at redhat.com
Tue Dec 6 20:53:19 UTC 2016


Am Dienstag, den 06.12.2016, 21:07 +0100 schrieb Aleksey Shipilev:
> On 12/06/2016 08:55 PM, Roman Kennke wrote:
> > Am Dienstag, den 06.12.2016, 20:50 +0100 schrieb Aleksey Shipilev:
> > > Now, I want to know if it's okay to skip zeroing memory past the 
> > > allocation pointer. I think it is safe, because that's how
> > > zeroing
> > > elimination works in other cases?
> > 
> > It's not only ok, I think it is a bug to zero past the allocation
> > ptr.
> > Consider what happens when you allocate at the region boundary, and
> > then initialize one word past the object -> we'd wreck the 1st word
> > of
> > the next region.
> 
> Hrmpf. IIRC our filler object mechanics correctly, we allocate the
> space at the
> end of the object, so there is no way to cross into other region?

Nope, this shouldn't be the case. We *should* always allocate brooks
ptr + object of this object, not into the next one.

> Anyhow, that one notwithstanding, I meant if it's okay to have non-
> zeroed slot
> _under_ the allocation top, as in:
> 
>   (obj2 header would go here)
>  ----------------------------------------- alloc top
>   [garbage slot, soon to be obj2 fwdptr]
>   [obj1 fields]
>   [obj1 header]
>   [obj1 fwdptr]
>   ...

It should be:

  (obj2 header would go here)
   [garbage slot, soon to be obj2 fwdptr]
  ----------------------------------------- alloc top
   [obj1 fields]
   [obj1 header]
   [obj1 fwdptr]
   ...

if not, I'd say it's a bug.

Roman


More information about the shenandoah-dev mailing list