diff --git a/ChangeLog b/ChangeLog index 44ae5b4d48..67b6350ec7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Sat Jun 14 00:09:19 2008 Nobuyoshi Nakada + + * gc.c (ruby_gc_stress): moved to rb_objspace_t. + + * gc.c (gc_stress_get, gc_stress_set): VM local attribute. + + * signal.c (sigsegv): ditto. + Fri Jun 13 21:55:48 2008 Tadayoshi Funaba * rational.c (nurat_equal_p): Rational(0,x) and 0 are equivalent, diff --git a/gc.c b/gc.c index 5a19ed7093..a5041da700 100644 --- a/gc.c +++ b/gc.c @@ -179,6 +179,7 @@ typedef struct rb_objspace { } markstack; struct gc_list *global_list; unsigned int count; + int gc_stress; } rb_objspace_t; #if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE @@ -206,6 +207,7 @@ static rb_objspace_t rb_objspace = {{GC_MALLOC_LIMIT}, {HEAP_MIN_SLOTS}}; #define mark_stack_ptr objspace->markstack.ptr #define mark_stack_overflow objspace->markstack.overflow #define global_List objspace->global_list +#define ruby_gc_stress objspace->gc_stress #if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE rb_objspace_t * @@ -243,7 +245,7 @@ VALUE *rb_gc_stack_start = 0; VALUE *rb_gc_register_stack_start = 0; #endif -int ruby_gc_stress = 0; +int ruby_disable_gc_stress = 0; #ifdef DJGPP @@ -289,6 +291,7 @@ rb_memerror(void) static VALUE gc_stress_get(VALUE self) { + rb_objspace_t *objspace = &rb_objspace; return ruby_gc_stress ? Qtrue : Qfalse; } @@ -307,6 +310,7 @@ gc_stress_get(VALUE self) static VALUE gc_stress_set(VALUE self, VALUE bool) { + rb_objspace_t *objspace = &rb_objspace; rb_secure(2); ruby_gc_stress = RTEST(bool); return bool; @@ -326,7 +330,8 @@ vm_xmalloc(rb_objspace_t *objspace, size_t size) size += sizeof(size_t); #endif - if (ruby_gc_stress || (malloc_increase+size) > malloc_limit) { + if ((ruby_gc_stress && !ruby_disable_gc_stress) || + (malloc_increase+size) > malloc_limit) { garbage_collect(objspace); } RUBY_CRITICAL(mem = malloc(size)); @@ -360,7 +365,7 @@ vm_xrealloc(rb_objspace_t *objspace, void *ptr, size_t size) } if (!ptr) return ruby_xmalloc(size); if (size == 0) size = 1; - if (ruby_gc_stress) garbage_collect(objspace); + if (ruby_gc_stress && !ruby_disable_gc_stress) garbage_collect(objspace); #if CALC_EXACT_MALLOC_SIZE size += sizeof(size_t); @@ -664,7 +669,7 @@ rb_newobj_from_heap(rb_objspace_t *objspace) { VALUE obj; - if (ruby_gc_stress || !freelist) { + if ((ruby_gc_stress && !ruby_disable_gc_stress) || !freelist) { if (!heaps_increment(objspace) && !garbage_collect(objspace)) { rb_memerror(); } diff --git a/signal.c b/signal.c index 51cfabd3f8..e35f3713ed 100644 --- a/signal.c +++ b/signal.c @@ -554,12 +554,12 @@ sigsegv(int sig) { if (segv_received) { fprintf(stderr, "SEGV recieved in SEGV handler\n"); - exit(1); + exit(EXIT_FAILURE); } else { - extern int ruby_gc_stress; + extern int ruby_disable_gc_stress; segv_received = 1; - ruby_gc_stress = 0; + ruby_disable_gc_stress = 1; rb_bug("Segmentation fault"); } } diff --git a/version.h b/version.h index a8aebd55a3..497179ad96 100644 --- a/version.h +++ b/version.h @@ -1,7 +1,7 @@ #define RUBY_VERSION "1.9.0" -#define RUBY_RELEASE_DATE "2008-06-13" +#define RUBY_RELEASE_DATE "2008-06-14" #define RUBY_VERSION_CODE 190 -#define RUBY_RELEASE_CODE 20080613 +#define RUBY_RELEASE_CODE 20080614 #define RUBY_PATCHLEVEL 0 #define RUBY_VERSION_MAJOR 1 @@ -9,7 +9,7 @@ #define RUBY_VERSION_TEENY 0 #define RUBY_RELEASE_YEAR 2008 #define RUBY_RELEASE_MONTH 6 -#define RUBY_RELEASE_DAY 13 +#define RUBY_RELEASE_DAY 14 #ifdef RUBY_EXTERN RUBY_EXTERN const char ruby_version[];