From eddef7ffc0404f43e8edf276e4c51db0713b21e3 Mon Sep 17 00:00:00 2001 From: Mirek Klimos Date: Thu, 27 Jun 2013 17:42:28 -0700 Subject: [PATCH] Replacing PackCont and ContExit opcodes with ContSuspend. PackCont opcode is always followed by ContExit so let's join them into ContSuspend. ContResume counterpart may come later (replacing ContNext/Send/Raise/Enter). --- hphp/compiler/analysis/emitter.cpp | 9 +++----- hphp/doc/bytecode.specification | 21 +++++++------------ hphp/doc/ir.specification | 2 +- .../runtime/debugger/cmd/cmd_flow_control.cpp | 2 +- hphp/runtime/debugger/cmd/cmd_next.cpp | 16 +++++++------- hphp/runtime/vm/bytecode.cpp | 18 +++++++--------- hphp/runtime/vm/hhbc.h | 3 +-- hphp/runtime/vm/jit/hhbctranslator.cpp | 18 ++++++++-------- hphp/runtime/vm/jit/hhbctranslator.h | 5 ++--- hphp/runtime/vm/jit/irtranslator.cpp | 8 ++----- hphp/runtime/vm/jit/translator-instrs.h | 3 +-- hphp/runtime/vm/jit/translator.cpp | 7 +++---- hphp/runtime/vm/jit/translator.h | 2 +- 13 files changed, 47 insertions(+), 67 deletions(-) diff --git a/hphp/compiler/analysis/emitter.cpp b/hphp/compiler/analysis/emitter.cpp index 7a7cc2d74..60667a706 100644 --- a/hphp/compiler/analysis/emitter.cpp +++ b/hphp/compiler/analysis/emitter.cpp @@ -3941,17 +3941,14 @@ bool EmitterVisitor::visitImpl(ConstructPtr node) { visit(y->getExpression()); emitConvertToCell(e); - // pack continuation and set the return label + // suspend continuation and set the return label assert(m_evalStack.size() == 1); m_metaInfo.addKnownDataType( KindOfObject, false, m_ue.bcPos(), false, 1); - e.PackCont(2 * y->getLabel()); - - // transfer control - assert(m_evalStack.size() == 0); - e.ContExit(); + e.ContSuspend(2 * y->getLabel()); // emit return label for raise() + assert(m_evalStack.size() == 0); e.Null(); m_yieldLabels[2 * y->getLabel() - 1].set(e); diff --git a/hphp/doc/bytecode.specification b/hphp/doc/bytecode.specification index 24c25671f..64d5a9603 100644 --- a/hphp/doc/bytecode.specification +++ b/hphp/doc/bytecode.specification @@ -3683,8 +3683,8 @@ ArrayIdx [C C C] -> [C] CreateCont [] -> [C] Creates a Continuation object and pushes it on the stack. The Continuation - will capture all defined local variables in the current function. The - Continuation will store a reference to the function named by the string + will capture all defined local variables in the current function. The + Continuation will store a reference to the function named by the string immediate to be used as its body. ContEnter [C] -> [] @@ -3694,11 +3694,13 @@ ContEnter [C] -> [] associated with the $this object of the Continuation object. The value on the stack is sent to the Continuation to be retrieved by UnpackCont. -ContExit [] -> [] +ContSuspend