supporting fixed type size specification for a nonpointer variable object like class(#byte(30))). work still in progress
This commit is contained in:
@ -134,8 +134,8 @@
|
||||
* For example, on a platform where sizeof(moo_oow_t) is 4,
|
||||
* the layout of the spec field of a class as an OOP value looks like this:
|
||||
*
|
||||
* 31 10 9 8 7 6 5 4 3 2 1 0
|
||||
* |number of named instance variables|indexed-type|indexability|oop-tag|
|
||||
* 31 11 10 9 8 7 6 5 4 3 2 1 0
|
||||
* |number of named instance variables|indexed-type|flags|oop-tag|
|
||||
*
|
||||
* the number of named instance variables is stored in high 23 bits.
|
||||
* the indexed type takes up bit 3 to bit 8 (assuming MOO_OBJ_TYPE_BITS is 6.
|
||||
@ -143,7 +143,7 @@
|
||||
* and the indexability is stored in bit 2.
|
||||
*
|
||||
* The maximum number of named(fixed) instance variables for a class is:
|
||||
* 2 ^ ((BITS-IN-OOW - MOO_OOP_TAG_BITS_LO) - MOO_OBJ_TYPE_BITS - 1) - 1
|
||||
* 2 ^ ((BITS-IN-OOW - MOO_OOP_TAG_BITS_LO) - MOO_OBJ_TYPE_BITS - 1 - 2) - 1
|
||||
*
|
||||
* MOO_OOP_TAG_BITS_LO are decremented from the number of bits in OOW because
|
||||
* the spec field is always encoded as a small integer.
|
||||
@ -187,11 +187,9 @@
|
||||
#define MOO_CLASS_SPEC_IS_IMMUTABLE(spec) (MOO_CLASS_SPEC_FLAGS(spec) & MOO_CLASS_SPEC_FLAG_IMMUTABLE)
|
||||
|
||||
/* What is the maximum number of named instance variables?
|
||||
* This limit is set so because the number must be encoded into the spec field
|
||||
* of the class with limited number of bits assigned to the number of
|
||||
* named instance variables. the trailing -1 in the calculation of number of
|
||||
* bits is to consider the sign bit of a small-integer which is a typical
|
||||
* type of the spec field in the class object.
|
||||
* This limit is set this way because the number must be encoded into
|
||||
* the spec field of the class with limited number of bits assigned to
|
||||
* the number of named instance variables.
|
||||
*/
|
||||
#define MOO_MAX_NAMED_INSTVARS \
|
||||
MOO_BITS_MAX(moo_oow_t, MOO_SMOOI_ABS_BITS - (MOO_OBJ_FLAGS_TYPE_BITS + 2))
|
||||
@ -515,6 +513,7 @@ struct moo_compiler_t
|
||||
{
|
||||
int flags;
|
||||
int indexed_type;
|
||||
moo_oow_t type_size; /* fixed type size */
|
||||
|
||||
moo_oop_class_t self_oop;
|
||||
moo_oop_t super_oop; /* this may be nil. so the type is moo_oop_t */
|
||||
|
Reference in New Issue
Block a user