diff --git a/hphp/runtime/vm/bytecode.cpp b/hphp/runtime/vm/bytecode.cpp index a21bc1d7d..baf118cc7 100644 --- a/hphp/runtime/vm/bytecode.cpp +++ b/hphp/runtime/vm/bytecode.cpp @@ -1850,9 +1850,11 @@ void VMExecutionContext::syncGdbState() { } void VMExecutionContext::enterVMWork(ActRec* enterFnAr) { + TCA start = nullptr; if (enterFnAr) { EventHook::FunctionEnter(enterFnAr, EventHook::NormalFunc); INST_HOOK_FENTRY(enterFnAr->m_func->fullName()); + start = enterFnAr->m_func->getFuncBody(); } Stats::inc(Stats::VMEnter); if (RuntimeOption::EvalJit && @@ -1862,7 +1864,7 @@ void VMExecutionContext::enterVMWork(ActRec* enterFnAr) { LIKELY(!DEBUGGER_FORCE_INTR)) { Transl::SrcKey sk(Transl::curFunc(), m_pc); (void) curUnit()->offsetOf(m_pc); /* assert */ - tx64->enterTC(sk); + tx64->enterTC(sk, start); } else { dispatch(); } diff --git a/hphp/runtime/vm/translator/translator-x64.cpp b/hphp/runtime/vm/translator/translator-x64.cpp index 049a02737..3b25beabd 100644 --- a/hphp/runtime/vm/translator/translator-x64.cpp +++ b/hphp/runtime/vm/translator/translator-x64.cpp @@ -3278,7 +3278,7 @@ void enterTCHelper(Cell* vm_sp, void* targetCacheBase) asm ("__enterTCHelper"); void -TranslatorX64::enterTC(SrcKey sk) { +TranslatorX64::enterTC(SrcKey sk, TCA start) { using namespace TargetCache; if (debug) { @@ -3289,7 +3289,7 @@ TranslatorX64::enterTC(SrcKey sk) { TReqInfo info; info.requestNum = -1; info.saved_rStashedAr = 0; - TCA start = getTranslation(sk, true); + if (UNLIKELY(!start)) start = getTranslation(sk, true); for (;;) { assert(sizeof(Cell) == 16); assert(((uintptr_t)vmsp() & (sizeof(Cell) - 1)) == 0); @@ -3308,7 +3308,8 @@ TranslatorX64::enterTC(SrcKey sk) { sk = SrcKey(curFunc(), newPc); start = getTranslation(sk, true); } - assert(isValidCodeAddress(start)); + assert(start == (TCA)HPHP::VM::Transl::funcBodyHelperThunk || + isValidCodeAddress(start)); assert(!s_writeLease.amOwner()); curFunc()->validate(); INC_TPC(enter_tc); diff --git a/hphp/runtime/vm/translator/translator-x64.h b/hphp/runtime/vm/translator/translator-x64.h index d8ee22ca1..8de4fec49 100644 --- a/hphp/runtime/vm/translator/translator-x64.h +++ b/hphp/runtime/vm/translator/translator-x64.h @@ -991,7 +991,7 @@ public: * a given nested invocation of the intepreter (calling back into it * as necessary for blocks that need to be interpreted). */ - void enterTC(SrcKey sk); + void enterTC(SrcKey sk, TCA start); TranslatorX64(); virtual ~TranslatorX64();