mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
merge revision(s) 65350: [Backport #15245]
compile.c: fix peephole optimization * compile.c (iseq_peephole_optimize): should `pop` before jump instruction which succeeds to `newarray` of a literal object, not after. [ruby-core:89536] [Bug #15245] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@65580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a2d9317d04
commit
756009186b
3 changed files with 10 additions and 4 deletions
|
@ -2651,7 +2651,7 @@ iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcal
|
|||
}
|
||||
else if (!iseq_pop_newarray(iseq, pobj)) {
|
||||
pobj = new_insn_core(iseq, pobj->insn_info.line_no, BIN(pop), 0, NULL);
|
||||
ELEM_INSERT_NEXT(&iobj->link, &pobj->link);
|
||||
ELEM_INSERT_PREV(&iobj->link, &pobj->link);
|
||||
}
|
||||
if (cond) {
|
||||
if (prev_dup) {
|
||||
|
|
|
@ -743,4 +743,10 @@ class TestRubyOptimization < Test::Unit::TestCase
|
|||
end
|
||||
assert_equal(:ok, x.bug(:ok))
|
||||
end
|
||||
|
||||
def test_peephole_jump_after_newarray
|
||||
i = 0
|
||||
%w(1) || 2 while (i += 1) < 100
|
||||
assert_equal(100, i)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#define RUBY_VERSION "2.5.4"
|
||||
#define RUBY_RELEASE_DATE "2018-11-06"
|
||||
#define RUBY_PATCHLEVEL 108
|
||||
#define RUBY_RELEASE_DATE "2018-11-07"
|
||||
#define RUBY_PATCHLEVEL 109
|
||||
|
||||
#define RUBY_RELEASE_YEAR 2018
|
||||
#define RUBY_RELEASE_MONTH 11
|
||||
#define RUBY_RELEASE_DAY 6
|
||||
#define RUBY_RELEASE_DAY 7
|
||||
|
||||
#include "ruby/version.h"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue