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

ruby-changes:48352

From: ko1 <ko1@a...>
Date: Fri, 27 Oct 2017 10:31:20 +0900 (JST)
Subject: [ruby-changes:48352] ko1:r60466 (trunk): ec->th for vm_cref_push() and constify.

ko1	2017-10-27 10:31:15 +0900 (Fri, 27 Oct 2017)

  New Revision: 60466

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

  Log:
    ec->th for vm_cref_push() and constify.
    
    * vm_insnhelper.c (vm_cref_push): accepts `ec` instead of `th`.
    
    * vm_insnhelper.c: consitfy the first parameter (ec):
      * lep_svar
      * lep_svar_write
      * lep_svar_get
      * lep_svar_set
      * vm_getspecial
      and added vm_cref_push.

  Modified files:
    trunk/insns.def
    trunk/vm_eval.c
    trunk/vm_insnhelper.c
Index: vm_insnhelper.c
===================================================================
--- vm_insnhelper.c	(revision 60465)
+++ vm_insnhelper.c	(revision 60466)
@@ -387,7 +387,7 @@ vm_svar_valid_p(VALUE svar) https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L387
 #endif
 
 static inline struct vm_svar *
-lep_svar(rb_execution_context_t *ec, const VALUE *lep)
+lep_svar(const rb_execution_context_t *ec, const VALUE *lep)
 {
     VALUE svar;
 
@@ -404,7 +404,7 @@ lep_svar(rb_execution_context_t *ec, con https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L404
 }
 
 static inline void
-lep_svar_write(rb_execution_context_t *ec, const VALUE *lep, const struct vm_svar *svar)
+lep_svar_write(const rb_execution_context_t *ec, const VALUE *lep, const struct vm_svar *svar)
 {
     VM_ASSERT(vm_svar_valid_p((VALUE)svar));
 
@@ -417,7 +417,7 @@ lep_svar_write(rb_execution_context_t *e https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L417
 }
 
 static VALUE
-lep_svar_get(rb_execution_context_t *ec, const VALUE *lep, rb_num_t key)
+lep_svar_get(const rb_execution_context_t *ec, const VALUE *lep, rb_num_t key)
 {
     const struct vm_svar *svar = lep_svar(ec, lep);
 
@@ -448,7 +448,7 @@ svar_new(VALUE obj) https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L448
 }
 
 static void
-lep_svar_set(rb_execution_context_t *ec, const VALUE *lep, rb_num_t key, VALUE val)
+lep_svar_set(const rb_execution_context_t *ec, const VALUE *lep, rb_num_t key, VALUE val)
 {
     struct vm_svar *svar = lep_svar(ec, lep);
 
@@ -475,7 +475,7 @@ lep_svar_set(rb_execution_context_t *ec, https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L475
 }
 
 static inline VALUE
-vm_getspecial(rb_execution_context_t *ec, const VALUE *lep, rb_num_t key, rb_num_t type)
+vm_getspecial(const rb_execution_context_t *ec, const VALUE *lep, rb_num_t key, rb_num_t type)
 {
     VALUE val;
 
@@ -734,7 +734,7 @@ rb_vm_rewrite_cref(rb_cref_t *cref, VALU https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L734
 }
 
 static rb_cref_t *
-vm_cref_push(rb_thread_t *th, VALUE klass, const VALUE *ep, int pushed_by_eval)
+vm_cref_push(const rb_execution_context_t *ec, VALUE klass, const VALUE *ep, int pushed_by_eval)
 {
     rb_cref_t *prev_cref = NULL;
 
@@ -742,7 +742,7 @@ vm_cref_push(rb_thread_t *th, VALUE klas https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L742
 	prev_cref = vm_env_cref(ep);
     }
     else {
-	rb_control_frame_t *cfp = vm_get_ruby_level_caller_cfp(th->ec, th->ec->cfp);
+	rb_control_frame_t *cfp = vm_get_ruby_level_caller_cfp(ec, ec->cfp);
 
 	if (cfp) {
 	    prev_cref = vm_env_cref(cfp->ep);
Index: insns.def
===================================================================
--- insns.def	(revision 60465)
+++ insns.def	(revision 60466)
@@ -837,7 +837,7 @@ defineclass https://github.com/ruby/ruby/blob/trunk/insns.def#L837
     /* enter scope */
     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),
+		  (VALUE)vm_cref_push(th->ec, klass, NULL, FALSE),
 		  class_iseq->body->iseq_encoded, GET_SP(),
 		  class_iseq->body->local_table_size,
 		  class_iseq->body->stack_max);
Index: vm_eval.c
===================================================================
--- vm_eval.c	(revision 60465)
+++ vm_eval.c	(revision 60466)
@@ -1583,7 +1583,7 @@ yield_under(VALUE under, VALUE self, int https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1583
 	VM_FORCE_WRITE_SPECIAL_CONST(&VM_CF_LEP(th->ec->cfp)[VM_ENV_DATA_INDEX_SPECVAL], new_block_handler);
     }
 
-    cref = vm_cref_push(th, under, ep, TRUE);
+    cref = vm_cref_push(th->ec, under, ep, TRUE);
     return vm_yield_with_cref(th, argc, argv, cref, is_lambda);
 }
 
@@ -1601,7 +1601,7 @@ rb_yield_refine_block(VALUE refinement, https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1601
 	struct rb_captured_block new_captured = *captured;
 	VALUE new_block_handler = VM_BH_FROM_ISEQ_BLOCK(&new_captured);
 	const VALUE *ep = captured->ep;
-	rb_cref_t *cref = vm_cref_push(th, refinement, ep, TRUE);
+	rb_cref_t *cref = vm_cref_push(th->ec, refinement, ep, TRUE);
 	CREF_REFINEMENTS_SET(cref, refinements);
 	VM_FORCE_WRITE_SPECIAL_CONST(&VM_CF_LEP(th->ec->cfp)[VM_ENV_DATA_INDEX_SPECVAL], new_block_handler);
 	new_captured.self = refinement;
@@ -1613,7 +1613,7 @@ rb_yield_refine_block(VALUE refinement, https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1613
 static VALUE
 eval_under(VALUE under, VALUE self, VALUE src, VALUE file, int line)
 {
-    rb_cref_t *cref = vm_cref_push(GET_THREAD(), under, NULL, SPECIAL_CONST_P(self) && !NIL_P(under));
+    rb_cref_t *cref = vm_cref_push(GET_EC(), under, NULL, SPECIAL_CONST_P(self) && !NIL_P(under));
     SafeStringValue(src);
     return eval_string_with_cref(self, src, Qnil, cref, file, line);
 }

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

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