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

* 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
This commit is contained in:
akr 2008-06-13 22:57:41 +00:00
parent 4641b80166
commit 436b02b332
3 changed files with 16 additions and 4 deletions

View file

@ -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> Sat Jun 14 00:09:19 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* gc.c (ruby_gc_stress): moved to rb_objspace_t. * gc.c (ruby_gc_stress): moved to rb_objspace_t.

View file

@ -141,13 +141,13 @@ set_debug_option(const char *str, int len, void *arg)
#define SET_WHEN(name, var) do { \ #define SET_WHEN(name, var) do { \
if (len == sizeof(name) - 1 && \ if (len == sizeof(name) - 1 && \
strncmp(str, name, len) == 0) { \ strncmp(str, name, len) == 0) { \
extern int ruby_##var; \ extern int var; \
ruby_##var = 1; \ var = 1; \
return; \ return; \
} \ } \
} while (0) } while (0)
SET_WHEN("gc_stress", gc_stress); SET_WHEN("gc_stress", *ruby_initial_gc_stress_ptr);
SET_WHEN("core", enable_coredump); SET_WHEN("core", ruby_enable_coredump);
fprintf(stderr, "unexpected debug option: %.*s\n", len, str); fprintf(stderr, "unexpected debug option: %.*s\n", len, str);
} }

4
gc.c
View file

@ -184,8 +184,11 @@ typedef struct rb_objspace {
#if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE #if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
#define rb_objspace (*GET_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 #else
static rb_objspace_t rb_objspace = {{GC_MALLOC_LIMIT}, {HEAP_MIN_SLOTS}}; static rb_objspace_t rb_objspace = {{GC_MALLOC_LIMIT}, {HEAP_MIN_SLOTS}};
int *ruby_initial_gc_stress_ptr = &rb_objspace.gc_stress;
#endif #endif
#define malloc_limit objspace->malloc_params.limit #define malloc_limit objspace->malloc_params.limit
#define malloc_increase objspace->malloc_params.increase #define malloc_increase objspace->malloc_params.increase
@ -216,6 +219,7 @@ rb_objspace_alloc(void)
rb_objspace_t *objspace = malloc(sizeof(rb_objspace_t)); rb_objspace_t *objspace = malloc(sizeof(rb_objspace_t));
memset(objspace, 0, sizeof(*objspace)); memset(objspace, 0, sizeof(*objspace));
malloc_limit = GC_MALLOC_LIMIT; malloc_limit = GC_MALLOC_LIMIT;
ruby_gc_stress = ruby_initial_gc_stress;
return objspace; return objspace;
} }