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

ruby-changes:47637

From: ko1 <ko1@a...>
Date: Wed, 6 Sep 2017 11:47:05 +0900 (JST)
Subject: [ruby-changes:47637] ko1:r59752 (trunk): rb_execution_context_mark.

ko1	2017-09-06 11:46:59 +0900 (Wed, 06 Sep 2017)

  New Revision: 59752

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

  Log:
    rb_execution_context_mark.
    
    * vm.c (rb_execution_context_mark): separate from thread_mark().

  Modified files:
    trunk/vm.c
Index: vm.c
===================================================================
--- vm.c	(revision 59751)
+++ vm.c	(revision 59752)
@@ -2365,18 +2365,15 @@ rb_thread_recycle_stack_release(VALUE *s https://github.com/ruby/ruby/blob/trunk/vm.c#L2365
 
 void rb_fiber_mark_self(rb_fiber_t *fib);
 
-void
-rb_thread_mark(void *ptr)
+static void
+rb_execution_context_mark(const rb_execution_context_t *ec)
 {
-    rb_thread_t *th = ptr;
-    RUBY_MARK_ENTER("thread");
-
     /* mark VM stack */
-    if (th->ec.vm_stack) {
-	VALUE *p = th->ec.vm_stack;
-	VALUE *sp = th->ec.cfp->sp;
-	rb_control_frame_t *cfp = th->ec.cfp;
-	rb_control_frame_t *limit_cfp = (void *)(th->ec.vm_stack + th->ec.vm_stack_size);
+    if (ec->vm_stack) {
+	VALUE *p = ec->vm_stack;
+	VALUE *sp = ec->cfp->sp;
+	rb_control_frame_t *cfp = ec->cfp;
+	rb_control_frame_t *limit_cfp = (void *)(ec->vm_stack + ec->vm_stack_size);
 
 	rb_gc_mark_values((long)(sp - p), p);
 
@@ -2393,6 +2390,21 @@ rb_thread_mark(void *ptr) https://github.com/ruby/ruby/blob/trunk/vm.c#L2390
 	}
     }
 
+    RUBY_MARK_UNLESS_NULL(ec->errinfo);
+    RUBY_MARK_UNLESS_NULL(ec->root_svar);
+    rb_mark_tbl(ec->local_storage);
+    RUBY_MARK_UNLESS_NULL(ec->local_storage_recursive_hash);
+    RUBY_MARK_UNLESS_NULL(ec->local_storage_recursive_hash_for_trace);
+}
+
+void
+rb_thread_mark(void *ptr)
+{
+    rb_thread_t *th = ptr;
+    RUBY_MARK_ENTER("thread");
+
+    rb_execution_context_mark(&th->ec);
+
     /* mark machine stack */
     if (GET_THREAD() != th && th->machine.stack_start && th->machine.stack_end) {
 	rb_gc_mark_machine_stack(th);
@@ -2407,25 +2419,16 @@ rb_thread_mark(void *ptr) https://github.com/ruby/ruby/blob/trunk/vm.c#L2419
 
     RUBY_MARK_UNLESS_NULL(th->thgroup);
     RUBY_MARK_UNLESS_NULL(th->value);
-    RUBY_MARK_UNLESS_NULL(th->ec.errinfo);
     RUBY_MARK_UNLESS_NULL(th->pending_interrupt_queue);
     RUBY_MARK_UNLESS_NULL(th->pending_interrupt_mask_stack);
-    RUBY_MARK_UNLESS_NULL(th->ec.root_svar);
     RUBY_MARK_UNLESS_NULL(th->top_self);
     RUBY_MARK_UNLESS_NULL(th->top_wrapper);
     rb_fiber_mark_self(th->fiber);
     rb_fiber_mark_self(th->root_fiber);
     RUBY_MARK_UNLESS_NULL(th->stat_insn_usage);
     RUBY_MARK_UNLESS_NULL(th->last_status);
-
     RUBY_MARK_UNLESS_NULL(th->locking_mutex);
-
-    rb_mark_tbl(th->ec.local_storage);
-    RUBY_MARK_UNLESS_NULL(th->ec.local_storage_recursive_hash);
-    RUBY_MARK_UNLESS_NULL(th->ec.local_storage_recursive_hash_for_trace);
-
     RUBY_MARK_UNLESS_NULL(th->name);
-
     rb_vm_trace_mark_event_hooks(&th->event_hooks);
 
     RUBY_MARK_LEAVE("thread");

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

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