aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--gc.c8
-rw-r--r--thread.c3
3 files changed, 18 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 8d6f2ae576..b70899986a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Sun May 30 01:25:48 2010 Masaya Tarui <tarui@ruby-lnag.org>
+
+ * thread.c (RB_GC_SAVE_MACHINE_CONTEXT): start GC
+ by switching the thread if gc_stress == true
+
+ * gc.c (ruby_gc_stress_start): dotto.
+
Sun May 30 00:02:39 2010 Yusuke Endoh <mame@tsg.ne.jp>
* gc.c (force_chain_object, rb_objspace_call_finalizer): delete
diff --git a/gc.c b/gc.c
index b0a6dcf6c0..44d04caf16 100644
--- a/gc.c
+++ b/gc.c
@@ -517,6 +517,14 @@ gc_stress_get(VALUE self)
return ruby_gc_stress ? Qtrue : Qfalse;
}
+void
+ruby_gc_stress_start(void)
+{
+ rb_objspace_t *objspace = &rb_objspace;
+ if(ruby_gc_stress)
+ rb_gc();
+}
+
/*
* call-seq:
* GC.stress = bool -> bool
diff --git a/thread.c b/thread.c
index dcf7a2e838..b6e598304d 100644
--- a/thread.c
+++ b/thread.c
@@ -99,10 +99,13 @@ static void reset_unblock_function(rb_thread_t *th, const struct rb_unblock_call
static inline void blocking_region_end(rb_thread_t *th, struct rb_blocking_region_buffer *region);
+void ruby_gc_stress_start(void);
+
#define RB_GC_SAVE_MACHINE_CONTEXT(th) \
do { \
rb_gc_save_machine_context(th); \
SET_MACHINE_STACK_END(&(th)->machine_stack_end); \
+ ruby_gc_stress_start(); \
} while (0)
#define GVL_UNLOCK_BEGIN() do { \