ruby-changes:43487
From: nagachika <ko1@a...>
Date: Sat, 2 Jul 2016 03:59:10 +0900 (JST)
Subject: [ruby-changes:43487] nagachika:r55560 (ruby_2_3): merge revision(s) 55462: [Backport #11954]
nagachika 2016-07-02 03:59:06 +0900 (Sat, 02 Jul 2016) New Revision: 55560 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55560 Log: merge revision(s) 55462: [Backport #11954] * vm.c (invoke_bmethod, invoke_block_from_c_0): revert r52104 partially to avoid "self has wrong type to call super in this context" errors. [ruby-core:72724] [Bug #11954] Modified directories: branches/ruby_2_3/ Modified files: branches/ruby_2_3/ChangeLog branches/ruby_2_3/test/ruby/test_objectspace.rb branches/ruby_2_3/version.h branches/ruby_2_3/vm.c Index: ruby_2_3/test/ruby/test_objectspace.rb =================================================================== --- ruby_2_3/test/ruby/test_objectspace.rb (revision 55559) +++ ruby_2_3/test/ruby/test_objectspace.rb (revision 55560) @@ -85,6 +85,52 @@ End https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/ruby/test_objectspace.rb#L85 } end + def test_finalizer_with_super + assert_in_out_err(["-e", <<-END], "", %w(:ok), []) + class A + def foo + end + end + + class B < A + def foo + 1.times { super } + end + end + + class C + module M + end + + FINALIZER = proc do + M.module_eval do + end + end + + def define_finalizer + ObjectSpace.define_finalizer(self, FINALIZER) + end + end + + class D + def foo + B.new.foo + end + end + + C::M.singleton_class.send :define_method, :module_eval do |src, id, line| + end + + GC.stress = true + 10.times do + C.new.define_finalizer + D.new.foo + end + + p :ok + END + end + def test_each_object klass = Class.new new_obj = klass.new Index: ruby_2_3/ChangeLog =================================================================== --- ruby_2_3/ChangeLog (revision 55559) +++ ruby_2_3/ChangeLog (revision 55560) @@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1 +Sat Jul 2 03:33:28 2016 Shugo Maeda <shugo@r...> + + * vm.c (invoke_bmethod, invoke_block_from_c_0): revert r52104 + partially to avoid "self has wrong type to call super in this + context" errors. + [ruby-core:72724] [Bug #11954] + Mon Jun 20 02:38:29 2016 Nobuyoshi Nakada <nobu@r...> * lib/optparse.rb (OptionParser::Completion.candidate): get rid of Index: ruby_2_3/version.h =================================================================== --- ruby_2_3/version.h (revision 55559) +++ ruby_2_3/version.h (revision 55560) @@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1 #define RUBY_VERSION "2.3.2" -#define RUBY_RELEASE_DATE "2016-06-20" -#define RUBY_PATCHLEVEL 135 +#define RUBY_RELEASE_DATE "2016-07-02" +#define RUBY_PATCHLEVEL 136 #define RUBY_RELEASE_YEAR 2016 -#define RUBY_RELEASE_MONTH 6 -#define RUBY_RELEASE_DAY 20 +#define RUBY_RELEASE_MONTH 7 +#define RUBY_RELEASE_DAY 2 #include "ruby/version.h" Index: ruby_2_3/vm.c =================================================================== --- ruby_2_3/vm.c (revision 55559) +++ ruby_2_3/vm.c (revision 55560) @@ -922,15 +922,12 @@ invoke_block(rb_thread_t *th, const rb_i https://github.com/ruby/ruby/blob/trunk/ruby_2_3/vm.c#L922 } static VALUE -invoke_bmethod(rb_thread_t *th, const rb_iseq_t *iseq, VALUE self, const rb_block_t *block, int type, int opt_pc) +invoke_bmethod(rb_thread_t *th, const rb_iseq_t *iseq, VALUE self, const rb_block_t *block, const rb_callable_method_entry_t *me, int type, int opt_pc) { /* bmethod */ int arg_size = iseq->body->param.size; - const rb_callable_method_entry_t *me = th->passed_bmethod_me; VALUE ret; - th->passed_bmethod_me = NULL; - vm_push_frame(th, iseq, type | VM_FRAME_FLAG_FINISH | VM_FRAME_FLAG_BMETHOD, self, VM_ENVVAL_PREV_EP_PTR(block->ep), (VALUE)me, /* cref or method (TODO: can we ignore cref?) */ @@ -959,6 +956,9 @@ invoke_block_from_c_0(rb_thread_t *th, c https://github.com/ruby/ruby/blob/trunk/ruby_2_3/vm.c#L956 int i, opt_pc; int type = block_proc_is_lambda(block->proc) ? VM_FRAME_MAGIC_LAMBDA : VM_FRAME_MAGIC_BLOCK; VALUE *sp = th->cfp->sp; + const rb_callable_method_entry_t *me = th->passed_bmethod_me; + + th->passed_bmethod_me = NULL; for (i=0; i<argc; i++) { sp[i] = argv[i]; @@ -967,11 +967,11 @@ invoke_block_from_c_0(rb_thread_t *th, c https://github.com/ruby/ruby/blob/trunk/ruby_2_3/vm.c#L967 opt_pc = vm_yield_setup_args(th, iseq, argc, sp, blockptr, (type == VM_FRAME_MAGIC_LAMBDA ? (splattable ? arg_setup_lambda : arg_setup_method) : arg_setup_block)); - if (th->passed_bmethod_me == NULL) { + if (me == NULL) { return invoke_block(th, iseq, self, block, cref, type, opt_pc); } else { - return invoke_bmethod(th, iseq, self, block, type, opt_pc); + return invoke_bmethod(th, iseq, self, block, me, type, opt_pc); } } Property changes on: ruby_2_3 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r55462 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/