Skip to content

Commit

Permalink
Merge pull request #1457 from skaes/patches-for-193p374
Browse files Browse the repository at this point in the history
added railsexpress patches for the latest 1.9.3 patch level (374)
  • Loading branch information
richo committed Jan 20, 2013
2 parents a7fa0f1 + 5c6fe91 commit 4d26302
Show file tree
Hide file tree
Showing 22 changed files with 7,824 additions and 88 deletions.
Original file line number Original file line Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/lib/mkmf.rb b/lib/mkmf.rb diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index 08053a9..361fd08 100644 index 7c706e8..c381a38 100644
--- a/lib/mkmf.rb --- a/lib/mkmf.rb
+++ b/lib/mkmf.rb +++ b/lib/mkmf.rb
@@ -2191,7 +2191,7 @@ def init_mkmf(config = CONFIG, rbconfig = RbConfig::CONFIG) @@ -2191,7 +2191,7 @@ def init_mkmf(config = CONFIG, rbconfig = RbConfig::CONFIG)
Expand Down
82 changes: 41 additions & 41 deletions patches/ruby/1.9.3/head/railsexpress/02-railsbench-gc.patch
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ index c64d981..6099a92 100644
dnl build section { dnl build section {


diff --git a/gc.c b/gc.c diff --git a/gc.c b/gc.c
index e38930d..c728587 100644 index f307ecb..0be1ec9 100644
--- a/gc.c --- a/gc.c
+++ b/gc.c +++ b/gc.c
@@ -97,6 +97,15 @@ ruby_gc_params_t initial_params = { @@ -98,6 +98,15 @@ ruby_gc_params_t initial_params = {
#endif #endif
}; };


Expand All @@ -33,7 +33,7 @@ index e38930d..c728587 100644
#define nomem_error GET_VM()->special_exceptions[ruby_error_nomemory] #define nomem_error GET_VM()->special_exceptions[ruby_error_nomemory]


#if SIZEOF_LONG == SIZEOF_VOIDP #if SIZEOF_LONG == SIZEOF_VOIDP
@@ -301,7 +310,7 @@ typedef struct RVALUE { @@ -302,7 +311,7 @@ typedef struct RVALUE {
struct RComplex complex; struct RComplex complex;
} as; } as;
#ifdef GC_DEBUG #ifdef GC_DEBUG
Expand All @@ -42,7 +42,7 @@ index e38930d..c728587 100644
int line; int line;
#endif #endif
} RVALUE; } RVALUE;
@@ -371,11 +380,25 @@ typedef struct rb_objspace { @@ -372,11 +381,25 @@ typedef struct rb_objspace {
size_t free_min; size_t free_min;
size_t final_num; size_t final_num;
size_t do_heap_free; size_t do_heap_free;
Expand All @@ -68,7 +68,7 @@ index e38930d..c728587 100644
} flags; } flags;
struct { struct {
st_table *table; st_table *table;
@@ -392,6 +415,14 @@ typedef struct rb_objspace { @@ -393,6 +416,14 @@ typedef struct rb_objspace {
struct gc_list *global_list; struct gc_list *global_list;
size_t count; size_t count;
int gc_stress; int gc_stress;
Expand All @@ -83,7 +83,7 @@ index e38930d..c728587 100644
} rb_objspace_t; } rb_objspace_t;


#if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE #if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
@@ -414,6 +445,16 @@ int *ruby_initial_gc_stress_ptr = &rb_objspace.gc_stress; @@ -415,6 +446,16 @@ int *ruby_initial_gc_stress_ptr = &rb_objspace.gc_stress;
#define heaps_freed objspace->heap.freed #define heaps_freed objspace->heap.freed
#define dont_gc objspace->flags.dont_gc #define dont_gc objspace->flags.dont_gc
#define during_gc objspace->flags.during_gc #define during_gc objspace->flags.during_gc
Expand All @@ -100,7 +100,7 @@ index e38930d..c728587 100644
#define finalizer_table objspace->final.table #define finalizer_table objspace->final.table
#define deferred_final_list objspace->final.deferred #define deferred_final_list objspace->final.deferred
#define global_List objspace->global_list #define global_List objspace->global_list
@@ -421,6 +462,14 @@ int *ruby_initial_gc_stress_ptr = &rb_objspace.gc_stress; @@ -422,6 +463,14 @@ int *ruby_initial_gc_stress_ptr = &rb_objspace.gc_stress;
#define initial_malloc_limit initial_params.initial_malloc_limit #define initial_malloc_limit initial_params.initial_malloc_limit
#define initial_heap_min_slots initial_params.initial_heap_min_slots #define initial_heap_min_slots initial_params.initial_heap_min_slots
#define initial_free_min initial_params.initial_free_min #define initial_free_min initial_params.initial_free_min
Expand All @@ -115,7 +115,7 @@ index e38930d..c728587 100644


static void rb_objspace_call_finalizer(rb_objspace_t *objspace); static void rb_objspace_call_finalizer(rb_objspace_t *objspace);


@@ -443,24 +492,59 @@ static void init_mark_stack(mark_stack_t *stack); @@ -444,24 +493,59 @@ static void init_mark_stack(mark_stack_t *stack);
void void
rb_gc_set_params(void) rb_gc_set_params(void)
{ {
Expand Down Expand Up @@ -182,7 +182,7 @@ index e38930d..c728587 100644
if (RTEST(ruby_verbose)) if (RTEST(ruby_verbose))
fprintf(stderr, "heap_min_slots=%d (%d)\n", fprintf(stderr, "heap_min_slots=%d (%d)\n",
heap_min_slots_i, initial_heap_min_slots); heap_min_slots_i, initial_heap_min_slots);
@@ -470,15 +554,42 @@ rb_gc_set_params(void) @@ -471,15 +555,42 @@ rb_gc_set_params(void)
} }
} }


