avoid extra dup and pop in compile_op_log
Co-authored-by: John Hawthorn <jhawthorn@github.com>
This commit is contained in:
parent
4bdd8f2ddf
commit
aafbc9068f
Notes:
git
2022-09-23 01:47:36 +09:00
19
compile.c
19
compile.c
@ -8831,7 +8831,10 @@ compile_op_log(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node,
|
|||||||
}
|
}
|
||||||
|
|
||||||
CHECK(COMPILE(ret, "NODE_OP_ASGN_AND/OR#nd_head", node->nd_head));
|
CHECK(COMPILE(ret, "NODE_OP_ASGN_AND/OR#nd_head", node->nd_head));
|
||||||
ADD_INSN(ret, node, dup);
|
|
||||||
|
if (!popped) {
|
||||||
|
ADD_INSN(ret, node, dup);
|
||||||
|
}
|
||||||
|
|
||||||
if (type == NODE_OP_ASGN_AND) {
|
if (type == NODE_OP_ASGN_AND) {
|
||||||
ADD_INSNL(ret, node, branchunless, lfin);
|
ADD_INSNL(ret, node, branchunless, lfin);
|
||||||
@ -8840,15 +8843,15 @@ compile_op_log(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node,
|
|||||||
ADD_INSNL(ret, node, branchif, lfin);
|
ADD_INSNL(ret, node, branchif, lfin);
|
||||||
}
|
}
|
||||||
|
|
||||||
ADD_INSN(ret, node, pop);
|
if (!popped) {
|
||||||
ADD_LABEL(ret, lassign);
|
|
||||||
CHECK(COMPILE(ret, "NODE_OP_ASGN_AND/OR#nd_value", node->nd_value));
|
|
||||||
ADD_LABEL(ret, lfin);
|
|
||||||
|
|
||||||
if (popped) {
|
|
||||||
/* we can apply more optimize */
|
|
||||||
ADD_INSN(ret, node, pop);
|
ADD_INSN(ret, node, pop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ADD_LABEL(ret, lassign);
|
||||||
|
|
||||||
|
CHECK(COMPILE_(ret, "NODE_OP_ASGN_AND/OR#nd_value", node->nd_value, popped));
|
||||||
|
|
||||||
|
ADD_LABEL(ret, lfin);
|
||||||
return COMPILE_OK;
|
return COMPILE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user