On Sat, 15 Nov 2014 01:56:17 +0000
IgorStepanov via Digitalmars-d <digitalmars-d@puremagic.com> wrote:

> On Friday, 14 November 2014 at 23:49:00 UTC, ketmar via 
> Digitalmars-d wrote:
> > On Fri, 14 Nov 2014 23:23:17 +0000
> > IgorStepanov via Digitalmars-d <digitalmars-d@puremagic.com> 
> > wrote:
> >
> >> What does the NO_INTERIOR flag?
> > it stops GC to acknowledge pointers inside allocated area as 
> > anchors.
> > i.e. if there is no pointer to the head (first address) of 
> > allocated
> > memory, it is assumed to be garbage.
> >
> > this way we have much less "false pointers", and GC not doing
> > pointer->block conversions.
> >
> > for buckets we certainly has "head pointer" and can't have 
> > pointers to
> > bucket elements without "head pointer". so it's safe to tell GC 
> > that it
> > shouldn't do unnecessary work.
> 
> In other words, if buckets array will contain only uint-s there 
> is no reason to mark buckets with NO_INTERIOR?
that's not about bucket contents, that's about other pointers to
buckets. with NO_INTERIOR you guarantees that things like
`&element[1]`, `&element[2]` and so on cannot exist without
`&element[0]`.

i.e. there ALWAYS be live pointer to the head. and if there is no such
pointer, GC will mark memory as "garbage" even if there are still
pointers to other elements, like `&element[1]`, etc.

it's not about what buckets themselves contains.

to stop scanning *contents* one using NO_SCAN, but that's obviously
wrong for buckets, as they will contain pointers to keys and values.

as AA buckets are internal structures user can't slice 'em in his
code, it's safe to set NO_INTERIOR flag.

btw, core.memory documents all this flags. maybe it should be fixed if
it's not clear enough? i don't know if it is clear for someone without
expirience in GC.

Attachment: signature.asc
Description: PGP signature

Reply via email to