mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Refactor rb_shape_transition_shape_capa to not accept capacity
This way the groth factor is encapsulated, which allows rb_shape_transition_shape_capa to be smarter about ideal sizes.
This commit is contained in:
parent
fd21460898
commit
5cc44f48c5
7 changed files with 21 additions and 24 deletions
|
@ -502,8 +502,6 @@ module RubyVM::RJIT
|
|||
shape = C.rb_shape_get_shape_by_id(shape_id)
|
||||
|
||||
current_capacity = shape.capacity
|
||||
new_capacity = current_capacity * 2
|
||||
|
||||
# If the object doesn't have the capacity to store the IV,
|
||||
# then we'll need to allocate it.
|
||||
needs_extension = shape.next_iv_index >= current_capacity
|
||||
|
@ -515,7 +513,7 @@ module RubyVM::RJIT
|
|||
if needs_extension
|
||||
# We need to add an extended table to the object
|
||||
# First, create an outgoing transition that increases the capacity
|
||||
C.rb_shape_transition_shape_capa(shape, new_capacity)
|
||||
C.rb_shape_transition_shape_capa(shape)
|
||||
else
|
||||
nil
|
||||
end
|
||||
|
@ -538,7 +536,7 @@ module RubyVM::RJIT
|
|||
# the capacity and set the buffer.
|
||||
asm.mov(C_ARGS[0], :rax)
|
||||
asm.mov(C_ARGS[1], current_capacity)
|
||||
asm.mov(C_ARGS[2], new_capacity)
|
||||
asm.mov(C_ARGS[2], capa_shape.capacity)
|
||||
asm.call(C.rb_ensure_iv_list_size)
|
||||
|
||||
# Load the receiver again after the function call
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue