Skip to content

Commit a3edc7b

Browse files
committed
ZJIT: Add test to reproduce binarytrees crash
1 parent 8117600 commit a3edc7b

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

test/ruby/test_zjit.rb

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3154,6 +3154,35 @@ def test(define)
31543154
}, call_threshold: 2
31553155
end
31563156

3157+
def test_regression_cfp_sp_set_correctly_before_leaf_gc_call
3158+
assert_compiles ':ok', %q{
3159+
def check(l, r)
3160+
return 1 unless l
3161+
1 + check(*l) + check(*r)
3162+
end
3163+
3164+
def tree(depth)
3165+
# This duparray is our leaf-gc target.
3166+
return [nil, nil] unless depth > 0
3167+
3168+
# Modify the local and pass it to the following calls.
3169+
depth -= 1
3170+
[tree(depth), tree(depth)]
3171+
end
3172+
3173+
def test
3174+
GC.stress = true
3175+
2.times do
3176+
t = tree(11)
3177+
check(*t)
3178+
end
3179+
:ok
3180+
end
3181+
3182+
test
3183+
}, call_threshold: 14, num_profiles: 5
3184+
end
3185+
31573186
private
31583187

31593188
# Assert that every method call in `test_script` can be compiled by ZJIT

0 commit comments

Comments
 (0)