1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

th->ec: rb_load_internal0

* load.c (rb_load_internal0): accepts `ec`.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60689 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2017-11-07 05:45:46 +00:00
parent 8d8e339d76
commit 8b7f06d2d6

23
load.c
View file

@ -578,9 +578,10 @@ NORETURN(static void load_failed(VALUE));
const rb_iseq_t *rb_iseq_load_iseq(VALUE fname); const rb_iseq_t *rb_iseq_load_iseq(VALUE fname);
static int static int
rb_load_internal0(rb_thread_t *th, VALUE fname, int wrap) rb_load_internal0(rb_execution_context_t *ec, VALUE fname, int wrap)
{ {
enum ruby_tag_type state; enum ruby_tag_type state;
rb_thread_t *th = rb_ec_thread_ptr(ec);
volatile VALUE wrapper = th->top_wrapper; volatile VALUE wrapper = th->top_wrapper;
volatile VALUE self = th->top_self; volatile VALUE self = th->top_self;
#if !defined __GNUC__ #if !defined __GNUC__
@ -646,11 +647,11 @@ rb_load_internal0(rb_thread_t *th, VALUE fname, int wrap)
static void static void
rb_load_internal(VALUE fname, int wrap) rb_load_internal(VALUE fname, int wrap)
{ {
rb_thread_t *curr_th = GET_THREAD(); rb_execution_context_t *ec = GET_EC();
int state = rb_load_internal0(curr_th, fname, wrap); int state = rb_load_internal0(ec, fname, wrap);
if (state) { if (state) {
if (state == TAG_RAISE) rb_exc_raise(curr_th->ec->errinfo); if (state == TAG_RAISE) rb_exc_raise(ec->errinfo);
EC_JUMP_TAG(curr_th->ec, state); EC_JUMP_TAG(ec, state);
} }
} }
@ -680,7 +681,7 @@ rb_load_protect(VALUE fname, int wrap, int *pstate)
} }
POP_TAG(); POP_TAG();
if (state == TAG_NONE) state = rb_load_internal0(GET_THREAD(), path, wrap); if (state == TAG_NONE) state = rb_load_internal0(GET_EC(), path, wrap);
if (state != TAG_NONE) *pstate = state; if (state != TAG_NONE) *pstate = state;
} }
@ -963,8 +964,8 @@ int
rb_require_internal(VALUE fname, int safe) rb_require_internal(VALUE fname, int safe)
{ {
volatile int result = -1; volatile int result = -1;
rb_thread_t *th = GET_THREAD(); rb_execution_context_t *ec = GET_EC();
volatile VALUE errinfo = th->ec->errinfo; volatile VALUE errinfo = ec->errinfo;
enum ruby_tag_type state; enum ruby_tag_type state;
struct { struct {
int safe; int safe;
@ -976,7 +977,7 @@ rb_require_internal(VALUE fname, int safe)
path = rb_str_encode_ospath(fname); path = rb_str_encode_ospath(fname);
RUBY_DTRACE_HOOK(REQUIRE_ENTRY, RSTRING_PTR(fname)); RUBY_DTRACE_HOOK(REQUIRE_ENTRY, RSTRING_PTR(fname));
EC_PUSH_TAG(th->ec); EC_PUSH_TAG(ec);
saved.safe = rb_safe_level(); saved.safe = rb_safe_level();
if ((state = EXEC_TAG()) == TAG_NONE) { if ((state = EXEC_TAG()) == TAG_NONE) {
long handle; long handle;
@ -999,7 +1000,7 @@ rb_require_internal(VALUE fname, int safe)
else { else {
switch (found) { switch (found) {
case 'r': case 'r':
state = rb_load_internal0(th, path, 0); state = rb_load_internal0(ec, path, 0);
break; break;
case 's': case 's':
@ -1025,7 +1026,7 @@ rb_require_internal(VALUE fname, int safe)
return state; return state;
} }
th->ec->errinfo = errinfo; ec->errinfo = errinfo;
RUBY_DTRACE_HOOK(REQUIRE_RETURN, RSTRING_PTR(fname)); RUBY_DTRACE_HOOK(REQUIRE_RETURN, RSTRING_PTR(fname));