Self implementation details
milan_va at seznam.cz
Thu Oct 5 13:44:24 UTC 2006
I'm designing a network protocol where I need to serialize objects, and I'm trying to use some Self ideas.
I've been studying the memory representation of objects and I can understand almost everything, except for the "virtual function pointer", the fourth word of a map. What does it do, and how does it look? (I guess it's an array of pointers to native functions, but I don't know what they do).
Another question is how the Literal array of Bytecode object looks like? Is it an array of SmallInts/tagged pointers? How are the closures implemented and where are they stored?
And why is there only one literal array? I think it serves two functions, a) method names, and b) literals. No element can serve both functions. So splitting it into two arrays would save some INDEX-EXTENSION opcodes, while requiring some contant overhead. Am I right, and have the designers decided that it's better the current way?
Also, how is the Bytecode array of Bytecode object ended? Is there a length field somewhere, and when all the bytecodes are interpreted, the top of the current stack is pushed into the caller's stack?
Thanks for any tips. I couldn't find these things in Sun's documentation and I'm not quite able to face the Self source code...
More information about the Self-interest