aboutsummaryrefslogtreecommitdiffstats
path: root/rjit_c.rb
diff options
context:
space:
mode:
authorJean Boussier <byroot@ruby-lang.org>2023-10-10 22:17:30 +0200
committerJean Boussier <jean.boussier@gmail.com>2023-10-11 08:33:09 +0200
commite3afc212ec059525fe4e5387b2a3be920ffe0f0e (patch)
treecf315265d2a60f91186ea4c455ec3a2504ebd79e /rjit_c.rb
parente5d97308f646dc5702ebab3c8d1b6383aaf4ad94 (diff)
downloadruby-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.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/rjit_c.rb b/rjit_c.rb
index 72e8221cbc..5a4c2446a6 100644
--- a/rjit_c.rb
+++ b/rjit_c.rb
@@ -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)")],