[前][次][番号順一覧][スレッド一覧]

ruby-changes:32985

From: normal <ko1@a...>
Date: Fri, 21 Feb 2014 08:46:01 +0900 (JST)
Subject: [ruby-changes:32985] normal:r45064 (trunk): gc.c: RB_GC_GUARD should be robust enough for any compiler

normal	2014-02-21 08:45:55 +0900 (Fri, 21 Feb 2014)

  New Revision: 45064

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45064

  Log:
    gc.c: RB_GC_GUARD should be robust enough for any compiler
    
    * include/ruby/ruby.h (RB_GC_GUARD):
      use rb_gc_guarded_ptr_val on non-GCC/MSC
    * gc.c (rb_gc_guarded_ptr_val): rename and adjust argument.
      RB_GC_GUARD should be robust enough for any compiler.
      [ruby-core:60816] [Bug #7805]

  Modified files:
    trunk/ChangeLog
    trunk/gc.c
    trunk/include/ruby/ruby.h
Index: include/ruby/ruby.h
===================================================================
--- include/ruby/ruby.h	(revision 45063)
+++ include/ruby/ruby.h	(revision 45064)
@@ -515,12 +515,16 @@ static inline int rb_type(VALUE obj); https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L515
 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))
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 45063)
+++ ChangeLog	(revision 45064)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Feb 21 08:27:19 2014  Eric Wong  <e@8...>
+
+	* include/ruby/ruby.h (RB_GC_GUARD):
+	  use rb_gc_guarded_ptr_val on non-GCC/MSC
+	* gc.c (rb_gc_guarded_ptr_val): rename and adjust argument.
+	  RB_GC_GUARD should be robust enough for any compiler.
+	  [ruby-core:60816] [Bug #7805]
+
 Thu Feb 20 22:21:26 2014  Tanaka Akira  <akr@f...>
 
 	* ext/socket/raddrinfo.c (numeric_getaddrinfo): Use xcalloc.
Index: gc.c
===================================================================
--- gc.c	(revision 45063)
+++ gc.c	(revision 45064)
@@ -88,10 +88,14 @@ https://github.com/ruby/ruby/blob/trunk/gc.c#L88
 #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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]