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

ruby-changes:47640

From: ko1 <ko1@a...>
Date: Wed, 6 Sep 2017 12:39:32 +0900 (JST)
Subject: [ruby-changes:47640] ko1:r59756 (trunk): accept ec instead of th.

ko1	2017-09-06 12:39:26 +0900 (Wed, 06 Sep 2017)

  New Revision: 59756

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

  Log:
    accept ec instead of th.
    
    * vm.c: VM_EP_IN_HEAP_P() and vm_ep_in_heap_p_() only requires ec
      pointed from th.
    
    * vm.c (rb_execution_context_mark): GET_THREAD() returns current
      running thread and we need to use marking thread here. Pass marking
      thread's ec instead of current thread.

  Modified files:
    trunk/vm.c
Index: vm.c
===================================================================
--- vm.c	(revision 59755)
+++ vm.c	(revision 59756)
@@ -101,10 +101,10 @@ VM_CFP_IN_HEAP_P(const rb_thread_t *th, https://github.com/ruby/ruby/blob/trunk/vm.c#L101
 }
 
 static int
-VM_EP_IN_HEAP_P(const rb_thread_t *th, const VALUE *ep)
+VM_EP_IN_HEAP_P(const rb_execution_context_t *ec, const VALUE *ep)
 {
-    const VALUE *start = th->ec.vm_stack;
-    const VALUE *end = (VALUE *)th->ec.cfp;
+    const VALUE *start = ec->vm_stack;
+    const VALUE *end = (VALUE *)ec->cfp;
     VM_ASSERT(start != NULL);
 
     if (start <= ep && ep < end) {
@@ -116,9 +116,9 @@ VM_EP_IN_HEAP_P(const rb_thread_t *th, c https://github.com/ruby/ruby/blob/trunk/vm.c#L116
 }
 
 int
-vm_ep_in_heap_p_(const rb_thread_t *th, const VALUE *ep)
+vm_ep_in_heap_p_(const rb_execution_context_t *ec, const VALUE *ep)
 {
-    if (VM_EP_IN_HEAP_P(th, ep)) {
+    if (VM_EP_IN_HEAP_P(ec, ep)) {
 	VALUE envval = ep[VM_ENV_DATA_INDEX_ENV]; /* VM_ENV_ENVVAL(ep); */
 
 	if (envval != Qundef) {
@@ -138,7 +138,7 @@ vm_ep_in_heap_p_(const rb_thread_t *th, https://github.com/ruby/ruby/blob/trunk/vm.c#L138
 int
 rb_vm_ep_in_heap_p(const VALUE *ep)
 {
-    return vm_ep_in_heap_p_(GET_THREAD(), ep);
+    return vm_ep_in_heap_p_(&GET_THREAD()->ec, ep);
 }
 #endif
 
@@ -813,7 +813,7 @@ rb_proc_create_from_captured(VALUE klass https://github.com/ruby/ruby/blob/trunk/vm.c#L813
     VALUE procval = rb_proc_alloc(klass);
     rb_proc_t *proc = RTYPEDDATA_DATA(procval);
 
-    VM_ASSERT(VM_EP_IN_HEAP_P(GET_THREAD(), captured->ep));
+    VM_ASSERT(VM_EP_IN_HEAP_P(&GET_THREAD()->ec, captured->ep));
 
     /* copy block */
     RB_OBJ_WRITE(procval, &proc->block.as.captured.self, captured->self);
@@ -855,7 +855,7 @@ rb_proc_create(VALUE klass, const struct https://github.com/ruby/ruby/blob/trunk/vm.c#L855
     VALUE procval = rb_proc_alloc(klass);
     rb_proc_t *proc = RTYPEDDATA_DATA(procval);
 
-    VM_ASSERT(VM_EP_IN_HEAP_P(GET_THREAD(), vm_block_ep(block)));
+    VM_ASSERT(VM_EP_IN_HEAP_P(&GET_THREAD()->ec, vm_block_ep(block)));
     rb_vm_block_copy(procval, &proc->block, block);
     vm_block_type_set(&proc->block, block->type);
     proc->safe_level = safe_level;
@@ -880,7 +880,7 @@ rb_vm_make_proc_lambda(rb_thread_t *th, https://github.com/ruby/ruby/blob/trunk/vm.c#L880
 	rb_control_frame_t *cfp = VM_CAPTURED_BLOCK_TO_CFP(captured);
 	vm_make_env_object(th, cfp);
     }
-    VM_ASSERT(VM_EP_IN_HEAP_P(th, captured->ep));
+    VM_ASSERT(VM_EP_IN_HEAP_P(&th->ec, captured->ep));
     VM_ASSERT(imemo_type_p(captured->code.val, imemo_iseq) ||
 	      imemo_type_p(captured->code.val, imemo_ifunc));
 
@@ -2380,7 +2380,7 @@ rb_execution_context_mark(const rb_execu https://github.com/ruby/ruby/blob/trunk/vm.c#L2380
 	while (cfp != limit_cfp) {
 #if VM_CHECK_MODE > 0
 	    const VALUE *ep = cfp->ep;
-	    VM_ASSERT(!!VM_ENV_FLAGS(ep, VM_ENV_FLAG_ESCAPED) == vm_ep_in_heap_p_(GET_THREAD(), ep));
+	    VM_ASSERT(!!VM_ENV_FLAGS(ep, VM_ENV_FLAG_ESCAPED) == vm_ep_in_heap_p_(ec, ep));
 #endif
 	    rb_gc_mark(cfp->self);
 	    rb_gc_mark((VALUE)cfp->iseq);

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

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