one suggestion for improving the performance of gc and memroy management
Michel Fortin
michel.fortin at michelf.com
Tue Dec 22 09:08:27 PST 2009
On 2009-12-22 11:39:04 -0500, Jerry Quinn <jlquinn at optonline.net> said:
> Michel Fortin Wrote:
>
>> My opinion is that immutable and shared immutable should be two
>> different type modifiers. Contrary to other shared values, shared
>> immutable values can be cast to non-shared immutable (and non-shared
>> const) since they do not require memory barriers, but the reverse
>> should be forbidden (sending a non-shared immutable value to another
>> thread) because it would allow thread-local objects to escape.
>
> You don't need the language to prevent the non-shared to shared cast as long
> as the object can be moved to shared GC once it crosses the barrier.
> The compiler
> could do this when it sees the cast happening.
Indeed. But you still need the compiler to treat immutable and shared
immutable as two different things. Currently those are synonyms
semantically.
--
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/
More information about the Digitalmars-d
mailing list