[squeak-dev] The solution of (Was: Creating an image from first principles)

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

[squeak-dev] re: The solution of

ccrraaiigg

 > ...SystemTracer [doesn't give us a way to] truncate unwanted stuff
 > from the current image to produce a new, smaller one.

      Yes, it does. It's called "clamping". See the class comment for
SystemTracer. :)


-C



Reply | Threaded
Open this post in threaded view
|

[squeak-dev] re: The solution of

ccrraaiigg
In reply to this post by K. K. Subramaniam

 > Mmm... Why do the tools and utilities required to build a VM, garbage
 > collector, primitives and plugins...

      I don't think those particular tools are required, actually.

 > ...suddenly become "crappy" when building an initial image?

      Because we've created better ones in the meantime (allegedly :).


-C



Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] re: The solution of

Igor Stasenko
In reply to this post by ccrraaiigg
2008/8/7 Craig Latta <[hidden email]>:
>
>> ...SystemTracer [doesn't give us a way to] truncate unwanted stuff
>> from the current image to produce a new, smaller one.
>
>     Yes, it does. It's called "clamping". See the class comment for
> SystemTracer. :)
>

I have a SystemTracer2, which comment reads:

Use it by subclassing it and overriding desired methods in:
        'object relacement' to create replacement objects for desired objects
(swapMap);
        'object encoding' to specify bit representation of objects;
        'clone startup' to initialize the new image on first startup.

... a bit further...

 swapMap IdentityDictionary (oldObject -> newObject)
                        When an object is visited, swapMap is checked to see if it has a
replacement, and if so the new object is traced and written instead of
the original.  You can add to the swapMap in initSwapMapPreShutdown or
initSwapMapPostShutdown before tracing starts, or you can add to it
during tracing in convert:pointer:field:.  The tracer automatically
adds itself and the active process to swapMap so it own execution
won't be traced (pvtWriteImageConverted).

---------

Maybe i was not precise (sorry for my bad English).
SystemTracer alone doesn't provide any sophisticated means how to
terminate a subgraph by replacing edges to something different,
neither any criteria upon which edges can be replaced/removed etc.
I mean, this is completely up to you - what objects will/can be placed
in swapMap.



--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] re: The solution of

timrowledge

On 7-Aug-08, at 11:21 AM, Igor Stasenko wrote:
>
>
> Maybe i was not precise (sorry for my bad English).
> SystemTracer alone doesn't provide any sophisticated means how to
> terminate a subgraph by replacing edges to something different,
> neither any criteria upon which edges can be replaced/removed etc.
> I mean, this is completely up to you - what objects will/can be placed
> in swapMap.
>
It gives you complete and total control over what goes into the  
wordarray that will be written out as an image, not just what gets  
swapped or clamped. Making a variant tracer that read a spec from XML  
(or whatever) and created objects in the 'new OM' is entirely  
possible. The hardest part (from my point of view) would be reading  
the xml and understanding it. Oh, and designing the entire spec of an  
image in XML would be kinda amusing too.

Much more sensible would be creating some tools in a decent language  
(Squeak, duh) to allow us to define a class graph for the new image  
along with specs for whole it all gets written out. Since the new  
objects would not need to execute anything in the 'old' image there  
would be no problem with compatibility. Then you create a script that  
writes out suitable instances of the essential objects for the new  
image; you do not need to have ever created them in the old image,  
though it may well be simpler to do so in most cases.

You could create an image with a totally different object format,  
image layout, class tree, bytecode set, etc this way. And of course  
you could modify the simulation code so that you could run it all  
before ever compiling a 'real VM. That's what it is all there for.

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Useful random insult:- His head whistles in a cross wind.



Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] The solution of (Was: Creating an image from first principles)

timrowledge
In reply to this post by K. K. Subramaniam

On 7-Aug-08, at 10:25 AM, K. K. Subramaniam wrote:

> On Thursday 07 Aug 2008 8:45:12 pm tim Rowledge wrote:
>> On 7-Aug-08, at 5:18 AM, K. K. Subramaniam wrote:
>>> I think the original question about creating an image from first
>>> principles
>>> was about transmutation, not cloning.
>>
>> The SystemTracer can easily create new images from specs rather than
>> 'merely cloning' an existing image.
> SystemTracer is a Smalltalk utility. So it does not qualify as a  
> transmutation
> tool.

What? Don't be silly.

> The quest is to bootstrap a Smalltalk system (VM and image) from more
> basic primitives. We know it is possible for the VM, but is it  
> possible for
> the image too?

Why? Who cares what tool is used other than to want the best one for  
the job? If there is actually anyone that claims that you have to  
generate an image solely by use of unix commandline utilities in order  
for it to be 'proper' then screw'em. They're mental.

>
>
>>> How does one create a Smalltalk
>>> environment (i.e. an image) starting with an environment that has  
>>> only
>>> imperative programming tools (e.g. C/C++, Forth etc.)? What is
>>> sought is a
>>> process that can be replicated by anyone proficient in the  
>>> imperative
>>> environment.
>>
>> Why waste time using crappy tools...
> Mmm.. Why do the tools and utilities required to build a VM, garbage
> collector, primitives and plugins suddenly become "crappy" when  
> building an
> initial image?

They don't. They're crappy to begin with. I've spent decades fighting  
with C compilers and debuggers etc etc etc and anyone that claims  
they're good is clearly either totally inexperienced with using them  
or deluded.

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
ASCII to  ASCII, DOS to DOS.



Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Re: The solution of

ccrraaiigg
In reply to this post by Igor Stasenko

 > > > ...SystemTracer [doesn't give us a way to] truncate unwanted stuff
 > > > from the current image to produce a new, smaller one.
 > >
 > > Yes, it does. It's called "clamping". See the class comment for
 > > SystemTracer. :)
 >
 > I have a SystemTracer2, which comment reads... [no mention of
 > clamping]

      I was referring to the class comment for SystemTracer (in, for
example, Squeak 3.2). In particular, it says "The tracer has built-in
support for clamping unwanted (or unneeded) objects out of the system."

      More importantly, Tim has used it extensively and
been-there-done-that with all of this. :)


-C

--
Craig Latta
improvisational musical informaticist
www.netjam.org
Smalltalkers do: [:it | All with: Class, (And love: it)]



Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] re: The solution of

Igor Stasenko
In reply to this post by timrowledge
2008/8/8 tim Rowledge <[hidden email]>:

>
> On 7-Aug-08, at 11:21 AM, Igor Stasenko wrote:
>>
>>
>> Maybe i was not precise (sorry for my bad English).
>> SystemTracer alone doesn't provide any sophisticated means how to
>> terminate a subgraph by replacing edges to something different,
>> neither any criteria upon which edges can be replaced/removed etc.
>> I mean, this is completely up to you - what objects will/can be placed
>> in swapMap.
>>
> It gives you complete and total control over what goes into the wordarray
> that will be written out as an image, not just what gets swapped or clamped.
> Making a variant tracer that read a spec from XML (or whatever) and created
> objects in the 'new OM' is entirely possible. The hardest part (from my
> point of view) would be reading the xml and understanding it. Oh, and
> designing the entire spec of an image in XML would be kinda amusing too.
>
No XML please.  :)
Few lines of smalltalk code can do literally same as few megabytes of XML spec.

> Much more sensible would be creating some tools in a decent language
> (Squeak, duh) to allow us to define a class graph for the new image along
> with specs for whole it all gets written out. Since the new objects would
> not need to execute anything in the 'old' image there would be no problem
> with compatibility. Then you create a script that writes out suitable
> instances of the essential objects for the new image; you do not need to
> have ever created them in the old image, though it may well be simpler to do
> so in most cases.
>
> You could create an image with a totally different object format, image
> layout, class tree, bytecode set, etc this way. And of course you could
> modify the simulation code so that you could run it all before ever
> compiling a 'real VM. That's what it is all there for.
>

Very good. Is it available somewhere (SystemTracer, not SystemTracer2)
so i can download it as separate package?

As you may guess, i'm not interesting in mutating object formats or
bytecodes or whatever, but to define a small subset of image (either
by creating a brand new objects or by reusing already existing
objects) to be transferred into new image & run within new Hydra
thread.

In this regard, the most interesting to me - mentioned 'clamping'
techniques seem completely wiped out from SystemTracer2.

> tim
> --
> tim Rowledge; [hidden email]; http://www.rowledge.org/tim
> Useful random insult:- His head whistles in a cross wind.
>
>
>
>



