aboutsummaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-07-12 04:25:46 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-07-12 04:25:46 +0000
commit6b6bf4dd481f744faf54b5efcda5f32e4565bd7d (patch)
tree793fe567ccc6f9f6a8588a9ae2d5d5b040984b37 /eval.c
parent2e601474e7dc483aca0e7c7b7ced750e869aab7f (diff)
downloadruby-6b6bf4dd481f744faf54b5efcda5f32e4565bd7d.tar.gz
* blockinlining.c: remove "yarv" prefix.
* array.c, numeric.c: ditto. * insnhelper.ci, insns.def, vm_evalbody.ci: ditto. * yarvcore.c: removed. * yarvcore.h: renamed to core.h. * cont.c, debug.c, error.c, process.c, signal.c : ditto. * ext/probeprofiler/probeprofiler.c: ditto. * id.c, id.h: added. * inits.c: ditto. * compile.c: rename internal functions. * compile.h: fix debug flag. * eval.c, object.c, vm.c: remove ruby_top_self. use rb_vm_top_self() instead. * eval_intern.h, eval_load: ditto. * gc.c: rename yarv_machine_stack_mark() to rb_gc_mark_machine_stack(). * insnhelper.h: remove unused macros. * iseq.c: add iseq_compile() to create iseq object from source string. * proc.c: rename a internal function. * template/insns.inc.tmpl: remove YARV prefix. * thread.c: * vm.c (rb_iseq_eval): added. * vm.c: move some functions from yarvcore.c. * vm_dump.c: fix to remove compiler warning. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/eval.c b/eval.c
index 1f0228642c..53b4ab2025 100644
--- a/eval.c
+++ b/eval.c
@@ -32,8 +32,6 @@ VALUE rb_eSysStackError;
VALUE exception_error;
VALUE sysstack_error;
-extern VALUE ruby_top_self;
-
static VALUE eval(VALUE, VALUE, VALUE, const char *, int);
static inline VALUE rb_yield_0(int argc, VALUE *argv);
@@ -63,7 +61,7 @@ void rb_call_inits _((void));
void Init_stack _((VALUE *));
void Init_heap _((void));
void Init_ext _((void));
-void Init_yarv(void);
+void Init_BareVM(void);
void
ruby_init(void)
@@ -82,7 +80,7 @@ ruby_init(void)
#endif
Init_stack((void *)&state);
- Init_yarv();
+ Init_BareVM();
Init_heap();
PUSH_TAG();
@@ -214,7 +212,7 @@ ruby_cleanup(int ex)
}
int
-ruby_exec_node(void *n)
+ruby_exec_node(void *n, char *file)
{
int state;
VALUE val;
@@ -226,8 +224,10 @@ ruby_exec_node(void *n)
PUSH_TAG();
if ((state = EXEC_TAG()) == 0) {
SAVE_ROOT_JMPBUF(th, {
+ VALUE iseq = rb_iseq_new(n, rb_str_new2("<main>"),
+ rb_str_new2(file), Qfalse, ISEQ_TYPE_TOP);
th->base_block = 0;
- val = yarvcore_eval_parsed(node, rb_str_new2(node->nd_file));
+ val = rb_iseq_eval(iseq);
});
}
POP_TAG();
@@ -243,17 +243,18 @@ ruby_stop(int ex)
int
ruby_run_node(void *n)
{
+ NODE *node = (NODE *)n;
if (!n) {
return EXIT_FAILURE;
}
Init_stack((void *)&n);
- return ruby_cleanup(ruby_exec_node(n));
+ return ruby_cleanup(ruby_exec_node(node, node->nd_file));
}
VALUE
rb_eval_string(const char *str)
{
- return eval(ruby_top_self, rb_str_new2(str), Qnil, "(eval)", 1);
+ return eval(rb_vm_top_self(), rb_str_new2(str), Qnil, "(eval)", 1);
}
VALUE
@@ -272,7 +273,7 @@ rb_eval_string_wrap(const char *str, int *state)
VALUE val;
th->top_wrapper = rb_module_new();
- th->top_self = rb_obj_clone(ruby_top_self);
+ th->top_self = rb_obj_clone(rb_vm_top_self());
rb_extend_object(th->top_self, th->top_wrapper);
val = rb_eval_string_protect(str, &status);
@@ -318,7 +319,7 @@ rb_eval_cmd(VALUE cmd, VALUE arg, int level)
PUSH_TAG();
if ((state = EXEC_TAG()) == 0) {
- val = eval(ruby_top_self, cmd, Qnil, 0, 0);
+ val = eval(rb_vm_top_self(), cmd, Qnil, 0, 0);
}
POP_TAG();
@@ -1679,7 +1680,7 @@ eval(VALUE self, VALUE src, VALUE scope, const char *file, int line)
/* make eval iseq */
th->parse_in_eval++;
- iseqval = vm_compile(th, src, rb_str_new2(file), INT2FIX(line));
+ iseqval = rb_iseq_compile(src, rb_str_new2(file), INT2FIX(line));
th->parse_in_eval--;
rb_vm_set_eval_stack(th, iseqval);
th->base_block = 0;
@@ -2710,9 +2711,9 @@ Init_eval(void)
rb_define_singleton_method(rb_cModule, "nesting", rb_mod_nesting, 0);
rb_define_singleton_method(rb_cModule, "constants", rb_mod_s_constants, -1);
- rb_define_singleton_method(ruby_top_self, "include", top_include, -1);
- rb_define_singleton_method(ruby_top_self, "public", top_public, -1);
- rb_define_singleton_method(ruby_top_self, "private", top_private, -1);
+ rb_define_singleton_method(rb_vm_top_self(), "include", top_include, -1);
+ rb_define_singleton_method(rb_vm_top_self(), "public", top_public, -1);
+ rb_define_singleton_method(rb_vm_top_self(), "private", top_private, -1);
rb_define_method(rb_mKernel, "extend", rb_obj_extend, -1);