2009-12-27

pointer-based vs open inheritance

8.27: adda/oop/efficiency:
. how much efficiency would be lost by
referring to all obj's by pointer?
. doing this would allow there to be
separate address spaces for diff'nt native types,
avoiding the wasted space due to allignment constraints;
. the pointer could be small
because there are only a few places it could point to:
{which heap in {main, sub, subsub}};
and, which type in {float, int, ?} .
. depending on how small the pointer was,
it might be possible to use the spare space
to hold the obj's type.tag;
ie, one 32-bit word could hold
both the pointer and the tag .
[12.19:
. in the typical oop impl',
all obj's are pointers to some heap-based obj'
so then the type'mgt can fully control
not only the organization of the obj'
but also how much size it takes up
per instantiation or time point .
. given that the typical pointer is 32-bits,
this freedom is not cheap .
. but the typical oop system is interested in
not just polymorphic types but also inheritance .
. this is in contrast to the case I'm most interested in
called type clustering:
an example is the type.class Number,
which includes the subclasses:
Reals, Quotients, Integers, Complex, Irrationals .
. Number is an abstract class that has complete control over
what it's list of subclasses are .
. this can keep the type.tag size managable,
and it means Number can decide
whether the use of pointers would be space-efficient .
]

No comments:

Post a Comment