From: Eric Wong <normalperson@yhbt.net>
To: ruby-core@ruby-lang.org
Subject: [ruby-core:60816] Re: [ruby-trunk - Bug #7805] ruby 2.0rc2 core on solaris
Date: Tue, 18 Feb 2014 08:01:11 +0000 [thread overview]
Message-ID: <20140218080111.GA25077@dcvr.yhbt.net> (raw)
In-Reply-To: <redmine.journal-45233.20140218072208.2c973138147b7b6e@ruby-lang.org>
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
next prev parent reply other threads:[~2014-02-18 8:10 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-08 19:04 [ruby-core:52042] [ruby-trunk - Bug #7805][Open] ruby 2.0rc2 core on solaris groenveld@acm.org (John Groenveld)
2013-02-09 2:51 ` [ruby-core:52056] [ruby-trunk - Bug #7805][Assigned] " mame (Yusuke Endoh)
2013-02-10 13:34 ` [ruby-core:52110] [ruby-trunk - Bug #7805] " ngoto (Naohisa Goto)
2013-02-10 13:35 ` [ruby-core:52111] [ruby-trunk - Bug #7805][Feedback] " ngoto (Naohisa Goto)
2013-02-18 16:12 ` [ruby-core:52483] [ruby-trunk - Bug #7805] " mame (Yusuke Endoh)
2013-02-22 8:03 ` [ruby-core:52687] " ngoto (Naohisa Goto)
2013-02-22 8:12 ` [ruby-core:52688] " nobu (Nobuyoshi Nakada)
2013-02-22 8:27 ` [ruby-core:52689] " ngoto (Naohisa Goto)
2013-02-26 17:40 ` [ruby-core:52946] " groenveld@acm.org (John Groenveld)
2013-02-27 3:43 ` [ruby-core:52979] " kosaki (Motohiro KOSAKI)
2013-03-09 5:03 ` [ruby-core:53253] " groenveld@acm.org (John Groenveld)
2014-02-14 10:07 ` [ruby-core:60730] Re: [ruby-trunk - Bug #7805][Open] " Eric Wong
2014-02-14 10:11 ` [ruby-core:60731] [ruby-trunk - Bug #7805] " normalperson
2014-02-18 7:12 ` [ruby-core:60811] [ruby-trunk - Bug #7805] [Open] " ngotogenome
2014-02-18 7:13 ` [ruby-core:60812] [ruby-trunk - Bug #7805] " ngotogenome
2014-02-18 7:19 ` [ruby-core:60813] " ngotogenome
2014-02-18 7:21 ` [ruby-core:60814] " Eric Wong
2014-02-18 7:22 ` [ruby-core:60815] " normalperson
2014-02-18 8:01 ` Eric Wong [this message]
2014-02-18 8:12 ` [ruby-core:60818] " normalperson
2014-02-20 23:10 ` [ruby-core:60914] " nobu
2014-02-20 23:47 ` [ruby-core:60915] " Eric Wong
2014-02-20 23:53 ` [ruby-core:60916] " normalperson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.ruby-lang.org/en/community/mailing-lists/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140218080111.GA25077@dcvr.yhbt.net \
--to=ruby-core@ruby-lang.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).