diff --git a/ChangeLog b/ChangeLog index 67d04b92f8..fc4c4c3da8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Tue Jul 1 00:49:11 2008 Nobuyoshi Nakada + + * gc.c (rb_newobj): abort GC phase before rb_bug. + Mon Jun 30 23:15:07 2008 Yusuke Endoh * test/openssl/test_ssl.rb (start_server): shutdown TCPServer before diff --git a/gc.c b/gc.c index e4e6312126..ed6b769051 100644 --- a/gc.c +++ b/gc.c @@ -705,18 +705,25 @@ rb_fill_value_cache(rb_thread_t *th) VALUE rb_newobj(void) { -#if USE_VALUE_CACHE +#if USE_VALUE_CACHE || (defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE) rb_thread_t *th = GET_THREAD(); +#endif +#if USE_VALUE_CACHE VALUE v = *th->value_cache_ptr; +#endif #if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE rb_objspace_t *objspace = th->vm->objspace; #else rb_objspace_t *objspace = &rb_objspace; #endif - if (during_gc) - rb_bug("object allocation during garbage collection phase"); + if (during_gc) { + dont_gc = 1; + during_gc = 0; + rb_bug("object allocation during garbage collection phase"); + } +#if USE_VALUE_CACHE if (v) { RBASIC(v)->flags = 0; th->value_cache_ptr++; @@ -731,9 +738,6 @@ rb_newobj(void) #endif return v; #else - rb_objspace_t *objspace = &rb_objspace; - if (during_gc) - rb_bug("object allocation during garbage collection phase"); return rb_newobj_from_heap(objspace); #endif } @@ -920,7 +924,7 @@ gc_mark_locations(rb_objspace_t *objspace, VALUE *start, VALUE *end) if (end <= start) return; n = end - start; - mark_locations_array(&rb_objspace, start,n); + mark_locations_array(objspace, start, n); } void