From 0c391a55d3ed4637e17462d9b9b8aa21e64e2340 Mon Sep 17 00:00:00 2001 From: ko1 Date: Tue, 9 Sep 2014 04:12:14 +0000 Subject: * gc.c: remvoe ruby_disable_gc_stress and add ruby_disable_gc to speed-up newobj_of(). * gc.c (ready_to_gc): check ruby_disable_gc. * signal.c: use ruby_disable_gc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- gc.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'gc.c') diff --git a/gc.c b/gc.c index 0836a71894..f5c184cab1 100644 --- a/gc.c +++ b/gc.c @@ -728,7 +728,7 @@ struct RZombie { int ruby_gc_debug_indent = 0; VALUE rb_mGC; -int ruby_disable_gc_stress = 0; +int ruby_disable_gc = 0; void rb_gcdebug_print_obj_condition(VALUE obj); @@ -1599,7 +1599,7 @@ newobj_of(VALUE klass, VALUE flags, VALUE v1, VALUE v2, VALUE v3) rb_bug("object allocation during garbage collection phase"); } - if (UNLIKELY(ruby_gc_stress && !ruby_disable_gc_stress)) { + if (UNLIKELY(ruby_gc_stress)) { if (!garbage_collect(objspace, FALSE, FALSE, FALSE, GPR_FLAG_NEWOBJ)) { rb_memerror(); } @@ -5666,25 +5666,27 @@ enum { #define gc_stress_full_mark_after_malloc_p() \ (FIXNUM_P(ruby_gc_stress) && (FIX2LONG(ruby_gc_stress) & (1<freelist && !heap->free_pages) { - if (!heap_increment(objspace, heap)) { - heap_set_increment(objspace, 1); - heap_increment(objspace, heap); - } + if (!heap->freelist && !heap->free_pages) { + if (!heap_increment(objspace, heap)) { + heap_set_increment(objspace, 1); + heap_increment(objspace, heap); } - return FALSE; } - return TRUE; } static int ready_to_gc(rb_objspace_t *objspace) { - return heap_ready_to_gc(objspace, heap_eden); + if (dont_gc || during_gc || ruby_disable_gc) { + heap_ready_to_gc(objspace, heap_eden); + return FALSE; + } + else { + return TRUE; + } } static void @@ -5792,7 +5794,7 @@ gc_start(rb_objspace_t *objspace, const int full_mark, const int immediate_mark, gc_enter(objspace, "gc_start"); - if (ruby_gc_stress && !ruby_disable_gc_stress) { + if (ruby_gc_stress) { int flag = FIXNUM_P(ruby_gc_stress) ? FIX2INT(ruby_gc_stress) : 0; if ((flag & (1<flags = reason | ((ruby_gc_stress && !ruby_disable_gc_stress) ? GPR_FLAG_STRESS : 0); + record->flags = reason | (ruby_gc_stress ? GPR_FLAG_STRESS : 0); #if MALLOC_ALLOCATED_SIZE record->allocated_size = malloc_allocated_size; #endif -- cgit v1.2.3