diff options
author | Jean Boussier <byroot@ruby-lang.org> | 2023-10-10 22:17:30 +0200 |
---|---|---|
committer | Jean Boussier <jean.boussier@gmail.com> | 2023-10-11 08:33:09 +0200 |
commit | e3afc212ec059525fe4e5387b2a3be920ffe0f0e (patch) | |
tree | cf315265d2a60f91186ea4c455ec3a2504ebd79e /shape.h | |
parent | e5d97308f646dc5702ebab3c8d1b6383aaf4ad94 (diff) |
shape.h: Make attr_index_t uint8_t
Given `SHAPE_MAX_NUM_IVS 80`, we transition to TOO_COMPLEX
way before we could overflow a 8bit counter.
This reduce the size of `rb_shape_t` from 32B to 24B.
If we decide to raise `SHAPE_MAX_NUM_IVS` we can always increase
that type again.
Diffstat (limited to 'shape.h')
-rw-r--r-- | shape.h | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -6,12 +6,11 @@ #if (SIZEOF_UINT64_T <= SIZEOF_VALUE) #define SIZEOF_SHAPE_T 4 #define SHAPE_IN_BASIC_FLAGS 1 -typedef uint32_t attr_index_t; #else #define SIZEOF_SHAPE_T 2 #define SHAPE_IN_BASIC_FLAGS 0 -typedef uint16_t attr_index_t; #endif +typedef uint8_t attr_index_t; #define MAX_IVARS (attr_index_t)(-1) @@ -44,7 +43,7 @@ struct rb_shape { struct rb_id_table * edges; // id_table from ID (ivar) to next shape ID edge_name; // ID (ivar) for transition from parent to rb_shape attr_index_t next_iv_index; - uint32_t capacity; // Total capacity of the object with this shape + attr_index_t capacity; // Total capacity of the object with this shape uint8_t type; uint8_t size_pool_index; shape_id_t parent_id; |