summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-27 03:20:35 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-27 03:20:35 +0000
commit09007ccbaa14f81202dfd4c85177241dc2be9f15 (patch)
treef2453edb619097b017cb6563c23e145783c8b402 /vm.c
parentf30a5223d3d4a83759c0458bc50636835ec867b2 (diff)
* vm_core.h (rb_vm_t), gc.c (rb_objspace, rb_newobj), vm.c
(Init_BareVM): per-VM object space support, which is disabled now. * gc.c (rb_objspace_alloc), vm.c (Init_BareVM): should not use ruby malloc here. * gc.c (garbage_collect, etc): performance improvement by passing the reference instead of refering the global variable in each functions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/vm.c b/vm.c
index 087f7e78ec..211ae8bb62 100644
--- a/vm.c
+++ b/vm.c
@@ -1846,17 +1846,22 @@ Init_VM(void)
vm_init_redefined_flag();
}
+struct rb_objspace *rb_objspace_alloc(void);
+
void
Init_BareVM(void)
{
/* VM bootstrap: phase 1 */
- rb_vm_t *vm = ALLOC(rb_vm_t);
- rb_thread_t *th = ALLOC(rb_thread_t);
+ rb_vm_t *vm = malloc(sizeof(*vm));
+ rb_thread_t *th = malloc(sizeof(*th));
MEMZERO(th, rb_thread_t, 1);
rb_thread_set_current_raw(th);
vm_init2(vm);
+#if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
+ vm->objspace = rb_objspace_alloc();
+#endif
ruby_current_vm = vm;
th_init2(th);