On Thu, Dec 10, 2009 at 1:59 AM, Sheridan Mahoney < sheridan@sheridan-mahoney.com> wrote:
Adrian Lienhard wrote:
On Dec 8, 2009, at 12:08 , Mariano Martinez Peck wrote:
On Fri, Dec 4, 2009 at 12:05 PM, Adrian Lienhard <adi@netstyle.ch> wrote:
When you are creating your root of objects and you put symbols inside, they are not put in ourPointers but in ByteArray. This is due to the fact that the only object who is pointing to that symbol is inside the segment ?
To be precise, the symbols are also pointed to by the symbol table, but only by weak references. Since image segments use the GC mark logic, these pointers are not considered.
Martin and I had been working towards the idea that ImageSegments should never create non-Canonical symbols,
what does non-Canonical mean ?
and the user should not have to use manual techniques to preserve symbols they are interested in keeping alive.
+9999 agree.
I ended up getting stuck however, in trying to discover what process ImageSegment goes through while it is installing objects - ImageSegment #install has a call to an unimplemented method #readFromFileWithSymbols which it seems it should be using, but isn't....(wha' the?)
yes. We should try to look in the old squeak images (like 3.6). I tried to make it work, but my machine seems to be too new :( Does someone has an old squeak running and has this method implemented?
install "This operation retrieves the segment if necessary from file storage, installs it in memory, and replaces (using become:) all the root stubs with the reconstructed roots of the segment."
| newRoots | state = #onFile ifTrue: [self readFromFile]. state = #onFileWithSymbols ifTrue: [self readFromFileWithSymbols. endMarker := segment nextObject. "for enumeration of objects" endMarker == 0 ifTrue: [endMarker := 'End' clone]]. (state = #active) | (state = #imported) ifFalse: [self errorWrongState]. newRoots := self loadSegmentFrom: segment outPointers: outPointers. state = #imported ifTrue: ["just came in from exported file" arrayOfRoots := newRoots] ifFalse: [ arrayOfRoots elementsForwardIdentityTo: newRoots]. state := #inactive. Beeper beepPrimitive
I think the next step in this trajectory is to trace is how the state is getting set - right now it is kind of a mystery...
Easy, see the senders of onFileWithSymbols.There are 4, but the more important is writeToFileWithSymbols which is also called by writeToFileWithSymbols: So, if you don't use any of those messages, the state never would be onFileWithSymbols. Try to write a test using that message and you will probably get the DNU. In addition, as you said, the user shouldn't even be care about this method. He should just send the message "writeToDisk". I have the same impression with the classes. When you store in a segment a class, you must also put the metaclass. And I think this can be automatically be done by ImageSegment instead of the user.
Does this seem reasonable?
Thanks,
Sheri
-- View this message in context: http://n2.nabble.com/Re-getting-rid-of-Symbol-new-tp4109230p4143090.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project