summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-11-13 00:58:34 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-11-13 00:58:34 +0000
commitf446630a13197ed10f4f781fa63b5451ce2fd6db (patch)
tree4d57f4b29a38f354b425d8a375078568263483cb
parentff69f15baaf393923c18a194278ce7bdec3c7556 (diff)
downloadruby-f446630a13197ed10f4f781fa63b5451ce2fd6db.tar.gz
* parse.y (Init_sym): use separate object space.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/mvm@25743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--gc.c14
-rw-r--r--gc.h4
-rw-r--r--parse.y9
4 files changed, 23 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 3cc96f2bc8..bb09745b48 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Fri Nov 13 09:58:31 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (Init_sym): use separate object space.
+
Thu Nov 12 16:35:42 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval.c (ruby_vm_run): cleanup needed.
diff --git a/gc.c b/gc.c
index 181c3321b6..027a94c82c 100644
--- a/gc.c
+++ b/gc.c
@@ -1337,8 +1337,8 @@ mark_locations_array(rb_objspace_t *objspace, register VALUE *x, register long n
}
}
-static void
-gc_mark_locations(rb_objspace_t *objspace, VALUE *start, VALUE *end)
+void
+rb_objspace_mark_locations(rb_objspace_t *objspace, VALUE *start, VALUE *end)
{
long n;
@@ -1350,10 +1350,10 @@ gc_mark_locations(rb_objspace_t *objspace, VALUE *start, VALUE *end)
void
rb_gc_mark_locations(VALUE *start, VALUE *end)
{
- gc_mark_locations(&rb_objspace, start, end);
+ rb_objspace_mark_locations(&rb_objspace, start, end);
}
-#define rb_gc_mark_locations(start, end) gc_mark_locations(objspace, start, end)
+#define rb_gc_mark_locations(start, end) rb_objspace_mark_locations(objspace, start, end)
struct mark_tbl_arg {
rb_objspace_t *objspace;
@@ -1485,6 +1485,12 @@ free_m_table(st_table *tbl)
}
void
+rb_objspace_mark_tbl(rb_objspace_t *objspace, st_table *tbl)
+{
+ mark_tbl(objspace, tbl, 0);
+}
+
+void
rb_mark_tbl(st_table *tbl)
{
mark_tbl(&rb_objspace, tbl, 0);
diff --git a/gc.h b/gc.h
index 6ea288e919..adb14bca77 100644
--- a/gc.h
+++ b/gc.h
@@ -80,4 +80,8 @@ VALUE rb_objspace_gc_disable(struct rb_objspace *objspace);
VALUE rb_objspace_gc_enable(struct rb_objspace *objspace);
VALUE rb_newobj_from_heap(struct rb_objspace *objspace);
+struct st_table;
+void rb_objspace_mark_tbl(struct rb_objspace *objspace, struct st_table *tbl);
+void rb_objspace_mark_locations(struct rb_objspace *objspace, VALUE *start, VALUE *end);
+
#endif /* RUBY_GC_H */
diff --git a/parse.y b/parse.y
index 0f9b75711f..98f90c7ea7 100644
--- a/parse.y
+++ b/parse.y
@@ -9324,7 +9324,8 @@ Init_sym(void)
{
ruby_native_thread_lock_initialize(&global_symbols.lock);
ruby_native_thread_lock(&global_symbols.lock);
- global_symbols.objspace = GET_VM()->objspace;
+ global_symbols.objspace = rb_objspace_alloc();
+ rb_objspace_gc_disable(global_symbols.objspace);
global_symbols.sym_id = st_init_table_with_size(&symhash, 1000);
global_symbols.id_str = st_init_numtable_with_size(1000);
Init_id();
@@ -9347,9 +9348,9 @@ void
rb_gc_mark_symbols(void)
{
#if 0
- rb_mark_tbl(global_symbols.id_str);
- rb_gc_mark_locations(global_symbols.op_sym,
- global_symbols.op_sym + tLAST_TOKEN);
+ rb_objspace_mark_tbl(global_symbols.objspace, global_symbols.id_str);
+ rb_objspace_mark_locations(global_symbols.objspace, global_symbols.op_sym,
+ global_symbols.op_sym + tLAST_TOKEN);
#endif
}
#endif /* !RIPPER */