summaryrefslogtreecommitdiff
path: root/cont.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-06-26 07:56:44 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-06-26 07:56:44 +0000
commit1939d097e650a60557eafbd89a6684f4626e0ad5 (patch)
tree62a3065ee36528808c6dd58a23011df911fc3820 /cont.c
parent043523adc5275b640f5bb33bd05513194dabf61d (diff)
move several fields from rb_thread_t to rb_execution_context_t.
* vm_core.h (rb_thread_t): move several fields which are copied at cont.c to rb_execution_context_t. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'cont.c')
-rw-r--r--cont.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/cont.c b/cont.c
index 16c8297fe6..b8572b495a 100644
--- a/cont.c
+++ b/cont.c
@@ -164,7 +164,7 @@ static VALUE rb_eFiberError;
NOINLINE(static VALUE cont_capture(volatile int *volatile stat));
#define THREAD_MUST_BE_RUNNING(th) do { \
- if (!(th)->tag) rb_raise(rb_eThreadError, "not running thread"); \
+ if (!(th)->ec.tag) rb_raise(rb_eThreadError, "not running thread"); \
} while (0)
static void
@@ -410,12 +410,9 @@ cont_save_thread(rb_context_t *cont, rb_thread_t *th)
/* save thread context */
sth->ec = th->ec;
+
sth->local_storage = th->local_storage;
- sth->safe_level = th->safe_level;
- sth->raised_flag = th->raised_flag;
VM_ASSERT(th->status == THREAD_RUNNABLE);
- sth->tag = th->tag;
- sth->protect_tag = th->protect_tag;
sth->errinfo = th->errinfo;
sth->first_proc = th->first_proc;
sth->root_lep = th->root_lep;
@@ -548,6 +545,10 @@ cont_restore_thread(rb_context_t *cont)
/* other members of ec */
th->ec.cfp = sth->ec.cfp;
+ th->ec.safe_level = sth->ec.safe_level;
+ th->ec.raised_flag = sth->ec.raised_flag;
+ th->ec.tag = sth->ec.tag;
+ th->ec.protect_tag = sth->ec.protect_tag;
}
else {
/* fiber */
@@ -561,10 +562,6 @@ cont_restore_thread(rb_context_t *cont)
th->fiber = (rb_fiber_t*)cont;
}
- th->safe_level = sth->safe_level;
- th->raised_flag = sth->raised_flag;
- th->tag = sth->tag;
- th->protect_tag = sth->protect_tag;
th->errinfo = sth->errinfo;
th->first_proc = sth->first_proc;
th->root_lep = sth->root_lep;
@@ -1066,7 +1063,7 @@ rb_cont_call(int argc, VALUE *argv, VALUE contval)
if (cont->saved_thread.self != th->self) {
rb_raise(rb_eRuntimeError, "continuation called across threads");
}
- if (cont->saved_thread.protect_tag != th->protect_tag) {
+ if (cont->saved_thread.ec.protect_tag != th->ec.protect_tag) {
rb_raise(rb_eRuntimeError, "continuation called across stack rewinding barrier");
}
if (cont->saved_thread.fiber) {
@@ -1228,7 +1225,7 @@ fiber_init(VALUE fibval, VALUE proc)
0, /* local_size */
0);
- th->tag = 0;
+ th->ec.tag = 0;
th->local_storage = st_init_numtable();
th->local_storage_recursive_hash = Qnil;
th->local_storage_recursive_hash_for_trace = Qnil;
@@ -1432,7 +1429,7 @@ fiber_switch(rb_fiber_t *fib, int argc, const VALUE *argv, int is_resume)
if (cont->saved_thread.self != th->self) {
rb_raise(rb_eFiberError, "fiber called across threads");
}
- else if (cont->saved_thread.protect_tag != th->protect_tag) {
+ else if (cont->saved_thread.ec.protect_tag != th->ec.protect_tag) {
rb_raise(rb_eFiberError, "fiber called across stack rewinding barrier");
}
else if (fib->status == FIBER_TERMINATED) {