summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-24 15:42:30 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-24 15:42:30 +0000
commit66b2b435bfb30a287b2b11f1a77a20bb59a4b026 (patch)
treed10fd8a84bd7ba72a864b81934a38d50986dd6c1
parent2c30e876c43debeb2736dc40b96fb82268d2ea49 (diff)
merge revision(s) 51816: [Backport #8543]
* 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] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@52740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--compile.c2
-rw-r--r--test/ruby/test_iseq.rb20
-rw-r--r--version.h2
4 files changed, 28 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index e0e90fc10e..9e013849d3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Wed Nov 25 00:32:44 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 Nov 25 00:14:28 2015 NARUSE, Yui <naruse@ruby-lang.org>
* ext/digest/*/*.[ch]: include ruby.h before digest.h to avoid
diff --git a/compile.c b/compile.c
index 218afcfcd2..a316cbbf0a 100644
--- a/compile.c
+++ b/compile.c
@@ -5973,7 +5973,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 686646ddd8..3ae93bc0b8 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
diff --git a/version.h b/version.h
index a1f5862838..e2570ab34b 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.2.4"
#define RUBY_RELEASE_DATE "2015-11-25"
-#define RUBY_PATCHLEVEL 196
+#define RUBY_PATCHLEVEL 197
#define RUBY_RELEASE_YEAR 2015
#define RUBY_RELEASE_MONTH 11