[Pharo-project] object format of true, false, nil and others...
Hi imagine that I want to bootstrap our nice kernel. I will need to somehow create a new nil, true, false, instances of new classes Undefined, True, False. Such instances will then be put on the SpecialObjectArray somehow. Now I can create a dummy object playing such roles and then use SystemTracer to substitute my placeholder with the true nil falseâ¦. or another trick to swap them. Now anybody has other ideas? Stef
Hi: On 23 Nov 2011, at 22:59, Stéphane Ducasse wrote:
imagine that I want to bootstrap our nice kernel. I will need to somehow create a new nil, true, false, instances of new classes Undefined, True, False. Such instances will then be put on the SpecialObjectArray somehow.
Something kind of related: When debugging the VM, I am happy that I always encounter the same object as the first object in the heap. It is some strange string (think it encodes an error message or so). However, my thought was, also for other purposes, would it be possible to have these special objects sorted to the beginning? Especially, the nilObj would be very handy to have as the first object. That would need special VM support to arrange it that way, but knowing the nilObj from the very beginning would allow my to initialize some of my hacks more consistently, avoiding C-level NULLs and runtime checks. Just an idea, vaguely related to the question. Would be interesting to hear whether there are any historical insights with regard to ordering objects in the image. Guess it is not done because nobody needed it. (and then there isn't really a primitive for it, and a moving GC might also be contra-productive, etc.) Best regards Stefan
Stef
-- Stefan Marr Software Languages Lab Vrije Universiteit Brussel Pleinlaan 2 / B-1050 Brussels / Belgium http://soft.vub.ac.be/~smarr Phone: +32 2 629 2974 Fax: +32 2 629 3525
To reply to the question from our pov: In Pinocchio we actually need that nil, true and false fall within the first 4gb of virtual memory space, since our native code directly addresses those objects; and AMD64 code can only use 32bits for direct addresses. This is kinda sucky since OSX thinks it's a good idea to reserve the whole first 4gb virtual address space as "null memory", to ensure they really really really capture all accidental NULL-pointer dereferences. And obviously the standard 4K isn't enough for OSX developers. Oh well, we managed to fix that with some ld flag on OSX. We do this since it gives a very slight advantage in performance, and we don't seriously expect nil, true and false to ever change. And if they do... we can still visit all code in the system and change it :) cheers, Toon On 11/23/2011 11:25 PM, Stefan Marr wrote:
Hi:
On 23 Nov 2011, at 22:59, Stéphane Ducasse wrote:
imagine that I want to bootstrap our nice kernel. I will need to somehow create a new nil, true, false, instances of new classes Undefined, True, False. Such instances will then be put on the SpecialObjectArray somehow. Something kind of related:
When debugging the VM, I am happy that I always encounter the same object as the first object in the heap. It is some strange string (think it encodes an error message or so).
However, my thought was, also for other purposes, would it be possible to have these special objects sorted to the beginning? Especially, the nilObj would be very handy to have as the first object.
That would need special VM support to arrange it that way, but knowing the nilObj from the very beginning would allow my to initialize some of my hacks more consistently, avoiding C-level NULLs and runtime checks.
Just an idea, vaguely related to the question.
Would be interesting to hear whether there are any historical insights with regard to ordering objects in the image. Guess it is not done because nobody needed it. (and then there isn't really a primitive for it, and a moving GC might also be contra-productive, etc.)
Best regards Stefan
Stef
On Nov 25, 2011, at 10:03 PM, Toon Verwaest wrote:
To reply to the question from our pov:
In Pinocchio we actually need that nil, true and false fall within the first 4gb of virtual memory space, since our native code directly addresses those objects; and AMD64 code can only use 32bits for direct addresses.
This is kinda sucky since OSX thinks it's a good idea to reserve the whole first 4gb virtual address space as "null memory", to ensure they really really really capture all accidental NULL-pointer dereferences. And obviously the standard 4K isn't enough for OSX developers. Oh well, we managed to fix that with some ld flag on OSX.
We do this since it gives a very slight advantage in performance, and we don't seriously expect nil, true and false to ever change. And if they do... we can still visit all code in the system and change it :)
right now I just need a placeholder after I imagine that the specialObjectArray and system tracer can let me specify what I want in the resulting image. And may be I could use mate explicit object format description to migrate (instead of systemTracer).
cheers, Toon
On 11/23/2011 11:25 PM, Stefan Marr wrote:
Hi:
On 23 Nov 2011, at 22:59, Stéphane Ducasse wrote:
imagine that I want to bootstrap our nice kernel. I will need to somehow create a new nil, true, false, instances of new classes Undefined, True, False. Such instances will then be put on the SpecialObjectArray somehow. Something kind of related:
When debugging the VM, I am happy that I always encounter the same object as the first object in the heap. It is some strange string (think it encodes an error message or so).
However, my thought was, also for other purposes, would it be possible to have these special objects sorted to the beginning? Especially, the nilObj would be very handy to have as the first object.
That would need special VM support to arrange it that way, but knowing the nilObj from the very beginning would allow my to initialize some of my hacks more consistently, avoiding C-level NULLs and runtime checks.
Just an idea, vaguely related to the question.
Would be interesting to hear whether there are any historical insights with regard to ordering objects in the image. Guess it is not done because nobody needed it. (and then there isn't really a primitive for it, and a moving GC might also be contra-productive, etc.)
Best regards Stefan
Stef
right now I just need a placeholder after I imagine that the specialObjectArray and system tracer can let me specify what I want in the resulting image.
yes
And may be I could use mate explicit object format description to migrate (instead of systemTracer).
what is mate? ;-) Why would you like to replace SystemTracer? is there some cons using it? Luc
cheers, Toon
On 11/23/2011 11:25 PM, Stefan Marr wrote:
Hi:
On 23 Nov 2011, at 22:59, Stéphane Ducasse wrote:
imagine that I want to bootstrap our nice kernel. I will need to somehow create a new nil, true, false, instances of new
classes Undefined, True, False.
Such instances will then be put on the SpecialObjectArray somehow. Something kind of related:
When debugging the VM, I am happy that I always encounter the same object as the first object in the heap. It is some strange string (think it encodes an error message or so).
However, my thought was, also for other purposes, would it be possible to have these special objects sorted to the beginning? Especially, the nilObj would be very handy to have as the first object.
That would need special VM support to arrange it that way, but knowing the nilObj from the very beginning would allow my to initialize some of my hacks more consistently, avoiding C-level NULLs and runtime checks.
Just an idea, vaguely related to the question.
Would be interesting to hear whether there are any historical insights with regard to ordering objects in the image. Guess it is not done because nobody needed it. (and then there isn't really a primitive for it, and a moving GC might also be contra-productive, etc.)
Best regards Stefan
Stef
On 30 November 2011 10:01, Luc Fabresse <luc.fabresse@gmail.com> wrote:
right now I just need a placeholder after I imagine that the specialObjectArray and system tracer can let me specify what I want in the resulting image.
yes
And may be I could use mate explicit object format description to migrate (instead of systemTracer).
what is mate? ;-)
a secret military project, developed in our lab using forced-labor :))))) Javier, can you tell about it?
Why would you like to replace SystemTracer? is there some cons using it?
i think it is wrong wording. Mate needs own bootstrapper, and SystemTracer won't work for it, since its for Squeak.
Luc
-- Best regards, Igor Stasenko.
The synonym, "by graduate students," requires less typing :) ________________________________________ From: pharo-project-bounces@lists.gforge.inria.fr [pharo-project-bounces@lists.gforge.inria.fr] on behalf of Igor Stasenko [siguctua@gmail.com] Sent: Wednesday, November 30, 2011 1:14 PM To: Pharo-project@lists.gforge.inria.fr Subject: Re: [Pharo-project] object format of true, false, nil and others...
what is mate? ;-)
a secret military project, developed in our lab using forced-labor :)))))
Mate is an experiment to see how to bootstrap VM representation and assembly generation. It is just the start. Now I was looking at how format is represented. Because systemTracer is doing that taking on object and either map it to another or transforming the object header. but with bitAnd: and other uglies.. With a first class object representing format and object header encoding the code would be nicer. Stef
right now I just need a placeholder after I imagine that the specialObjectArray and system tracer can let me specify what I want in the resulting image.
yes
And may be I could use mate explicit object format description to migrate (instead of systemTracer).
what is mate? ;-) Why would you like to replace SystemTracer? is there some cons using it?
Luc
cheers, Toon
On 11/23/2011 11:25 PM, Stefan Marr wrote:
Hi:
On 23 Nov 2011, at 22:59, Stéphane Ducasse wrote:
imagine that I want to bootstrap our nice kernel. I will need to somehow create a new nil, true, false, instances of new classes Undefined, True, False. Such instances will then be put on the SpecialObjectArray somehow. Something kind of related:
When debugging the VM, I am happy that I always encounter the same object as the first object in the heap. It is some strange string (think it encodes an error message or so).
However, my thought was, also for other purposes, would it be possible to have these special objects sorted to the beginning? Especially, the nilObj would be very handy to have as the first object.
That would need special VM support to arrange it that way, but knowing the nilObj from the very beginning would allow my to initialize some of my hacks more consistently, avoiding C-level NULLs and runtime checks.
Just an idea, vaguely related to the question.
Would be interesting to hear whether there are any historical insights with regard to ordering objects in the image. Guess it is not done because nobody needed it. (and then there isn't really a primitive for it, and a moving GC might also be contra-productive, etc.)
Best regards Stefan
Stef
On Wed, Nov 23, 2011 at 2:25 PM, Stefan Marr <pharo@stefan-marr.de> wrote:
Hi:
On 23 Nov 2011, at 22:59, Stéphane Ducasse wrote:
imagine that I want to bootstrap our nice kernel. I will need to somehow create a new nil, true, false, instances of new classes Undefined, True, False. Such instances will then be put on the SpecialObjectArray somehow.
Something kind of related:
When debugging the VM, I am happy that I always encounter the same object as the first object in the heap. It is some strange string (think it encodes an error message or so).
However, my thought was, also for other purposes, would it be possible to have these special objects sorted to the beginning? Especially, the nilObj would be very handy to have as the first object.
Note that Cog assumes that false and true are next to each other. You'll find in all Pharo/Squeak images that the first three objects are nil, false, true in that order. Assuming they're contiguous allows the JIT to generate more compact conditional branch code since true = false + 8, and so it only has to load one 32-bit constant and can derive the other by adding a small constant.
That would need special VM support to arrange it that way, but knowing the nilObj from the very beginning would allow my to initialize some of my hacks more consistently, avoiding C-level NULLs and runtime checks.
It's safe to assume nil comes first. One can imagine experimental contexts where one would want to become nil but the current VMs will very likely crash without some work. But why waste cycles on every run when it is so unlilkely anyone will try this?
Just an idea, vaguely related to the question.
Would be interesting to hear whether there are any historical insights with regard to ordering objects in the image. Guess it is not done because nobody needed it. (and then there isn't really a primitive for it, and a moving GC might also be contra-productive, etc.)
Best regards Stefan
Stef
-- Stefan Marr Software Languages Lab Vrije Universiteit Brussel Pleinlaan 2 / B-1050 Brussels / Belgium http://soft.vub.ac.be/~smarr Phone: +32 2 629 2974 Fax: +32 2 629 3525
-- best, Eliot
On 30 November 2011 00:17, Eliot Miranda <eliot.miranda@gmail.com> wrote:
On Wed, Nov 23, 2011 at 2:25 PM, Stefan Marr <pharo@stefan-marr.de> wrote:
Hi:
On 23 Nov 2011, at 22:59, Stéphane Ducasse wrote:
imagine that I want to bootstrap our nice kernel. I will need to somehow create a new nil, true, false, instances of new classes Undefined, True, False. Such instances will then be put on the SpecialObjectArray somehow.
Something kind of related:
When debugging the VM, I am happy that I always encounter the same object as the first object in the heap. It is some strange string (think it encodes an error message or so).
However, my thought was, also for other purposes, would it be possible to have these special objects sorted to the beginning? Especially, the nilObj would be very handy to have as the first object.
Note that Cog assumes that false and true are next to each other. Â You'll find in all Pharo/Squeak images that the first three objects are nil, false, true in that order. Â Assuming they're contiguous allows the JIT to generate more compact conditional branch code since true = false + 8, and so it only has to load one 32-bit constant and can derive the other by adding a small constant.
That would need special VM support to arrange it that way, but knowing the nilObj from the very beginning would allow my to initialize some of my hacks more consistently, avoiding C-level NULLs and runtime checks.
It's safe to assume nil comes first. Â One can imagine experimental contexts where one would want to become nil but the current VMs will very likely crash without some work. Â But why waste cycles on every run when it is so unlilkely anyone will try this?
even more, since nil, true, false are stateless singletons there is no much sense to use heap space for them. they could be identified by a simple immediate value (like non-existent address). Even if we imagine some weird experiment with objects , i doubt we will need to touch these objects at all. Because they are representing a concepts which cannot be void or replaced by something else. -- Best regards, Igor Stasenko.
We do the same for our bootstrapper. First allocate space for the objects used by the metamodel: Metaclass, Class, Behavior, Object, UndefinedObject, True, False, their instances, metaclasses, etc. Each object of its corresponding size. After that, fill the header and fields of these objects. Finally, new objects can be created by sending messages to objects in this kernel. Cheers, Javier. On Wed, Nov 23, 2011 at 10:59 PM, Stéphane Ducasse < stephane.ducasse@inria.fr> wrote:
Hi
imagine that I want to bootstrap our nice kernel. I will need to somehow create a new nil, true, false, instances of new classes Undefined, True, False. Such instances will then be put on the SpecialObjectArray somehow.
Now I can create a dummy object playing such roles and then use SystemTracer to substitute my placeholder with the true nil falseâ¦. or another trick to swap them. Now anybody has other ideas?
Stef
-- Lic. Javier Pimás Ciudad de Buenos Aires
We do the same for our bootstrapper. First allocate space for the objects used by the metamodel: Metaclass, Class, Behavior, Object, UndefinedObject, True, False, their instances, metaclasses, etc. Each object of its corresponding size.
how do you compute the size?
After that, fill the header and fields of these objects. Finally, new objects can be created by sending messages to objects in this kernel.
I was planning to do the same so I would like to see your code. Tomorrow I want to read it. Stef
Cheers, Javier.
On Wed, Nov 23, 2011 at 10:59 PM, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote: Hi
imagine that I want to bootstrap our nice kernel. I will need to somehow create a new nil, true, false, instances of new classes Undefined, True, False. Such instances will then be put on the SpecialObjectArray somehow.
Now I can create a dummy object playing such roles and then use SystemTracer to substitute my placeholder with the true nil falseâ¦. or another trick to swap them. Now anybody has other ideas?
Stef
-- Lic. Javier Pimás Ciudad de Buenos Aires
On Thu, Nov 24, 2011 at 4:58 PM, Stéphane Ducasse <stephane.ducasse@inria.fr
wrote:
We do the same for our bootstrapper. First allocate space for the objects used by the metamodel: Metaclass, Class, Behavior, Object, UndefinedObject, True, False, their instances, metaclasses, etc. Each object of its corresponding size.
how do you compute the size?
Good question. For now we still don't have a design that convinces me in this area. In some cases we calculate it manually, for example in objects without fields. In other cases we take it from the current image, this is the case of metaclass and class. In the end, it depends on which are the compact classes, and what fields you assume that some objects will have, like class and metaclass. After this kernel is bootstraped, objects are created sending new so the size is calculated from the class.
After that, fill the header and fields of these objects. Finally, new objects can be created by sending messages to objects in this kernel.
I was planning to do the same so I would like to see your code. Tomorrow I want to read it.
Stef
Cheers, Javier.
On Wed, Nov 23, 2011 at 10:59 PM, Stéphane Ducasse <
stephane.ducasse@inria.fr> wrote:
Hi
imagine that I want to bootstrap our nice kernel. I will need to somehow create a new nil, true, false, instances of new classes Undefined, True, False. Such instances will then be put on the SpecialObjectArray somehow.
Now I can create a dummy object playing such roles and then use SystemTracer to substitute my placeholder with the true nil falseâ¦. or another trick to swap them. Now anybody has other ideas?
Stef
-- Lic. Javier Pimás Ciudad de Buenos Aires
-- Lic. Javier Pimás Ciudad de Buenos Aires
On 24 November 2011 23:29, Javier Pimás <elpochodelagente@gmail.com> wrote:
On Thu, Nov 24, 2011 at 4:58 PM, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
We do the same for our bootstrapper. First allocate space for the objects used by the metamodel: Metaclass, Class, Behavior, Object, UndefinedObject, True, False, their instances, metaclasses, etc. Each object of its corresponding size.
    how do you compute the size?
Good question. For now we still don't have a design that convinces me in this area. In some cases we calculate it manually, for example in objects without fields. In other cases we take it from the current image, this is the case of metaclass and class.
but you should be able to calculate size taken from object format descriptor, don't you?
In the end, it depends on which are the compact classes, and what fields you assume that some objects will have, like class and metaclass.
After this kernel is bootstraped, objects are created sending new so the size is calculated from the class.
After that, fill the header and fields of these objects. Finally, new objects can be created by sending messages to objects in this kernel.
I was planning to do the same so I would like to see your code. Tomorrow I want to read it.
Stef
Cheers, Javier.
On Wed, Nov 23, 2011 at 10:59 PM, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote: Hi
imagine that I want to bootstrap our nice kernel. I will need to somehow create a new nil, true, false, instances of new classes Undefined, True, False. Such instances will then be put on the SpecialObjectArray somehow.
Now I can create a dummy object playing such roles and then use SystemTracer to substitute my placeholder with the true nil falseâ¦. or another trick to swap them. Now anybody has other ideas?
Stef
-- Lic. Javier Pimás Ciudad de Buenos Aires
-- Lic. Javier Pimás Ciudad de Buenos Aires
-- Best regards, Igor Stasenko.
On 11/25/2011 12:14 AM, Igor Stasenko wrote:
On 24 November 2011 23:29, Javier Pimás<elpochodelagente@gmail.com> wrote:
On Thu, Nov 24, 2011 at 4:58 PM, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
We do the same for our bootstrapper. First allocate space for the objects used by the metamodel: Metaclass, Class, Behavior, Object, UndefinedObject, True, False, their instances, metaclasses, etc. Each object of its corresponding size. how do you compute the size?
Good question. For now we still don't have a design that convinces me in this area. In some cases we calculate it manually, for example in objects without fields. In other cases we take it from the current image, this is the case of metaclass and class.
but you should be able to calculate size taken from object format descriptor, don't you? That's what we do in Pinocchio. We just ask for instSize, amongst other things... Maybe I'm missing something? :)
In the end, it depends on which are the compact classes, and what fields you assume that some objects will have, like class and metaclass.
After this kernel is bootstraped, objects are created sending new so the size is calculated from the class.
After that, fill the header and fields of these objects. Finally, new objects can be created by sending messages to objects in this kernel. I was planning to do the same so I would like to see your code. Tomorrow I want to read it.
Stef
Cheers, Javier.
On Wed, Nov 23, 2011 at 10:59 PM, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote: Hi
imagine that I want to bootstrap our nice kernel. I will need to somehow create a new nil, true, false, instances of new classes Undefined, True, False. Such instances will then be put on the SpecialObjectArray somehow.
Now I can create a dummy object playing such roles and then use SystemTracer to substitute my placeholder with the true nil falseâ¦. or another trick to swap them. Now anybody has other ideas?
Stef
-- Lic. Javier Pimás Ciudad de Buenos Aires
-- Lic. Javier Pimás Ciudad de Buenos Aires
but you should be able to calculate size taken from object format descriptor, don't you? That's what we do in Pinocchio. We just ask for instSize, amongst other things... Maybe I'm missing something? :)
right now I will start with stub to get some momentum and think after. I was reading the bootstrap of Mate and it should be close to the one of pinocchio. I'm reading also micro squeak and gst But I should bump into the walls to progress. Stef
That's what we do in Pinocchio. We just ask for instSize, amongst other things... Maybe I'm missing something? :) right now I will start with stub to get some momentum and think after. I was reading the bootstrap of Mate and it should be close to the one of pinocchio. I'm reading also micro squeak and gst But I should bump into the walls to progress.
Stef Let me know if you have specific questions I can help with... I'm not hyper-responsive (nor reading mailing lists) since working on paper and thesis, but if you mail me directly I might be able to help out with questions at least.
Toon
Thanks for now I should eat my own dog food and do it and stop talking or even thinking about it. But I'm sucked by the world around me (wife, kids, colleagues, mail, admin, I should go to an island without humans and internet). Stef On Nov 25, 2011, at 10:14 PM, Toon Verwaest wrote:
That's what we do in Pinocchio. We just ask for instSize, amongst other things... Maybe I'm missing something? :) right now I will start with stub to get some momentum and think after. I was reading the bootstrap of Mate and it should be close to the one of pinocchio. I'm reading also micro squeak and gst But I should bump into the walls to progress.
Stef Let me know if you have specific questions I can help with... I'm not hyper-responsive (nor reading mailing lists) since working on paper and thesis, but if you mail me directly I might be able to help out with questions at least.
Toon
Hi Javier, 2011/11/24 Javier Pimás <elpochodelagente@gmail.com>
We do the same for our bootstrapper.
Which boostrapper are you talking about? Thanks Luc
First allocate space for the objects used by the metamodel: Metaclass, Class, Behavior, Object, UndefinedObject, True, False, their instances, metaclasses, etc. Each object of its corresponding size. After that, fill the header and fields of these objects. Finally, new objects can be created by sending messages to objects in this kernel.
Cheers, Javier.
On Wed, Nov 23, 2011 at 10:59 PM, Stéphane Ducasse < stephane.ducasse@inria.fr> wrote:
Hi
imagine that I want to bootstrap our nice kernel. I will need to somehow create a new nil, true, false, instances of new classes Undefined, True, False. Such instances will then be put on the SpecialObjectArray somehow.
Now I can create a dummy object playing such roles and then use SystemTracer to substitute my placeholder with the true nil falseâ¦. or another trick to swap them. Now anybody has other ideas?
Stef
-- Lic. Javier Pimás Ciudad de Buenos Aires
On 23 November 2011 21:59, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
Hi
imagine that I want to bootstrap our nice kernel. I will need to somehow create a new nil, true, false, instances of new classes Undefined, True, False. Such instances will then be put on the SpecialObjectArray somehow.
Now I can create a dummy object playing such roles and then use SystemTracer to substitute my placeholder with the true nil falseâ¦. or another trick to swap them. Now anybody has other ideas?
I recall Michael van der Gulik bootstrapping his SecureSqueak a while back in a sort've "ab initio" kind of way. Maybe he can offer some insight? frank
Hi-- I'll throw in a word here for "Dissolve", a feature of Spoon. It uses an alternate version of the garbage collector to treat as garbage all methods which haven't been run since a chosen point in time. With it I created the smallest Smalltalk object memory I've seen so far (1,337 bytes). For more info, see: http://netjam.org/spoon/smallest thanks, -C -- Craig Latta www.netjam.org/resume +31 6 2757 7177 + 1 415 287 3547
participants (10)
-
Craig Latta -
Eliot Miranda -
Frank Shearar -
Igor Stasenko -
Javier Pimás -
Luc Fabresse -
Schwab,Wilhelm K -
Stefan Marr -
Stéphane Ducasse -
Toon Verwaest