diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-10 19:00:08 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-10 19:00:08 +0000 |
commit | b53b37758d61e0367b6ca38d16011833cf95c0b1 (patch) | |
tree | 427e988789e5078559e5800b14e21b13f9db1aae /vm_insnhelper.c | |
parent | 2a01ac897d98e1794666782ece6673185613171a (diff) | |
download | ruby-b53b37758d61e0367b6ca38d16011833cf95c0b1.tar.gz |
store ec instead of thread in rb_context_t.
* cont.c (rb_context_t): introduce saved_ec instaad of saved_thread.
We only need to transfer ec data (not all of thread data).
Introduce `thread_value` field to point creation thread.
To acccess this field, `cont_thread_value()` is introduced.
* vm.c (rb_execution_context_mark): remove `static` and use it
from cont.c (use this function instead of `rb_thread_mark`).
* vm_insnhelper.c (rb_vm_push_frame): accept ec instead of th.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r-- | vm_insnhelper.c | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c index c38725e3f0..1678100eab 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -197,18 +197,18 @@ vm_check_frame(VALUE type, #endif /* VM_CHECK_MODE > 0 */ static inline rb_control_frame_t * -vm_push_frame(rb_thread_t *th, - const rb_iseq_t *iseq, - VALUE type, - VALUE self, - VALUE specval, - VALUE cref_or_me, - const VALUE *pc, - VALUE *sp, - int local_size, - int stack_max) +vm_push_frame_(rb_execution_context_t *ec, + const rb_iseq_t *iseq, + VALUE type, + VALUE self, + VALUE specval, + VALUE cref_or_me, + const VALUE *pc, + VALUE *sp, + int local_size, + int stack_max) { - rb_control_frame_t *const cfp = th->ec.cfp - 1; + rb_control_frame_t *const cfp = ec->cfp - 1; int i; vm_check_frame(type, specval, cref_or_me, iseq); @@ -217,7 +217,7 @@ vm_push_frame(rb_thread_t *th, /* check stack overflow */ CHECK_VM_STACK_OVERFLOW0(cfp, sp, local_size + stack_max); - th->ec.cfp = cfp; + ec->cfp = cfp; /* setup new frame */ cfp->pc = (VALUE *)pc; @@ -254,8 +254,23 @@ vm_push_frame(rb_thread_t *th, return cfp; } +static rb_control_frame_t * +vm_push_frame(rb_thread_t *th, + const rb_iseq_t *iseq, + VALUE type, + VALUE self, + VALUE specval, + VALUE cref_or_me, + const VALUE *pc, + VALUE *sp, + int local_size, + int stack_max) +{ + return vm_push_frame_(&th->ec, iseq, type, self, specval, cref_or_me, pc, sp, local_size, stack_max); +} + rb_control_frame_t * -rb_vm_push_frame(rb_thread_t *th, +rb_vm_push_frame(rb_execution_context_t *ec, const rb_iseq_t *iseq, VALUE type, VALUE self, @@ -266,7 +281,7 @@ rb_vm_push_frame(rb_thread_t *th, int local_size, int stack_max) { - return vm_push_frame(th, iseq, type, self, specval, cref_or_me, pc, sp, local_size, stack_max); + return vm_push_frame_(ec, iseq, type, self, specval, cref_or_me, pc, sp, local_size, stack_max); } /* return TRUE if the frame is finished */ |