new principle of division between structures and classes

Bill Baxter wbaxter at gmail.com
Mon Jan 12 17:27:49 PST 2009


On Tue, Jan 13, 2009 at 10:17 AM, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org> wrote:
> Bill Baxter wrote:
>>
>> So it may be worth while to have a special kind construct for
>> containing data that the compiler is free to move around.  This type
>> would have a hidden pointer inside of it that can be moved around by
>> the gc, but applications would not be allowed to access that pointer.
>>  And I suppose that means all access to the data would given via
>> lvalue only.   Probably wouldn't take much on the part of the GC to
>> provide the necessary hooks.  Just some sort of "relocatable alloc"
>> call.  Rest could probably be handled in higher level libs.
>
> Interesting. (Link?) Structs in D are supposed to be location transparent
> (it is unclear to me to what extent this should be enforced vs. just
> assumed), so if the compiler can show the address of a struct is not taken,
> it should be free to move it around.

The message doesn't appear to have come up on the list archive yet,
but here's the full text:


"""
> Third solution that was popular is to make your data completely
relocatable and allow the blocks to be moved around as needed.

One nice thing I've found is that only some of your data needs to be like
this to get the full benefit, because it can move around to fill in the gaps
left by all the other fixed-position parts. Especially helpful on consoles,
where most of your data is stuff like sound, texture and geometry buffers,
which are all trivially relocatable.

TomF.
"""
(TomF is Tom Forsyth, been in the game biz for a long time, now at
Intel working on Larabee)

--bb



More information about the Digitalmars-d mailing list