Expand Down Expand Up @@ -228,7 +228,7 @@ index e38930d..c728587 100644
} }


#if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE #if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
@@ -775,6 +886,11 @@ vm_malloc_fixup(rb_objspace_t *objspace, void *mem, size_t size) @@ -776,6 +887,11 @@ vm_malloc_fixup(rb_objspace_t *objspace, void *mem, size_t size)
mem = (size_t *)mem + 1; mem = (size_t *)mem + 1;
#endif #endif


Expand All @@ -240,7 +240,7 @@ index e38930d..c728587 100644
return mem; return mem;
} }


@@ -835,6 +951,13 @@ vm_xrealloc(rb_objspace_t *objspace, void *ptr, size_t size) @@ -836,6 +952,13 @@ vm_xrealloc(rb_objspace_t *objspace, void *ptr, size_t size)
mem = (size_t *)mem + 1; mem = (size_t *)mem + 1;
#endif #endif


Expand All @@ -254,15 +254,15 @@ index e38930d..c728587 100644
return mem; return mem;
} }


@@ -916,7 +1039,6 @@ ruby_xfree(void *x) @@ -917,7 +1040,6 @@ ruby_xfree(void *x)
vm_xfree(&rb_objspace, x); vm_xfree(&rb_objspace, x);
} }