--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Re: The solution of

Igor Stasenko
In reply to this post by ccrraaiigg
2008/8/8 Craig Latta <[hidden email]>:

>
>> > > ...SystemTracer [doesn't give us a way to] truncate unwanted stuff
>> > > from the current image to produce a new, smaller one.
>> >
>> > Yes, it does. It's called "clamping". See the class comment for
>> > SystemTracer. :)
>>
>> I have a SystemTracer2, which comment reads... [no mention of
>> clamping]
>
>     I was referring to the class comment for SystemTracer (in, for example,
> Squeak 3.2). In particular, it says "The tracer has built-in support for
> clamping unwanted (or unneeded) objects out of the system."
>
>     More importantly, Tim has used it extensively and been-there-done-that
> with all of this. :)
>

Tim, could you please pick some books from dusty shelves for me? ;)

If you have freely available sources & samples, which could be useful,
please let me know.



--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

[squeak-dev] SystemTracer (Was: The solution of (Was: Creating an image from first principles))

David T. Lewis
In reply to this post by timrowledge
On Wed, Aug 06, 2008 at 10:43:08AM -0700, tim Rowledge wrote:
>
> We've had this for decades. It's called the SystemTracer. It's way  
> more flexible than a primitive. I (amongst others) have performed Acts  
> Of Deep Magick with the tracer other the years. All it takes is a  
> twisty mind and some patience.

I'm not sure that the SystemTracer is in a very good state of health:

        http://bugs.squeak.org/view.php?id=5240

One act of magic that I'd like to be able to perform is to retrace a
64-bit image, since the original 64-bit image no longer works with the
current VM code base.

Dave


Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Re: The solution of

David T. Lewis
In reply to this post by Igor Stasenko
On Fri, Aug 08, 2008 at 03:37:39AM +0300, Igor Stasenko wrote:

> 2008/8/8 Craig Latta <[hidden email]>:
> >
> >     More importantly, Tim has used it extensively and been-there-done-that
> > with all of this. :)
>
> Tim, could you please pick some books from dusty shelves for me? ;)
>
> If you have freely available sources & samples, which could be useful,
> please let me know.
>

Not related to the "clamping" discussion, but a description of the conversion
of a Squeak 32-bit object memory to 64-bit object memory is at:
        http://squeakvm.org/squeak64/

The SystemTracer64 sources are provided (although unfortunately not functional
on little-endian machines).

Dave
 

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] re: The solution of

Igor Stasenko
In reply to this post by Igor Stasenko
2008/8/8 Igor Stasenko <[hidden email]>:

> 2008/8/8 tim Rowledge <[hidden email]>:
>>
>> On 7-Aug-08, at 11:21 AM, Igor Stasenko wrote:
>>>
>>>
>>> Maybe i was not precise (sorry for my bad English).
>>> SystemTracer alone doesn't provide any sophisticated means how to
>>> terminate a subgraph by replacing edges to something different,
>>> neither any criteria upon which edges can be replaced/removed etc.
>>> I mean, this is completely up to you - what objects will/can be placed
>>> in swapMap.
>>>
>> It gives you complete and total control over what goes into the wordarray
>> that will be written out as an image, not just what gets swapped or clamped.
>> Making a variant tracer that read a spec from XML (or whatever) and created
>> objects in the 'new OM' is entirely possible. The hardest part (from my
>> point of view) would be reading the xml and understanding it. Oh, and
>> designing the entire spec of an image in XML would be kinda amusing too.
>>
> No XML please.  :)
> Few lines of smalltalk code can do literally same as few megabytes of XML spec.
>
>> Much more sensible would be creating some tools in a decent language
>> (Squeak, duh) to allow us to define a class graph for the new image along
>> with specs for whole it all gets written out. Since the new objects would
>> not need to execute anything in the 'old' image there would be no problem
>> with compatibility. Then you create a script that writes out suitable
>> instances of the essential objects for the new image; you do not need to
>> have ever created them in the old image, though it may well be simpler to do
>> so in most cases.
>>
>> You could create an image with a totally different object format, image
>> layout, class tree, bytecode set, etc this way. And of course you could
>> modify the simulation code so that you could run it all before ever
>> compiling a 'real VM. That's what it is all there for.
>>
>
> Very good. Is it available somewhere (SystemTracer, not SystemTracer2)
> so i can download it as separate package?
>
> As you may guess, i'm not interesting in mutating object formats or
> bytecodes or whatever, but to define a small subset of image (either
> by creating a brand new objects or by reusing already existing
> objects) to be transferred into new image & run within new Hydra
> thread.
>
> In this regard, the most interesting to me - mentioned 'clamping'
> techniques seem completely wiped out from SystemTracer2.
>

