An important pull request: accessing shared affix for immutable data

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Fri Feb 12 19:05:08 PST 2016


On 02/12/2016 10:03 PM, tsbockman wrote:
> On Saturday, 13 February 2016 at 01:27:49 UTC, Andrei Alexandrescu wrote:
>> On 02/12/2016 08:02 PM, tsbockman wrote:
>>> What about providing a way to mark a piece of data as thread-local at
>>> allocation time?
>>
>> Yah, could be part of the metadata. Then after inspecting that bit,
>> shared can be casted away. I consider that an optimization that
>> doesn't add or remove generality. -- Andrei
>
> I was actually suggesting encoding the shared-ness into the memory
> address itself. (No tricks - just allocate shared data in a separate
> memory range. This may only be feasible on 64-bit though, with its
> over-abundance of address space.)
>
> This way, you can determine whether the (meta-)data is shared without
> accessing it at all, just by asking the allocator about the address.

Yah, TypedAllocator can be used for exactly that. -- Andrei


More information about the Digitalmars-d mailing list