mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Pack values to preserve
This commit is contained in:
parent
f0f9e77b65
commit
635e1c5282
1 changed files with 8 additions and 6 deletions
14
load.c
14
load.c
|
@ -1028,9 +1028,11 @@ require_internal(rb_execution_context_t *ec, VALUE fname, int exception)
|
||||||
{
|
{
|
||||||
volatile int result = -1;
|
volatile int result = -1;
|
||||||
rb_thread_t *th = rb_ec_thread_ptr(ec);
|
rb_thread_t *th = rb_ec_thread_ptr(ec);
|
||||||
volatile VALUE wrapper = th->top_wrapper;
|
volatile const struct {
|
||||||
volatile VALUE self = th->top_self;
|
VALUE wrapper, self, errinfo;
|
||||||
volatile VALUE errinfo = ec->errinfo;
|
} saved = {
|
||||||
|
th->top_wrapper, th->top_self, ec->errinfo,
|
||||||
|
};
|
||||||
enum ruby_tag_type state;
|
enum ruby_tag_type state;
|
||||||
char *volatile ftptr = 0;
|
char *volatile ftptr = 0;
|
||||||
VALUE path;
|
VALUE path;
|
||||||
|
@ -1082,8 +1084,8 @@ require_internal(rb_execution_context_t *ec, VALUE fname, int exception)
|
||||||
EC_POP_TAG();
|
EC_POP_TAG();
|
||||||
|
|
||||||
rb_thread_t *th2 = rb_ec_thread_ptr(ec);
|
rb_thread_t *th2 = rb_ec_thread_ptr(ec);
|
||||||
th2->top_self = self;
|
th2->top_self = saved.self;
|
||||||
th2->top_wrapper = wrapper;
|
th2->top_wrapper = saved.wrapper;
|
||||||
if (reset_ext_config) ext_config_pop(th2, &prev_ext_config);
|
if (reset_ext_config) ext_config_pop(th2, &prev_ext_config);
|
||||||
|
|
||||||
if (ftptr) load_unlock(RSTRING_PTR(path), !state);
|
if (ftptr) load_unlock(RSTRING_PTR(path), !state);
|
||||||
|
@ -1112,7 +1114,7 @@ require_internal(rb_execution_context_t *ec, VALUE fname, int exception)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == TAG_RETURN) rb_provide_feature(path);
|
if (result == TAG_RETURN) rb_provide_feature(path);
|
||||||
ec->errinfo = errinfo;
|
ec->errinfo = saved.errinfo;
|
||||||
|
|
||||||
RUBY_DTRACE_HOOK(REQUIRE_RETURN, RSTRING_PTR(fname));
|
RUBY_DTRACE_HOOK(REQUIRE_RETURN, RSTRING_PTR(fname));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue