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>
This commit is contained in:
Jemma Issroff 2022-11-08 15:35:31 -05:00 committed by Peter Zhu
parent 9986697b62
commit 5246f4027e
Notes: git 2022-11-10 15:12:05 +00:00
28 changed files with 483 additions and 203 deletions

10
gc.rb
View file

@ -252,16 +252,6 @@ module GC
end
end
# call-seq:
# GC.using_rvargc? -> true or false
#
# Returns true if using experimental feature Variable Width Allocation, false
# otherwise.
def self.using_rvargc? # :nodoc:
GC::INTERNAL_CONSTANTS[:SIZE_POOL_COUNT] > 1
end
# call-seq:
# GC.measure_total_time = true/false
#