Ruby
2.4.2p198(2017-09-14revision59899)
|
#include "internal.h"
#include "ruby/util.h"
#include "dln.h"
#include "eval_intern.h"
#include "probes.h"
Go to the source code of this file.
Data Structures | |
struct | loaded_feature_searching |
Macros | |
#define | IS_RBEXT(e) (strcmp((e), ".rb") == 0) |
#define | IS_SOEXT(e) (strcmp((e), ".so") == 0 || strcmp((e), ".o") == 0) |
#define | IS_DLEXT(e) (strcmp((e), DLEXT) == 0) |
#define | rb_intern(str) rb_intern2((str), strlen(str)) |
Enumerations | |
enum | expand_type { EXPAND_ALL, EXPAND_RELATIVE, EXPAND_HOME, EXPAND_NON_CACHE } |
Variables | |
static VALUE | ruby_dln_librefs |
static const char *const | loadable_ext [] |
#define IS_DLEXT | ( | e | ) | (strcmp((e), DLEXT) == 0) |
Definition at line 18 of file load.c.
Referenced by loaded_feature_path(), rb_feature_p(), rb_feature_provided(), and search_required().
#define IS_RBEXT | ( | e | ) | (strcmp((e), ".rb") == 0) |
Definition at line 13 of file load.c.
Referenced by loaded_feature_path(), rb_feature_p(), rb_feature_provided(), and search_required().
#define IS_SOEXT | ( | e | ) | (strcmp((e), ".so") == 0 || strcmp((e), ".o") == 0) |
Definition at line 14 of file load.c.
Referenced by rb_feature_p(), rb_feature_provided(), and search_required().
#define rb_intern | ( | str | ) | rb_intern2((str), strlen(str)) |
Referenced by Init_load().
enum expand_type |
Definition at line 224 of file load.c.
References features_index_add_single(), NULL, rb_str_subseq(), RSTRING_LEN, and StringValuePtr.
Referenced by get_loaded_features_index(), and rb_provide_feature().
Definition at line 184 of file load.c.
References Check_Type, get_loaded_features_index_raw(), NIL_P, numberof, Qnil, rb_ary_cat(), rb_ary_push(), RB_TYPE_P, RBASIC, ruby_strdup(), st_data_t, st_insert, st_lookup, StringValueCStr, T_ARRAY, T_FIXNUM, T_STRING, and xcalloc.
Referenced by features_index_add().
Definition at line 654 of file load.c.
References FilePathValue, load_failed(), and rb_find_file().
Referenced by rb_load(), and rb_load_protect().
|
static |
Definition at line 159 of file load.c.
References GET_VM.
Referenced by Init_load(), rb_feature_p(), and rb_provide_feature().
|
static |
Definition at line 278 of file load.c.
References features, features_index_add(), GET_VM, INT2FIX, rb_vm_struct::loaded_features, rb_vm_struct::loaded_features_index, loaded_features_index_clear_i(), rb_vm_struct::loaded_features_snapshot, RARRAY_LEN, rb_ary_entry(), rb_ary_shared_with_p(), rb_ary_store(), rb_fstring(), rb_str_freeze(), reset_loaded_features_snapshot(), st_foreach, and StringValue.
Referenced by rb_feature_p().
|
static |
Definition at line 172 of file load.c.
References GET_VM.
Referenced by features_index_add_single().
|
static |
Definition at line 178 of file load.c.
References GET_VM.
Referenced by load_lock(), load_unlock(), rb_feature_p(), and ruby_init_ext().
void Init_load | ( | void | ) |
Definition at line 1179 of file load.c.
References get_loaded_features(), GET_VM, load_path_getter(), rb_alias_variable(), rb_ary_new(), rb_ary_tmp_new(), rb_cModule, rb_define_global_function(), rb_define_hooked_variable(), rb_define_method(), rb_define_virtual_variable(), rb_f_autoload(), rb_f_autoload_p(), rb_f_load(), rb_f_require(), rb_f_require_relative(), rb_gc_register_mark_object(), rb_gvar_readonly_setter(), rb_intern, rb_intern2(), rb_mod_autoload(), rb_mod_autoload_p(), ruby_dln_librefs, and st_init_strtable.
Definition at line 942 of file load.c.
References dln_load(), METHOD_VISI_PUBLIC, rb_scope_visibility_set(), and RSTRING_PTR.
Referenced by rb_require_internal().
|
static |
Definition at line 936 of file load.c.
References rb_load_fail().
Referenced by file_to_load(), rb_f_load(), rb_provide(), and rb_require_safe().
|
static |
Definition at line 722 of file load.c.
References MEMO::func, get_loading_table(), imemo_memo, MEMO_CAST, Qfalse, Qnil, rb_backtrace_print_to(), rb_stderr, rb_thread_shield_new(), rb_thread_shield_wait(), RB_TYPE_P, rb_warning(), RTEST, ruby_strdup(), ruby_verbose, st_data_t, st_insert, st_lookup, T_IMEMO, and MEMO::u3.
Referenced by rb_require_internal().
|
static |
Definition at line 98 of file load.c.
References my_getcwd, rb_filesystem_str_new_cstr(), and xfree().
Referenced by rb_get_expanded_load_path().
Definition at line 153 of file load.c.
References rb_vm_struct::load_path.
Referenced by Init_load().
|
static |
Definition at line 773 of file load.c.
References get_loading_table(), key, release_thread_shield(), st_data_t, and st_update().
Referenced by rb_require_internal().
|
static |
Definition at line 315 of file load.c.
References IS_DLEXT, IS_RBEXT, len, RARRAY_AREF, RARRAY_LEN, RSTRING_LEN, strchr(), and StringValuePtr.
Referenced by loaded_feature_path_i(), and rb_feature_p().
Definition at line 367 of file load.c.
References loaded_feature_searching::len, loaded_feature_searching::load_path, loaded_feature_path(), loaded_feature_searching::name, loaded_feature_searching::result, ST_CONTINUE, ST_STOP, strlen(), and loaded_feature_searching::type.
Referenced by rb_feature_p().
Definition at line 266 of file load.c.
References rb_ary_free(), SPECIAL_CONST_P, ST_DELETE, and xfree().
Referenced by get_loaded_features_index().
NORETURN | ( | static void | load_failedVALUE | ) |
Referenced by rb_provide().
|
static |
Definition at line 49 of file load.c.
References EXPAND_HOME, EXPAND_NON_CACHE, EXPAND_RELATIVE, rb_vm_struct::expanded_load_path, GET_VM, level, rb_vm_struct::load_path, rb_vm_struct::load_path_snapshot, Qnil, RARRAY_AREF, RARRAY_LEN, rb_ary_push(), rb_ary_replace(), rb_ary_tmp_new(), rb_file_expand_path_fast(), rb_fstring(), rb_get_path_check_convert(), rb_get_path_check_to_string(), rb_is_absolute_path(), rb_obj_freeze(), rb_safe_level(), rb_str_freeze(), RB_TYPE_P, RSTRING_PTR, and T_STRING.
Referenced by rb_get_expanded_load_path().
Definition at line 1147 of file load.c.
References NIL_P, rb_class_real(), rb_eTypeError, rb_mod_autoload(), rb_raise(), and rb_vm_cbase().
Referenced by Init_load().
Definition at line 1168 of file load.c.
References NIL_P, Qnil, rb_mod_autoload_p(), and rb_vm_cbase().
Referenced by Init_load().
Definition at line 698 of file load.c.
References load_failed(), Qtrue, rb_file_load_ok(), rb_find_file(), rb_get_path_check_to_string(), rb_load_internal(), rb_safe_level(), rb_scan_args(), rb_str_encode_ospath(), RSTRING_PTR, RTEST, RUBY_DTRACE_HOOK, and StringValuePtr.
Referenced by Init_load().
Definition at line 821 of file load.c.
References rb_require_safe(), and rb_safe_level().
Referenced by Init_load().
Definition at line 835 of file load.c.
References NIL_P, rb_current_realfilepath(), rb_file_absolute_path(), rb_file_dirname(), rb_loaderror(), rb_require_safe(), and rb_safe_level().
Referenced by Init_load().
|
static |
Definition at line 379 of file load.c.
References buf, DLEXT_MAXLEN, f, features, FIX2LONG, get_loaded_features(), get_loaded_features_index(), get_loading_table(), IS_DLEXT, IS_RBEXT, IS_SOEXT, loaded_feature_searching::len, loaded_feature_searching::load_path, loadable_ext, loaded_feature_path(), loaded_feature_path_i(), MEMCPY, loaded_feature_searching::name, NIL_P, numberof, Qnil, RARRAY_AREF, RARRAY_LEN, rb_get_expanded_load_path(), rb_str_resize(), rb_str_tmp_new(), RB_TYPE_P, loaded_feature_searching::result, RSTRING_LEN, RSTRING_PTR, st_data_t, st_foreach, st_get_key(), st_lookup, StringValuePtr, strlcpy(), strlen(), T_ARRAY, and loaded_feature_searching::type.
Referenced by rb_feature_provided(), and search_required().
Definition at line 528 of file load.c.
References FALSE, IS_DLEXT, IS_RBEXT, IS_SOEXT, Qnil, rb_feature_p(), rb_file_expand_path_fast(), RB_GC_GUARD, rb_get_path(), rb_str_new2, RSTRING_PTR, strchr(), strrchr(), and TRUE.
Referenced by autoload_provided(), and rb_provided().
VALUE rb_get_expanded_load_path | ( | void | ) |
Definition at line 107 of file load.c.
References EXPAND_ALL, EXPAND_HOME, EXPAND_NON_CACHE, EXPAND_RELATIVE, rb_vm_struct::expanded_load_path, GET_VM, rb_vm_struct::load_path, rb_vm_struct::load_path_check_cache, load_path_getcwd(), rb_vm_struct::load_path_snapshot, Qtrue, rb_ary_shared_with_p(), rb_construct_expanded_load_path(), and rb_str_equal().
Referenced by rb_feature_p(), rb_find_file_ext_safe(), and rb_find_file_safe().
Definition at line 490 of file iseq.c.
References iseqw_check(), NULL, rb_check_funcall(), rb_cISeq, rb_intern, RBASIC_CLASS, and SPECIAL_CONST_P.
Referenced by rb_load_internal0(), and rb_provide().
void rb_load | ( | VALUE | fname, |
int | wrap | ||
) |
Definition at line 662 of file load.c.
References file_to_load(), and rb_load_internal().
|
static |
Definition at line 643 of file load.c.
References rb_thread_struct::errinfo, GET_THREAD, rb_exc_raise(), rb_load_internal0(), TAG_RAISE, and TH_JUMP_TAG.
Referenced by rb_f_load(), and rb_load().
|
static |
Definition at line 581 of file load.c.
References rb_thread_struct::errinfo, EXEC_TAG, FALSE, NIL_P, NULL, Qnil, Qundef, rb_extend_object(), RB_GC_GUARD, rb_iseq_eval(), rb_iseq_load_iseq(), rb_iseq_new_top(), rb_module_new(), rb_obj_clone(), rb_parser_load_file(), rb_parser_new(), rb_parser_set_context(), rb_realpath_internal(), rb_str_new2, rb_vm_make_jump_tag_but_local_jump(), rb_vm_top_self(), TAG_RAISE, TH_POP_TAG, TH_PUSH_TAG, rb_thread_struct::top_self, and rb_thread_struct::top_wrapper.
Referenced by rb_load_internal(), rb_load_protect(), and rb_require_internal().
void rb_load_protect | ( | VALUE | fname, |
int | wrap, | ||
int * | state | ||
) |
Definition at line 668 of file load.c.
References EXEC_TAG, file_to_load(), GET_THREAD, POP_TAG, PUSH_TAG, and rb_load_internal0().
Definition at line 1103 of file load.c.
References FilePathValue, Qnil, rb_autoload_str(), and rb_to_id().
Referenced by Init_load(), and rb_f_autoload().
Definition at line 1126 of file load.c.
References Qnil, rb_autoload_p(), and rb_check_id().
Referenced by Init_load(), and rb_f_autoload_p().
void rb_provide | ( | const char * | feature | ) |
Definition at line 572 of file load.c.
References load_failed(), NORETURN(), rb_iseq_load_iseq(), rb_provide_feature(), and rb_usascii_str_new2.
Referenced by Init_Complex(), init_golf(), Init_Rational(), Init_thread_sync(), and InitVM_Enumerator().
|
static |
Definition at line 555 of file load.c.
References features, features_index_add(), get_loaded_features(), INT2FIX, OBJ_FROZEN, RARRAY_LEN, rb_ary_push(), rb_eRuntimeError, rb_fstring(), rb_raise(), rb_str_freeze(), and reset_loaded_features_snapshot().
Referenced by rb_provide(), and rb_require_internal().
int rb_provided | ( | const char * | feature | ) |
Definition at line 522 of file load.c.
References rb_feature_provided().
Referenced by ruby_init_ext().
Definition at line 1056 of file load.c.
References OBJ_FREEZE, rb_require_safe(), rb_safe_level(), and rb_str_new2.
Referenced by dump_output(), Init_bubblebabble(), Init_generator(), Init_md5(), Init_ossl_digest(), Init_parser(), Init_psych_parser(), Init_rmd160(), Init_sha1(), and Init_sha2().
int rb_require_internal | ( | VALUE | fname, |
int | safe | ||
) |
Definition at line 956 of file load.c.
References rb_thread_struct::errinfo, EXEC_TAG, FilePathValue, GET_THREAD, load_ext(), load_lock(), load_unlock(), LONG2NUM, rb_ary_push(), rb_load_internal0(), rb_provide_feature(), rb_safe_level(), rb_set_safe_level_force(), rb_str_encode_ospath(), rb_vm_call_cfunc(), rb_vm_top_self(), loaded_feature_searching::result, RSTRING_PTR, ruby_dln_librefs, RUBY_DTRACE_HOOK, search_required(), MEMO::state, StringValuePtr, TAG_RETURN, TH_POP_TAG, TH_PUSH_TAG, and VM_BLOCK_HANDLER_NONE.
Referenced by load_encoding(), rb_require_safe(), and ruby_require_internal().
Definition at line 1040 of file load.c.
References JUMP_TAG, load_failed(), Qfalse, Qtrue, rb_errinfo(), rb_exc_raise(), rb_require_internal(), loaded_feature_searching::result, TAG_RAISE, and TAG_RETURN.
Referenced by load_transcoder_entry(), rb_f_require(), rb_f_require_relative(), and rb_require().
|
static |
Definition at line 1064 of file load.c.
References MEMO_NEW, loaded_feature_searching::name, rb_warn(), RUBY_FUNC_EXPORTED, ruby_strdup(), ST_CONTINUE, and st_data_t.
Referenced by ruby_init_ext().
|
static |
Definition at line 755 of file load.c.
References rb_thread_shield_destroy(), rb_thread_shield_release(), ST_CONTINUE, ST_DELETE, ST_STOP, and xfree().
Referenced by load_unlock().
|
static |
Definition at line 165 of file load.c.
References GET_VM, rb_vm_struct::loaded_features, rb_vm_struct::loaded_features_snapshot, and rb_ary_replace().
Referenced by get_loaded_features_index(), and rb_provide_feature().
RUBY_FUNC_EXPORTED void ruby_init_ext | ( | const char * | name, |
void(*)(void) | init | ||
) |
Definition at line 1079 of file load.c.
References get_loading_table(), rb_provided(), register_init_ext(), st_data_t, and st_update().
int ruby_require_internal | ( | const char * | fname, |
unsigned int | len | ||
) |
Definition at line 1030 of file load.c.
References Qnil, rb_require_internal(), rb_set_errinfo(), rb_setup_fake_str(), loaded_feature_searching::result, and TAG_RETURN.
Definition at line 846 of file load.c.
References FALSE, IS_DLEXT, IS_RBEXT, IS_SOEXT, loadable_ext, OBJ_FREEZE, rb_feature_p(), rb_filesystem_str_new_cstr(), rb_find_file_ext_safe(), rb_find_file_safe(), rb_str_cat2(), rb_str_subseq(), RSTRING_PTR, strchr(), strrchr(), TRUE, and loaded_feature_searching::type.
Referenced by rb_require_internal().
Definition at line 21 of file load.c.
Referenced by rb_feature_p(), and search_required().
|
static |
Definition at line 11 of file load.c.
Referenced by Init_load(), and rb_require_internal().