[Vm-dev] Weak finalization enh. are still not integrated into VM(s)

Igor Stasenko siguctua at gmail.com
Tue Sep 21 00:17:15 UTC 2010

On 21 September 2010 02:08, Eliot Miranda <eliot.miranda at gmail.com> wrote:
> On Mon, Sep 20, 2010 at 4:02 PM, Igor Stasenko <siguctua at gmail.com> wrote:
>> Hello guys,
>> i'd like to remind you that this stuff is not yet made own way to VM and images.
>> Magma suffers badly from old finalization implementation, and as a
>> consequence it losing in speed competition
>> comparing to other OODBs.
>> I'd really like to see this enhancement to be integrated to both
>> Squeak VM and Cog VM.
>> My quick analyzis shows that Squeak 4.2 image contains some things,
>> which needed:
>>        "Weak reference finalization"
>>        newArray at: 56 put: (self at: #WeakFinalizer ifAbsent: []).
>> while Pharo still not.
>> I'd like to remind you that VM-side changes are really simple and
>> backwards compatible (given the right size of special objects array).
>> Once we will have new VMs, supporting this feature , we could start
>> integrating the image-side part of it.
>> Please, inform me, what i can do to help closing this issue.
> you can either send me a change set that is w.r.t. to a Cog version or save a Monticello version that is a delta from Cog.  I also need image level test code to pound on this.

The issue #7473 are dedicated for both vm-side changes and
image-side changes.

The image-side scripts are:

- Weak-finalizers-classes.2.cs
- new-finalization-auto.2.cs

install them in the above order, then run

WeakArray restartFinalizationProcess

I added the test case for new kind of registry, and all tests which
are green for old registry
also green for a new one.
The new registry are automatically detects if VM supports new
finalization or not,
and switching to suitable finalization logic  (it takes a single GC
in order to detect it).

The last thing is #recreateSpecialObjectsArray  [2].
A new entry is already added in Squeak, thanks Levente,
except that naming is wrong, and should refer to #WeakFinalizationList,
instead of  #WeakFinalizer , i.e.

	"Weak reference finalization"
	newArray at: 56 put: (self at: #WeakFinalizationList ifAbsent: []).

The VM-side changes is in file
 weak-finalizers-VM.1.cs ,
 but they are for Squeak VM, and a bit outdated, since index of
special object is wrong
(obviously, should be in sync with one in spl objs array).

There are two methods, which don't require changes:


And on a class side, the #intitializeSpecialObjectIndices, should use
a correct index for
WeakFinalizer class var, i.e.

WeakFinalizer := 55.

For Cog VM, i made everything fixed (see changesets in attachments).
I was able to build new Cog VM and it works fine, reporting:

WeakFinalizationRegistry hasNewFinalization  ==> true

after starting an image under this VM.

1. http://bugs.squeak.org/view.php?id=7473
2. http://bugs.squeak.org/view.php?id=7525

> best,
> Eliot

Best regards,
Igor Stasenko AKA sig.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Cog-weakfinalizers.1.cs
Type: application/octet-stream
Size: 10530 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20100921/2f1ebb7a/Cog-weakfinalizers.1-0001.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: splObjsArray.1.cs
Type: application/octet-stream
Size: 5441 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20100921/2f1ebb7a/splObjsArray.1-0001.obj

More information about the Vm-dev mailing list