radical ideas about GC and ARC : need to be time driven?

Marco Leise via Digitalmars-d digitalmars-d at puremagic.com
Sun May 11 21:26:51 PDT 2014


Am Mon, 12 May 2014 03:36:34 +1000
schrieb Manu via Digitalmars-d <digitalmars-d at puremagic.com>:

> On 12 May 2014 02:38, Marco Leise via Digitalmars-d
> <digitalmars-d at puremagic.com> wrote:
> > Am Sun, 11 May 2014 14:52:50 +1000
> > schrieb Manu via Digitalmars-d <digitalmars-d at puremagic.com>:
> >
> >> On 11 May 2014 05:39, H. S. Teoh via Digitalmars-d
> >> <digitalmars-d at puremagic.com> wrote:
> >> > On Sat, May 10, 2014 at 09:16:54PM +0200, Xavier Bigand via Digitalmars-d wrote:
> >> >>  - Same question if D migrate to ARC?
> >> >
> >> > I highly doubt D will migrate to ARC. ARC will probably become
> >> > *possible*, but some language features fundamentally rely on the GC, and
> >> > I can't see how that will ever be changed.
> >>
> >> Which ones are incompatible with ARC?
> >
> > Pass-by-value slices as 2 machine words
> 
> 64bit pointers are only 40-48 bits, so there's 32bits waste for an
> offset... and if the base pointer is 32byte aligned (all allocated
> memory is aligned), then you can reclaim another 5 bits there... I
> think saving an arg register would probably be worth a shift.
> 32bit pointers... not so luck :/
> video games consoles though have bugger all memory, so heaps of spare
> bits in the pointers! :P

And remember how people abused the high bit in 32-bit until
kernels were modified to support the full address space and
the Windows world got that LARGE_ADDRESS_AWARE flag to mark
executables that do not gamble with the high bit.

On the positive side the talk about Rust, in particular how
reference counted pointers decay to borrowed pointers made me
think the same could be done for our "scope" args. A reference
counted slice with 3 machine words could decay to a 2 machine
word "scoped" slice. Most of my code at least just works on the
slices and doesn't keep a reference to them. A counter example
is when you have something like an XML parser - a use case
that D traditionally (see Tango) excelled in. The GC
environment and slices make it possible to replace string
copies with cheap slices into the original XML string.

-- 
Marco



More information about the Digitalmars-d mailing list