We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 093740a + 0001e7a commit d130c0bCopy full SHA for d130c0b
bootstraptest/test_yjit.rb
@@ -441,6 +441,29 @@ def bar()
441
foo(4)[1]
442
}
443
444
+# Method redefinition while the method is on the stack
445
+assert_equal '[777, 1]', %q{
446
+ def foo
447
+ redef()
448
+ 777
449
+ end
450
+
451
+ def redef
452
+ # Redefine the global foo
453
+ eval("def foo; 1; end", TOPLEVEL_BINDING)
454
455
+ # Collect dead code
456
+ GC.stress = true
457
+ GC.start
458
459
+ # But we will return to the original foo,
460
+ # which remains alive because it's on the stack
461
462
463
+ # Must produce [777, 1]
464
+ [foo, foo]
465
+}
466
467
# Test for GC safety. Don't invalidate dead iseqs.
468
assert_normal_exit %q{
469
Class.new do
0 commit comments