Skip to content

Commit

Permalink
* gc.c (ruby_initial_gc_stress): defined.
Browse files Browse the repository at this point in the history
  (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
  • Loading branch information
akr committed Jun 13, 2008
1 parent 4641b80 commit 436b02b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
8 changes: 8 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
Sat Jun 14 07:52:53 2008 Tanaka Akira <[email protected]>

* 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 <[email protected]>

* gc.c (ruby_gc_stress): moved to rb_objspace_t.
Expand Down
8 changes: 4 additions & 4 deletions debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
4 changes: 4 additions & 0 deletions gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 436b02b

Please sign in to comment.