Leopold Toetsch wrote:
> Benjamin Goldberg wrote:
> 
>> I'd like to reiterate (and clarify) my idea, of a hybrid scheme
>> combining refcounting and DoD.
> 
> I'll try to translate this to parrot speak. I hope that I fully
> understand your scheme, but lets see.
[snip]
>> During the course of a DoD run, when we look for what PMCs are
>> reachable, we keep track of what each thing was reachable *from*.
> 
>> If a PMC was found to be reachable through a non-refcounted variable,
>> then we set a flag saying so.  At the end of DoD, every reachable
>> refcounted value which has the first flag set, but this other flag
>> not set, gets it's first flag cleared.
> 
> I think I don't understand the "first & other flag".
> 
> If a PTimer is e.g. inside an aggregate (i.e. reachable through
> non-refcounted) the live_FLAG of the PTimer gets set and it will not
> get destroyed.  If during the DOD run the PTimer is not referenced it
> will have the live_FLAG cleared and will be destroyed.
> 
> If there are any objects with a refcount live after a DOD run, we set
> again the interpreter->need_lazy_dod flag.

Suppose that we have the following situation:

   {
      my $x is refcounted = FileHandle.new("<", "foo.txt");
      my $y = FileHandle.new("<", "bar.txt"); # sets need_lazy_dod
      {
         undef $y;
         # at the following end of scope,
         # the handle to bar.txt is closed by a DoD run.
      }
      # right now, is interpreter->need_lazy_dod set?
   }  # Does this end-of-scope result in a DoD run?

Following the DoD run from the first end-of-scope, there is one
refcounted object live.  It has a refcount of 1.  It is not referenced
through any variables lacking the 'is refcounted' property.  Thus, it
will be cleaned up at the end of scope due to it's refcount going to
zero.  There is no need for a DoD run at the second end-of-scope to
clean it up.

With my idea with flags on each value, we turn off
interpreter->need_lazy_dod after the first end-of-scope.

With your suggestion, the interpreter->need_lazy_dod would never get
unset until *all* refcounted objects get cleaned up.

-- 
$a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
);{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "[EMAIL PROTECTED]
]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}

Reply via email to