diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | eval_load.c | 21 | ||||
-rw-r--r-- | yarvcore.c | 4 | ||||
-rw-r--r-- | yarvcore.h | 4 |
4 files changed, 26 insertions, 10 deletions
@@ -1,3 +1,10 @@ +Wed Feb 14 11:12:02 2007 Koichi Sasada <ko1@atdot.net> + + * eval_load.c, yarvcore.h: use rb_vm_t#loaded_features instead of + rb_features (global variable). + + * yarvcore.c: mark rb_vm_t#loaded_features. + Wed Feb 14 08:46:25 2007 Yukihiro Matsumoto <matz@ruby-lang.org> * compile.c (defined_expr): no longer distinguish ordinary local diff --git a/eval_load.c b/eval_load.c index d5a23ade2f..2048ea36b5 100644 --- a/eval_load.c +++ b/eval_load.c @@ -7,11 +7,8 @@ extern VALUE ruby_top_self; VALUE ruby_dln_librefs; -static VALUE rb_features; static st_table *loading_tbl; -NORETURN(void jump_tag_but_local_jump(int, VALUE)); - #define IS_SOEXT(e) (strcmp(e, ".so") == 0 || strcmp(e, ".o") == 0) #ifdef DLEXT2 #define IS_DLEXT(e) (strcmp(e, DLEXT) == 0 || strcmp(e, DLEXT2) == 0) @@ -19,6 +16,12 @@ NORETURN(void jump_tag_but_local_jump(int, VALUE)); #define IS_DLEXT(e) (strcmp(e, DLEXT) == 0) #endif +static VALUE +get_loaded_features(void) +{ + return GET_VM()->loaded_features; +} + static int rb_feature_p(const char *feature, const char *ext, int rb) { @@ -34,8 +37,8 @@ rb_feature_p(const char *feature, const char *ext, int rb) len = strlen(feature); elen = 0; } - for (i = 0; i < RARRAY_LEN(rb_features); ++i) { - v = RARRAY_PTR(rb_features)[i]; + for (i = 0; i < RARRAY_LEN(get_loaded_features()); ++i) { + v = RARRAY_PTR(get_loaded_features())[i]; f = StringValuePtr(v); if (strncmp(f, feature, len) != 0) continue; @@ -99,7 +102,7 @@ rb_provided(const char *feature) static void rb_provide_feature(VALUE feature) { - rb_ary_push(rb_features, feature); + rb_ary_push(get_loaded_features(), feature); } void @@ -518,9 +521,9 @@ Init_load() rb_define_readonly_variable("$-I", &rb_load_path); rb_define_readonly_variable("$LOAD_PATH", &rb_load_path); - rb_features = rb_ary_new(); - rb_define_readonly_variable("$\"", &rb_features); - rb_define_readonly_variable("$LOADED_FEATURES", &rb_features); + rb_define_virtual_variable("$\"", get_loaded_features, 0); + rb_define_virtual_variable("$LOADED_FEATURES", get_loaded_features, 0); + GET_VM()->loaded_features = rb_ary_new(); rb_define_global_function("load", rb_f_load, -1); rb_define_global_function("require", rb_f_require, 1); diff --git a/yarvcore.c b/yarvcore.c index 3acbfab19b..ee0b02a3a9 100644 --- a/yarvcore.c +++ b/yarvcore.c @@ -182,7 +182,9 @@ vm_mark(void *ptr) MARK_UNLESS_NULL(vm->thgroup_default); MARK_UNLESS_NULL(vm->mark_object_ary); MARK_UNLESS_NULL(vm->last_status); + MARK_UNLESS_NULL(vm->loaded_features); } + MARK_REPORT_LEAVE("vm"); } @@ -512,9 +514,9 @@ Init_VM(void) /* create vm object */ VALUE vmval = vm_alloc(rb_cVM); VALUE thval; - rb_vm_t *vm; rb_thread_t *th; + vm = theYarvVM; xfree(RDATA(vmval)->data); diff --git a/yarvcore.h b/yarvcore.h index 79f410cad3..7e66f7ec20 100644 --- a/yarvcore.h +++ b/yarvcore.h @@ -327,6 +327,10 @@ typedef struct rb_vm_struct { /* object management */ VALUE mark_object_ary; + /* load */ + VALUE loaded_features; + + /* signal */ rb_atomic_t signal_buff[RUBY_NSIG]; rb_atomic_t bufferd_signal_size; } rb_vm_t; |