[#60404] is RB_GC_GUARD needed in rb_io_syswrite? — Eric Wong <normalperson@...>
I haven't gotten it to crash as-is, but it seems like we need to
4 messages
2014/02/01
[#60682] volatile usages — Eric Wong <normalperson@...>
Hi all, I went ahead and removed some use of volatile which were once
5 messages
2014/02/13
[#60794] [RFC] rearrange+pack vtm and time_object structs — Eric Wong <normalperson@...>
Extracted from addendum on top of Feature #9362 (cache-aligned objects).
4 messages
2014/02/16
[#61139] [ruby-trunk - Feature #9577] [Open] [PATCH] benchmark/driver.rb: align columns in text output — normalperson@...
Issue #9577 has been reported by Eric Wong.
3 messages
2014/02/28
[ruby-core:60816] Re: [ruby-trunk - Bug #7805] ruby 2.0rc2 core on solaris
From:
Eric Wong <normalperson@...>
Date:
2014-02-18 08:01:11 UTC
List:
ruby-core #60816
Can you please try the following patch?
This is hopefully robust enough for all future compilers:
http://bogomips.org/ruby.git/patch?id=1b5d3c0b9d
--- a/gc.c
+++ b/gc.c
@@ -88,10 +88,14 @@
#define rb_setjmp(env) RUBY_SETJMP(env)
#define rb_jmp_buf rb_jmpbuf_t
-#if defined(HAVE_RB_GC_GUARDED_PTR) && HAVE_RB_GC_GUARDED_PTR
+#if defined(HAVE_RB_GC_GUARDED_PTR_VAL) && HAVE_RB_GC_GUARDED_PTR_VAL
+/* trick the compiler into thinking a external signal handler uses this */
+volatile VALUE rb_gc_guarded_val;
volatile VALUE *
-rb_gc_guarded_ptr(volatile VALUE *ptr)
+rb_gc_guarded_ptr_val(volatile VALUE *ptr, VALUE val)
{
+ rb_gc_guarded_val = val;
+
return ptr;
}
#endif
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
index 55ea252..abd4b4b 100644
--- a/include/ruby/ruby.h
+++ b/include/ruby/ruby.h
@@ -515,12 +515,16 @@ static inline int rb_type(VALUE obj);
static inline volatile VALUE *rb_gc_guarded_ptr(volatile VALUE *ptr) {return ptr;}
#pragma optimize("", on)
#else
-volatile VALUE *rb_gc_guarded_ptr(volatile VALUE *ptr);
-#define HAVE_RB_GC_GUARDED_PTR 1
+volatile VALUE *rb_gc_guarded_ptr_val(volatile VALUE *ptr, VALUE val);
+#define HAVE_RB_GC_GUARDED_PTR_VAL 1
+#define RB_GC_GUARD(v) (*rb_gc_guarded_ptr_val(&(v),(v)))
#endif
#define RB_GC_GUARD_PTR(ptr) rb_gc_guarded_ptr(ptr)
#endif
+
+#ifndef RB_GC_GUARD
#define RB_GC_GUARD(v) (*RB_GC_GUARD_PTR(&(v)))
+#endif
#ifdef __GNUC__
#define RB_UNUSED_VAR(x) x __attribute__ ((unused))
------------------------------8<---------------------------
If you prefer git pull:
git pull git://80x24.org/ruby.git gc-guard-harder-v2
Maybe my original idea works, too, but it is weaker, I think:
git pull git://80x24.org/ruby.git gc-guard-harder
http://bogomips.org/ruby.git/patch?id=ecc6f50ca