true/false defined where?

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

true/false defined where?

SeanTAllen
where do true and false spring into existence?

i've been poking around and cant figure it out.

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: true/false defined where?

Derek O'Connell-2
Have a look in Kernel-Objects

On Tue, Aug 5, 2008 at 1:48 PM, Sean Allen <[hidden email]> wrote:
> where do true and false spring into existence?
>
> i've been poking around and cant figure it out.
>
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: true/false defined where?

Michael Rueger-6
In reply to this post by SeanTAllen
Sean Allen wrote:
> where do true and false spring into existence?

They have been around longer than some people on this mailing list ;-)

> i've been poking around and cant figure it out.


true and false and some of the very few objects known to the VM and they
where instantiated when the parent of all current images was created.
All images are basically cloned and not re-created from source, and
that's why you don't see any initialization code for them, they just "are".

Hope this doesn't add to any confusion...

Michael
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: true/false defined where?

SeanTAllen

On Aug 5, 2008, at 8:54 AM, Michael Rueger wrote:

> Sean Allen wrote:
>> where do true and false spring into existence?
>
> They have been around longer than some people on this mailing list ;-)
>
>> i've been poking around and cant figure it out.
>
>
> true and false and some of the very few objects known to the VM and  
> they where instantiated when the parent of all current images was  
> created.
> All images are basically cloned and not re-created from source, and  
> that's why you don't see any initialization code for them, they just  
> "are".
>
> Hope this doesn't add to any confusion...

How is this for a confusing answer... it both does and doesnt.

I have a feeling the secret to unraveling that confusion comes from  
this:

'true and false and some of the very few objects known to the VM'

does that mean that I can't go and find these variables anywhere? that  
they arent true
global variables they are some sort of special global?

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: true/false defined where?

Randal L. Schwartz
>>>>> "Sean" == Sean Allen <[hidden email]> writes:

Sean> I have a feeling the secret to unraveling that confusion comes from  this:

Sean> 'true and false and some of the very few objects known to the VM'

Sean> does that mean that I can't go and find these variables anywhere? that
Sean> they arent true global variables they are some sort of special global?

If you explore "Smalltalk specialObjectsArray", you'll see a special list of
variables that both the VM and the Smalltalk code have to agree on in order to
run.  For example, if a primitive wants to return "false", it has to
know what the rest of the Smalltalk image considers the sole instance
of the "False" class.

These items are established in
"SystemDictionary>>#recreateSpecialObjectsArray", the first version of which
had to be executed essentially "by hand" on the first VM (either the early
versions of Smalltalk 76 or 80).  Since then, this special array has gotten
its initial values by running it in an already running system, so the first
few entries there (nil, false, true) are in fact clones of clones of clones of
the original handcrafted objects.  Of course, there's code on the VM side that
knows the precise order of this magical array, and this is what allows them to
communicate, so you can't just add new things here or change the ordering
without building a corresponding new VM.

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[hidden email]> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: true/false defined where?

SeanTAllen

On Aug 5, 2008, at 10:52 AM, Randal L. Schwartz wrote:

>>>>>> "Sean" == Sean Allen <[hidden email]> writes:
>
> Sean> I have a feeling the secret to unraveling that confusion comes  
> from  this:
>
> Sean> 'true and false and some of the very few objects known to the  
> VM'
>
> Sean> does that mean that I can't go and find these variables  
> anywhere? that
> Sean> they arent true global variables they are some sort of special  
> global?
>
> If you explore "Smalltalk specialObjectsArray", you'll see a special  
> list of
> variables that both the VM and the Smalltalk code have to agree on  
> in order to
> run.  For example, if a primitive wants to return "false", it has to
> know what the rest of the Smalltalk image considers the sole instance
> of the "False" class.
>
> These items are established in
> "SystemDictionary>>#recreateSpecialObjectsArray", the first version  
> of which
> had to be executed essentially "by hand" on the first VM (either the  
> early
> versions of Smalltalk 76 or 80).  Since then, this special array has  
> gotten
> its initial values by running it in an already running system, so  
> the first
> few entries there (nil, false, true) are in fact clones of clones of  
> clones of
> the original handcrafted objects.  Of course, there's code on the VM  
> side that
> knows the precise order of this magical array, and this is what  
> allows them to
> communicate, so you can't just add new things here or change the  
> ordering
> without building a corresponding new VM.

Thanks for the pointer of where to explore and the background info.
In a couple days when I've had time to review and digest hopefully it  
will all make sense.

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: true/false defined where?

K. K. Subramaniam
In reply to this post by SeanTAllen
On Tuesday 05 Aug 2008 6:39:01 pm Sean Allen wrote:
> I have a feeling the secret to unraveling that confusion comes from
> this:
>
> 'true and false and some of the very few objects known to the VM'
An object in Squeak contains between two to three header words (object
descriptor, class and size). Some objects which are required to bootstrap an
image into existence or which are frequently exchanged between VM and image
are held in a array and its index is packed into the descriptor word itself
leading to a compact one-word header.
e.g.
   oop -> the object whose class is number 5 size 4 words
instead of
   oop -> the object whose class is at 0x3058587474 size 4 words

When the VM encounters an object descriptor of the first type, it will look up
the class number in the global variable, specialObjectsArray to extract the
class pointer. The number and order of elements in this array has to be
finalized at the time of compiling VM code. This explains the "objects known
to the VM" part. If the number or order of indexed objects are changed in
Image, a new VM has to be compiled with these changes.

How does the VM know where to find specialObjectsArray? from the header in the
image file (fifth 32-bit slot).

Subbu
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners