summaryrefslogtreecommitdiff
path: root/marshal.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-13 07:30:30 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-13 07:30:30 +0000
commit8788489ca967599f83d96083f244f91c83286a88 (patch)
tree10ac4bd9571d8d3fffa2d69bad7f29743a99c1ea /marshal.c
parentaf41ce23eaacb4697216ad8bb5975fc97a06147b (diff)
merge revision(s) 57410,57619,57621,57631,57634: [Backport #13150]
Prevent GC by volatile [Bug #13150] test/ruby/test_marshal.rb test_context_switch (load) and test_gc (dump) are failed on FreeBSD 10.3 and gcc7 (FreeBSD Ports Collection) 7.0.0 20170115 (experimental); RB_GC_GUARD looks not worked well. 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. ruby.h: remove comment * include/ruby/ruby.h (RB_GC_GUARD): remove comment unsupported by Solaris AS. marshal.c: use hidden objects to allow recycling Hidden objects (klass == 0) are not visible to Ruby code invoked from other threads or signal handlers, so they can never be accessed from other contexts. This makes it safe to call rb_gc_force_recycle on the object slot after releasing malloc memory. * marshal.c (rb_marshal_dump_limited): hide dump_arg and recycle when done (rb_marshal_load_with_proc): hide load_arg and recycle when done [ruby-core:79518] marshal.c: revert r57631 partially * marshal.c (rb_marshal_dump_limited): do not free dump_arg, which may be dereferenced in check_dump_arg due to continuation, and get rid of dangling pointers. * marshal.c (rb_marshal_load_with_proc): ditto for load_arg. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@57954 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'marshal.c')
-rw-r--r--marshal.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/marshal.c b/marshal.c
index a9926acf56..7e16d0b024 100644
--- a/marshal.c
+++ b/marshal.c
@@ -1026,7 +1026,7 @@ rb_marshal_dump_limited(VALUE obj, VALUE port, int limit)
struct dump_arg *arg;
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(0, struct dump_arg, &dump_arg_data, arg);
arg->dest = 0;
arg->symbols = st_init_numtable();
arg->data = rb_init_identtable();
@@ -2053,7 +2053,7 @@ rb_marshal_load_with_proc(VALUE port, VALUE proc)
else {
io_needed();
}
- wrapper = TypedData_Make_Struct(rb_cData, struct load_arg, &load_arg_data, arg);
+ wrapper = TypedData_Make_Struct(0, struct load_arg, &load_arg_data, arg);
arg->infection = infection;
arg->src = port;
arg->offset = 0;