1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
nobu 2007-05-25 07:03:30 +00:00
parent e8a5295841
commit d289b8e8c6
2 changed files with 12 additions and 27 deletions

View file

@ -1,3 +1,8 @@
Fri May 25 16:04:47 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* yarvcore.c (Init_VM): wrap already initialized structs to use
it directly.
Fri May 25 11:09:47 2007 NAKAMURA Usaku <usa@ruby-lang.org>
* regint.h (include): on some platform, defines.h redefines

View file

@ -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 */
{
rb_vm_t *vm = ruby_current_vm;
rb_thread_t *th = GET_THREAD();
/* create vm object */
VALUE vmval = vm_alloc(rb_cVM);
VALUE thval;
rb_vm_t *vm;
rb_thread_t *th;
vm = ruby_current_vm;
xfree(RDATA(vmval)->data);
RDATA(vmval)->data = vm;
vm->self = vmval;
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);
}