serializing a class

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|

serializing a class

Stéphane Ducasse
Hi

I would like to do a little experiment.
I need to save a class (not the instances) in a binary format and I was wondering if somebody got experience with that.

Stef
_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: serializing a class

Schwab,Wilhelm K
Stef,

Dolphin's solution is to use proxies.  Rather than serializing the class itself, one might prefer to serialize a proxy that knows enough to find the appropriate object once it "wakes up" in the new image.  In the case of a class, it should be enough to know the name, so the proxy would have that one aspect and it would resolve itself by looking for it in the system dictionary.  There is a little more to it, but that is the basic idea.

Bill


-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Stéphane Ducasse
Sent: Thursday, April 01, 2010 3:03 PM
To: [hidden email] Development
Subject: [Pharo-project] serializing a class

Hi

I would like to do a little experiment.
I need to save a class (not the instances) in a binary format and I was wondering if somebody got experience with that.

Stef
_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: serializing a class

Mariano Martinez Peck
In reply to this post by Stéphane Ducasse


On Thu, Apr 1, 2010 at 10:02 PM, Stéphane Ducasse <[hidden email]> wrote:
Hi

I would like to do a little experiment.
I need to save a class (not the instances) in a binary format and I was wondering if somebody got experience with that.


Stef, why you need it in a binary format? I mean, why a simple file out is  not adecuated ? or SmartRefStream, or to xml..

Cheers

Mariano

 
Stef
_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: serializing a class

Igor Stasenko
In reply to this post by Stéphane Ducasse
On 1 April 2010 23:02, Stéphane Ducasse <[hidden email]> wrote:
> Hi
>
> I would like to do a little experiment.
> I need to save a class (not the instances) in a binary format and I was wondering if somebody got experience with that.
>

I'd rather change the 'class' to an 'object' in your question.
Mainly, the problem is to file-out an object-memory subgraph, with
predefined stub points,
and then load it into another object memory and reconnect these stubs.

> Stef
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>



--
Best regards,
Igor Stasenko AKA sig.

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: serializing a class

Lukas Renggli
In reply to this post by Mariano Martinez Peck
2010/4/1 Mariano Martinez Peck <[hidden email]>:

>
>
> On Thu, Apr 1, 2010 at 10:02 PM, Stéphane Ducasse
> <[hidden email]> wrote:
>>
>> Hi
>>
>> I would like to do a little experiment.
>> I need to save a class (not the instances) in a binary format and I was
>> wondering if somebody got experience with that.
>>
>
> Stef, why you need it in a binary format? I mean, why a simple file out is
> not adecuated ? or SmartRefStream, or to xml..

Monticello provides various serialization methods for classes: a
binary one based on reference streams, and one based on the file-out
mechanism.

Monticello 2 uses a custom (binary) serializer for classes.

Lukas

--
Lukas Renggli
www.lukas-renggli.ch

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: serializing a class

Schwab,Wilhelm K
In reply to this post by Igor Stasenko
Sig,

SIXX will do what you describe, but I respectfully submit that you are missing the point - worse, you appear to be going out of your way to obfuscate it: there are indeed objects (classes are among them) that require specialized serialization.

Bill



-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Igor Stasenko
Sent: Thursday, April 01, 2010 4:36 PM
To: [hidden email]
Subject: Re: [Pharo-project] serializing a class

On 1 April 2010 23:02, Stéphane Ducasse <[hidden email]> wrote:
> Hi
>
> I would like to do a little experiment.
> I need to save a class (not the instances) in a binary format and I was wondering if somebody got experience with that.
>

I'd rather change the 'class' to an 'object' in your question.
Mainly, the problem is to file-out an object-memory subgraph, with predefined stub points, and then load it into another object memory and reconnect these stubs.

> Stef
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>



--
Best regards,
Igor Stasenko AKA sig.

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: serializing a class

Igor Stasenko
On 2 April 2010 01:26, Schwab,Wilhelm K <[hidden email]> wrote:
> Sig,
>
> SIXX will do what you describe, but I respectfully submit that you are missing the point - worse, you appear to be going out of your way to obfuscate it: there are indeed objects (classes are among them) that require specialized serialization.
>

sorry, can't parse it. What you mean by obfuscating the point what i missing?
I never said that classes doesn't require special handling. What i
tried to point out, that being able to serialize any object in right
way will make it much easier to deal with classes.

> Bill
>
>
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf Of Igor Stasenko
> Sent: Thursday, April 01, 2010 4:36 PM
> To: [hidden email]
> Subject: Re: [Pharo-project] serializing a class
>
> On 1 April 2010 23:02, Stéphane Ducasse <[hidden email]> wrote:
>> Hi
>>
>> I would like to do a little experiment.
>> I need to save a class (not the instances) in a binary format and I was wondering if somebody got experience with that.
>>
>
> I'd rather change the 'class' to an 'object' in your question.
> Mainly, the problem is to file-out an object-memory subgraph, with predefined stub points, and then load it into another object memory and reconnect these stubs.
>
>> Stef
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>
>
>
> --
> Best regards,
> Igor Stasenko AKA sig.
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>



