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 /rjit_c.rb | |
parent | e5d97308f646dc5702ebab3c8d1b6383aaf4ad94 (diff) | |
download | ruby-e3afc212ec059525fe4e5387b2a3be920ffe0f0e.tar.gz |
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 'rjit_c.rb')
-rw-r--r-- | rjit_c.rb | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -898,7 +898,7 @@ module RubyVM::RJIT # :nodoc: all end def C.attr_index_t - @attr_index_t ||= CType::Immediate.parse("uint32_t") + @attr_index_t ||= CType::Immediate.parse("uint8_t") end def C.iseq_inline_constant_cache @@ -1479,7 +1479,7 @@ module RubyVM::RJIT # :nodoc: all edges: [CType::Pointer.new { self.rb_id_table }, Primitive.cexpr!("OFFSETOF((*((struct rb_shape *)NULL)), edges)")], edge_name: [self.ID, Primitive.cexpr!("OFFSETOF((*((struct rb_shape *)NULL)), edge_name)")], next_iv_index: [self.attr_index_t, Primitive.cexpr!("OFFSETOF((*((struct rb_shape *)NULL)), next_iv_index)")], - capacity: [CType::Immediate.parse("uint32_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_shape *)NULL)), capacity)")], + capacity: [self.attr_index_t, Primitive.cexpr!("OFFSETOF((*((struct rb_shape *)NULL)), capacity)")], type: [CType::Immediate.parse("uint8_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_shape *)NULL)), type)")], size_pool_index: [CType::Immediate.parse("uint8_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_shape *)NULL)), size_pool_index)")], parent_id: [self.shape_id_t, Primitive.cexpr!("OFFSETOF((*((struct rb_shape *)NULL)), parent_id)")], |