ruby-changes:53855
From: nagachika <ko1@a...>
Date: Wed, 28 Nov 2018 22:55:23 +0900 (JST)
Subject: [ruby-changes:53855] nagachika:r66074 (ruby_2_5): merge revision(s) 64799, 64800, 64801: [Backport #15105]
nagachika 2018-11-28 22:55:17 +0900 (Wed, 28 Nov 2018) New Revision: 66074 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=66074 Log: merge revision(s) 64799,64800,64801: [Backport #15105] fix typo. * vm_exec.h (DEBUG_END_INSN()): use `ec` instead of `th`. This macro is used when `VMDEBUG > 0`. escape all env properly. * vm_backtrace.c (rb_debug_inspector_open): escape all env using `rb_vm_stack_to_heap()` before making bindings. [Bug #15105] There is a complicated story of this issue: Without this patch, IFUNC frame does not escaped. A IFUNC frame points to CFUNC ep as previous ep. However, CFUNC ep can be escaped because of making bindings of Ruby level frames. IFUNC's ep can points to invalidated ep and `rb_iter_break()` will fail. This is why `any?` fails. * test/-ext-/debug/test_debug.rb: add a test. * remove trailing spaces. Modified directories: branches/ruby_2_5/ Modified files: branches/ruby_2_5/test/-ext-/debug/test_debug.rb branches/ruby_2_5/version.h branches/ruby_2_5/vm_backtrace.c branches/ruby_2_5/vm_exec.h Index: ruby_2_5/test/-ext-/debug/test_debug.rb =================================================================== --- ruby_2_5/test/-ext-/debug/test_debug.rb (revision 66073) +++ ruby_2_5/test/-ext-/debug/test_debug.rb (revision 66074) @@ -56,4 +56,20 @@ class TestDebug < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_5/test/-ext-/debug/test_debug.rb#L56 binds = inspector_in_eval binds_check binds, bug7635 end + + class MyRelation + include Enumerable + + def each + yield :each_entry + end + end + + def test_lazy_block + x = MyRelation.new.any? do + Bug::Debug.inspector + true + end + assert_equal true, x, '[Bug #15105]' + end end Index: ruby_2_5/vm_exec.h =================================================================== --- ruby_2_5/vm_exec.h (revision 66073) +++ ruby_2_5/vm_exec.h (revision 66074) @@ -36,7 +36,7 @@ typedef rb_iseq_t *ISEQ; https://github.com/ruby/ruby/blob/trunk/ruby_2_5/vm_exec.h#L36 #endif #define DEBUG_END_INSN() \ - rb_vmdebug_debug_print_post(th, GET_CFP() SC_REGS()); + rb_vmdebug_debug_print_post(ec, GET_CFP() SC_REGS()); #else Index: ruby_2_5/version.h =================================================================== --- ruby_2_5/version.h (revision 66073) +++ ruby_2_5/version.h (revision 66074) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_5/version.h#L1 #define RUBY_VERSION "2.5.4" #define RUBY_RELEASE_DATE "2018-11-28" -#define RUBY_PATCHLEVEL 113 +#define RUBY_PATCHLEVEL 114 #define RUBY_RELEASE_YEAR 2018 #define RUBY_RELEASE_MONTH 11 Index: ruby_2_5/vm_backtrace.c =================================================================== --- ruby_2_5/vm_backtrace.c (revision 66073) +++ ruby_2_5/vm_backtrace.c (revision 66074) @@ -1201,6 +1201,9 @@ rb_debug_inspector_open(rb_debug_inspect https://github.com/ruby/ruby/blob/trunk/ruby_2_5/vm_backtrace.c#L1201 enum ruby_tag_type state; volatile VALUE MAYBE_UNUSED(result); + /* escape all env to heap */ + rb_vm_stack_to_heap(ec); + dbg_context.ec = ec; dbg_context.cfp = dbg_context.ec->cfp; dbg_context.backtrace = ec_backtrace_location_ary(ec, 0, 0); Index: ruby_2_5 =================================================================== --- ruby_2_5 (revision 66073) +++ ruby_2_5 (revision 66074) Property changes on: ruby_2_5 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /trunk:r64799-64801 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/