diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-02-13 08:14:19 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-02-13 08:14:19 +0000 |
commit | 9eb54f7fb4672a4b0f39772be819965a4b7088f5 (patch) | |
tree | abd755e740995acd6b511ea71ecb635505a9e44c /include | |
parent | 959aac29e74547e98a83325e765c0cc9e57f50ca (diff) | |
download | ruby-9eb54f7fb4672a4b0f39772be819965a4b7088f5.tar.gz |
ruby.h: RB_GC_GUARD stronger than gcc7
* include/ruby/ruby.h (RB_GC_GUARD): prevent guarded pointer from
optimization by using as an input to inline asm.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57619 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'include')
-rw-r--r-- | include/ruby/ruby.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h index 6144c67234..d0651f40ac 100644 --- a/include/ruby/ruby.h +++ b/include/ruby/ruby.h @@ -536,7 +536,11 @@ static inline int rb_type(VALUE obj); #ifdef __GNUC__ #define RB_GC_GUARD(v) \ - (*__extension__ ({volatile VALUE *rb_gc_guarded_ptr = &(v); rb_gc_guarded_ptr;})) + (*__extension__ ({ \ + volatile VALUE *rb_gc_guarded_ptr = &(v); \ + __asm__("### RB_GC_GUARD("#v")" : : "m"(rb_gc_guarded_ptr)); \ + rb_gc_guarded_ptr; \ + })) #elif defined _MSC_VER #pragma optimize("", off) static inline volatile VALUE *rb_gc_guarded_ptr(volatile VALUE *ptr) {return ptr;} |