diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | debug.c | 8 | ||||
-rw-r--r-- | gc.c | 4 |
3 files changed, 16 insertions, 4 deletions
@@ -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. @@ -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); } @@ -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; } |