- -
/* /*
* call-seq: * call-seq:
* GC.enable -> true or false * GC.enable -> true or false
@@ -962,6 +1084,455 @@ rb_gc_disable(void) @@ -963,6 +1085,455 @@ rb_gc_disable(void)
return old ? Qtrue : Qfalse; return old ? Qtrue : Qfalse;
} }


Expand Down Expand Up @@ -718,7 +718,7 @@ index e38930d..c728587 100644
VALUE rb_mGC; VALUE rb_mGC;


void void
@@ -1033,6 +1604,12 @@ allocate_sorted_heaps(rb_objspace_t *objspace, size_t next_heaps_length) @@ -1034,6 +1605,12 @@ allocate_sorted_heaps(rb_objspace_t *objspace, size_t next_heaps_length)
static void static void
assign_heap_slot(rb_objspace_t *objspace) assign_heap_slot(rb_objspace_t *objspace)
{ {
Expand All @@ -731,15 +731,15 @@ index e38930d..c728587 100644
RVALUE *p, *pend, *membase; RVALUE *p, *pend, *membase;
struct heaps_slot *slot; struct heaps_slot *slot;
size_t hi, lo, mid; size_t hi, lo, mid;
@@ -1094,6 +1671,7 @@ assign_heap_slot(rb_objspace_t *objspace) @@ -1095,6 +1672,7 @@ assign_heap_slot(rb_objspace_t *objspace)
if (lomem == 0 || lomem > p) lomem = p; if (lomem == 0 || lomem > p) lomem = p;
if (himem < pend) himem = pend; if (himem < pend) himem = pend;
heaps_used++; heaps_used++;
+ heap_size += objs; + heap_size += objs;


while (p < pend) { while (p < pend) {
p->as.free.flags = 0; p->as.free.flags = 0;
@@ -1150,7 +1728,7 @@ initial_expand_heap(rb_objspace_t *objspace) @@ -1151,7 +1729,7 @@ initial_expand_heap(rb_objspace_t *objspace)
static void static void
set_heaps_increment(rb_objspace_t *objspace) set_heaps_increment(rb_objspace_t *objspace)
{ {
Expand All @@ -748,7 +748,7 @@ index e38930d..c728587 100644


if (next_heaps_length == heaps_used) { if (next_heaps_length == heaps_used) {
next_heaps_length++; next_heaps_length++;
@@ -1183,6 +1761,22 @@ rb_during_gc(void) @@ -1184,6 +1762,22 @@ rb_during_gc(void)


#define RANY(o) ((RVALUE*)(o)) #define RANY(o) ((RVALUE*)(o))


Expand All @@ -771,7 +771,7 @@ index e38930d..c728587 100644
VALUE VALUE
rb_newobj(void) rb_newobj(void)
{ {
@@ -1214,9 +1808,11 @@ rb_newobj(void) @@ -1215,9 +1809,11 @@ rb_newobj(void)


MEMZERO((void*)obj, RVALUE, 1); MEMZERO((void*)obj, RVALUE, 1);
#ifdef GC_DEBUG #ifdef GC_DEBUG
Expand All @@ -784,7 +784,7 @@ index e38930d..c728587 100644
GC_PROF_INC_LIVE_NUM; GC_PROF_INC_LIVE_NUM;


return obj; return obj;
@@ -1768,6 +2364,12 @@ gc_mark_children(rb_objspace_t *objspace, VALUE ptr) @@ -1769,6 +2365,12 @@ gc_mark_children(rb_objspace_t *objspace, VALUE ptr)
{ {
register RVALUE *obj = RANY(ptr); register RVALUE *obj = RANY(ptr);


Expand All @@ -797,7 +797,7 @@ index e38930d..c728587 100644
goto marking; /* skip */ goto marking; /* skip */


again: again:
@@ -1778,6 +2380,12 @@ gc_mark_children(rb_objspace_t *objspace, VALUE ptr) @@ -1779,6 +2381,12 @@ gc_mark_children(rb_objspace_t *objspace, VALUE ptr)
obj->as.basic.flags |= FL_MARK; obj->as.basic.flags |= FL_MARK;
objspace->heap.live_num++; objspace->heap.live_num++;


Expand All @@ -810,7 +810,7 @@ index e38930d..c728587 100644
marking: marking:
if (FL_TEST(obj, FL_EXIVAR)) { if (FL_TEST(obj, FL_EXIVAR)) {
rb_mark_generic_ivar(ptr); rb_mark_generic_ivar(ptr);
@@ -2120,6 +2728,25 @@ free_unused_heaps(rb_objspace_t *objspace) @@ -2121,6 +2729,25 @@ free_unused_heaps(rb_objspace_t *objspace)
} }
} }


