summaryrefslogtreecommitdiff
path: root/eval_intern.h
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-26 08:32:49 (GMT)
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-26 08:32:49 (GMT)
commit837fd5e494731d7d44786f29e7d6e8c27029806f (patch)
tree7ccbb6b6733ccb07c28b7df28e3e2a6b604cc731 /eval_intern.h
parent07f04f468d729b399b794198c61516f2e8ac0a89 (diff)
Use rb_execution_context_t instead of rb_thread_t
to represent execution context [Feature #14038] * vm_core.h (rb_thread_t): rb_thread_t::ec is now a pointer. There are many code using `th` to represent execution context (such as cfp, VM stack and so on). To access `ec`, they need to use `th->ec->...` (adding one indirection) so that we need to replace them by passing `ec` instead of `th`. * vm_core.h (GET_EC()): introduced to access current ec. Also remove `ruby_current_thread` global variable. * cont.c (rb_context_t): introduce rb_context_t::thread_ptr instead of rb_context_t::thread_value. * cont.c (ec_set_vm_stack): added to update vm_stack explicitly. * cont.c (ec_switch): added to switch ec explicitly. * cont.c (rb_fiber_close): added to terminate fibers explicitly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval_intern.h')
-rw-r--r--eval_intern.h30
1 files changed, 15 insertions, 15 deletions
diff --git a/eval_intern.h b/eval_intern.h
index 217eddc..229b34b 100644
--- a/eval_intern.h
+++ b/eval_intern.h
@@ -14,10 +14,10 @@ vm_passed_block_handler_set(rb_thread_t *th, VALUE block_handler)
static inline void
pass_passed_block_handler(rb_thread_t *th)
{
- VALUE block_handler = rb_vm_frame_block_handler(th->ec.cfp);
+ VALUE block_handler = rb_vm_frame_block_handler(th->ec->cfp);
vm_block_handler_verify(block_handler);
vm_passed_block_handler_set(th, block_handler);
- VM_ENV_FLAGS_SET(th->ec.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)
@@ -133,16 +133,16 @@ LONG WINAPI rb_w32_stack_overflow_handler(struct _EXCEPTION_POINTERS *);
struct rb_vm_tag _tag; \
_tag.state = TAG_NONE; \
_tag.tag = Qundef; \
- _tag.prev = _th->ec.tag;
+ _tag.prev = _th->ec->tag;
#define TH_POP_TAG() \
- _th->ec.tag = _tag.prev; \
+ _th->ec->tag = _tag.prev; \
} while (0)
#define TH_TMPPOP_TAG() \
- _th->ec.tag = _tag.prev
+ _th->ec->tag = _tag.prev
-#define TH_REPUSH_TAG() (void)(_th->ec.tag = &_tag)
+#define TH_REPUSH_TAG() (void)(_th->ec->tag = &_tag)
#define PUSH_TAG() TH_PUSH_TAG(GET_THREAD())
#define POP_TAG() TH_POP_TAG()
@@ -174,12 +174,12 @@ LONG WINAPI rb_w32_stack_overflow_handler(struct _EXCEPTION_POINTERS *);
#undef RB_OBJ_WRITE
#define RB_OBJ_WRITE(a, slot, b) UNALIGNED_MEMBER_ACCESS(rb_obj_write((VALUE)(a), (VALUE *)(slot), (VALUE)(b), __FILE__, __LINE__))
-/* clear th->ec.tag->state, and return the value */
+/* clear th->ec->tag->state, and return the value */
static inline int
rb_threadptr_tag_state(rb_thread_t *th)
{
- enum ruby_tag_type state = th->ec.tag->state;
- th->ec.tag->state = TAG_NONE;
+ enum ruby_tag_type state = th->ec->tag->state;
+ th->ec->tag->state = TAG_NONE;
return state;
}
@@ -187,8 +187,8 @@ NORETURN(static inline void rb_threadptr_tag_jump(rb_thread_t *, enum ruby_tag_t
static inline void
rb_threadptr_tag_jump(rb_thread_t *th, enum ruby_tag_type st)
{
- th->ec.tag->state = st;
- ruby_longjmp(th->ec.tag->buf, 1);
+ th->ec->tag->state = st;
+ ruby_longjmp(th->ec->tag->buf, 1);
}
/*
@@ -282,10 +282,10 @@ enum {
};
int rb_threadptr_set_raised(rb_thread_t *th);
int rb_threadptr_reset_raised(rb_thread_t *th);
-#define rb_thread_raised_set(th, f) ((th)->ec.raised_flag |= (f))
-#define rb_thread_raised_reset(th, f) ((th)->ec.raised_flag &= ~(f))
-#define rb_thread_raised_p(th, f) (((th)->ec.raised_flag & (f)) != 0)
-#define rb_thread_raised_clear(th) ((th)->ec.raised_flag = 0)
+#define rb_thread_raised_set(th, f) ((th)->ec->raised_flag |= (f))
+#define rb_thread_raised_reset(th, f) ((th)->ec->raised_flag &= ~(f))
+#define rb_thread_raised_p(th, f) (((th)->ec->raised_flag & (f)) != 0)
+#define rb_thread_raised_clear(th) ((th)->ec->raised_flag = 0)
int rb_threadptr_stack_check(rb_thread_t *th);
VALUE rb_f_eval(int argc, const VALUE *argv, VALUE self);