From 6546c3edf66691ef50bd34ed37fa28a1c0e54b23 Mon Sep 17 00:00:00 2001 From: Jordan DeLong Date: Sun, 12 May 2013 14:05:07 -0700 Subject: [PATCH] Don't hoist LdLocs to the top of tracelets. We have separate GuardLoc instructions now. This was originally intended to be an optimization (and LdLoc was simultaneously acting as the guard back then), but now that Rematerialization is off (and since we don't do a DCE after register allocation anyway) I am doubtful. --- .../vm/translator/hopt/hhbctranslator.cpp | 16 ------------- .../vm/translator/hopt/hhbctranslator.h | 24 ------------------- .../vm/translator/hopt/irtranslator.cpp | 7 ------ hphp/runtime/vm/translator/translator-x64.cpp | 4 ---- hphp/runtime/vm/translator/translator-x64.h | 1 - 5 files changed, 52 deletions(-) diff --git a/hphp/runtime/vm/translator/hopt/hhbctranslator.cpp b/hphp/runtime/vm/translator/hopt/hhbctranslator.cpp index f86d5bb30..ac8d184e3 100644 --- a/hphp/runtime/vm/translator/hopt/hhbctranslator.cpp +++ b/hphp/runtime/vm/translator/hopt/hhbctranslator.cpp @@ -2198,7 +2198,6 @@ void HhbcTranslator::setThisAvailable() { void HhbcTranslator::guardTypeLocal(uint32_t locId, Type type) { checkTypeLocal(locId, type); - m_typeGuards.push_back(TypeGuard(TypeGuard::Local, locId, type)); } void HhbcTranslator::checkTypeLocal(uint32_t locId, Type type) { @@ -2225,7 +2224,6 @@ Trace* HhbcTranslator::guardTypeStack(uint32_t stackIndex, nextTrace = getGuardExit(); } gen(GuardStk, type, nextTrace, StackOffset(stackIndex), m_tb->getSp()); - m_typeGuards.push_back(TypeGuard(TypeGuard::Stack, stackIndex, type)); return nextTrace; } @@ -2263,20 +2261,6 @@ void HhbcTranslator::assertTypeStack(uint32_t stackIndex, Type type) { refineType(tmp, type); } -void HhbcTranslator::emitLoadDeps() { - for (auto& guard : m_typeGuards) { - switch (guard.getKind()) { - case TypeGuard::Local: - ldLoc(guard.getIndex()); - break; - case TypeGuard::Stack: - break; - default: - assert(false); // iterator guards should not happen - } - } -} - Trace* HhbcTranslator::guardRefs(int64_t entryArDelta, const vector& mask, const vector& vals, diff --git a/hphp/runtime/vm/translator/hopt/hhbctranslator.h b/hphp/runtime/vm/translator/hopt/hhbctranslator.h index cacf1b8fe..56aa9429c 100644 --- a/hphp/runtime/vm/translator/hopt/hhbctranslator.h +++ b/hphp/runtime/vm/translator/hopt/hhbctranslator.h @@ -369,7 +369,6 @@ struct HhbcTranslator { void checkTypeTopOfStack(Type type, Offset nextByteCode); void overrideTypeLocal(uint32_t localIndex, Type type); void setThisAvailable(); - void emitLoadDeps(); void emitInterpOne(Type type, int numPopped, int numExtraPushed = 0); void emitInterpOneCF(int numPopped); @@ -638,28 +637,6 @@ private: const Func* func; }; - struct TypeGuard { - enum Kind { - Local, - Stack, - Iter - }; - - TypeGuard(Kind kind, uint32_t index, Type type) - : m_kind(kind) - , m_index(index) - , m_type(type) - {} - - Kind getKind() const { return m_kind; } - uint32_t getIndex() const { return m_index; } - - private: - Kind m_kind; - uint32_t m_index; - Type m_type; - }; - private: IRFactory& m_irFactory; std::unique_ptr @@ -695,7 +672,6 @@ private: std::stack> m_fpiStack; - vector m_typeGuards; Trace* const m_exitGuardFailureTrace; }; diff --git a/hphp/runtime/vm/translator/hopt/irtranslator.cpp b/hphp/runtime/vm/translator/hopt/irtranslator.cpp index f5fda4f00..eae4e240f 100644 --- a/hphp/runtime/vm/translator/hopt/irtranslator.cpp +++ b/hphp/runtime/vm/translator/hopt/irtranslator.cpp @@ -141,13 +141,6 @@ TranslatorX64::irCheckType(X64Assembler& a, return; } -void -TranslatorX64::irEmitLoadDeps() { - assert(m_useHHIR); - m_hhbcTrans->emitLoadDeps(); -} - - void TranslatorX64::irTranslateMod(const Tracelet& t, const NormalizedInstruction& i) { diff --git a/hphp/runtime/vm/translator/translator-x64.cpp b/hphp/runtime/vm/translator/translator-x64.cpp index 369f513d5..68f95a0db 100644 --- a/hphp/runtime/vm/translator/translator-x64.cpp +++ b/hphp/runtime/vm/translator/translator-x64.cpp @@ -11036,10 +11036,6 @@ TranslatorX64::emitGuardChecks(X64Assembler& a, } } - if (m_useHHIR) { - irEmitLoadDeps(); - } - checkRefs(a, sk, refDeps, fail); if (Trace::moduleEnabled(Trace::stats, 2)) { diff --git a/hphp/runtime/vm/translator/translator-x64.h b/hphp/runtime/vm/translator/translator-x64.h index de1e59ee3..556e85ead 100644 --- a/hphp/runtime/vm/translator/translator-x64.h +++ b/hphp/runtime/vm/translator/translator-x64.h @@ -844,7 +844,6 @@ private: SrcRec& fail); void irCheckType(Asm&, const Location& l, const RuntimeType& rtt, SrcRec& fail); - void irEmitLoadDeps(); void checkRefs(Asm&, SrcKey, const RefDeps&, SrcRec&);