diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-05-25 07:03:30 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-05-25 07:03:30 +0000 |
commit | d289b8e8c6a730063723a2637c45e93cb4bc9a45 (patch) | |
tree | 9139d8798da6f4554f0f80e37640e8cd7314bc59 /yarvcore.c | |
parent | e8a529584197da790723f4f2f3c8c1b483f54b35 (diff) | |
download | ruby-d289b8e8c6a730063723a2637c45e93cb4bc9a45.tar.gz |
* yarvcore.c (Init_VM): wrap already initialized structs to use
it directly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12384 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'yarvcore.c')
-rw-r--r-- | yarvcore.c | 34 |
1 files changed, 7 insertions, 27 deletions
diff --git a/yarvcore.c b/yarvcore.c index b266bf6957..0530a36ca0 100644 --- a/yarvcore.c +++ b/yarvcore.c @@ -208,18 +208,6 @@ rb_vm_mark(void *ptr) vm_mark(ptr); } -static VALUE -vm_alloc(VALUE klass) -{ - VALUE volatile obj; - rb_vm_t *vm; - obj = Data_Make_Struct(klass, rb_vm_t, vm_mark, vm_free, vm); - - vm->self = obj; - vm->mark_object_ary = rb_ary_new(); - return obj; -} - static void vm_init2(rb_vm_t *vm) { @@ -548,30 +536,22 @@ Init_VM(void) /* VM bootstrap: phase 2 */ { - /* create vm object */ - VALUE vmval = vm_alloc(rb_cVM); - VALUE thval; - rb_vm_t *vm; - rb_thread_t *th; + rb_vm_t *vm = ruby_current_vm; + rb_thread_t *th = GET_THREAD(); - vm = ruby_current_vm; - - xfree(RDATA(vmval)->data); - RDATA(vmval)->data = vm; - vm->self = vmval; + /* create vm object */ + vm->self = Data_Wrap_Struct(rb_cVM, vm_mark, vm_free, vm); /* create main thread */ - thval = rb_thread_alloc(rb_cThread); - GetThreadPtr(thval, th); + th->self = Data_Wrap_Struct(rb_cThread, thread_mark, thread_free, th); vm->main_thread = th; vm->running_thread = th; - GET_THREAD()->vm = vm; - thread_free(GET_THREAD()); th->vm = vm; + th->top_wrapper = 0; + th->top_self = ruby_top_self; rb_thread_set_current(th); - th->machine_stack_start = rb_gc_stack_start; vm->living_threads = st_init_numtable(); st_insert(vm->living_threads, th->self, (st_data_t) th->thread_id); } |