[前][次][番号順一覧][スレッド一覧]

ruby-changes:45941

From: nobu <ko1@a...>
Date: Sat, 18 Mar 2017 20:29:40 +0900 (JST)
Subject: [ruby-changes:45941] nobu:r58012 (trunk): vm.c: guard arguments [EXPERIMENTAL]

nobu	2017-03-18 20:29:35 +0900 (Sat, 18 Mar 2017)

  New Revision: 58012

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58012

  Log:
    vm.c: guard arguments [EXPERIMENTAL]
    
    * vm.c (invoke_iseq_block_from_c): guard arguments on stack, not
      to be clobbered during splatting.

  Modified files:
    trunk/vm.c
    trunk/vm_insnhelper.c
Index: vm_insnhelper.c
===================================================================
--- vm_insnhelper.c	(revision 58011)
+++ vm_insnhelper.c	(revision 58012)
@@ -2506,7 +2506,11 @@ vm_callee_setup_block_arg_arg0_check(VAL https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L2506
 {
     VALUE ary, arg0 = argv[0];
     ary = rb_check_array_type(arg0);
+#if 0
     argv[0] = arg0;
+#else
+    VM_ASSERT(argv[0] == arg0);
+#endif
     return ary;
 }
 
Index: vm.c
===================================================================
--- vm.c	(revision 58011)
+++ vm.c	(revision 58012)
@@ -998,12 +998,14 @@ invoke_iseq_block_from_c(rb_thread_t *th https://github.com/ruby/ruby/blob/trunk/vm.c#L998
     th->passed_bmethod_me = NULL;
 
     CHECK_VM_STACK_OVERFLOW(cfp, argc);
+    cfp->sp = sp + i;
     for (i=0; i<argc; i++) {
 	sp[i] = argv[i];
     }
 
     opt_pc = vm_yield_setup_args(th, iseq, argc, sp, passed_block_handler,
 				 (type == VM_FRAME_MAGIC_LAMBDA ? (splattable ? arg_setup_lambda : arg_setup_method) : arg_setup_block));
+    cfp->sp = sp;
 
     if (me == NULL) {
 	return invoke_block(th, iseq, self, captured, cref, type, opt_pc);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]