On 12/13/11 10:45 AM, Hans Uhlig wrote:
On 12/11/2011 11:32 AM, Andrei Alexandrescu wrote:
On 12/11/11 12:17 PM, Chad J wrote:
On 12/11/2011 11:21 AM, Andrei Alexandrescu wrote:
On 12/11/11 9:14 AM, Chad J wrote:

I think one thing that could would be (optional) reference counting
for
transitively atomic types. Of course, this is just another kind of
garbage collection, but it is /deterministic/ and parallelizes well,
and
I bet this would open up a large amount of Phobos while the
stop-the-world collector is offline, and with little or no code
change.

I think the language has enough (in theory) and nearly enough (in
practice) expressiveness to implement reference counted classes in a
library, virtually transparently. I mean one could define a template
RefCounted (an extended version of what's now in std) such that this
pattern is possible:

// client code
class WidgetImpl {
...
}

alias RefCounted!WidgetImpl Widget;

Aside from using WidgetImpl in type relationships, using Widget would
transparently insert the appropriate reference counting without
otherwise interfering with normal WidgetImpl semantics.


Andrei

This is good. So stick it in the runtime and make the compiler emit
RefCounted!___ templates whenever it finds a transitively atomic type.

This can be done alongside the existing garbage collector.

Then we can benchmark different combinations of memory management
strategies.

Two compiler flags can work in tandem:
-nogc
-norefcount

(Turn them both off if you really want to break Phobos.)

We considered that route, and concluded it's marred by too many issues.

Andrei


What issues did it cause?

Inheritance, conversions, type checks, circular references, ...

Andrei

Reply via email to