From 8a1b1c2b41b475cc40a8013623b5b6fe5381d6da Mon Sep 17 00:00:00 2001 From: ko1 Date: Mon, 26 Feb 2007 22:51:33 +0000 Subject: * yarvcore.h, vm.h: rename th_invoke_yield() to th_yield(). * blockinlining.c: ditto. * eval.c: ditto. * vm.c, insns.def: rename th_invoke_yield_cfunc() to th_yield_with_cfunc(). * yarvcore.h, yarvcore.c: rename theYarvVM to ruby_current_vm and yarvCurrentThread to ruby_current_thread. remove yarvVMArray. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 14 ++++++++++++++ blockinlining.c | 6 +++--- eval.c | 5 ++--- insns.def | 4 ++-- vm.c | 13 +++++++------ yarvcore.c | 16 ++++++---------- yarvcore.h | 12 ++++++------ 7 files changed, 40 insertions(+), 30 deletions(-) diff --git a/ChangeLog b/ChangeLog index 241d93986f..23bb5d510d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +Tue Feb 27 07:47:24 2007 Koichi Sasada + + * yarvcore.h, vm.h: rename th_invoke_yield() to th_yield(). + + * blockinlining.c: ditto. + + * eval.c: ditto. + + * vm.c, insns.def: rename th_invoke_yield_cfunc() + to th_yield_with_cfunc(). + + * yarvcore.h, yarvcore.c: rename theYarvVM to ruby_current_vm and + yarvCurrentThread to ruby_current_thread. remove yarvVMArray. + Tue Feb 27 00:45:23 2007 Minero Aoki * test/ruby/test_optimization.rb: restore method before calling diff --git a/blockinlining.c b/blockinlining.c index f5c6a41d87..b6563bd81c 100644 --- a/blockinlining.c +++ b/blockinlining.c @@ -199,7 +199,7 @@ yarv_invoke_Integer_times_special_block(VALUE num) th->cfp->lfp[0] = GC_GUARDED_PTR(&block); argv[0] = INT2FIX(0); argv[1] = num; - val = th_invoke_yield(th, 2, argv); + val = th_yield(th, 2, argv); if (val == Qundef) { return num; } @@ -318,7 +318,7 @@ yarv_invoke_Range_each_special_block(VALUE range, th->cfp->lfp[0] = GC_GUARDED_PTR(&block); argv[0] = beg; argv[1] = end; - val = th_invoke_yield(th, 2, argv); + val = th_yield(th, 2, argv); if (val == Qundef) { return range; } @@ -448,7 +448,7 @@ yarv_invoke_Array_each_special_block(VALUE ary) th->cfp->lfp[0] = GC_GUARDED_PTR(&block); argv[0] = 0; argv[1] = ary; - val = th_invoke_yield(th, 2, argv); + val = th_yield(th, 2, argv); if (val == Qundef) { return ary; } diff --git a/eval.c b/eval.c index 582450941f..12ab5e992a 100644 --- a/eval.c +++ b/eval.c @@ -1140,8 +1140,7 @@ rb_yield_0(VALUE val, VALUE self, VALUE klass /* OK */ , int flags, int avalue) { if (avalue) { - return th_invoke_yield(GET_THREAD(), - RARRAY_LEN(val), RARRAY_PTR(val)); + return th_yield(GET_THREAD(), RARRAY_LEN(val), RARRAY_PTR(val)); } else { int argc = (val == Qundef) ? 0 : 1; @@ -1153,7 +1152,7 @@ rb_yield_0(VALUE val, VALUE self, VALUE klass /* OK */ , int flags, argv = RARRAY_PTR(argv[0]); } */ - return th_invoke_yield(GET_THREAD(), argc, argv); + return th_yield(GET_THREAD(), argc, argv); } } diff --git a/insns.def b/insns.def index 13c468cfc4..801f94b97c 100644 --- a/insns.def +++ b/insns.def @@ -1360,8 +1360,8 @@ invokeblock /* unreachable */ } else { - val = th_invoke_yield_cfunc(th, block, block->self, - num, STACK_ADDR_FROM_TOP(num)); + val = th_yield_with_cfunc(th, block, block->self, + num, STACK_ADDR_FROM_TOP(num)); POPN(num); } } diff --git a/vm.c b/vm.c index e28b10f64d..8bec3bf3bc 100644 --- a/vm.c +++ b/vm.c @@ -41,8 +41,9 @@ void vm_analysis_register(int reg, int isset); void vm_analysis_insn(int insn); static inline VALUE - th_invoke_yield_cfunc(rb_thread_t *th, rb_block_t *block, - VALUE self, int argc, VALUE *argv); +th_yield_cfunc(rb_thread_t *th, rb_block_t *block, + VALUE self, int argc, VALUE *argv); + VALUE th_invoke_proc(rb_thread_t *th, rb_proc_t *proc, VALUE self, int argc, VALUE *argv); @@ -647,8 +648,8 @@ rb_call_super(int argc, const VALUE *argv) } static inline VALUE -th_invoke_yield_cfunc(rb_thread_t *th, rb_block_t *block, - VALUE self, int argc, VALUE *argv) +th_yield_with_cfunc(rb_thread_t *th, rb_block_t *block, + VALUE self, int argc, VALUE *argv) { NODE *ifunc = (NODE *) block->iseq; VALUE val; @@ -780,13 +781,13 @@ invoke_block(rb_thread_t *th, rb_block_t *block, VALUE self, int argc, VALUE *ar argc = 1; argv = &args; } - val = th_invoke_yield_cfunc(th, block, block->self, argc, argv); + val = th_yield_with_cfunc(th, block, block->self, argc, argv); } return val; } VALUE -th_invoke_yield(rb_thread_t *th, int argc, VALUE *argv) +th_yield(rb_thread_t *th, int argc, VALUE *argv) { rb_block_t *block = GC_GUARDED_PTR_REF(th->cfp->lfp[0]); diff --git a/yarvcore.c b/yarvcore.c index bfc53fc6b3..b8f06ab6d8 100644 --- a/yarvcore.c +++ b/yarvcore.c @@ -71,9 +71,9 @@ ID id__send_bang; /* YARVCore */ /************/ -rb_thread_t *yarvCurrentThread = 0; -rb_vm_t *theYarvVM = 0; -static VALUE yarvVMArray = Qnil; +rb_thread_t *ruby_current_thread = 0; +rb_vm_t *ruby_current_vm = 0; +static VALUE ruby_vm_list = Qnil; RUBY_EXTERN int ruby_nerrs; @@ -153,7 +153,7 @@ vm_free(void *ptr) /* TODO: MultiVM Instance */ /* VM object should not be cleaned by GC */ /* ruby_xfree(ptr); */ - /* theYarvVM = 0; */ + /* ruby_current_vm = 0; */ } FREE_REPORT_LEAVE("vm"); } @@ -521,16 +521,12 @@ Init_VM(void) rb_vm_t *vm; rb_thread_t *th; - vm = theYarvVM; + vm = ruby_current_vm; xfree(RDATA(vmval)->data); RDATA(vmval)->data = vm; vm->self = vmval; - yarvVMArray = rb_ary_new(); - rb_register_mark_object(yarvVMArray); - rb_ary_push(yarvVMArray, vm->self); - /* create main thread */ thval = rb_thread_alloc(rb_cThread); GetThreadPtr(thval, th); @@ -557,7 +553,7 @@ Init_yarv(void) rb_thread_t *th = ALLOC(rb_thread_t); vm_init2(vm); - theYarvVM = vm; + ruby_current_vm = vm; th_init2(th); th->vm = vm; diff --git a/yarvcore.h b/yarvcore.h index e2885711cc..b82896896a 100644 --- a/yarvcore.h +++ b/yarvcore.h @@ -609,7 +609,7 @@ VALUE th_make_proc(rb_thread_t *th, rb_control_frame_t *cfp, rb_block_t *block); VALUE th_make_env_object(rb_thread_t *th, rb_control_frame_t *cfp); VALUE th_backtrace(rb_thread_t *, int); -VALUE th_invoke_yield(rb_thread_t *th, int argc, VALUE *argv); +VALUE th_yield(rb_thread_t *th, int argc, VALUE *argv); VALUE th_call0(rb_thread_t *th, VALUE klass, VALUE recv, VALUE id, ID oid, int argc, const VALUE *argv, NODE * body, int nosuper); @@ -622,12 +622,12 @@ VALUE yarvcore_eval(VALUE self, VALUE str, VALUE file, VALUE line); /* for thread */ #if RUBY_VM_THREAD_MODEL == 2 -extern rb_thread_t *yarvCurrentThread; -extern rb_vm_t *theYarvVM; +extern rb_thread_t *ruby_current_thread; +extern rb_vm_t *ruby_current_vm; -#define GET_VM() theYarvVM -#define GET_THREAD() yarvCurrentThread -#define rb_thread_set_current_raw(th) (yarvCurrentThread = th) +#define GET_VM() ruby_current_vm +#define GET_THREAD() ruby_current_thread +#define rb_thread_set_current_raw(th) (ruby_current_thread = th) #define rb_thread_set_current(th) do { \ rb_thread_set_current_raw(th); \ th->vm->running_thread = th; \ -- cgit v1.2.3