Update:

i took a look on SystemTracer in squeak 3.2 image.
Things is not much different comparing to SystemTracer2 : what is
called 'clamping' in SytemTracer is literally same what is called
swapMap in SystemTracer2 - there are same thechnique behind it:
replace one oop with another during tracing.

This is not something, which gives an 'exceptional' boost for
producing smaller images - its just a most basic functionality.
Still, for the rest of things - i'm on my own :)


--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] The solution of (Was: Creating an image from first principles)

K. K. Subramaniam
In reply to this post by timrowledge
On Friday 08 Aug 2008 5:21:45 am tim Rowledge wrote:
> On 7-Aug-08, at 10:25 AM, K. K. Subramaniam wrote:
> > SystemTracer is a Smalltalk utility. So it does not qualify as a
> > transmutation
> > tool.
>
> What? Don't be silly.
No. I am dead serious. I am curious about what does it take for a
non-smalltalk system to self host a Smalltalk environment? If there is
already a Smalltalk environment then the question doesn't arise at all.

> >> Why waste time using crappy tools...
> >
> > Mmm.. Why do the tools and utilities required to build a VM, garbage
> > collector, primitives and plugins suddenly become "crappy" when
> > building an
> > initial image?
>
> They don't. They're crappy to begin with. I've spent decades fighting
> with C compilers and debuggers etc etc etc and anyone that claims
> they're good is clearly either totally inexperienced with using them
> or deluded.
Different strokes for different folks, I suppose. Back to the main query -
what is so mysterious ;-) in a image that can't be captured in an imperative
environment?

Subbu

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] The solution of (Was: Creating an image from first principles)

Igor Stasenko
2008/8/8 K. K. Subramaniam <[hidden email]>:

> On Friday 08 Aug 2008 5:21:45 am tim Rowledge wrote:
>> On 7-Aug-08, at 10:25 AM, K. K. Subramaniam wrote:
>> > SystemTracer is a Smalltalk utility. So it does not qualify as a
>> > transmutation
>> > tool.
>>
>> What? Don't be silly.
> No. I am dead serious. I am curious about what does it take for a
> non-smalltalk system to self host a Smalltalk environment? If there is
> already a Smalltalk environment then the question doesn't arise at all.
>
>> >> Why waste time using crappy tools...
>> >
>> > Mmm.. Why do the tools and utilities required to build a VM, garbage
>> > collector, primitives and plugins suddenly become "crappy" when
>> > building an
>> > initial image?
>>
>> They don't. They're crappy to begin with. I've spent decades fighting
>> with C compilers and debuggers etc etc etc and anyone that claims
>> they're good is clearly either totally inexperienced with using them
>> or deluded.
> Different strokes for different folks, I suppose. Back to the main query -
> what is so mysterious ;-) in a image that can't be captured in an imperative
> environment?
>

Nobody says its impossible. Its just about using right tools for doing things.

It you want to do just compile & populate objects, or translate an
already existing image to new one - its not a problem to write code in
C.
But when you want to trim already existing image with different
analysis based on reflection and introspection - doing this in C would
be really silly.

> Subbu
>

--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] The solution of (Was: Creating an image from first principles)

K. K. Subramaniam
On Friday 08 Aug 2008 7:53:47 pm Igor Stasenko wrote:
> It you want to do just compile & populate objects, or translate an
> already existing image to new one - its not a problem to write code in
> C.
> But when you want to trim already existing image with different
> analysis based on reflection and introspection - doing this in C would
> be really silly.
Well the query was in the context of generating an image from scratch - the
very first Smalltalk image.

Subbu

Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Re: The solution of

ccrraaiigg
In reply to this post by Igor Stasenko

 > ...what is called 'clamping' in SytemTracer is literally same what is
 > called swapMap in SystemTracer2 - there are same thechnique behind it:
 > replace one oop with another during tracing.

      It's also used to omit objects entirely. This is a clearly
