summaryrefslogtreecommitdiff
path: root/cont.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-06 05:41:48 (GMT)
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-06 05:41:48 (GMT)
commite5e735549db7f678cf0174d4103df8c98651da36 (patch)
tree0cc3302d269376c8031bcd97c73e5afd30b1632c /cont.c
parent54e58c947b119ff02fde57413ae104c98432c48d (diff)
renmae ec::fiber to ec::fiber_ptr.
* vm_core.h (rb_execution_context_t): renmae ec::fiber to ec::fiber_ptr make consistent with ec::thread_ptr. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'cont.c')
-rw-r--r--cont.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/cont.c b/cont.c
index b4f9fce..889c35c 100644
--- a/cont.c
+++ b/cont.c
@@ -192,7 +192,7 @@ static void
fiber_verify(const rb_fiber_t *fib)
{
#if VM_CHECK_MODE > 0
- VM_ASSERT(fib->cont.saved_ec.fiber == fib);
+ VM_ASSERT(fib->cont.saved_ec.fiber_ptr == fib);
switch (fib->status) {
case FIBER_RESUMED:
@@ -241,7 +241,7 @@ ec_switch(rb_thread_t *th, rb_fiber_t *fib)
{
rb_execution_context_t *ec = &fib->cont.saved_ec;
ruby_current_execution_context_ptr = th->ec = ec;
- VM_ASSERT(ec->fiber->cont.self == 0 || ec->vm_stack != NULL);
+ VM_ASSERT(ec->fiber_ptr->cont.self == 0 || ec->vm_stack != NULL);
}
static const rb_data_type_t cont_data_type, fiber_data_type;
@@ -657,7 +657,7 @@ static inline void
fiber_restore_thread(rb_thread_t *th, rb_fiber_t *fib)
{
ec_switch(th, fib);
- VM_ASSERT(th->ec->fiber == fib);
+ VM_ASSERT(th->ec->fiber_ptr == fib);
}
static inline void
@@ -671,8 +671,8 @@ cont_restore_thread(rb_context_t *cont)
rb_execution_context_t *sec = &cont->saved_ec;
rb_fiber_t *fib = NULL;
- if (sec->fiber != NULL) {
- fib = sec->fiber;
+ if (sec->fiber_ptr != NULL) {
+ fib = sec->fiber_ptr;
}
else if (th->root_fiber) {
fib = th->root_fiber;
@@ -1203,8 +1203,8 @@ rb_cont_call(int argc, VALUE *argv, VALUE contval)
if (cont->saved_ec.protect_tag != th->ec->protect_tag) {
rb_raise(rb_eRuntimeError, "continuation called across stack rewinding barrier");
}
- if (cont->saved_ec.fiber) {
- if (th->ec->fiber != cont->saved_ec.fiber) {
+ if (cont->saved_ec.fiber_ptr) {
+ if (th->ec->fiber_ptr != cont->saved_ec.fiber_ptr) {
rb_raise(rb_eRuntimeError, "continuation called across fiber");
}
}
@@ -1311,7 +1311,7 @@ fiber_t_alloc(VALUE fibval)
fib->cont.self = fibval;
fib->cont.type = FIBER_CONTEXT;
cont_init(&fib->cont, th);
- fib->cont.saved_ec.fiber = fib;
+ fib->cont.saved_ec.fiber_ptr = fib;
fib->prev = NULL;
/* fib->status == 0 == CREATED
@@ -1395,7 +1395,7 @@ void
rb_fiber_start(void)
{
rb_thread_t * volatile th = GET_THREAD();
- rb_fiber_t *fib = th->ec->fiber;
+ rb_fiber_t *fib = th->ec->fiber_ptr;
rb_proc_t *proc;
enum ruby_tag_type state;
@@ -1441,7 +1441,7 @@ static rb_fiber_t *
root_fiber_alloc(rb_thread_t *th)
{
VALUE fibval = fiber_alloc(rb_cFiber);
- rb_fiber_t *fib = th->ec->fiber;
+ rb_fiber_t *fib = th->ec->fiber_ptr;
VM_ASSERT(DATA_PTR(fibval) == NULL);
VM_ASSERT(fib->cont.type == ROOT_FIBER_CONTEXT);
@@ -1466,7 +1466,7 @@ rb_threadptr_root_fiber_setup(rb_thread_t *th)
rb_fiber_t *fib = ruby_mimmalloc(sizeof(rb_fiber_t));
MEMZERO(fib, rb_fiber_t, 1);
fib->cont.type = ROOT_FIBER_CONTEXT;
- fib->cont.saved_ec.fiber = fib;
+ fib->cont.saved_ec.fiber_ptr = fib;
fib->cont.saved_ec.thread_ptr = th;
fiber_status_set(fib, FIBER_RESUMED); /* skip CREATED */
th->ec = &fib->cont.saved_ec;
@@ -1486,9 +1486,9 @@ rb_threadptr_root_fiber_release(rb_thread_t *th)
/* ignore. A root fiber object will free th->ec */
}
else {
- VM_ASSERT(th->ec->fiber->cont.type == ROOT_FIBER_CONTEXT);
- VM_ASSERT(th->ec->fiber->cont.self == 0);
- fiber_free(th->ec->fiber);
+ VM_ASSERT(th->ec->fiber_ptr->cont.type == ROOT_FIBER_CONTEXT);
+ VM_ASSERT(th->ec->fiber_ptr->cont.self == 0);
+ fiber_free(th->ec->fiber_ptr);
if (th->ec == ruby_current_execution_context_ptr) {
ruby_current_execution_context_ptr = NULL;
@@ -1501,10 +1501,10 @@ static inline rb_fiber_t*
fiber_current(void)
{
rb_thread_t *th = GET_THREAD();
- if (th->ec->fiber->cont.self == 0) {
+ if (th->ec->fiber_ptr->cont.self == 0) {
root_fiber_alloc(th);
}
- return th->ec->fiber;
+ return th->ec->fiber_ptr;
}
static inline rb_fiber_t*
@@ -1541,8 +1541,8 @@ fiber_store(rb_fiber_t *next_fib, rb_thread_t *th)
{
rb_fiber_t *fib;
- if (th->ec->fiber != NULL) {
- fib = th->ec->fiber;
+ if (th->ec->fiber_ptr != NULL) {
+ fib = th->ec->fiber_ptr;
}
else {
/* create root fiber */
@@ -1589,14 +1589,14 @@ fiber_store(rb_fiber_t *next_fib, rb_thread_t *th)
terminated_machine_stack.size = 0;
}
#endif /* not _WIN32 */
- fib = th->ec->fiber;
+ fib = th->ec->fiber_ptr;
if (fib->cont.argc == -1) rb_exc_raise(fib->cont.value);
return fib->cont.value;
#else /* FIBER_USE_NATIVE */
if (ruby_setjmp(fib->cont.jmpbuf)) {
/* restored */
- fib = th->ec->fiber;
+ fib = th->ec->fiber_ptr;
if (fib->cont.argc == -1) rb_exc_raise(fib->cont.value);
if (next_fib->cont.value == Qundef) {
cont_restore_0(&next_fib->cont, &next_fib->cont.value);
@@ -1622,7 +1622,7 @@ fiber_switch(rb_fiber_t *fib, int argc, const VALUE *argv, int is_resume)
/* make sure the root_fiber object is available */
if (th->root_fiber == NULL) root_fiber_alloc(th);
- if (th->ec->fiber == fib) {
+ if (th->ec->fiber_ptr == fib) {
/* ignore fiber context switch
* because destination fiber is same as current fiber
*/
@@ -1638,7 +1638,7 @@ fiber_switch(rb_fiber_t *fib, int argc, const VALUE *argv, int is_resume)
else if (FIBER_TERMINATED_P(fib)) {
value = rb_exc_new2(rb_eFiberError, "dead fiber called");
- if (!FIBER_TERMINATED_P(th->ec->fiber)) {
+ if (!FIBER_TERMINATED_P(th->ec->fiber_ptr)) {
rb_exc_raise(value);
VM_UNREACHABLE(fiber_switch);
}
@@ -1652,7 +1652,7 @@ fiber_switch(rb_fiber_t *fib, int argc, const VALUE *argv, int is_resume)
cont->argc = -1;
cont->value = value;
#if FIBER_USE_NATIVE
- fiber_setcontext(th->root_fiber, th->ec->fiber);
+ fiber_setcontext(th->root_fiber, th->ec->fiber_ptr);
#else
cont_restore_0(cont, &value);
#endif
@@ -1751,7 +1751,7 @@ rb_fiber_reset_root_local_storage(VALUE thval)
{
rb_thread_t *th = rb_thread_ptr(thval);
- if (th->root_fiber && th->root_fiber != th->ec->fiber) {
+ if (th->root_fiber && th->root_fiber != th->ec->fiber_ptr) {
th->ec->local_storage = th->root_fiber->cont.saved_ec.local_storage;
}
}