mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Make sure newarraykwsplat accesses a correct index
on stack when local_stack_p is enabled. This fixes `RB_FL_TEST_RAW:"RB_FL_ABLE(obj)"` assertion failure on power_assert's test with JIT enabled.
This commit is contained in:
parent
0f7d3e4e40
commit
04e56958e6
2 changed files with 11 additions and 1 deletions
|
@ -719,6 +719,16 @@ class TestJIT < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
def test_newarraykwsplat_on_stack
|
||||
assert_eval_with_jit("#{<<~"begin;"}\n#{<<~"end;"}", stdout: "[nil, [{:type=>:development}]]\n", success_count: 1, insns: %i[newarraykwsplat])
|
||||
begin;
|
||||
def arr
|
||||
[nil, [:type => :development]]
|
||||
end
|
||||
p arr
|
||||
end;
|
||||
end
|
||||
|
||||
def test_local_stack_on_exception
|
||||
assert_eval_with_jit("#{<<~"begin;"}\n#{<<~"end;"}", stdout: '3', success_count: 2)
|
||||
begin;
|
||||
|
|
|
@ -101,7 +101,7 @@
|
|||
% # #define STACK_ADDR_FROM_TOP(n) (GET_SP()-(n))
|
||||
% num = Regexp.last_match[:num]
|
||||
fprintf(f, <%= to_cstr.call(line.sub(/\bSTACK_ADDR_FROM_TOP\(([^)]+)\)/, '%s')) %>,
|
||||
(status->local_stack_p ? "stack + (stack_size - (<%= num %>))" : "STACK_ADDR_FROM_TOP(<%= num %>)"));
|
||||
(status->local_stack_p ? "(stack + (stack_size - (<%= num %>)))" : "STACK_ADDR_FROM_TOP(<%= num %>)"));
|
||||
% when /\bTOPN\((?<num>[^)]+)\)/
|
||||
% # #define TOPN(n) (*(GET_SP()-(n)-1))
|
||||
% num = Regexp.last_match[:num]
|
||||
|
|
Loading…
Reference in a new issue