one suggestion for improving the performance of gc and memroy management

Jerry Quinn jlquinn at optonline.net
Tue Dec 22 08:39:04 PST 2009


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.

Jerry




More information about the Digitalmars-d mailing list