Want reasonable reference counting? Disable automatic sharing of immutable
Timon Gehr
timon.gehr at gmx.ch
Tue Nov 16 01:40:58 UTC 2021
On 16.11.21 02:33, rikki cattermole wrote:
> On 16/11/2021 2:16 PM, deadalnix wrote:
>> On Monday, 15 November 2021 at 21:30:29 UTC, rikki cattermole wrote:
>>> There is nothing stopping the compiler putting immutable values in
>>> ROM, nor the user who didn't know that something like __mutable is in
>>> use from making memory they allocated read only.
>>>
>>
>> How will the compiler put something that is dynamically allocated in ROM?
>
> It won't (or at least I'm not aware that there is a way to do it outside
> of globals/literals).
>
> That particular situation would be for globals or literals.
Again, the compiler is aware which memory ranges have __mutable fields
in them and can just put those in the writable data segment. There is no
opacity at that point. I think this is just a non-issue, you only pay
for what you use.
More information about the Digitalmars-d
mailing list