diff options
Diffstat (limited to 'vm/oo/Object.h')
-rw-r--r-- | vm/oo/Object.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/vm/oo/Object.h b/vm/oo/Object.h index b8236db66..3e724f41e 100644 --- a/vm/oo/Object.h +++ b/vm/oo/Object.h @@ -173,6 +173,34 @@ typedef enum PrimitiveType { #define PRIM_TYPE_TO_LETTER "ZCFDBSIJV" /* must match order in enum */ /* + * Definitions for packing refOffsets in ClassObject. + */ +/* + * A magic value for refOffsets. Ignore the bits and walk the super + * chain when this is the value. + * [This is an unlikely "natural" value, since it would be 30 non-ref instance + * fields followed by 2 ref instance fields.] + */ +#define CLASS_WALK_SUPER ((unsigned int)(3)) +#define CLASS_SMALLEST_OFFSET (sizeof(struct Object)) +#define CLASS_BITS_PER_WORD (sizeof(unsigned long int) * 8) +#define CLASS_OFFSET_ALIGNMENT 4 +#define CLASS_HIGH_BIT ((unsigned int)1 << (CLASS_BITS_PER_WORD - 1)) +/* + * Return a single bit, or zero if the encoding can't encode the offset. + */ +#define CLASS_BIT_FROM_OFFSET(byteOffset) \ + (CLASS_HIGH_BIT >> \ + (((unsigned int)(byteOffset) - CLASS_SMALLEST_OFFSET) / \ + CLASS_OFFSET_ALIGNMENT)) +/* + * Return an offset, given a bit number as returned from CLZ. + */ +#define CLASS_OFFSET_FROM_CLZ(rshift) \ + (((int)(rshift) * CLASS_OFFSET_ALIGNMENT) + CLASS_SMALLEST_OFFSET) + + +/* * Used for iftable in ClassObject. */ typedef struct InterfaceEntry { @@ -423,6 +451,9 @@ struct ClassObject { int ifieldRefCount; // number of fields that are object refs InstField* ifields; + /* bitmap of offsets of ifields */ + u4 refOffsets; + /* source file name, if known */ const char* sourceFile; }; |