Skip to content

Commit

Permalink
MJIT: Remove the code to optimize shape transition
Browse files Browse the repository at this point in the history
because this code crashes on railsbench. I'll try adding a repro for it
later, but I don't know shapes enough to craft it right away.
  • Loading branch information
k0kubun committed Nov 25, 2022
1 parent 1d64a5a commit 4ea9d7d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
12 changes: 1 addition & 11 deletions lib/mjit/compiler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -376,19 +376,9 @@ def compile_ivar(insn_name, stack_size, pos, status, operands, body)
src << " VALUE obj = GET_SELF();\n"
# JIT: cache hit path of vm_getivar/vm_setivar, or cancel JIT (recompile it with exivar)
if insn_name == :setinstancevariable
src << " const shape_id_t source_shape_id = (shape_id_t)#{source_shape_id};\n"
src << " const uint32_t index = #{attr_index - 1};\n"
src << " const shape_id_t dest_shape_id = (shape_id_t)#{dest_shape_id};\n"
src << " if (source_shape_id == ROBJECT_SHAPE_ID(obj) && \n"
src << " dest_shape_id != ROBJECT_SHAPE_ID(obj)) {\n"
# Conditionally generate a capacity change if there is one
# between the destination and the parent IV set
src << " rb_ensure_iv_list_size(obj, ROBJECT_IV_CAPACITY(obj), #{capa});\n" if capa
src << " ROBJECT_SET_SHAPE_ID(obj, dest_shape_id);\n"
src << " VALUE *ptr = ROBJECT_IVPTR(obj);\n"
src << " RB_OBJ_WRITE(obj, &ptr[index], stack[#{stack_size - 1}]);\n"
src << " }\n"
src << " else if (dest_shape_id == ROBJECT_SHAPE_ID(obj)) {\n"
src << " if (dest_shape_id == ROBJECT_SHAPE_ID(obj)) {\n"
src << " VALUE *ptr = ROBJECT_IVPTR(obj);\n"
src << " RB_OBJ_WRITE(obj, &ptr[index], stack[#{stack_size - 1}]);\n"
src << " }\n"
Expand Down
2 changes: 1 addition & 1 deletion test/ruby/test_mjit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ def bar
end

def test_inlined_undefined_ivar
assert_eval_with_jit("#{<<~"begin;"}\n#{<<~"end;"}", stdout: "bbb", success_count: 2, call_threshold: 2)
assert_eval_with_jit("#{<<~"begin;"}\n#{<<~"end;"}", stdout: "bbb", success_count: 5, call_threshold: 2)
begin;
class Foo
def initialize
Expand Down

0 comments on commit 4ea9d7d

Please sign in to comment.