Thoughts about composition of different object properties

2 views
Skip to first unread message

Igor Stasenko

unread,
Apr 24, 2009, 12:48:03 AM4/24/09
to Moebius project discussion
If you remember, each vtable (or smalltalk class) in moebius having a
special slot, named fixedMethodTable,
which responsible from holding a different methods, which can be used
directly, w/o lookups.
These methods serve as a bridge between early-bound world to late-bound world.

I think i now come to more complete understanding of role for such
bridge and how to define a set of object format(s) and be able to play
with them w/o much hassle.

So, instead of having a 'fixed methods' and well-known Squeak's class
'format' ivar, which defining an object format in cryptic manner ,
with bit fields etc, it will be replaced by special object which i
called 'species'.

These objects will hold methods and state which will answer how to get
to different objects contents.
Here the class hierarchy:
CVObjectSpecies
CVNamedVariableSpecie
CVVariableSpecie
CVByteVariableSpecie
CVOopVariableSpecie
CVWordVariableSpecie
(more can be added later).

Now, each class will hold own reference to its specie, and compiler
will use them to determine different object's properties at compile
time, as well as at run time.

For instance,
Object>>instVarAt: index
implementation will look like:

^ self class specie instVarOf: self at: index

an interesting outcome of such implementation, that if you create a
class which having no instance variables (having specie == instance
of CVObjectSpecies)
you will get DNU error, because CVObjectSpecies knows nothing about
instance variables. Similar happens for variable classes.

P.S. It is really looks like a mixin i.e.
Array class == ArrayedCollection class + Variable Oop mixin
ByteArray class == ArrayedCollection class + Variable Byte mixin

so, maybe it would be better to make variable specie to be a direct
subclass of generic specie. I'm not sure about it.
The problem here, that if you cross-breed variable + named, you have
to be careful, to keep object format with class inheritance to make
sure that methods which accessing specific slots (be it named slots or
indexable) will do it correctly regardless of how many subclasses you
define.

--
Best regards,
Igor Stasenko AKA sig.

Igor Stasenko

unread,
Apr 26, 2009, 5:22:23 PM4/26/09
to Moebius project discussion
I rewrote a bootstrapping procedure to MachineSimulator to use object species.
Now it is much more cleaner, than before and it can easily replicate
any generic Squeak object in to Moebius object memory.
Also, what makes species extremely useful, that their behavior is
invariant in any environment.
So, i can use them not only for defining oops from scratch during
bootstrap, but also poke in oops when running simulation in Squeak, as
well as running in Moebius.
A specie, like CVFixedSlotsSpecie defining a way to access to object
instance variable:

setFixedSlotOf: oop at: index to: value
(self fixedSlotInOop: oop at: index) writeWord: value

this method can be inlined by compiler at compile time to produce a
code, which sets an instance variable.
Same goes for other things, like setting oop's header, class etc.

Alejandro F. Reimondo

unread,
Apr 27, 2009, 1:59:31 AM4/27/09
to moebius-proje...@googlegroups.com
Hi Igor,
Thanks for the details about your advances.
Reading your email make me happy and wanted to see
some sources to compile and make it run.
I visited the project page in gooooogle at
http://code.google.com/p/moebius-st/
but there is no source published in the svn trunk
Can you or anyone involved in the project upload sources
to apply the license? (it is like a joke for me to
read the code license terms promoting open source
virtues of empty sources :-)
thanks in advance and congratulations for your results,
Ale.

Igor Stasenko

unread,
Apr 27, 2009, 2:37:45 AM4/27/09
to moebius-proje...@googlegroups.com
2009/4/27 Alejandro F. Reimondo <aleRe...@smalltalking.net>:
>
> Hi Igor,
> Thanks for the details about your advances.
> Reading your email make me happy and wanted to see
>  some sources to compile and make it run.
> I visited the project page in gooooogle at
>    http://code.google.com/p/moebius-st/
> but there is no source published in the svn trunk
> Can you or anyone involved in the project upload sources
>  to apply the license? (it is like a joke for me to
>  read the code license terms promoting open source
>  virtues of empty sources :-)
> thanks in advance and congratulations for your results,
> Ale.
>

Thanks for keeping an eye on Moebius, Alejandro. :)
The things which i speaking about is currently residing only on my PC.
But sources, of course , is available on SqS, and as soon as i
consider i passed the next milestone i will make it available
publicly.
http://www.squeaksource.com/CorruptVM
(sorry, i'm too lazy to rename repository, as well as package name :)

In the package, you'll find a new implementation of Parser & tests for it.
Take note: The parser is functional, but its protocol is not fully
stabilized. What we determined clearly in new parser design is two
things with distiguished roles:
- parser should speak with environment (to get details about non-local
variables and other environment-relared stuff)
- parser should speak with requestor to notify it about syntax errors etc.
(see notes at http://code.google.com/p/moebius-st/wiki/Parser)

The rest parts of code is still under 'hacking' stage. If you maybe
know, once i got the bootstrapping procedure working & were able to
simulate running the code.
But now this stuff is severly broken, because i exploring an
alternative ways/introducing different stuff to simplify the native
code generation and to make overall compiler model more simpler and
comprehensive.

P.S. 2 All: I would really appreciate if you take part in discussion ,
your vision , how to fill the gap between a) source text and b)
machine code without much pain :)
Reply all
Reply to author
Forward
0 new messages