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
This commit is contained in:
parent
959aac29e7
commit
9eb54f7fb4
@ -536,7 +536,11 @@ static inline int rb_type(VALUE obj);
|
|||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#define RB_GC_GUARD(v) \
|
#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
|
#elif defined _MSC_VER
|
||||||
#pragma optimize("", off)
|
#pragma optimize("", off)
|
||||||
static inline volatile VALUE *rb_gc_guarded_ptr(volatile VALUE *ptr) {return ptr;}
|
static inline volatile VALUE *rb_gc_guarded_ptr(volatile VALUE *ptr) {return ptr;}
|
||||||
|
@ -1024,7 +1024,7 @@ VALUE
|
|||||||
rb_marshal_dump_limited(VALUE obj, VALUE port, int limit)
|
rb_marshal_dump_limited(VALUE obj, VALUE port, int limit)
|
||||||
{
|
{
|
||||||
struct dump_arg *arg;
|
struct dump_arg *arg;
|
||||||
volatile VALUE wrapper; /* used to avoid memory leak in case of exception */
|
VALUE wrapper; /* used to avoid memory leak in case of exception */
|
||||||
|
|
||||||
wrapper = TypedData_Make_Struct(rb_cData, struct dump_arg, &dump_arg_data, arg);
|
wrapper = TypedData_Make_Struct(rb_cData, struct dump_arg, &dump_arg_data, arg);
|
||||||
arg->dest = 0;
|
arg->dest = 0;
|
||||||
@ -2038,7 +2038,7 @@ rb_marshal_load_with_proc(VALUE port, VALUE proc)
|
|||||||
{
|
{
|
||||||
int major, minor, infection = 0;
|
int major, minor, infection = 0;
|
||||||
VALUE v;
|
VALUE v;
|
||||||
volatile VALUE wrapper; /* used to avoid memory leak in case of exception */
|
VALUE wrapper; /* used to avoid memory leak in case of exception */
|
||||||
struct load_arg *arg;
|
struct load_arg *arg;
|
||||||
|
|
||||||
v = rb_check_string_type(port);
|
v = rb_check_string_type(port);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user