From c3205d65e719dc60deef4136d4556b7ebd803b5f Mon Sep 17 00:00:00 2001 From: usa Date: Wed, 9 Aug 2017 08:40:46 +0000 Subject: [Backport #13150] this patch contains r54158, r57410, r57631 and r57954. 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. * 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. 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 (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_3@59539 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_marshal.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_marshal.rb b/test/ruby/test_marshal.rb index 6ac5c29991..dc2b8b30dc 100644 --- a/test/ruby/test_marshal.rb +++ b/test/ruby/test_marshal.rb @@ -645,6 +645,9 @@ class TestMarshal < Test::Unit::TestCase c = Bug9523.new assert_raise_with_message(RuntimeError, /Marshal\.dump reentered at marshal_dump/) do Marshal.dump(c) + GC.start + 1000.times {"x"*1000} + GC.start c.cc.call end end -- cgit v1.2.3