critical feature, since you usually want to include objects created
during the trace.

      At any rate, I still claim that the hard (and interesting) part of
this problem is deciding which objects you want to put in the new image,
and you haven't addressed that at all.


-C



Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Re: The solution of

ccrraaiigg

 > > ...what is called 'clamping' in SytemTracer is literally same what
 > > is called swapMap in SystemTracer2 - there are same thechnique
 > > behind it: replace one oop with another during tracing.
 >
 > It's also used to omit objects entirely. This is a clearly critical
 > feature, since you usually want to include objects created during the
 > trace.

      Er, *exclude*. :)


-C



Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Re: The solution of (Was: Creating an image from first principles)

ccrraaiigg
In reply to this post by K. K. Subramaniam

 > what is so mysterious ;-) in a image that can't be captured in an
 > imperative environment?

      Nothing. (And I think you meant "declarative".)

      We're haggling over a matter of motivation at this point.


-C




Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Re: The solution of

Igor Stasenko
In reply to this post by ccrraaiigg
2008/8/8 Craig Latta <[hidden email]>:

>
>> ...what is called 'clamping' in SytemTracer is literally same what is
>> called swapMap in SystemTracer2 - there are same thechnique behind it:
>> replace one oop with another during tracing.
>
>     It's also used to omit objects entirely. This is a clearly critical
> feature, since you usually want to include objects created during the trace.
>
>     At any rate, I still claim that the hard (and interesting) part of this
> problem is deciding which objects you want to put in the new image, and you
> haven't addressed that at all.
>

Right.
I'm currently tracing an objects to create an image with a single
idleProcess loop.

>
> -C
>
>
>
>



--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Re: The solution of (Was: Creating an image from first principles)

K. K. Subramaniam
In reply to this post by ccrraaiigg
On Friday 08 Aug 2008 10:55:11 pm Craig Latta wrote:
>  > what is so mysterious ;-) in a image that can't be captured in an
>  > imperative environment?
>
>       Nothing. (And I think you meant "declarative".)
>
>       We're haggling over a matter of motivation at this point
I can understand why someone may not wish to go so far into the past that they
cross the point of singularity (when the first image came into existence).
But the knowledge about how to create the primordial soup should not be lost
into oblivion. SystemTracer can be a source but should not be the only
source.

Smalltalk is compact (and powerful) because of consistent and repeated
applications of few powerful patterns; just like Nature. My interest got
piqued because if the primal image is so complex that it requires jiggery
pokery perhaps it is time to apply Occam's razor to it. Transmutation (aka
bootstrapping) from one type of system into Smalltalk should not be so
complex that SystemTracer remains only source of information even after nine
years. A google count of 492 after nine years of SystemTracer is
disconcerting. What patters have we missed out here?

BTW, I meant imperative *environments* (OS platforms like Linux, Unix or
Windows). The image itself can be declarative.

Subbu

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Re: The solution of (Was: Creating an image from first principles)

Tony Garnock-Jones-2
Hi,

K. K. Subramaniam wrote:
> My interest got
> piqued because if the primal image is so complex that it requires jiggery
> pokery perhaps it is time to apply Occam's razor to it. Transmutation (aka
> bootstrapping) from one type of system into Smalltalk should not be so
> complex that SystemTracer remains only source of information even after nine
> years.

Have a look at the bootstrapping process for Slate, starting perhaps
with http://slate.tunes.org/repos/stable/src/mobius/vm/bootstrap.slate.
The fact that the program is written in Slate does not detract from what
the program does, which is (if I remember rightly!) to build and
serialise a model of an image that does not rely on any characteristics
of the host language.

(Compare approaches to implementing call/return in simple interpreters:
you can use the host language's support for call and return, by
recursing into your evaluator in the host language, or you can reify the
stack, and so avoid requiring the host language to even have call/return
semantics. Similarly, Slate reifies the image being constructed, so
doesn't depend on being image-based itself.)

(Also, I had a go at the same thing myself: See the definition of
(bootstrap-image!) in
http://www.eighty-twenty.org/~tonyg/Darcs/smalltalk-tng/r1/kernel.scm.
This is a Scheme system implementing an image-based Slate-like language.)

Regards,
   Tony

123