--
Best regards,
Igor Stasenko AKA sig.

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: serializing a class

Stéphane Ducasse
In reply to this post by Mariano Martinez Peck
Because I want to play with the idea of bootstrapping a smalltalk and I would like to have
a socket and a raw sequence of numbers...
No compiler no.... just a reader of stuff (but of course for that you need already a lot)

Stef

> On Thu, Apr 1, 2010 at 10:02 PM, Stéphane Ducasse <[hidden email]> wrote:
> Hi
>
> I would like to do a little experiment.
> I need to save a class (not the instances) in a binary format and I was wondering if somebody got experience with that.
>
>
> Stef, why you need it in a binary format? I mean, why a simple file out is  not adecuated ? or SmartRefStream, or to xml..
>
> Cheers
>
> Mariano
>
>  
> Stef
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: serializing a class

Michael Rueger-6
On 4/2/2010 5:12 PM, Stéphane Ducasse wrote:
> Because I want to play with the idea of bootstrapping a smalltalk and I would like to have
> a socket and a raw sequence of numbers...
> No compiler no.... just a reader of stuff (but of course for that you need already a lot)

Craig has done quite a bit of work regarding code loading I would assume.

For bare bones (binary) loading of compiled code and classes you
actually shouldn't need much infrastructure, but a lot of thought
beforehand (representing and binding symbols, encoding the literal frame
etc) :-)

Michael

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: serializing a class

Stéphane Ducasse

On Apr 2, 2010, at 5:23 PM, Michael Rueger wrote:

> On 4/2/2010 5:12 PM, Stéphane Ducasse wrote:
>> Because I want to play with the idea of bootstrapping a smalltalk and I would like to have
>> a socket and a raw sequence of numbers...
>> No compiler no.... just a reader of stuff (but of course for that you need already a lot)
>
> Craig has done quite a bit of work regarding code loading I would assume.

yes
but somebody has to do archeology there.

> For bare bones (binary) loading of compiled code and classes you actually shouldn't need much infrastructure, but a lot of thought beforehand (representing and binding symbols, encoding the literal frame etc) :-)

Yes this is what I'm trying to learn so that I know what I ask when i will ask some guys to do it :)

>
> Michael
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: serializing a class

Stéphane Ducasse
In reply to this post by Michael Rueger-6

On Apr 2, 2010, at 5:23 PM, Michael Rueger wrote:

> On 4/2/2010 5:12 PM, Stéphane Ducasse wrote:
>> Because I want to play with the idea of bootstrapping a smalltalk and I would like to have
>> a socket and a raw sequence of numbers...
>> No compiler no.... just a reader of stuff (but of course for that you need already a lot)
>
> Craig has done quite a bit of work regarding code loading I would assume.

looking for spoon.2a12.macosx.dmg

> For bare bones (binary) loading of compiled code and classes you actually shouldn't need much infrastructure, but a lot of thought beforehand (representing and binding symbols, encoding the literal frame etc) :-)
 you would save part of the stack?

Stef
_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: serializing a class

hernanmd
In reply to this post by Stéphane Ducasse
Something like this?

http://www.smalltalking.net/Papers/stGen/stGenE.htm
http://alereimondo.no-ip.org/ImageGestation

Hernán

2010/4/2 Stéphane Ducasse <[hidden email]>:

> Because I want to play with the idea of bootstrapping a smalltalk and I would like to have
> a socket and a raw sequence of numbers...
> No compiler no.... just a reader of stuff (but of course for that you need already a lot)
>
> Stef
>
>> On Thu, Apr 1, 2010 at 10:02 PM, Stéphane Ducasse <[hidden email]> wrote:
>> Hi
>>
>> I would like to do a little experiment.
>> I need to save a class (not the instances) in a binary format and I was wondering if somebody got experience with that.
>>
>>
>> Stef, why you need it in a binary format? I mean, why a simple file out is  not adecuated ? or SmartRefStream, or to xml..
>>
>> Cheers
>>
>> Mariano
>>
>>
>> Stef
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: serializing a class

Mariano Martinez Peck
In reply to this post by Lukas Renggli


On Thu, Apr 1, 2010 at 11:36 PM, Lukas Renggli <[hidden email]> wrote:
2010/4/1 Mariano Martinez Peck <[hidden email]>:
>
>
> On Thu, Apr 1, 2010 at 10:02 PM, Stéphane Ducasse
> <[hidden email]> wrote:
>>
>> Hi
>>
>> I would like to do a little experiment.
>> I need to save a class (not the instances) in a binary format and I was
>> wondering if somebody got experience with that.
>>
>
> Stef, why you need it in a binary format? I mean, why a simple file out is
> not adecuated ? or SmartRefStream, or to xml..

Monticello provides various serialization methods for classes: a
binary one based on reference streams, and one based on the file-out
mechanism.

Monticello 2 uses a custom (binary) serializer for classes.


Lukas/Colin  can you point me to this in the code?  classes/methods that does that?
 
Thanks!



Lukas

--
Lukas Renggli
www.lukas-renggli.ch

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply | Threaded
Open this post in threaded view
|

Re: serializing a class