Expand All @@ -836,7 +836,7 @@ index e38930d..c728587 100644
static void static void
slot_sweep(rb_objspace_t *objspace, struct heaps_slot *sweep_slot) slot_sweep(rb_objspace_t *objspace, struct heaps_slot *sweep_slot)
{ {
@@ -2127,14 +2754,23 @@ slot_sweep(rb_objspace_t *objspace, struct heaps_slot *sweep_slot) @@ -2128,14 +2755,23 @@ slot_sweep(rb_objspace_t *objspace, struct heaps_slot *sweep_slot)
RVALUE *p, *pend; RVALUE *p, *pend;
RVALUE *free = freelist, *final = deferred_final_list; RVALUE *free = freelist, *final = deferred_final_list;
int deferred; int deferred;
Expand All @@ -860,7 +860,7 @@ index e38930d..c728587 100644
p->as.free.flags = T_ZOMBIE; p->as.free.flags = T_ZOMBIE;
RDATA(p)->dfree = 0; RDATA(p)->dfree = 0;
} }
@@ -2144,6 +2780,10 @@ slot_sweep(rb_objspace_t *objspace, struct heaps_slot *sweep_slot) @@ -2145,6 +2781,10 @@ slot_sweep(rb_objspace_t *objspace, struct heaps_slot *sweep_slot)
final_num++; final_num++;
} }
else { else {
Expand All @@ -871,7 +871,7 @@ index e38930d..c728587 100644
add_freelist(objspace, p); add_freelist(objspace, p);
free_num++; free_num++;
} }
@@ -2151,13 +2791,22 @@ slot_sweep(rb_objspace_t *objspace, struct heaps_slot *sweep_slot) @@ -2152,13 +2792,22 @@ slot_sweep(rb_objspace_t *objspace, struct heaps_slot *sweep_slot)
else if (BUILTIN_TYPE(p) == T_ZOMBIE) { else if (BUILTIN_TYPE(p) == T_ZOMBIE) {
/* objects to be finalized */ /* objects to be finalized */
/* do nothing remain marked */ /* do nothing remain marked */
Expand All @@ -895,7 +895,7 @@ index e38930d..c728587 100644
objspace->heap.free_num > objspace->heap.do_heap_free) { objspace->heap.free_num > objspace->heap.do_heap_free) {
RVALUE *pp; RVALUE *pp;


@@ -2168,6 +2817,8 @@ slot_sweep(rb_objspace_t *objspace, struct heaps_slot *sweep_slot) @@ -2169,6 +2818,8 @@ slot_sweep(rb_objspace_t *objspace, struct heaps_slot *sweep_slot)
sweep_slot->limit = final_num; sweep_slot->limit = final_num;
freelist = free; /* cancel this page from freelist */ freelist = free; /* cancel this page from freelist */
unlink_heap_slot(objspace, sweep_slot); unlink_heap_slot(objspace, sweep_slot);
Expand All @@ -904,7 +904,7 @@ index e38930d..c728587 100644
} }
else { else {
objspace->heap.free_num += free_num; objspace->heap.free_num += free_num;
@@ -2180,6 +2831,10 @@ slot_sweep(rb_objspace_t *objspace, struct heaps_slot *sweep_slot) @@ -2181,6 +2832,10 @@ slot_sweep(rb_objspace_t *objspace, struct heaps_slot *sweep_slot)
RUBY_VM_SET_FINALIZER_INTERRUPT(th); RUBY_VM_SET_FINALIZER_INTERRUPT(th);
} }
} }
Expand All @@ -915,7 +915,7 @@ index e38930d..c728587 100644
} }


