1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

compile.c: keep debug info

* compile.c (iseq_peephole_optimize): keep freezestring insn
  with debug info.  [Bug #14475]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2018-02-16 01:15:35 +00:00
parent b67f65dbd6
commit 86de3e411a
2 changed files with 4 additions and 1 deletions

View file

@ -2846,11 +2846,12 @@ iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcal
}
if (IS_INSN_ID(iobj, freezestring) &&
NIL_P(OPERAND_AT(iobj, 0)) &&
IS_NEXT_INSN_ID(&iobj->link, send)) {
INSN *niobj = (INSN *)iobj->link.next;
struct rb_call_info *ci = (struct rb_call_info *)OPERAND_AT(niobj, 0);
/*
* freezestring debug_info
* freezestring nil # no debug_info
* send <:+@, 0, ARG_SIMPLE> # :-@, too
* =>
* send <:+@, 0, ARG_SIMPLE> # :-@, too

View file

@ -947,6 +947,8 @@ class TestRubyOptions < Test::Unit::TestCase
[
['"foo" << "bar"', err],
['"foo#{123}bar" << "bar"', err],
['+"foo#{123}bar" << "bar"', []],
['-"foo#{123}bar" << "bar"', freeze && debug ? with_debug_pat : wo_debug_pat],
].each do |code, expected|
assert_in_out_err(opt, code, [], expected, [opt, code])
end