summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-13 22:57:41 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-13 22:57:41 +0000
commit436b02b3322d6809c2bf4cbadbe8b324a53e07e4 (patch)
tree545da3945e02e22b954ebe4653f947206f4bf37f
parent4641b801664008c7ae509a79354da1bc84b6fc1c (diff)
* gc.c (ruby_initial_gc_stress): defined.
(ruby_initial_gc_stress_ptr): defined. * debug.c (set_debug_option): use ruby_initial_gc_stress_ptr for gc_stress option. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog8
-rw-r--r--debug.c8
-rw-r--r--gc.c4
3 files changed, 16 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 67b6350..cc683be 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Sat Jun 14 07:52:53 2008 Tanaka Akira <akr@fsij.org>
+
+ * gc.c (ruby_initial_gc_stress): defined.
+ (ruby_initial_gc_stress_ptr): defined.
+
+ * debug.c (set_debug_option): use ruby_initial_gc_stress_ptr for
+ gc_stress option.
+
Sat Jun 14 00:09:19 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* gc.c (ruby_gc_stress): moved to rb_objspace_t.
diff --git a/debug.c b/debug.c
index 3ec7da4..3699359 100644
--- a/debug.c
+++ b/debug.c
@@ -141,13 +141,13 @@ set_debug_option(const char *str, int len, void *arg)
#define SET_WHEN(name, var) do { \
if (len == sizeof(name) - 1 && \
strncmp(str, name, len) == 0) { \
- extern int ruby_##var; \
- ruby_##var = 1; \
+ extern int var; \
+ var = 1; \
return; \
} \
} while (0)
- SET_WHEN("gc_stress", gc_stress);
- SET_WHEN("core", enable_coredump);
+ SET_WHEN("gc_stress", *ruby_initial_gc_stress_ptr);
+ SET_WHEN("core", ruby_enable_coredump);
fprintf(stderr, "unexpected debug option: %.*s\n", len, str);
}
diff --git a/gc.c b/gc.c
index a5041da..969f1fa 100644
--- a/gc.c
+++ b/gc.c
@@ -184,8 +184,11 @@ typedef struct rb_objspace {
#if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
#define rb_objspace (*GET_VM()->objspace)
+static int ruby_initial_gc_stress = 0;
+int *ruby_initial_gc_stress_ptr = &ruby_initial_gc_stress;
#else
static rb_objspace_t rb_objspace = {{GC_MALLOC_LIMIT}, {HEAP_MIN_SLOTS}};
+int *ruby_initial_gc_stress_ptr = &rb_objspace.gc_stress;
#endif
#define malloc_limit objspace->malloc_params.limit
#define malloc_increase objspace->malloc_params.increase
@@ -216,6 +219,7 @@ rb_objspace_alloc(void)
rb_objspace_t *objspace = malloc(sizeof(rb_objspace_t));
memset(objspace, 0, sizeof(*objspace));
malloc_limit = GC_MALLOC_LIMIT;
+ ruby_gc_stress = ruby_initial_gc_stress;
return objspace;
}