Quantcast

Not re-created, encoded

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Not re-created, encoded

Chris Cunnington
"Spoon's remote messaging support doesn't use ReferenceStream to
serialize, it uses a minimal proxy-aware framework (with a bias toward
sending references, not copies). See class MessagingSession, and the
implementors of storeOnProxyStream:for: and storeOnProxyStream:."


A Message instance is isolated and sent #storeOnProxyStream:for:. This begins an encoding of that object, which is to say, the object is 
described with tags. That tags are here:

MessagingSession class >> #initialize
	"Initialize myself."
	"self initialize"

	SpecialVariableSignatories := (
		(Dictionary new)
			at: true put: trueTag;
			at: false put: falseTag;
			at: nil put: nilTag;
			yourself).

	EncodingClasses := (
		(Dictionary new)
			at: symbolTag put: Symbol;
			at: stringTag put: String;
			at: messageSendTag put: MessagingSession;
			at: counterpartRequestTag put: CounterpartRequest;
		... snip ... 

All manner of object can be described with these encoding tags. It's a stream of this tag information that goes over the wire. With this
information the objects can be recreated on the other size. That's interesting. Unlike Noury's solution we are not copying the object on 
other side; we are sending lots of information about it. 

I can see how this would replace a Changes file, because you have stored the state of the code with these encoding tags. You're storing
the state of the source code without using text. 

And maybe it's a little more versatile than that, too. I understand Viewpoints Research has created something called Worlds, where versions
of a single object be stored in a single image. This version information seems like a way to do something similar. Different 
versions can be stored and re-instantiated. 

The Object>>storeOnProxySTream:for: has a class comment that seems to sum it up:

storeOnProxyStream: aStream for: aMessagingSession 
	"Store myself on aStream in such a way that I may be reconstructed by the peer connected to aMessagingSession."
	"By default, store a reference to myself, not a copy."

	(
		(self respondsTo: #storeOnProxyStream:)
			ifTrue: [self]
			ifFalse: [self otherVia: aMessagingSession]
	)
		storeOnProxyStream: aStream


To conclude, objects are described by encoding. The encoding is done by a series of tags in MessagingSession. These are stored in 
the history image. 

The only thing I don't understand is how encoding data can "re-animate" an object on the other side, if the subject image does 
not have a compiler. I used to think Spoon sent serialized compiled methods to the subject memory, but we are encoding the 
specifications of compiled methods and sending that over the wire. But what agency is building fresh objects with this data? Is this 
something the modified vm does?

Chris 



_______________________________________________
Spoon mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/spoon
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Not re-created, encoded

ccrraaiigg

Hi Chris--

> The only thing I don't understand is how encoding data can
> "re-animate" an object on the other side, if the subject image does
> not have a compiler. I used to think Spoon sent serialized compiled
> methods to the subject memory, but we are encoding the
> specifications of compiled methods and sending that over the wire.
> But what agency is building fresh objects with this data? Is this
> something the modified vm does?

     No, this is all done by Smalltalk code. See MethodEdition>>method.


-C

--
Craig Latta
www.netjam.org/resume
+31   6 2757 7177
+ 1 415  287 3547


_______________________________________________
Spoon mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/spoon
Loading...