8000 Revert "Collapse putobject, putobject, newarray" · github/ruby@5d3aa0a · GitHub
[go: up one dir, main page]

Skip to content {"props":{"docsUrl":"https://docs.github.com/get-started/accessibility/keyboard-shortcuts"}}

Commit 5d3aa0a

Browse files
committed
Revert "Collapse putobject, putobject, newarray"
This reverts commit cbdf5a1. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent cf18fc3 commit 5d3aa0a

File tree

1 file changed

+0
-47
lines changed

1 file changed

+0
-47
lines changed

compile.c

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change< 10000 /th>
@@ -2823,53 +2823,6 @@ iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcal
28232823
}
28242824
}
28252825

2826-
/*
2827-
* putobject "foo"
2828-
* putobject "bar"
2829-
* newarray 2
2830-
*
2831-
* ==>
2832-
*
2833-
* duparray ["foo", "bar"]
2834-
*/
2835-
if (IS_INSN_ID(iobj, newarray)) {
2836-
int len;
2837-
2838-
len = NUM2INT(OPERAND_AT(iobj, 0));
2839-
2840-
if (len > 0) {
2841-
INSN *link;
2842-
INSN *cur;
2843-
int i;
2844-
2845-
link = iobj;
2846-
i = len;
2847-
while(i > 0) {
2848-
link = (INSN *)get_prev_insn(link);
2849-
if (!IS_INSN_ID(link, putobject))
2850-
break;
2851-
2852-
i--;
2853-
}
2854-
2855-
/* All previous instructions were `putobject` */
2856-
if (i == 0) {
2857-
VALUE list = rb_ary_new_capa(len);
2858-
iseq_add_mark_object_compile_time(iseq, list);
2859-
2860-
while(i < len) {
2861-
cur = link;
2862-
rb_ary_push(list, OPERAND_AT(cur, 0));
2863-
link = (INSN *)get_next_insn(link);
2864-
ELEM_REMOVE(&cur->link);
2865-
i++;
2866-
}
2867-
iobj->insn_id = BIN(duparray);
2868-
OPERAND_AT(iobj, 0) = list;
2869-
}
2870-
}
2871-
}
2872-
28732826
if (IS_INSN_ID(iobj, leave)) {
28742827
remove_unreachable_chunk(iseq, iobj->link.next);
28752828
}

0 commit comments

Comments
 (0)
0