aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--compile.c2
-rw-r--r--test/ruby/test_iseq.rb20
3 files changed, 27 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 22c4e21571..57892f8fc9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Thu Sep 10 12:17:28 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * compile.c (iseq_build_from_ary_body): register cdhash to the
+ iseq constant body instead of compile time mark array, not to
+ get GCed. [ruby-core:70708] [Feature #8543]
+
Wed Sep 9 18:16:14 2015 NAKAMURA Usaku <usa@ruby-lang.org>
* lib/rubygems/stub_specification.rb (Gem::StubSpecification#data):
diff --git a/compile.c b/compile.c
index f77dc24282..857d994f4e 100644
--- a/compile.c
+++ b/compile.c
@@ -6048,7 +6048,7 @@ iseq_build_from_ary_body(rb_iseq_t *iseq, LINK_ANCHOR *anchor,
}
RB_GC_GUARD(op);
argv[j] = map;
- iseq_add_mark_object_compile_time(iseq, map);
+ rb_iseq_add_mark_object(iseq, map);
}
break;
case TS_FUNCPTR:
diff --git a/test/ruby/test_iseq.rb b/test/ruby/test_iseq.rb
index 3938fb3d48..72b9c4ae3a 100644
--- a/test/ruby/test_iseq.rb
+++ b/test/ruby/test_iseq.rb
@@ -51,6 +51,26 @@ class TestISeq < Test::Unit::TestCase
assert_raise_with_message(TypeError, /:foobar/) {RubyVM::InstructionSequence.load(ary)}
end if defined?(RubyVM::InstructionSequence.load)
+ def test_loaded_cdhash_mark
+ iseq = RubyVM::InstructionSequence.compile(<<-'end;', __FILE__, __FILE__, __LINE__+1)
+ def bug(kw)
+ case kw
+ when "false" then false
+ when "true" then true
+ when "nil" then nil
+ else raise("unhandled argument: #{kw.inspect}")
+ end
+ end
+ end;
+ assert_separately([], <<-"end;")
+ iseq = #{iseq.to_a.inspect}
+ RubyVM::InstructionSequence.load(iseq).eval
+ assert_equal(false, bug("false"))
+ GC.start
+ assert_equal(false, bug("false"))
+ end;
+ end if defined?(RubyVM::InstructionSequence.load)
+
def test_disasm_encoding
src = "\u{3042} = 1; \u{3042}; \u{3043}"
asm = RubyVM::InstructionSequence.compile(src).disasm