At 9:19 PM +0100 2/26/04, Leopold Toetsch wrote:
Dan Sugalski <[EMAIL PROTECTED]> wrote:
At 6:22 PM +0100 2/26/04, Leopold Toetsch wrote:
- classoffset and attribute offsets of subclassed objects, e.g.
   how to get at the very first attribute

 Which very first attribute? The first attribute for a class, or the
 first attribute in the object?

Object of course:

Ah, OK. You don't.


The opcode is:

classoffset Ioffs, PObject, Sclass

I/the compiler wants an offset to be able to set/get attributes for that
object. But what shall go into "Sclass". The objects class, the parent,
which parent ...
And does the compiler know all parents?

The compiler doesn't have to know anything about the parents. All it knows about is the current class, the one it's compiling the method its' working on into. That's the class that goes in the Sclass slot.


Attribute offsets are adjacent (currrently 2+ ...). Can a compiler emit
just offsets from Ioffs .. Ioffs+n_attribs - 1, like in the mentioned
test?

Yes. The assumption is that the compiler will track which attributes were emitted for a class, and in which order.


Are there rules if a parent class attribs comes first/last?

Nope. They can go in any order, though currently all the parent classes come first to make adding attributes easier. We're not promising that.


If not: Getting all the offsets for object and parents needs currently
and instantiation of the parents just to query the offset.

There's no reason that anything outside the Evil Core Object Code should have to know anything about the structure of an object, or its internal layouts.


The rule is that a method in a class has access to the attributes for that class and nothing else. We're not enforcing that rule at the low level, but compilers should never emit code for a method that has any knowledge of attributes outside the class the method is compiled into.

This signature:

classoffset Ioffs, PObject, Pclass

would probably be better for that case - or generally for speed reasons.

Maybe, but not by much. Within a method the class offset should be fetched only once. I'm not sure there's much of a speed win there since you still have to fetch the PMC for the class. I suppose it's in a slot in the object, though, so it's pretty quick.


It can go in if you want, or hold off for 0.1.1. Your call.

And eventually

s/classoffset/atribute_offset/

Well... I suppose. Class_attribute_offset really. I think we'll stick with classoffset for now, though.
--
Dan


--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to