diff options
author | Jean Boussier <byroot@ruby-lang.org> | 2023-11-07 18:09:55 +0100 |
---|---|---|
committer | Jean Boussier <jean.boussier@gmail.com> | 2023-11-08 11:02:55 +0100 |
commit | d898e8d6f89fba34a9ee5c0e139f38ac807059e6 (patch) | |
tree | bf9d79ff3b3502565b5b718427f192bcd472dc64 /rjit_c.rb | |
parent | 4abf6cde583f3ebe562bd9d62e0126b2cbf4dfac (diff) |
Refactor rb_shape_transition_shape_capa out
Right now the `rb_shape_get_next` shape caller need to
first check if there is capacity left, and if not call
`rb_shape_transition_shape_capa` before it can call `rb_shape_get_next`.
And on each of these it needs to checks if we got a TOO_COMPLEX
back.
All this logic is duplicated in the interpreter, YJIT and RJIT.
Instead we can have `rb_shape_get_next` do the capacity transition
when needed. The caller can compare the old and new shapes capacity
to know if resizing is needed. It also can check for TOO_COMPLEX
only once.
Diffstat (limited to 'rjit_c.rb')
-rw-r--r-- | rjit_c.rb | 6 |
1 files changed, 0 insertions, 6 deletions
@@ -171,12 +171,6 @@ module RubyVM::RJIT # :nodoc: all me_addr == 0 ? nil : rb_method_entry_t.new(me_addr) end - def rb_shape_transition_shape_capa(shape) - _shape = shape.to_i - shape_addr = Primitive.cexpr! 'SIZET2NUM((size_t)rb_shape_transition_shape_capa((rb_shape_t *)NUM2SIZET(_shape)))' - rb_shape_t.new(shape_addr) - end - def rb_shape_get_next(shape, obj, id) _shape = shape.to_i shape_addr = Primitive.cexpr! 'SIZET2NUM((size_t)rb_shape_get_next((rb_shape_t *)NUM2SIZET(_shape), obj, (ID)NUM2SIZET(id)))' |