* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11720 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9ba43ab6d4
commit
9895ce9f77
@ -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>
|
Wed Feb 14 08:46:25 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* compile.c (defined_expr): no longer distinguish ordinary local
|
* compile.c (defined_expr): no longer distinguish ordinary local
|
||||||
|
21
eval_load.c
21
eval_load.c
@ -7,11 +7,8 @@
|
|||||||
extern VALUE ruby_top_self;
|
extern VALUE ruby_top_self;
|
||||||
|
|
||||||
VALUE ruby_dln_librefs;
|
VALUE ruby_dln_librefs;
|
||||||
static VALUE rb_features;
|
|
||||||
static st_table *loading_tbl;
|
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)
|
#define IS_SOEXT(e) (strcmp(e, ".so") == 0 || strcmp(e, ".o") == 0)
|
||||||
#ifdef DLEXT2
|
#ifdef DLEXT2
|
||||||
#define IS_DLEXT(e) (strcmp(e, DLEXT) == 0 || strcmp(e, DLEXT2) == 0)
|
#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)
|
#define IS_DLEXT(e) (strcmp(e, DLEXT) == 0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static VALUE
|
||||||
|
get_loaded_features(void)
|
||||||
|
{
|
||||||
|
return GET_VM()->loaded_features;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
rb_feature_p(const char *feature, const char *ext, int rb)
|
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);
|
len = strlen(feature);
|
||||||
elen = 0;
|
elen = 0;
|
||||||
}
|
}
|
||||||
for (i = 0; i < RARRAY_LEN(rb_features); ++i) {
|
for (i = 0; i < RARRAY_LEN(get_loaded_features()); ++i) {
|
||||||
v = RARRAY_PTR(rb_features)[i];
|
v = RARRAY_PTR(get_loaded_features())[i];
|
||||||
f = StringValuePtr(v);
|
f = StringValuePtr(v);
|
||||||
if (strncmp(f, feature, len) != 0)
|
if (strncmp(f, feature, len) != 0)
|
||||||
continue;
|
continue;
|
||||||
@ -99,7 +102,7 @@ rb_provided(const char *feature)
|
|||||||
static void
|
static void
|
||||||
rb_provide_feature(VALUE feature)
|
rb_provide_feature(VALUE feature)
|
||||||
{
|
{
|
||||||
rb_ary_push(rb_features, feature);
|
rb_ary_push(get_loaded_features(), feature);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -518,9 +521,9 @@ Init_load()
|
|||||||
rb_define_readonly_variable("$-I", &rb_load_path);
|
rb_define_readonly_variable("$-I", &rb_load_path);
|
||||||
rb_define_readonly_variable("$LOAD_PATH", &rb_load_path);
|
rb_define_readonly_variable("$LOAD_PATH", &rb_load_path);
|
||||||
|
|
||||||
rb_features = rb_ary_new();
|
rb_define_virtual_variable("$\"", get_loaded_features, 0);
|
||||||
rb_define_readonly_variable("$\"", &rb_features);
|
rb_define_virtual_variable("$LOADED_FEATURES", get_loaded_features, 0);
|
||||||
rb_define_readonly_variable("$LOADED_FEATURES", &rb_features);
|
GET_VM()->loaded_features = rb_ary_new();
|
||||||
|
|
||||||
rb_define_global_function("load", rb_f_load, -1);
|
rb_define_global_function("load", rb_f_load, -1);
|
||||||
rb_define_global_function("require", rb_f_require, 1);
|
rb_define_global_function("require", rb_f_require, 1);
|
||||||
|
@ -182,7 +182,9 @@ vm_mark(void *ptr)
|
|||||||
MARK_UNLESS_NULL(vm->thgroup_default);
|
MARK_UNLESS_NULL(vm->thgroup_default);
|
||||||
MARK_UNLESS_NULL(vm->mark_object_ary);
|
MARK_UNLESS_NULL(vm->mark_object_ary);
|
||||||
MARK_UNLESS_NULL(vm->last_status);
|
MARK_UNLESS_NULL(vm->last_status);
|
||||||
|
MARK_UNLESS_NULL(vm->loaded_features);
|
||||||
}
|
}
|
||||||
|
|
||||||
MARK_REPORT_LEAVE("vm");
|
MARK_REPORT_LEAVE("vm");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -512,9 +514,9 @@ Init_VM(void)
|
|||||||
/* create vm object */
|
/* create vm object */
|
||||||
VALUE vmval = vm_alloc(rb_cVM);
|
VALUE vmval = vm_alloc(rb_cVM);
|
||||||
VALUE thval;
|
VALUE thval;
|
||||||
|
|
||||||
rb_vm_t *vm;
|
rb_vm_t *vm;
|
||||||
rb_thread_t *th;
|
rb_thread_t *th;
|
||||||
|
|
||||||
vm = theYarvVM;
|
vm = theYarvVM;
|
||||||
|
|
||||||
xfree(RDATA(vmval)->data);
|
xfree(RDATA(vmval)->data);
|
||||||
|
@ -327,6 +327,10 @@ typedef struct rb_vm_struct {
|
|||||||
/* object management */
|
/* object management */
|
||||||
VALUE mark_object_ary;
|
VALUE mark_object_ary;
|
||||||
|
|
||||||
|
/* load */
|
||||||
|
VALUE loaded_features;
|
||||||
|
|
||||||
|
/* signal */
|
||||||
rb_atomic_t signal_buff[RUBY_NSIG];
|
rb_atomic_t signal_buff[RUBY_NSIG];
|
||||||
rb_atomic_t bufferd_signal_size;
|
rb_atomic_t bufferd_signal_size;
|
||||||
} rb_vm_t;
|
} rb_vm_t;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user