Replace ContSend by CGetL+CUnsetL
The behavior of ContSend is equivalent to CGetL+CUnsetL. Let's kill this unnecessary opcode. Let's remove this logic from ContRaise opcode as well.
Esse commit está contido em:
@@ -7050,12 +7050,21 @@ static void emitContinuationMethod(UnitEmitter& ue, FuncEmitter* fe,
|
||||
ue.emitIVA(m == METH_SEND || m == METH_RAISE);
|
||||
|
||||
const Offset ehStart = ue.bcPos();
|
||||
static Op mOps[] = {
|
||||
OpNull,
|
||||
OpContSend,
|
||||
OpContRaise,
|
||||
};
|
||||
ue.emitOp(mOps[m]);
|
||||
switch(m) {
|
||||
case METH_NEXT:
|
||||
ue.emitOp(OpNull);
|
||||
break;
|
||||
case METH_RAISE:
|
||||
ue.emitOp(OpContRaise);
|
||||
// intentional fallthrough to push the exception on the stack
|
||||
case METH_SEND:
|
||||
ue.emitOp(OpCGetL); ue.emitIVA(0);
|
||||
ue.emitOp(OpUnsetL); ue.emitIVA(0);
|
||||
break;
|
||||
default:
|
||||
not_reached();
|
||||
}
|
||||
|
||||
ue.emitOp(OpContEnter);
|
||||
ue.emitOp(OpContStopped);
|
||||
ue.emitOp(OpNull);
|
||||
|
||||
@@ -3732,17 +3732,10 @@ ContCheck <check started> [] -> []
|
||||
object. If the continuation is finished, already running, or not yet started
|
||||
and <check started> is enabled, an exception will be thrown.
|
||||
|
||||
ContSend [] -> [C]
|
||||
|
||||
Prepare continuation to receive a value. $this must be a Continuation object
|
||||
that passed ContCheck<true> check. The value in local 0 is moved to the stack
|
||||
for sending to the Continuation by ContEnter.
|
||||
|
||||
ContRaise [] -> [C:Obj:Exception]
|
||||
ContRaise [] -> []
|
||||
|
||||
Prepare continuation to receive a thrown exception. $this must be a
|
||||
Continuation object that passed ContCheck<true> check. The exception in
|
||||
local 0 is moved to the stack for sending to the Continuation by ContEnter.
|
||||
Continuation object that passed ContCheck<true> check.
|
||||
|
||||
ContValid [] -> [C:Bool]
|
||||
|
||||
|
||||
@@ -6865,23 +6865,11 @@ inline void OPTBLD_INLINE VMExecutionContext::iopContCheck(PC& pc) {
|
||||
cont->preNext();
|
||||
}
|
||||
|
||||
inline void OPTBLD_INLINE VMExecutionContext::iopContSend(PC& pc) {
|
||||
NEXT();
|
||||
|
||||
// prepare value to be sent by ContEnter
|
||||
tvCopy(*frame_local(m_fp, 0), *m_stack.allocTV());
|
||||
tvWriteUninit(frame_local(m_fp, 0));
|
||||
}
|
||||
|
||||
inline void OPTBLD_INLINE VMExecutionContext::iopContRaise(PC& pc) {
|
||||
NEXT();
|
||||
c_Continuation* cont = this_continuation(m_fp);
|
||||
assert(cont->m_label);
|
||||
--cont->m_label;
|
||||
|
||||
// prepare exception to be sent by ContEnter
|
||||
tvCopy(*frame_local(m_fp, 0), *m_stack.allocTV());
|
||||
tvWriteUninit(frame_local(m_fp, 0));
|
||||
}
|
||||
|
||||
inline void OPTBLD_INLINE VMExecutionContext::iopContValid(PC& pc) {
|
||||
|
||||
@@ -553,8 +553,7 @@ enum SetOpOp {
|
||||
O(ContSuspendK, ONE(IVA), TWO(CV,CV), NOV, CF) \
|
||||
O(ContRetC, NA, ONE(CV), NOV, CF_TF) \
|
||||
O(ContCheck, ONE(IVA), NOV, NOV, NF) \
|
||||
O(ContSend, NA, NOV, ONE(CV), NF) \
|
||||
O(ContRaise, NA, NOV, ONE(CV), NF) \
|
||||
O(ContRaise, NA, NOV, NOV, NF) \
|
||||
O(ContValid, NA, NOV, ONE(CV), NF) \
|
||||
O(ContKey, NA, NOV, ONE(CV), NF) \
|
||||
O(ContCurrent, NA, NOV, ONE(CV), NF) \
|
||||
|
||||
@@ -1190,24 +1190,12 @@ void HhbcTranslator::emitContCheck(bool checkStarted) {
|
||||
gen(ContPreNext, getExitSlowTrace(), cont);
|
||||
}
|
||||
|
||||
void HhbcTranslator::emitContSend() {
|
||||
assert(curClass());
|
||||
|
||||
// prepare value to be sent by ContEnter
|
||||
push(gen(LdLoc, Type::Cell, LocalId(0), m_tb->fp()));
|
||||
gen(StLoc, LocalId(0), m_tb->fp(), m_tb->genDefUninit());
|
||||
}
|
||||
|
||||
void HhbcTranslator::emitContRaise() {
|
||||
assert(curClass());
|
||||
SSATmp* cont = gen(LdThis, m_tb->fp());
|
||||
SSATmp* label = gen(LdRaw, Type::Int, cont, cns(RawMemSlot::ContLabel));
|
||||
label = gen(OpSub, label, cns(1));
|
||||
gen(StRaw, cont, cns(RawMemSlot::ContLabel), label);
|
||||
|
||||
// prepare value to be sent by ContEnter
|
||||
push(gen(LdLoc, Type::Cell, LocalId(0), m_tb->fp()));
|
||||
gen(StLoc, LocalId(0), m_tb->fp(), m_tb->genDefUninit());
|
||||
}
|
||||
|
||||
void HhbcTranslator::emitContValid() {
|
||||
@@ -3339,8 +3327,6 @@ uint32_t localOutputId(const NormalizedInstruction& inst) {
|
||||
case OpUnpackCont:
|
||||
case OpContSuspend:
|
||||
case OpContRetC:
|
||||
case OpContSend:
|
||||
case OpContRaise:
|
||||
return 0;
|
||||
|
||||
case OpSetWithRefLM:
|
||||
|
||||
@@ -381,7 +381,6 @@ struct HhbcTranslator {
|
||||
void emitContSuspendK(int64_t labelId);
|
||||
void emitContRetC();
|
||||
void emitContCheck(bool checkStarted);
|
||||
void emitContSend();
|
||||
void emitContRaise();
|
||||
void emitContValid();
|
||||
void emitContKey();
|
||||
|
||||
@@ -568,10 +568,6 @@ void Translator::translateContCheck(const NormalizedInstruction& i) {
|
||||
HHIR_EMIT(ContCheck, i.imm[0].u_IVA);
|
||||
}
|
||||
|
||||
void Translator::translateContSend(const NormalizedInstruction& i) {
|
||||
HHIR_EMIT(ContSend);
|
||||
}
|
||||
|
||||
void Translator::translateContRaise(const NormalizedInstruction& i) {
|
||||
HHIR_EMIT(ContRaise);
|
||||
}
|
||||
|
||||
@@ -134,7 +134,6 @@
|
||||
CASE(ContSuspendK) \
|
||||
CASE(ContRetC) \
|
||||
CASE(ContCheck) \
|
||||
CASE(ContSend) \
|
||||
CASE(ContRaise) \
|
||||
CASE(ContValid) \
|
||||
CASE(ContKey) \
|
||||
|
||||
@@ -1270,8 +1270,7 @@ static const struct {
|
||||
{ OpContSuspendK,{Local|StackTop2, None, OutNone, -2 }},
|
||||
{ OpContRetC, {Local|Stack1, None, OutNone, -1 }},
|
||||
{ OpContCheck, {None, None, OutNone, 0 }},
|
||||
{ OpContSend, {Local, Stack1, OutUnknown, 1 }},
|
||||
{ OpContRaise, {Local, Stack1, OutUnknown, 1 }},
|
||||
{ OpContRaise, {None, None, OutNone, 0 }},
|
||||
{ OpContValid, {None, Stack1, OutBoolean, 1 }},
|
||||
{ OpContKey, {None, Stack1, OutUnknown, 1 }},
|
||||
{ OpContCurrent, {None, Stack1, OutUnknown, 1 }},
|
||||
@@ -1841,8 +1840,6 @@ void Translator::getInputs(SrcKey startSk,
|
||||
case OpContSuspend:
|
||||
case OpContSuspendK:
|
||||
case OpContRetC:
|
||||
case OpContSend:
|
||||
case OpContRaise:
|
||||
loc = 0;
|
||||
break;
|
||||
|
||||
|
||||
@@ -53,6 +53,8 @@ Break at Continuation::send()
|
||||
step
|
||||
Break at Continuation::send()
|
||||
step
|
||||
Break at Continuation::send()
|
||||
step
|
||||
Break at genFoo$continuation() on line 11 of %s/flow_gen.php
|
||||
10
|
||||
11 function genFoo($a) {
|
||||
@@ -112,6 +114,8 @@ Break at Continuation::send()
|
||||
step
|
||||
Break at Continuation::send()
|
||||
step
|
||||
Break at Continuation::send()
|
||||
step
|
||||
Break at genFoo$continuation() on line 11 of %s/flow_gen.php
|
||||
10
|
||||
11 function genFoo($a) {
|
||||
|
||||
@@ -12,6 +12,7 @@ step
|
||||
step
|
||||
step
|
||||
step
|
||||
step
|
||||
next
|
||||
next
|
||||
next
|
||||
@@ -23,6 +24,7 @@ step
|
||||
step
|
||||
step
|
||||
step
|
||||
step
|
||||
next
|
||||
next
|
||||
next
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário