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

ruby-changes:46494

From: normal <ko1@a...>
Date: Tue, 9 May 2017 14:06:47 +0900 (JST)
Subject: [ruby-changes:46494] normal:r58614 (trunk): rb_execution_context_t: move stack, stack_size and cfp from rb_thread_t

normal	2017-05-09 14:06:41 +0900 (Tue, 09 May 2017)

  New Revision: 58614

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

  Log:
    rb_execution_context_t: move stack, stack_size and cfp from rb_thread_t
    
    The goal is to reduce rb_context_t and rb_fiber_t size
    by removing the need to store the entire rb_thread_t in
    there.
    
    [ruby-core:81045] Work-in-progress: soon, we will move more fields here.

  Modified files:
    trunk/.gdbinit
    trunk/compile.c
    trunk/cont.c
    trunk/error.c
    trunk/eval.c
    trunk/eval_intern.h
    trunk/gc.c
    trunk/proc.c
    trunk/thread.c
    trunk/vm.c
    trunk/vm_args.c
    trunk/vm_backtrace.c
    trunk/vm_core.h
    trunk/vm_dump.c
    trunk/vm_eval.c
    trunk/vm_exec.c
    trunk/vm_exec.h
    trunk/vm_insnhelper.c
    trunk/vm_insnhelper.h
    trunk/vm_method.c
    trunk/vm_trace.c
Index: vm_dump.c
===================================================================
--- vm_dump.c	(revision 58613)
+++ vm_dump.c	(revision 58614)
@@ -22,13 +22,14 @@ https://github.com/ruby/ruby/blob/trunk/vm_dump.c#L22
 #define MAX_POSBUF 128
 
 #define VM_CFP_CNT(th, cfp) \
-  ((rb_control_frame_t *)((th)->stack + (th)->stack_size) - (rb_control_frame_t *)(cfp))
+  ((rb_control_frame_t *)((th)->ec.stack + (th)->ec.stack_size) - \
+   (rb_control_frame_t *)(cfp))
 
 static void
 control_frame_dump(rb_thread_t *th, rb_control_frame_t *cfp)
 {
     ptrdiff_t pc = -1;
-    ptrdiff_t ep = cfp->ep - th->stack;
+    ptrdiff_t ep = cfp->ep - th->ec.stack;
     char ep_in_heap = ' ';
     char posbuf[MAX_POSBUF+1];
     int line = 0;
@@ -38,7 +39,7 @@ control_frame_dump(rb_thread_t *th, rb_c https://github.com/ruby/ruby/blob/trunk/vm_dump.c#L39
 
     const rb_callable_method_entry_t *me;
 
-    if (ep < 0 || (size_t)ep > th->stack_size) {
+    if (ep < 0 || (size_t)ep > th->ec.stack_size) {
 	ep = (ptrdiff_t)cfp->ep;
 	ep_in_heap = 'p';
     }
@@ -117,14 +118,14 @@ control_frame_dump(rb_thread_t *th, rb_c https://github.com/ruby/ruby/blob/trunk/vm_dump.c#L118
     }
 
     fprintf(stderr, "c:%04"PRIdPTRDIFF" ",
-	    ((rb_control_frame_t *)(th->stack + th->stack_size) - cfp));
+	    ((rb_control_frame_t *)(th->ec.stack + th->ec.stack_size) - cfp));
     if (pc == -1) {
 	fprintf(stderr, "p:---- ");
     }
     else {
 	fprintf(stderr, "p:%04"PRIdPTRDIFF" ", pc);
     }
-    fprintf(stderr, "s:%04"PRIdPTRDIFF" ", cfp->sp - th->stack);
+    fprintf(stderr, "s:%04"PRIdPTRDIFF" ", cfp->sp - th->ec.stack);
     fprintf(stderr, ep_in_heap == ' ' ? "e:%06"PRIdPTRDIFF" " : "E:%06"PRIxPTRDIFF" ", ep % 10000);
     fprintf(stderr, "%-6s", magic);
     if (line) {
@@ -150,12 +151,12 @@ rb_vmdebug_stack_dump_raw(rb_thread_t *t https://github.com/ruby/ruby/blob/trunk/vm_dump.c#L151
     VALUE *p, *st, *t;
 
     fprintf(stderr, "-- stack frame ------------\n");
-    for (p = st = th->stack; p < sp; p++) {
+    for (p = st = th->ec.stack; p < sp; p++) {
 	fprintf(stderr, "%04ld (%p): %08"PRIxVALUE, (long)(p - st), p, *p);
 
 	t = (VALUE *)*p;
-	if (th->stack <= t && t < sp) {
-	    fprintf(stderr, " (= %ld)", (long)((VALUE *)GC_GUARDED_PTR_REF(t) - th->stack));
+	if (th->ec.stack <= t && t < sp) {
+	    fprintf(stderr, " (= %ld)", (long)((VALUE *)GC_GUARDED_PTR_REF(t) - th->ec.stack));
 	}
 
 	if (p == ep)
@@ -167,7 +168,7 @@ rb_vmdebug_stack_dump_raw(rb_thread_t *t https://github.com/ruby/ruby/blob/trunk/vm_dump.c#L168
 
     fprintf(stderr, "-- Control frame information "
 	    "-----------------------------------------------\n");
-    while ((void *)cfp < (void *)(th->stack + th->stack_size)) {
+    while ((void *)cfp < (void *)(th->ec.stack + th->ec.stack_size)) {
 	control_frame_dump(th, cfp);
 	cfp++;
     }
@@ -178,7 +179,7 @@ void https://github.com/ruby/ruby/blob/trunk/vm_dump.c#L179
 rb_vmdebug_stack_dump_raw_current(void)
 {
     rb_thread_t *th = GET_THREAD();
-    rb_vmdebug_stack_dump_raw(th, th->cfp);
+    rb_vmdebug_stack_dump_raw(th, th->ec.cfp);
 }
 
 void
@@ -219,7 +220,7 @@ rb_vmdebug_stack_dump_th(VALUE thval) https://github.com/ruby/ruby/blob/trunk/vm_dump.c#L220
 {
     rb_thread_t *th;
     GetThreadPtr(thval, th);
-    rb_vmdebug_stack_dump_raw(th, th->cfp);
+    rb_vmdebug_stack_dump_raw(th, th->ec.cfp);
 }
 
 #if VMDEBUG > 2
@@ -293,7 +294,7 @@ vm_stack_dump_each(rb_thread_t *th, rb_c https://github.com/ruby/ruby/blob/trunk/vm_dump.c#L294
 		break;
 	    }
 	    fprintf(stderr, "  stack %2d: %8s (%"PRIdPTRDIFF")\n", i, StringValueCStr(rstr),
-		    (ptr - th->stack));
+		    (ptr - th->ec.stack));
 	}
     }
     else if (VM_FRAME_FINISHED_P(cfp)) {
@@ -313,22 +314,22 @@ vm_stack_dump_each(rb_thread_t *th, rb_c https://github.com/ruby/ruby/blob/trunk/vm_dump.c#L314
 void
 rb_vmdebug_debug_print_register(rb_thread_t *th)
 {
-    rb_control_frame_t *cfp = th->cfp;
+    rb_control_frame_t *cfp = th->ec.cfp;
     ptrdiff_t pc = -1;
-    ptrdiff_t ep = cfp->ep - th->stack;
+    ptrdiff_t ep = cfp->ep - th->ec.stack;
     ptrdiff_t cfpi;
 
     if (VM_FRAME_RUBYFRAME_P(cfp)) {
 	pc = cfp->pc - cfp->iseq->body->iseq_encoded;
     }
 
-    if (ep < 0 || (size_t)ep > th->stack_size) {
+    if (ep < 0 || (size_t)ep > th->ec.stack_size) {
 	ep = -1;
     }
 
-    cfpi = ((rb_control_frame_t *)(th->stack + th->stack_size)) - cfp;
+    cfpi = ((rb_control_frame_t *)(th->ec.stack + th->ec.stack_size)) - cfp;
     fprintf(stderr, "  [PC] %04"PRIdPTRDIFF", [SP] %04"PRIdPTRDIFF", [EP] %04"PRIdPTRDIFF", [CFP] %04"PRIdPTRDIFF"\n",
-	    pc, (cfp->sp - th->stack), ep, cfpi);
+	    pc, (cfp->sp - th->ec.stack), ep, cfpi);
 }
 
 void
@@ -352,7 +353,7 @@ rb_vmdebug_debug_print_pre(rb_thread_t * https://github.com/ruby/ruby/blob/trunk/vm_dump.c#L353
 	    printf(" ");
 	}
 	printf("| ");
-	if(0)printf("[%03ld] ", (long)(cfp->sp - th->stack));
+	if(0)printf("[%03ld] ", (long)(cfp->sp - th->ec.stack));
 
 	/* printf("%3"PRIdPTRDIFF" ", VM_CFP_CNT(th, cfp)); */
 	if (pc >= 0) {
@@ -387,7 +388,7 @@ rb_vmdebug_debug_print_post(rb_thread_t https://github.com/ruby/ruby/blob/trunk/vm_dump.c#L388
 
 #if VMDEBUG > 2
     /* stack_dump_thobj(th); */
-    vm_stack_dump_each(th, th->cfp);
+    vm_stack_dump_each(th, th->ec.cfp);
 
 #if OPT_STACK_CACHING
     {
@@ -409,7 +410,7 @@ rb_vmdebug_thread_dump_state(VALUE self) https://github.com/ruby/ruby/blob/trunk/vm_dump.c#L410
     rb_thread_t *th;
     rb_control_frame_t *cfp;
     GetThreadPtr(self, th);
-    cfp = th->cfp;
+    cfp = th->ec.cfp;
 
     fprintf(stderr, "Thread state dump:\n");
     fprintf(stderr, "pc : %p, sp : %p\n", (void *)cfp->pc, (void *)cfp->sp);
@@ -1065,6 +1066,6 @@ rb_vmdebug_stack_dump_all_threads(void) https://github.com/ruby/ruby/blob/trunk/vm_dump.c#L1066
 #else
 	fprintf(stderr, "th: %p, native_id: %p\n", th, (void *)th->thread_id);
 #endif
-	rb_vmdebug_stack_dump_raw(th, th->cfp);
+	rb_vmdebug_stack_dump_raw(th, th->ec.cfp);
     }
 }
Index: .gdbinit
===================================================================
--- .gdbinit	(revision 58613)
+++ .gdbinit	(revision 58614)
@@ -1094,8 +1094,8 @@ define rb_ps_thread https://github.com/ruby/ruby/blob/trunk/.gdbinit#L1094
   set $ps_thread_th = (rb_thread_t*)$ps_thread->data
   printf "* #<Thread:%p rb_thread_t:%p native_thread:%p>\n", \
     $ps_thread, $ps_thread_th, $ps_thread_th->thread_id
-  set $cfp = $ps_thread_th->cfp
-  set $cfpend = (rb_control_frame_t *)($ps_thread_th->stack + $ps_thread_th->stack_size)-1
+  set $cfp = $ps_thread_th->ec.cfp
+  set $cfpend = (rb_control_frame_t *)($ps_thread_th->ec.stack + $ps_thread_th->ec.stack_size)-1
   while $cfp < $cfpend
     if $cfp->iseq
       if $cfp->pc
Index: vm_args.c
===================================================================
--- vm_args.c	(revision 58613)
+++ vm_args.c	(revision 58614)
@@ -526,7 +526,7 @@ setup_parameters_complex(rb_thread_t * c https://github.com/ruby/ruby/blob/trunk/vm_args.c#L526
     int given_argc;
     struct args_info args_body, *args;
     VALUE keyword_hash = Qnil;
-    VALUE * const orig_sp = th->cfp->sp;
+    VALUE * const orig_sp = th->ec.cfp->sp;
     unsigned int i;
 
     /*
@@ -546,7 +546,7 @@ setup_parameters_complex(rb_thread_t * c https://github.com/ruby/ruby/blob/trunk/vm_args.c#L546
     for (i=calling->argc; i<iseq->body->param.size; i++) {
 	locals[i] = Qnil;
     }
-    th->cfp->sp = &locals[i];
+    th->ec.cfp->sp = &locals[i];
 
     /* setup args */
     args = &args_body;
@@ -607,7 +607,7 @@ setup_parameters_complex(rb_thread_t * c https://github.com/ruby/ruby/blob/trunk/vm_args.c#L607
 	}
 	else {
 	    if (arg_setup_type == arg_setup_block) {
-		CHECK_VM_STACK_OVERFLOW(th->cfp, min_argc);
+		CHECK_VM_STACK_OVERFLOW(th->ec.cfp, min_argc);
 		given_argc = min_argc;
 		args_extend(args, min_argc);
 	    }
@@ -693,7 +693,7 @@ setup_parameters_complex(rb_thread_t * c https://github.com/ruby/ruby/blob/trunk/vm_args.c#L693
     }
 #endif
 
-    th->cfp->sp = orig_sp;
+    th->ec.cfp->sp = orig_sp;
     return opt_pc;
 }
 
@@ -705,7 +705,8 @@ raise_argument_error(rb_thread_t *th, co https://github.com/ruby/ruby/blob/trunk/vm_args.c#L705
     if (iseq) {
 	vm_push_frame(th, 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->cfp->sp, 0, 0 /* stack_max */);
+		      iseq->body->iseq_encoded,
+		      th->ec.cfp->sp, 0, 0 /* stack_max */);
 	at = rb_threadptr_backtrace_object(th);
 	rb_vm_pop_frame(th);
     }
Index: vm_trace.c
===================================================================
--- vm_trace.c	(revision 58613)
+++ vm_trace.c	(revision 58614)
@@ -359,7 +359,7 @@ rb_threadptr_exec_event_hooks_orig(rb_tr https://github.com/ruby/ruby/blob/trunk/vm_trace.c#L359
 
 	    if (state) {
 		if (pop_p) {
-		    if (VM_FRAME_FINISHED_P(th->cfp)) {
+		    if (VM_FRAME_FINISHED_P(th->ec.cfp)) {
 			th->tag = th->tag->prev;
 		    }
 		    rb_vm_pop_frame(th);
Index: cont.c
===================================================================
--- cont.c	(revision 58613)
+++ cont.c	(revision 58614)
@@ -87,8 +87,8 @@ typedef struct rb_context_struct { https://github.com/ruby/ruby/blob/trunk/cont.c#L87
     VALUE value;
     VALUE *vm_stack;
 #ifdef CAPTURE_JUST_VALID_VM_STACK
-    size_t vm_stack_slen;  /* length of stack (head of th->stack) */
-    size_t vm_stack_clen;  /* length of control frames (tail of th->stack) */
+    size_t vm_stack_slen;  /* length of stack (head of th->ec.stack) */
+    size_t vm_stack_clen;  /* length of control frames (tail of th->ec.stack) */
 #endif
     struct {
 	VALUE *stack;
@@ -221,7 +221,7 @@ cont_free(void *ptr) https://github.com/ruby/ruby/blob/trunk/cont.c#L221
     rb_context_t *cont = ptr;
 
     RUBY_FREE_ENTER("cont");
-    RUBY_FREE_UNLESS_NULL(cont->saved_thread.stack);
+    RUBY_FREE_UNLESS_NULL(cont->saved_thread.ec.stack);
 #if FIBER_USE_NATIVE
     if (cont->type == CONTINUATION_CONTEXT) {
 	/* cont */
@@ -280,7 +280,7 @@ cont_memsize(const void *ptr) https://github.com/ruby/ruby/blob/trunk/cont.c#L280
 #ifdef CAPTURE_JUST_VALID_VM_STACK
 	size_t n = (cont->vm_stack_slen + cont->vm_stack_clen);
 #else
-	size_t n = cont->saved_thread.stack_size;
+	size_t n = cont->saved_thread.ec.stack_size;
 #endif
 	size += n * sizeof(*cont->vm_stack);
     }
@@ -409,10 +409,8 @@ cont_save_thread(rb_context_t *cont, rb_ https://github.com/ruby/ruby/blob/trunk/cont.c#L409
     rb_thread_t *sth = &cont->saved_thread;
 
     /* save thread context */
-    sth->stack = th->stack;
-    sth->stack_size = th->stack_size;
+    sth->ec = th->ec;
     sth->local_storage = th->local_storage;
-    sth->cfp = th->cfp;
     sth->safe_level = th->safe_level;
     sth->raised_flag = th->raised_flag;
     sth->state = th->state;
@@ -470,6 +468,7 @@ cont_capture(volatile int *volatile stat https://github.com/ruby/ruby/blob/trunk/cont.c#L468
     rb_context_t *volatile cont;
     rb_thread_t *th = GET_THREAD();
     volatile VALUE contval;
+    rb_execution_context_t *ec = &th->ec;
 
     THREAD_MUST_BE_RUNNING(th);
     rb_vm_stack_to_heap(th);
@@ -477,16 +476,17 @@ cont_capture(volatile int *volatile stat https://github.com/ruby/ruby/blob/trunk/cont.c#L476
     contval = cont->self;
 
 #ifdef CAPTURE_JUST_VALID_VM_STACK
-    cont->vm_stack_slen = th->cfp->sp - th->stack;
-    cont->vm_stack_clen = th->stack + th->stack_size - (VALUE*)th->cfp;
+    cont->vm_stack_slen = ec->cfp->sp - ec->stack;
+    cont->vm_stack_clen = ec->stack + ec->stack_size - (VALUE*)ec->cfp;
     cont->vm_stack = ALLOC_N(VALUE, cont->vm_stack_slen + cont->vm_stack_clen);
-    MEMCPY(cont->vm_stack, th->stack, VALUE, cont->vm_stack_slen);
-    MEMCPY(cont->vm_stack + cont->vm_stack_slen, (VALUE*)th->cfp, VALUE, cont->vm_stack_clen);
+    MEMCPY(cont->vm_stack, ec->stack, VALUE, cont->vm_stack_slen);
+    MEMCPY(cont->vm_stack + cont->vm_stack_slen,
+		(VALUE*)ec->cfp, VALUE, cont->vm_stack_clen);
 #else
-    cont->vm_stack = ALLOC_N(VALUE, th->stack_size);
-    MEMCPY(cont->vm_stack, th->stack, VALUE, th->stack_size);
+    cont->vm_stack = ALLOC_N(VALUE, ec->stack_size);
+    MEMCPY(cont->vm_stack, ec->stack, VALUE, ec->stack_size);
 #endif
-    cont->saved_thread.stack = NULL;
+    cont->saved_thread.ec.stack = NULL;
 
     cont_save_machine_stack(th, cont);
 
@@ -535,30 +535,30 @@ cont_restore_thread(rb_context_t *cont) https://github.com/ruby/ruby/blob/trunk/cont.c#L535
 	th->fiber = sth->fiber;
 	fib = th->fiber ? th->fiber : th->root_fiber;
 
-	if (fib && fib->cont.saved_thread.stack) {
-	    th->stack_size = fib->cont.saved_thread.stack_size;
-	    th->stack = fib->cont.saved_thread.stack;
+	if (fib && fib->cont.saved_thread.ec.stack) {
+	    th->ec.stack_size = fib->cont.saved_thread.ec.stack_size;
+	    th->ec.stack = fib->cont.saved_thread.ec.stack;
 	}
 #ifdef CAPTURE_JUST_VALID_VM_STACK
-	MEMCPY(th->stack, cont->vm_stack, VALUE, cont->vm_stack_slen);
-	MEMCPY(th->stack + sth->stack_size - cont->vm_stack_clen,
+	MEMCPY(th->ec.stack, cont->vm_stack, VALUE, cont->vm_stack_slen);
+	MEMCPY(th->ec.stack + sth->ec.stack_size - cont->vm_stack_clen,
 	       cont->vm_stack + cont->vm_stack_slen, VALUE, cont->vm_stack_clen);
 #else
-	MEMCPY(th->stack, cont->vm_stack, VALUE, sth->stack_size);
+	MEMCPY(th->ec.stack, cont->vm_stack, VALUE, sth->ec.stack_size);
 #endif
     }
     else {
 	/* fiber */
-	th->stack = sth->stack;
-	sth->stack = NULL;
-	th->stack_size = sth->stack_size;
+	th->ec.stack = sth->ec.stack;
+	sth->ec.stack = NULL;
+	th->ec.stack_size = sth->ec.stack_size;
 	th->local_storage = sth->local_storage;
 	th->local_storage_recursive_hash = sth->local_storage_recursive_hash;
 	th->local_storage_recursive_hash_for_trace = sth->local_storage_recursive_hash_for_trace;
 	th->fiber = (rb_fiber_t*)cont;
     }
 
-    th->cfp = sth->cfp;
+    th->ec.cfp = sth->ec.cfp;
     th->safe_level = sth->safe_level;
     th->raised_flag = sth->raised_flag;
     th->state = sth->state;
@@ -1208,12 +1208,12 @@ fiber_init(VALUE fibval, VALUE proc) https://github.com/ruby/ruby/blob/trunk/cont.c#L1208
     /* initialize cont */
     cont->vm_stack = 0;
 
-    th->stack = NULL;
-    th->stack_size = 0;
+    th->ec.stack = NULL;
+    th->ec.stack_size = 0;
 
-    th->stack_size = cth->vm->default_params.fiber_vm_stack_size / sizeof(VALUE);
-    th->stack = ALLOC_N(VALUE, th->stack_size);
-    th->cfp = (void *)(th->stack + th->stack_size);
+    th->ec.stack_size = cth->vm->default_params.fiber_vm_stack_size / sizeof(VALUE);
+    th->ec.stack = ALLOC_N(VALUE, th->ec.stack_size);
+    th->ec.cfp = (void *)(th->ec.stack + th->ec.stack_size);
 
     rb_vm_push_frame(th,
 		     NULL,
@@ -1222,7 +1222,7 @@ fiber_init(VALUE fibval, VALUE proc) https://github.com/ruby/ruby/blob/trunk/cont.c#L1222
 		     VM_BLOCK_HANDLER_NONE,
 		     0, /* specval */
 		     NULL, /* pc */
-		     th->stack, /* sp */
+		     th->ec.stack, /* sp */
 		     0, /* local_size */
 		     0);
 
Index: vm_method.c
===================================================================
--- vm_method.c	(revision 58613)
+++ vm_method.c	(revision 58614)
@@ -264,7 +264,7 @@ method_definition_set(const rb_method_en https://github.com/ruby/ruby/blob/trunk/vm_method.c#L264
 
 		def->body.attr.id = (ID)(VALUE)opts;
 
-		cfp = rb_vm_get_ruby_level_next_cfp(th, th->cfp);
+		cfp = rb_vm_get_ruby_level_next_cfp(th, th->ec.cfp);
 
 		if (cfp && (line = rb_vm_get_sourceline(cfp))) {
 		    VALUE location = rb_ary_new3(2, cfp->iseq->body->location.path, INT2FIX(line));
@@ -1088,7 +1088,7 @@ static rb_method_visibility_t https://github.com/ruby/ruby/blob/trunk/vm_method.c#L1088
 rb_scope_visibility_get(void)
 {
     rb_thread_t *th = GET_THREAD();
-    rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(th, th->cfp);
+    rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(th, th->ec.cfp);
 
     if (!vm_env_cref_by_cref(cfp->ep)) {
 	return METHOD_VISI_PUBLIC;
@@ -1102,7 +1102,7 @@ static int https://github.com/ruby/ruby/blob/trunk/vm_method.c#L1102
 rb_scope_module_func_check(void)
 {
     rb_thread_t *th = GET_THREAD();
-    rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(th, th->cfp);
+    rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(th, th->ec.cfp);
 
     if (!vm_env_cref_by_cref(cfp->ep)) {
 	return FALSE;
Index: eval_intern.h
===================================================================
--- eval_intern.h	(revision 58613)
+++ eval_intern.h	(revision 58614)
@@ -14,10 +14,10 @@ vm_passed_block_handler_set(rb_thread_t https://github.com/ruby/ruby/blob/trunk/eval_intern.h#L14
 static inline void
 pass_passed_block_handler(rb_thread_t *th)
 {
-    VALUE block_handler = rb_vm_frame_block_handler(th->cfp);
+    VALUE block_handler = rb_vm_frame_block_handler(th->ec.cfp);
     VM_ASSERT(vm_block_handler_verify(block_handler));
     vm_passed_block_handler_set(th, block_handler);
-    VM_ENV_FLAGS_SET(th->cfp->ep, VM_FRAME_FLAG_PASSED);
+    VM_ENV_FLAGS_SET(th->ec.cfp->ep, VM_FRAME_FLAG_PASSED);
 }
 
 #define PASS_PASSED_BLOCK_HANDLER_TH(th) pass_passed_block_handler(th)
Index: error.c
===================================================================
--- error.c	(revision 58613)
+++ error.c	(revision 58614)
@@ -1279,7 +1279,8 @@ name_err_initialize(int argc, VALUE *arg https://github.com/ruby/ruby/blob/trunk/error.c#L1279
     {
 	rb_thread_t *th = GET_THREAD();
 	rb_control_frame_t *cfp =
-	    rb_vm_get_ruby_level_next_cfp(th, RUBY_VM_PREVIOUS_CONTROL_FRAME(th->cfp));
+	    rb_vm_get_ruby_level_next_cfp(th,
+				    RUBY_VM_PREVIOUS_CONTROL_FRAME(th->ec.cfp));
 	if (cfp) iseqw = rb_iseqw_new(cfp->iseq);
     }
     rb_ivar_set(self, id_iseq, iseqw);
Index: thread.c
===================================================================
--- thread.c	(revision 58613)
+++ thread.c	(revision 58614)
@@ -690,8 +690,8 @@ thread_start_func_2(rb_thread_t *th, VAL https://github.com/ruby/ruby/blob/trunk/thread.c#L690
 	rb_check_deadlock(th->vm);
 
 	if (!th->root_fiber) {
-	    rb_thread_recycle_stack_release(th->stack);
-	    th->stack = 0;
+	    rb_thread_recycle_stack_release(th->ec.stack);
+	    th->ec.stack = 0;
 	}
     }
     native_mutex_lock(&th->vm->thread_destruct_lock);
@@ -2095,7 +2095,8 @@ rb_threadptr_execute_interrupts(rb_threa https://github.com/ruby/ruby/blob/trunk/thread.c#L2095
 	    if (th->status == THREAD_RUNNABLE)
 		th->running_time_us += TIME_QUANTUM_USEC;
 
-	    EXEC_EVENT_HOOK(th, RUBY_INTERNAL_EVENT_SWITCH, th->cfp->self, 0, 0, 0, Qundef);
+	    EXEC_EVENT_HOOK(th, RUBY_INTERNAL_EVENT_SWITCH, th->ec.cfp->self,
+			    0, 0, 0, Qundef);
 
 	    rb_thread_schedule_limits(limits_us);
 	}
@@ -4996,7 +4997,7 @@ rb_check_deadlock(rb_vm_t *vm) https://github.com/ruby/ruby/blob/trunk/thread.c#L4997
 static void
 update_coverage(rb_event_flag_t event, VALUE proc, VALUE self, ID id, VALUE klass)
 {
-    VALUE coverage = rb_iseq_coverage(GET_THREAD()->cfp->iseq);
+    VALUE coverage = rb_iseq_coverage(GET_THREAD()->ec.cfp->iseq);
     if (RB_TYPE_P(coverage, T_ARRAY) && !RBASIC_CLASS(coverage)) {
 	long line = rb_sourceline() - 1;
 	long count;
Index: gc.c
===================================================================
--- gc.c	(revision 58613)
+++ gc.c	(revision 58614)
@@ -1755,7 +1755,7 @@ rb_objspace_set_event_hook(const rb_even https://github.com/ruby/ruby/blob/trunk/gc.c#L1755
 static void
 gc_event_hook_body(rb_thread_t *th, rb_objspace_t *objspace, const rb_event_flag_t event, VALUE data)
 {
-    EXEC_EVENT_HOOK(th, event, th->cfp->self, 0, 0, 0, data);
+    EXEC_EVENT_HOOK(th, event, th->ec.cfp->self, 0, 0, 0, data);
 }
 
 #define gc_event_hook_available_p(objspace) ((objspace)->flags.has_hook)
Index: vm_core.h
===================================================================
--- vm_core.h	(revision 58613)
+++ vm_core.h	(revision 58614)
@@ -696,15 +696,19 @@ typedef char rb_thread_id_string_t[sizeo https://gi (... truncated)

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

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