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

ruby-changes:48333

From: ko1 <ko1@a...>
Date: Thu, 26 Oct 2017 19:53:45 +0900 (JST)
Subject: [ruby-changes:48333] ko1:r60447 (trunk): vm_push_frame() accepts `ec` instead of `th`.

ko1	2017-10-26 19:53:42 +0900 (Thu, 26 Oct 2017)

  New Revision: 60447

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

  Log:
    vm_push_frame() accepts `ec` instead of `th`.
    
    * vm_insnhelper.c (vm_push_frame): accepts `ec` instead of `th`.

  Modified files:
    trunk/insns.def
    trunk/vm.c
    trunk/vm_args.c
    trunk/vm_eval.c
    trunk/vm_insnhelper.c
Index: vm_eval.c
===================================================================
--- vm_eval.c	(revision 60446)
+++ vm_eval.c	(revision 60447)
@@ -76,7 +76,7 @@ vm_call0_cfunc_with_frame(rb_thread_t* t https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L76
     {
 	rb_control_frame_t *reg_cfp = th->ec->cfp;
 
-	vm_push_frame(th, 0, VM_FRAME_MAGIC_CFUNC | VM_FRAME_FLAG_CFRAME | VM_ENV_FLAG_LOCAL, recv,
+	vm_push_frame(th->ec, 0, VM_FRAME_MAGIC_CFUNC | VM_FRAME_FLAG_CFRAME | VM_ENV_FLAG_LOCAL, recv,
 		      block_handler, (VALUE)me,
 		      0, reg_cfp->sp, 0, 0);
 
Index: vm_insnhelper.c
===================================================================
--- vm_insnhelper.c	(revision 60446)
+++ vm_insnhelper.c	(revision 60447)
@@ -197,16 +197,16 @@ vm_check_frame(VALUE type, https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L197
 #endif /* VM_CHECK_MODE > 0 */
 
 static inline rb_control_frame_t *
-vm_push_frame_(rb_execution_context_t *ec,
-	       const rb_iseq_t *iseq,
-	       VALUE type,
-	       VALUE self,
-	       VALUE specval,
-	       VALUE cref_or_me,
-	       const VALUE *pc,
-	       VALUE *sp,
-	       int local_size,
-	       int stack_max)
+vm_push_frame(rb_execution_context_t *ec,
+	      const rb_iseq_t *iseq,
+	      VALUE type,
+	      VALUE self,
+	      VALUE specval,
+	      VALUE cref_or_me,
+	      const VALUE *pc,
+	      VALUE *sp,
+	      int local_size,
+	      int stack_max)
 {
     rb_control_frame_t *const cfp = ec->cfp - 1;
     int i;
@@ -254,21 +254,6 @@ vm_push_frame_(rb_execution_context_t *e https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L254
     return cfp;
 }
 
-static rb_control_frame_t *
-vm_push_frame(rb_thread_t *th,
-	      const rb_iseq_t *iseq,
-	      VALUE type,
-	      VALUE self,
-	      VALUE specval,
-	      VALUE cref_or_me,
-	      const VALUE *pc,
-	      VALUE *sp,
-	      int local_size,
-	      int stack_max)
-{
-    return vm_push_frame_(th->ec, iseq, type, self, specval, cref_or_me, pc, sp, local_size, stack_max);
-}
-
 rb_control_frame_t *
 rb_vm_push_frame(rb_execution_context_t *ec,
 		 const rb_iseq_t *iseq,
@@ -281,7 +266,7 @@ rb_vm_push_frame(rb_execution_context_t https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L266
 		 int local_size,
 		 int stack_max)
 {
-    return vm_push_frame_(ec, iseq, type, self, specval, cref_or_me, pc, sp, local_size, stack_max);
+    return vm_push_frame(ec, iseq, type, self, specval, cref_or_me, pc, sp, local_size, stack_max);
 }
 
 /* return TRUE if the frame is finished */
@@ -1674,7 +1659,7 @@ vm_call_iseq_setup_normal(rb_thread_t *t https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L1659
     VALUE *sp = argv + param_size;
     cfp->sp = argv - 1 /* recv */;
 
-    vm_push_frame(th, iseq, VM_FRAME_MAGIC_METHOD | VM_ENV_FLAG_LOCAL, calling->recv,
+    vm_push_frame(th->ec, iseq, VM_FRAME_MAGIC_METHOD | VM_ENV_FLAG_LOCAL, calling->recv,
 		  calling->block_handler, (VALUE)me,
 		  iseq->body->iseq_encoded + opt_pc, sp,
 		  local_size - param_size,
@@ -1720,7 +1705,7 @@ vm_call_iseq_setup_tailcall(rb_thread_t https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L1705
 	*sp++ = src_argv[i];
     }
 
-    vm_push_frame(th, iseq, VM_FRAME_MAGIC_METHOD | VM_ENV_FLAG_LOCAL | finish_flag,
+    vm_push_frame(th->ec, iseq, VM_FRAME_MAGIC_METHOD | VM_ENV_FLAG_LOCAL | finish_flag,
 		  calling->recv, calling->block_handler, (VALUE)me,
 		  iseq->body->iseq_encoded + opt_pc, sp,
 		  iseq->body->local_table_size - iseq->body->param.size,
@@ -1928,7 +1913,7 @@ vm_call_cfunc_with_frame(rb_thread_t *th https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L1913
     RUBY_DTRACE_CMETHOD_ENTRY_HOOK(th, me->owner, me->def->original_id);
     EXEC_EVENT_HOOK(th, RUBY_EVENT_C_CALL, recv, me->def->original_id, ci->mid, me->owner, Qundef);
 
-    vm_push_frame(th, NULL, VM_FRAME_MAGIC_CFUNC | VM_FRAME_FLAG_CFRAME | VM_ENV_FLAG_LOCAL, recv,
+    vm_push_frame(th->ec, NULL, VM_FRAME_MAGIC_CFUNC | VM_FRAME_FLAG_CFRAME | VM_ENV_FLAG_LOCAL, recv,
 		  block_handler, (VALUE)me,
 		  0, th->ec->cfp->sp, 0, 0);
 
@@ -2559,7 +2544,7 @@ vm_yield_with_cfunc(rb_thread_t *th, https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L2544
 
     blockarg = vm_block_handler_to_proc(th, block_handler);
 
-    vm_push_frame(th, (const rb_iseq_t *)captured->code.ifunc,
+    vm_push_frame(th->ec, (const rb_iseq_t *)captured->code.ifunc,
 		  VM_FRAME_MAGIC_IFUNC | VM_FRAME_FLAG_CFRAME,
 		  self,
 		  VM_GUARDED_PREV_EP(captured->ep),
@@ -2676,7 +2661,7 @@ vm_invoke_iseq_block(rb_thread_t *th, rb https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L2661
 
     SET_SP(rsp);
 
-    vm_push_frame(th, iseq,
+    vm_push_frame(th->ec, iseq,
 		  VM_FRAME_MAGIC_BLOCK | (is_lambda ? VM_FRAME_FLAG_LAMBDA : 0),
 		  captured->self,
 		  VM_GUARDED_PREV_EP(captured->ep), 0,
Index: vm_args.c
===================================================================
--- vm_args.c	(revision 60446)
+++ vm_args.c	(revision 60447)
@@ -693,7 +693,7 @@ raise_argument_error(rb_thread_t *th, co https://github.com/ruby/ruby/blob/trunk/vm_args.c#L693
     VALUE at;
 
     if (iseq) {
-	vm_push_frame(th, iseq, VM_FRAME_MAGIC_DUMMY | VM_ENV_FLAG_LOCAL, Qnil /* self */,
+	vm_push_frame(th->ec, iseq, VM_FRAME_MAGIC_DUMMY | VM_ENV_FLAG_LOCAL, Qnil /* self */,
 		      VM_BLOCK_HANDLER_NONE /* specval*/, Qfalse /* me or cref */,
 		      iseq->body->iseq_encoded,
 		      th->ec->cfp->sp, 0, 0 /* stack_max */);
Index: insns.def
===================================================================
--- insns.def	(revision 60446)
+++ insns.def	(revision 60447)
@@ -835,7 +835,7 @@ defineclass https://github.com/ruby/ruby/blob/trunk/insns.def#L835
     rb_iseq_check(class_iseq);
 
     /* enter scope */
-    vm_push_frame(th, class_iseq, VM_FRAME_MAGIC_CLASS | VM_ENV_FLAG_LOCAL, klass,
+    vm_push_frame(th->ec, class_iseq, VM_FRAME_MAGIC_CLASS | VM_ENV_FLAG_LOCAL, klass,
 		  GET_BLOCK_HANDLER(),
 		  (VALUE)vm_cref_push(th, klass, NULL, FALSE),
 		  class_iseq->body->iseq_encoded, GET_SP(),
Index: vm.c
===================================================================
--- vm.c	(revision 60446)
+++ vm.c	(revision 60447)
@@ -449,7 +449,7 @@ vm_set_top_stack(rb_thread_t *th, const https://github.com/ruby/ruby/blob/trunk/vm.c#L449
     }
 
     /* for return */
-    vm_push_frame(th, iseq, VM_FRAME_MAGIC_TOP | VM_ENV_FLAG_LOCAL | VM_FRAME_FLAG_FINISH, th->top_self,
+    vm_push_frame(th->ec, iseq, VM_FRAME_MAGIC_TOP | VM_ENV_FLAG_LOCAL | VM_FRAME_FLAG_FINISH, th->top_self,
 		  VM_BLOCK_HANDLER_NONE,
 		  (VALUE)vm_cref_new_toplevel(th), /* cref or me */
 		  iseq->body->iseq_encoded, th->ec->cfp->sp,
@@ -459,7 +459,7 @@ vm_set_top_stack(rb_thread_t *th, const https://github.com/ruby/ruby/blob/trunk/vm.c#L459
 static void
 vm_set_eval_stack(rb_thread_t * th, const rb_iseq_t *iseq, const rb_cref_t *cref, const struct rb_block *base_block)
 {
-    vm_push_frame(th, iseq, VM_FRAME_MAGIC_EVAL | VM_FRAME_FLAG_FINISH,
+    vm_push_frame(th->ec, iseq, VM_FRAME_MAGIC_EVAL | VM_FRAME_FLAG_FINISH,
 		  vm_block_self(base_block), VM_GUARDED_PREV_EP(vm_block_ep(base_block)),
 		  (VALUE)cref, /* cref or me */
 		  iseq->body->iseq_encoded,
@@ -976,7 +976,7 @@ invoke_block(rb_thread_t *th, const rb_i https://github.com/ruby/ruby/blob/trunk/vm.c#L976
 {
     int arg_size = iseq->body->param.size;
 
-    vm_push_frame(th, iseq, type | VM_FRAME_FLAG_FINISH, self,
+    vm_push_frame(th->ec, iseq, type | VM_FRAME_FLAG_FINISH, self,
 		  VM_GUARDED_PREV_EP(captured->ep),
 		  (VALUE)cref, /* cref or method */
 		  iseq->body->iseq_encoded + opt_pc,
@@ -993,7 +993,7 @@ invoke_bmethod(rb_thread_t *th, const rb https://github.com/ruby/ruby/blob/trunk/vm.c#L993
     int arg_size = iseq->body->param.size;
     VALUE ret;
 
-    vm_push_frame(th, iseq, type | VM_FRAME_FLAG_BMETHOD, self,
+    vm_push_frame(th->ec, iseq, type | VM_FRAME_FLAG_BMETHOD, self,
 		  VM_GUARDED_PREV_EP(captured->ep),
 		  (VALUE)me,
 		  iseq->body->iseq_encoded + opt_pc,
@@ -1990,7 +1990,7 @@ vm_exec(rb_thread_t *th) https://github.com/ruby/ruby/blob/trunk/vm.c#L1990
 
 	    /* push block frame */
 	    cfp->sp[0] = (VALUE)err;
-	    vm_push_frame(th, catch_iseq, VM_FRAME_MAGIC_RESCUE,
+	    vm_push_frame(th->ec, catch_iseq, VM_FRAME_MAGIC_RESCUE,
 			  cfp->self,
 			  VM_GUARDED_PREV_EP(cfp->ep),
 			  0, /* cref or me */
@@ -2108,7 +2108,7 @@ rb_vm_call_cfunc(VALUE recv, VALUE (*fun https://github.com/ruby/ruby/blob/trunk/vm.c#L2108
     const rb_iseq_t *iseq = rb_iseq_new(0, filename, filename, Qnil, 0, ISEQ_TYPE_TOP);
     VALUE val;
 
-    vm_push_frame(th, iseq, VM_FRAME_MAGIC_TOP | VM_ENV_FLAG_LOCAL | VM_FRAME_FLAG_FINISH,
+    vm_push_frame(th->ec, iseq, VM_FRAME_MAGIC_TOP | VM_ENV_FLAG_LOCAL | VM_FRAME_FLAG_FINISH,
 		  recv, block_handler,
 		  (VALUE)vm_cref_new_toplevel(th), /* cref or me */
 		  0, reg_cfp->sp, 0, 0);
@@ -2546,7 +2546,7 @@ th_init(rb_thread_t *th, VALUE self) https://github.com/ruby/ruby/blob/trunk/vm.c#L2546
 
     th->ec->cfp = (void *)(th->ec->vm_stack + th->ec->vm_stack_size);
 
-    vm_push_frame(th, 0 /* dummy iseq */, VM_FRAME_MAGIC_DUMMY | VM_ENV_FLAG_LOCAL | VM_FRAME_FLAG_FINISH | VM_FRAME_FLAG_CFRAME /* dummy frame */,
+    vm_push_frame(th->ec, 0 /* dummy iseq */, VM_FRAME_MAGIC_DUMMY | VM_ENV_FLAG_LOCAL | VM_FRAME_FLAG_FINISH | VM_FRAME_FLAG_CFRAME /* dummy frame */,
 		  Qnil /* dummy self */, VM_BLOCK_HANDLER_NONE /* dummy block ptr */,
 		  0 /* dummy cref/me */,
 		  0 /* dummy pc */, th->ec->vm_stack, 0, 0);

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

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