static void rb_load_internal(VALUE fname, int wrap) { rb_thread_t *curr_th = GET_THREAD(); int state = rb_load_internal0(curr_th, fname, wrap); if (state) { if (state == TAG_RAISE) rb_exc_raise(curr_th->errinfo); JUMP_TAG(state); } }
static void rb_load_internal(VALUE fname, int wrap) { rb_execution_context_t *ec = GET_EC(); int state = rb_load_internal0(ec, fname, wrap); if (state) { if (state == TAG_RAISE) rb_exc_raise(ec->errinfo); EC_JUMP_TAG(ec, state); } }
void rb_load_protect(VALUE fname, int wrap, int *state) { int status; volatile VALUE path = 0; PUSH_TAG(); if ((status = EXEC_TAG()) == 0) { path = file_to_load(fname); } POP_TAG(); if (!status) status = rb_load_internal0(GET_THREAD(), path, wrap); if (state) *state = status; }
void rb_load_protect(VALUE fname, int wrap, int *pstate) { enum ruby_tag_type state; volatile VALUE path = 0; EC_PUSH_TAG(GET_EC()); if ((state = EC_EXEC_TAG()) == TAG_NONE) { path = file_to_load(fname); } EC_POP_TAG(); if (state == TAG_NONE) state = rb_load_internal0(GET_EC(), path, wrap); if (state != TAG_NONE) *pstate = state; }
/* * returns * 0: if already loaded (false) * 1: successfully loaded (true) * <0: not found (LoadError) * >1: exception */ int rb_require_internal(VALUE fname, int safe) { volatile int result = -1; rb_execution_context_t *ec = GET_EC(); volatile VALUE errinfo = ec->errinfo; enum ruby_tag_type state; struct { int safe; } volatile saved; char *volatile ftptr = 0; VALUE path; fname = rb_get_path_check(fname, safe); path = rb_str_encode_ospath(fname); RUBY_DTRACE_HOOK(REQUIRE_ENTRY, RSTRING_PTR(fname)); EC_PUSH_TAG(ec); saved.safe = rb_safe_level(); if ((state = EC_EXEC_TAG()) == TAG_NONE) { long handle; int found; rb_set_safe_level_force(0); RUBY_DTRACE_HOOK(FIND_REQUIRE_ENTRY, RSTRING_PTR(fname)); found = search_required(path, &path, safe, rb_feature_p); RUBY_DTRACE_HOOK(FIND_REQUIRE_RETURN, RSTRING_PTR(fname)); if (found) { if (!path || !(ftptr = load_lock(RSTRING_PTR(path)))) { result = 0; } else if (!*ftptr) { rb_provide_feature(path); result = TAG_RETURN; } else { switch (found) { case 'r': state = rb_load_internal0(ec, path, 0); break; case 's': handle = (long)rb_vm_call_cfunc(rb_vm_top_self(), load_ext, path, VM_BLOCK_HANDLER_NONE, path); rb_ary_push(ruby_dln_librefs, LONG2NUM(handle)); break; } if (!state) { rb_provide_feature(path); result = TAG_RETURN; } } } } EC_POP_TAG(); load_unlock(ftptr, !state); rb_set_safe_level_force(saved.safe); if (state) { RB_GC_GUARD(fname); /* never TAG_RETURN */ return state; } ec->errinfo = errinfo; RUBY_DTRACE_HOOK(REQUIRE_RETURN, RSTRING_PTR(fname)); return result; }
static void rb_load_internal(VALUE fname, int wrap) { rb_load_internal0(GET_THREAD(), fname, wrap); }