diff options
author | Jemma Issroff <jemmaissroff@gmail.com> | 2022-11-08 15:35:31 -0500 |
---|---|---|
committer | Peter Zhu <peter@peterzhu.ca> | 2022-11-10 10:11:34 -0500 |
commit | 5246f4027ec574e77809845e1b1f7822cc2a5cef (patch) | |
tree | a29c972df6a589c7ab8c2541ea2eea1f7caf5f70 /yjit | |
parent | 9986697b621e5345177a1c395489dcc9fab8602b (diff) | |
download | ruby-5246f4027ec574e77809845e1b1f7822cc2a5cef.tar.gz |
Transition shape when object's capacity changes
This commit adds a `capacity` field to shapes, and adds shape
transitions whenever an object's capacity changes. Objects which are
allocated out of a bigger size pool will also make a transition from the
root shape to the shape with the correct capacity for their size pool
when they are allocated.
This commit will allow us to remove numiv from objects completely, and
will also mean we can guarantee that if two objects share shapes, their
IVs are in the same positions (an embedded and extended object cannot
share shapes). This will enable us to implement ivar sets in YJIT using
object shapes.
Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org>
Diffstat (limited to 'yjit')
-rw-r--r-- | yjit/src/cruby_bindings.inc.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/yjit/src/cruby_bindings.inc.rs b/yjit/src/cruby_bindings.inc.rs index 9ede3030ff..d6218385b0 100644 --- a/yjit/src/cruby_bindings.inc.rs +++ b/yjit/src/cruby_bindings.inc.rs @@ -248,10 +248,9 @@ extern "C" { } pub const ROBJECT_EMBED: ruby_robject_flags = 8192; pub type ruby_robject_flags = u32; -pub const ROBJECT_OFFSET_NUMIV: i32 = 16; -pub const ROBJECT_OFFSET_AS_HEAP_IVPTR: i32 = 24; -pub const ROBJECT_OFFSET_AS_HEAP_IV_INDEX_TBL: i32 = 32; -pub const ROBJECT_OFFSET_AS_ARY: i32 = 24; +pub const ROBJECT_OFFSET_AS_HEAP_IVPTR: i32 = 16; +pub const ROBJECT_OFFSET_AS_HEAP_IV_INDEX_TBL: i32 = 24; +pub const ROBJECT_OFFSET_AS_ARY: i32 = 16; extern "C" { pub static mut rb_mKernel: VALUE; } @@ -420,7 +419,9 @@ pub struct rb_shape { pub edges: *mut rb_id_table, pub edge_name: ID, pub next_iv_index: attr_index_t, + pub capacity: u32, pub type_: u8, + pub size_pool_index: u8, pub parent_id: shape_id_t, } pub type rb_shape_t = rb_shape; |