An important pull request: accessing shared affix for immutable data

Ola Fosheim Grøstad via Digitalmars-d digitalmars-d at puremagic.com
Sat Feb 13 00:16:04 PST 2016


On Saturday, 13 February 2016 at 03:03:05 UTC, 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.

Be careful:

https://en.wikipedia.org/wiki/Address_space_layout_randomization



More information about the Digitalmars-d mailing list