static int static int
@@ -2200,6 +2855,21 @@ ready_to_gc(rb_objspace_t *objspace) @@ -2201,6 +2856,21 @@ ready_to_gc(rb_objspace_t *objspace)
static void static void
before_gc_sweep(rb_objspace_t *objspace) before_gc_sweep(rb_objspace_t *objspace)
{ {
Expand All @@ -937,7 +937,7 @@ index e38930d..c728587 100644
freelist = 0; freelist = 0;
objspace->heap.do_heap_free = (size_t)((heaps_used * HEAP_OBJ_LIMIT) * 0.65); objspace->heap.do_heap_free = (size_t)((heaps_used * HEAP_OBJ_LIMIT) * 0.65);
objspace->heap.free_min = (size_t)((heaps_used * HEAP_OBJ_LIMIT) * 0.2); objspace->heap.free_min = (size_t)((heaps_used * HEAP_OBJ_LIMIT) * 0.2);
@@ -2219,8 +2889,13 @@ before_gc_sweep(rb_objspace_t *objspace) @@ -2220,8 +2890,13 @@ before_gc_sweep(rb_objspace_t *objspace)
static void static void
after_gc_sweep(rb_objspace_t *objspace) after_gc_sweep(rb_objspace_t *objspace)
{ {
Expand All @@ -951,7 +951,7 @@ index e38930d..c728587 100644
if (objspace->heap.free_num < objspace->heap.free_min) { if (objspace->heap.free_num < objspace->heap.free_min) {
set_heaps_increment(objspace); set_heaps_increment(objspace);
heaps_increment(objspace); heaps_increment(objspace);
@@ -2233,6 +2908,29 @@ after_gc_sweep(rb_objspace_t *objspace) @@ -2234,6 +2909,29 @@ after_gc_sweep(rb_objspace_t *objspace)
malloc_increase = 0; malloc_increase = 0;


free_unused_heaps(objspace); free_unused_heaps(objspace);
Expand Down Expand Up @@ -981,7 +981,7 @@ index e38930d..c728587 100644
} }


static int static int
@@ -2266,9 +2964,11 @@ rest_sweep(rb_objspace_t *objspace) @@ -2267,9 +2965,11 @@ rest_sweep(rb_objspace_t *objspace)


static void gc_marks(rb_objspace_t *objspace); static void gc_marks(rb_objspace_t *objspace);


Expand All @@ -993,15 +993,15 @@ index e38930d..c728587 100644
int res; int res;
INIT_GC_PROF_PARAMS; INIT_GC_PROF_PARAMS;


@@ -2290,7 +2990,6 @@ gc_lazy_sweep(rb_objspace_t *objspace) @@ -2291,7 +2991,6 @@ gc_lazy_sweep(rb_objspace_t *objspace)
GC_PROF_TIMER_STOP(Qfalse); GC_PROF_TIMER_STOP(Qfalse);
return res; return res;
} }
- after_gc_sweep(objspace); - after_gc_sweep(objspace);
} }
else { else {
if (heaps_increment(objspace)) { if (heaps_increment(objspace)) {
@@ -2298,6 +2997,18 @@ gc_lazy_sweep(rb_objspace_t *objspace) @@ -2299,6 +2998,18 @@ gc_lazy_sweep(rb_objspace_t *objspace)
return TRUE; return TRUE;
} }
} }
Expand All @@ -1020,7 +1020,7 @@ index e38930d..c728587 100644


gc_marks(objspace); gc_marks(objspace);


@@ -2306,6 +3017,10 @@ gc_lazy_sweep(rb_objspace_t *objspace) @@ -2307,6 +3018,10 @@ gc_lazy_sweep(rb_objspace_t *objspace)
set_heaps_increment(objspace); set_heaps_increment(objspace);
} }


Expand All @@ -1031,15 +1031,15 @@ index e38930d..c728587 100644
GC_PROF_SWEEP_TIMER_START; GC_PROF_SWEEP_TIMER_START;
if(!(res = lazy_sweep(objspace))) { if(!(res = lazy_sweep(objspace))) {
after_gc_sweep(objspace); after_gc_sweep(objspace);
@@ -2317,6 +3032,7 @@ gc_lazy_sweep(rb_objspace_t *objspace) @@ -2318,6 +3033,7 @@ gc_lazy_sweep(rb_objspace_t *objspace)
GC_PROF_SWEEP_TIMER_STOP; GC_PROF_SWEEP_TIMER_STOP;


GC_PROF_TIMER_STOP(Qtrue); GC_PROF_TIMER_STOP(Qtrue);
+ +
return res; return res;
} }


@@ -2543,9 +3259,15 @@ gc_marks(rb_objspace_t *objspace) @@ -2544,9 +3260,15 @@ gc_marks(rb_objspace_t *objspace)
rb_thread_t *th = GET_THREAD(); rb_thread_t *th = GET_THREAD();
GC_PROF_MARK_TIMER_START; GC_PROF_MARK_TIMER_START;


Expand All @@ -1056,7 +1056,7 @@ index e38930d..c728587 100644


SET_STACK_END; SET_STACK_END;


@@ -2577,11 +3299,15 @@ gc_marks(rb_objspace_t *objspace) @@ -2578,11 +3300,15 @@ gc_marks(rb_objspace_t *objspace)
gc_mark_stacked_objects(objspace); gc_mark_stacked_objects(objspace);


