From 10788166e7e568fdcd0b748e8d5dab442dcdc7ef Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Thu, 17 Nov 2022 15:57:11 -0800 Subject: Differentiate T_OBJECT shapes from other objects We would like to differentiate types of objects via their shape. This commit adds a special T_OBJECT shape when we allocate an instance of T_OBJECT. This allows us to avoid testing whether an object is an instance of a T_OBJECT or not, we can just check the shape. --- shape.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'shape.h') diff --git a/shape.h b/shape.h index a2cbd7c482..9bbc5d35f9 100644 --- a/shape.h +++ b/shape.h @@ -42,7 +42,7 @@ typedef uint16_t shape_id_t; # define ROOT_SHAPE_ID 0x0 // We use SIZE_POOL_COUNT number of shape IDs for transitions out of different size pools // The next available shapd ID will be the SPECIAL_CONST_SHAPE_ID -# define SPECIAL_CONST_SHAPE_ID SIZE_POOL_COUNT +# define SPECIAL_CONST_SHAPE_ID (SIZE_POOL_COUNT * 2) struct rb_shape { struct rb_id_table * edges; // id_table from ID (ivar) to next shape @@ -63,6 +63,7 @@ enum shape_type { SHAPE_CAPACITY_CHANGE, SHAPE_IVAR_UNDEF, SHAPE_INITIAL_CAPACITY, + SHAPE_T_OBJECT, }; #if SHAPE_IN_BASIC_FLAGS -- cgit v1.2.1