[ENH] [VM] Object>>#becomeForward:copyHash: ( [et][su][cd] Symbol pain healed! )

chris at funkyobjects.org chris at funkyobjects.org
Tue Sep 30 05:04:03 UTC 2003


The nature of Squeaks becomeForward: makes storing Symbols in a Magma
database problematic.  This submission by Brent Pinkney worked perfectly
on Magma's stringent test script and gives Symbols the same level of
transparency of everything else.  Thank you Brent!

Brent has implemented this for minimum impact to legacy code.
becomeForward: remains unchanged, even though it's hard to imagine any
negative impacts even if it were.  Instead, a new method is added,
becomeForward:copyHash:, which I recommend using with a value of
"false".

Problem background:

To use Symbols in Magma at all, users are *highly advised* to study-up
on ReadStrategy's and use them to tell your MagmaSession *everywhere*
your persistent model references a Symbol.  Failing to do this will
someday result in a Symbol being used as the argument to Squeaks
#becomeForward: method (as in "myMagmaProxy becomeForward:
getObjectFromDatabaseThatHappensToBeASymbol").

With or without Magma, this is something that Squeak sometimes cannot
handle.  "Object new becomeForward: #size" will lock a pristine 3.6gamma
image tight.  The identityHash of the target object, #size, is changed
and causes future lookups in various MethodDictionaries to fail. 
Because this method is used all the time by low-level Smalltalk code,
the system is completely lost.

For Magma users, the next best case when there is no image lockup is
some special-case code that recognizes a Symbol was just materialized
and tries its best to clean up by rehashing the SymbolTable and the
Smalltalk global (just in case it was a Class name).

However, remembering the names of method-selector Symbols is a common
way for programs to employ listeners, callbacks, etc.  The special-case
code doesn't try to rehash MethodDictionaries and your program is very
likely headed for a DNU that boggles the mind ("but it *is* implemented,
I'm looking at it right here in the browser!").

This submission appears to have completely eliminated the problem!

After loading Brents new VM and his changeset, you can load the attached
changeset on top of Magma 1.0gamma6.  This will remove the special-case
code in that has, at best, sucked performance out of materializing
Symbols and make calls to becomeForward:copyHash: false instead of
becomeForward:.

My best thanks, once again, to Brent Pinkney for this great fix!

 - Chris Muller













< I'm a bug-fixing machine! >

This post brought to you by the BugFixArchiveViewer, a handy tool that
makes it easy to comment on proposed fixes and enhancements for Squeak. 
For more information, check out the Web page for the BugFixArchiveViewer
project: http://minnow.cc.gatech.edu/squeak/3214 

< I'm a bug-fixing machine! >
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MagmaUsingNewBecomeForward.sar
Type: application/octet-stream
Size: 1465 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20030929/ed8ffb77/MagmaUsingNewBecomeForward.obj


More information about the Squeak-dev mailing list