diff --git a/hphp/runtime/vm/bytecode.cpp b/hphp/runtime/vm/bytecode.cpp index 5fb5c0676..87e5bc8f9 100644 --- a/hphp/runtime/vm/bytecode.cpp +++ b/hphp/runtime/vm/bytecode.cpp @@ -1508,10 +1508,15 @@ void VMExecutionContext::syncGdbState() { } } +static bool jitIsEnabled(const Unit* unit) { + if (!ThreadInfo::s_threadInfo->m_reqInjectionData.getJit()) return false; + return unit == nullptr || !unit->isInterpretOnly(); +} + void VMExecutionContext::enterVMPrologue(ActRec* enterFnAr) { assert(enterFnAr); Stats::inc(Stats::VMEnter); - if (ThreadInfo::s_threadInfo->m_reqInjectionData.getJit()) { + if (jitIsEnabled(enterFnAr->m_func->unit())) { int np = enterFnAr->m_func->numParams(); int na = enterFnAr->numArgs(); if (na > np) na = np + 1; @@ -1532,7 +1537,7 @@ void VMExecutionContext::enterVMWork(ActRec* enterFnAr) { start = enterFnAr->m_func->getFuncBody(); } Stats::inc(Stats::VMEnter); - if (ThreadInfo::s_threadInfo->m_reqInjectionData.getJit()) { + if (jitIsEnabled(m_fp->unit())) { (void) m_fp->unit()->offsetOf(m_pc); /* assert */ if (enterFnAr) { assert(start); @@ -2570,12 +2575,14 @@ void VMExecutionContext::evalPHPDebugger(TypedValue* retval, StringData *code, int frame) { assert(retval); // The code has "data(), code->size()); if (unit == nullptr) { raise_error("Syntax error"); tvWriteNull(retval); return; } + // Do not JIT this unit, we are using it exactly once. + unit->setInterpretOnly(); VarEnv *varEnv = nullptr; ActRec *fp = getFP(); diff --git a/hphp/runtime/vm/unit.h b/hphp/runtime/vm/unit.h index 435964ae1..3aa9a40a4 100644 --- a/hphp/runtime/vm/unit.h +++ b/hphp/runtime/vm/unit.h @@ -643,6 +643,8 @@ public: m_cacheOffset = id >> 3; m_cacheMask = 1 << (id & 7); } + bool isInterpretOnly() const { return m_interpretOnly; } + void setInterpretOnly() { m_interpretOnly = false; } bool isMergeOnly() const { return m_mergeOnly; } void clearMergeOnly() { m_mergeOnly = false; } bool isEmpty() const { return m_mergeState & UnitMergeStateEmpty; } @@ -714,6 +716,7 @@ private: uint8_t m_mergeState; uint8_t m_cacheMask; bool m_mergeOnly; + bool m_interpretOnly; LineTable m_lineTable; FuncTable m_funcTable; mutable PseudoMainCacheMap *m_pseudoMainCache; diff --git a/hphp/test/quick/debugger/eval2.php b/hphp/test/quick/debugger/eval2.php new file mode 100644 index 000000000..2e8f8342c --- /dev/null +++ b/hphp/test/quick/debugger/eval2.php @@ -0,0 +1,5 @@ +