Mariano Martinez Peck
In reply to this post by Schwab,Wilhelm K


On Thu, Apr 1, 2010 at 11:05 PM, Schwab,Wilhelm K <[hidden email]> wrote:
Stef,

Dolphin's solution is to use proxies.  Rather than serializing the class itself, one might prefer to serialize a proxy that knows enough to find the appropriate object once it "wakes up" in the new image.  In the case of a class, it should be enough to know the name, so the proxy would have that one aspect and it would resolve itself by looking for it in the system dictionary.  There is a little more to it, but that is the basic idea.


ReferenceStream does the same, and te proxy is called DiskProxy.  This may work sometimes, but others, it doesn't.
For example, in my case, I need to REALLY serialize a class, becase I need to load it in another image where such class is not even present.

cheers

Mariano
 
Bill


-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Stéphane Ducasse
Sent: Thursday, April 01, 2010 3:03 PM
To: [hidden email] Development
Subject: [Pharo-project] serializing a class

Hi

I would like to do a little experiment.
I need to save a class (not the instances) in a binary format and I was wondering if somebody got experience with that.

Stef
_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply | Threaded
Open this post in threaded view
|

Re: serializing a class

Schwab,Wilhelm K
You might do some searches on Dolphin's binary packages; I tried them once and that was about it, but there might be some useful reading on them??

For your problem, my thoughts would be either a fileout or .mcz followed by SIXX for the data.

Bill




________________________________________
From: [hidden email] [[hidden email]] On Behalf Of Mariano Martinez Peck [[hidden email]]
Sent: Thursday, February 24, 2011 5:25 AM
To: [hidden email]
Subject: Re: [Pharo-project] serializing a class

On Thu, Apr 1, 2010 at 11:05 PM, Schwab,Wilhelm K <[hidden email]<mailto:[hidden email]>> wrote:
Stef,

Dolphin's solution is to use proxies.  Rather than serializing the class itself, one might prefer to serialize a proxy that knows enough to find the appropriate object once it "wakes up" in the new image.  In the case of a class, it should be enough to know the name, so the proxy would have that one aspect and it would resolve itself by looking for it in the system dictionary.  There is a little more to it, but that is the basic idea.


ReferenceStream does the same, and te proxy is called DiskProxy.  This may work sometimes, but others, it doesn't.
For example, in my case, I need to REALLY serialize a class, becase I need to load it in another image where such class is not even present.

cheers

Mariano

Bill


-----Original Message-----
From: [hidden email]<mailto:[hidden email]> [mailto:[hidden email]<mailto:[hidden email]>] On Behalf Of Stéphane Ducasse
Sent: Thursday, April 01, 2010 3:03 PM
To: [hidden email]<mailto:[hidden email]> Development
Subject: [Pharo-project] serializing a class

Hi

I would like to do a little experiment.
I need to save a class (not the instances) in a binary format and I was wondering if somebody got experience with that.

Stef
_______________________________________________
Pharo-project mailing list
[hidden email]<mailto:[hidden email]>
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

_______________________________________________
Pharo-project mailing list
[hidden email]<mailto:[hidden email]>
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


Reply | Threaded
Open this post in threaded view
|

Re: serializing a class

ccrraaiigg
In reply to this post by Stéphane Ducasse

Hi--

     Hm, I missed this thread before, sorry about that. (This thread
started in April last year. I started reading this list in October, and
had to just scan a lot of subject lines when catching up, during my move
to Europe.)

     (Conversation between Stéphane and Michael:)

> > > ...I want to play with the idea of bootstrapping a smalltalk and
> > > I would like to have a socket and a raw sequence of numbers... No
> > > compiler no.... just a reader of stuff (but of course for that
> > > you need already a lot)
> >
> > Craig has done quite a bit of work regarding code loading I would
> > assume.

     Yes!

> yes, but somebody has to do archeology there.

     I can help. :)  I'm actively working on this. My apologies if there
was a problem reaching the Spoon bits at the time; hosting providers
have come and gone occasionally. The current release is meant to be
constantly available at [1]. For announcements, please check out my
blog, thisContext[2]. For deeper discussion, please join the mailing
list[3] and chat with us on the IRC channel[4]. Also, please do feel
free to contact me via the info at the bottom of this message.

> > For bare bones (binary) loading of compiled code and classes you
> > actually shouldn't need much infrastructure, but a lot of thought
> > beforehand (representing and binding symbols, encoding the literal
> > frame etc) :-)
>
> Yes this is what I'm trying to learn so that I know what I ask when i
> will ask some guys to do it :)

     If you haven't seen it before, please check out the implementation
summary for Naiad, Spoon's module system[5]. It discusses infrastructure
for direct transfer of classes and compiled methods between live
systems. Please let me know if you have any questions, I'm happy and
eager to discuss. I read the Pharo, squeak-dev, vm-dev, and Spoon lists.


     thanks again,

-C

[1] http://netjam.org/spoon/releases/current
[2] http://thiscontext.wordpress.com
[3] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/spoon
[4] irc://freenode.net/#spoon
[5] http://netjam.org/spoon/naiad

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