From eea87e32c685e024f56d17f759fdbe4cfbe1a71c Mon Sep 17 00:00:00 2001 From: jdelong Date: Sat, 30 Mar 2013 18:34:36 -0700 Subject: [PATCH] Remove m_fpiStack It doesn't appear possible to get a Func this way that we didn't already have from static analysis. --- hphp/runtime/vm/translator/hopt/hhbctranslator.cpp | 28 ++++------------------ hphp/runtime/vm/translator/hopt/hhbctranslator.h | 23 +----------------- 2 files changed, 5 insertions(+), 46 deletions(-) diff --git a/hphp/runtime/vm/translator/hopt/hhbctranslator.cpp b/hphp/runtime/vm/translator/hopt/hhbctranslator.cpp index 74f7283ac65..5f2039aa96e 100644 --- a/hphp/runtime/vm/translator/hopt/hhbctranslator.cpp +++ b/hphp/runtime/vm/translator/hopt/hhbctranslator.cpp @@ -1184,23 +1184,20 @@ void HhbcTranslator::emitFPushActRec(SSATmp* func, SSATmp* actRec = m_tb->genDefActRec(func, objOrClass, numArgs, invName); m_evalStack.push(actRec); spillStack(); // TODO(#2036900) - m_fpiStack.push(actRec); } void HhbcTranslator::emitFPushCtor(int32_t numParams) { TRACE(3, "%u: FPushFuncCtor %d\n", m_bcOff, numParams); SSATmp* cls = popA(); spillStack(); - SSATmp* newObj = m_tb->genNewObj(numParams, cls); - m_fpiStack.push(newObj); + m_tb->genNewObj(numParams, cls); } void HhbcTranslator::emitFPushCtorD(int32_t numParams, int32_t classNameStrId) { const StringData* className = lookupStringId(classNameStrId); TRACE(3, "%u: FPushFuncCtorD %d %s\n", m_bcOff, numParams, className->data()); spillStack(); - SSATmp* newObj = m_tb->genNewObj(numParams, className); - m_fpiStack.push(newObj); + m_tb->genNewObj(numParams, className); } void HhbcTranslator::emitFPushFuncD(int32_t numParams, int32_t funcId) { @@ -1435,25 +1432,8 @@ void HhbcTranslator::emitFCall(uint32_t numParams, for (uint32_t i = 0; i < numParams; i++) { params[numParams - i - 1] = popF(); } - SSATmp* actRec = spillStack(); - - // pop the DefActRec or NewObj instruction from FPI stack - SSATmp* actRecOrNewObj = m_fpiStack.pop(); - - SSATmp* func = callee ? m_tb->genDefConst(callee) : nullptr; - if (!func) { - IRInstruction* actRecInst = actRecOrNewObj - ? actRecOrNewObj->getInstruction() : nullptr; - SSATmp* funcTmp = actRecInst && actRecInst->getOpcode() == DefActRec - ? actRecInst->getSrc(1) : nullptr; - - if (funcTmp && funcTmp->getType() == Type::Func && funcTmp->isConst()) { - func = funcTmp; - } else { - func = m_tb->genDefNull(); - } - } - + auto actRec = spillStack(); + auto func = callee ? cns(callee) : m_tb->genDefNull(); m_tb->genCall(actRec, returnBcOffset, func, diff --git a/hphp/runtime/vm/translator/hopt/hhbctranslator.h b/hphp/runtime/vm/translator/hopt/hhbctranslator.h index 2c8e928302a..60a36f5efec 100644 --- a/hphp/runtime/vm/translator/hopt/hhbctranslator.h +++ b/hphp/runtime/vm/translator/hopt/hhbctranslator.h @@ -77,23 +77,6 @@ private: std::vector m_vector; }; -class FpiStack { -public: - void push(SSATmp* tmp) { - stack.push(tmp); - } - SSATmp* pop() { - if (stack.empty()) { - return nullptr; - } - SSATmp* tmp = stack.top(); - stack.pop(); - return tmp; - } -private: - std::stack stack; -}; - class TypeGuard { public: enum Kind { @@ -616,17 +599,13 @@ private: * since the last SpillStack. * * The EvalStack contains cells and ActRecs that need to be - * spilled in order to materialize the stack. The FpiStack tracks - * calls between FPush* and FCall, and contains either Func* or - * ActRecs. (It contains Func* when we will need to use a - * runtime value for the Func*.) + * spilled in order to materialize the stack. * * m_stackDeficit represents the number of cells we've popped off * the virtual stack since the last sync. */ uint32_t m_stackDeficit; EvalStack m_evalStack; - FpiStack m_fpiStack; vector m_typeGuards; Trace* const m_exitGuardFailureTrace; -- 2.11.4.GIT