GC_PROF_MARK_TIMER_STOP; GC_PROF_MARK_TIMER_STOP;
Expand All @@ -1072,7 +1072,7 @@ index e38930d..c728587 100644
INIT_GC_PROF_PARAMS; INIT_GC_PROF_PARAMS;


if (GC_NOTIFY) printf("start garbage_collect()\n"); if (GC_NOTIFY) printf("start garbage_collect()\n");
@@ -2597,15 +3323,31 @@ garbage_collect(rb_objspace_t *objspace) @@ -2598,15 +3324,31 @@ garbage_collect(rb_objspace_t *objspace)


rest_sweep(objspace); rest_sweep(objspace);


Expand Down Expand Up @@ -1104,7 +1104,7 @@ index e38930d..c728587 100644
return TRUE; return TRUE;
} }


@@ -3094,6 +3836,39 @@ rb_gc_call_finalizer_at_exit(void) @@ -3095,6 +3837,39 @@ rb_gc_call_finalizer_at_exit(void)
rb_objspace_call_finalizer(&rb_objspace); rb_objspace_call_finalizer(&rb_objspace);
} }


Expand Down Expand Up @@ -1144,7 +1144,7 @@ index e38930d..c728587 100644
static void static void
rb_objspace_call_finalizer(rb_objspace_t *objspace) rb_objspace_call_finalizer(rb_objspace_t *objspace)
{ {
@@ -3408,6 +4183,49 @@ count_objects(int argc, VALUE *argv, VALUE os) @@ -3403,6 +4178,49 @@ count_objects(int argc, VALUE *argv, VALUE os)
return hash; return hash;
} }


Expand Down Expand Up @@ -1194,7 +1194,7 @@ index e38930d..c728587 100644
/* /*
* call-seq: * call-seq:
* GC.count -> Integer * GC.count -> Integer
@@ -3700,6 +4518,28 @@ Init_GC(void) @@ -3695,6 +4513,28 @@ Init_GC(void)
rb_define_singleton_method(rb_mGC, "stat", gc_stat, -1); rb_define_singleton_method(rb_mGC, "stat", gc_stat, -1);
rb_define_method(rb_mGC, "garbage_collect", rb_gc_start, 0); rb_define_method(rb_mGC, "garbage_collect", rb_gc_start, 0);


Expand Down Expand Up @@ -1223,7 +1223,7 @@ index e38930d..c728587 100644
rb_mProfiler = rb_define_module_under(rb_mGC, "Profiler"); rb_mProfiler = rb_define_module_under(rb_mGC, "Profiler");
rb_define_singleton_method(rb_mProfiler, "enabled?", gc_profile_enable_get, 0); rb_define_singleton_method(rb_mProfiler, "enabled?", gc_profile_enable_get, 0);
rb_define_singleton_method(rb_mProfiler, "enable", gc_profile_enable, 0); rb_define_singleton_method(rb_mProfiler, "enable", gc_profile_enable, 0);
@@ -3713,6 +4553,9 @@ Init_GC(void) @@ -3708,6 +4548,9 @@ Init_GC(void)
rb_define_module_function(rb_mObSpace, "each_object", os_each_obj, -1); rb_define_module_function(rb_mObSpace, "each_object", os_each_obj, -1);
rb_define_module_function(rb_mObSpace, "garbage_collect", rb_gc_start, 0); rb_define_module_function(rb_mObSpace, "garbage_collect", rb_gc_start, 0);


Expand Down
Original file line number Original file line Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/gc.c b/gc.c diff --git a/gc.c b/gc.c
index c728587..6b6c9f0 100644 index 0be1ec9..c198770 100644
--- a/gc.c --- a/gc.c
+++ b/gc.c +++ b/gc.c
@@ -1344,6 +1344,34 @@ rb_gc_log_file(int argc, VALUE *argv, VALUE self) @@ -1345,6 +1345,34 @@ rb_gc_log_file(int argc, VALUE *argv, VALUE self)
} }


/* /*
Expand Down
Loading

0 comments on commit 4d26302

Please sign in to comment.