From 00380e6ba703fbaadc4ad2c6d8fd4dee43835eda Mon Sep 17 00:00:00 2001 From: jdelong Date: Mon, 8 Apr 2013 17:26:03 -0700 Subject: [PATCH] Don't generate RaiseUndefProp in RepoAuthoritative mode This avoids a SpillStack for simple CGetMs. Gated under a flag that defaults to true. --- hphp/runtime/base/runtime_option.h | 4 ++- .../vm/translator/hopt/vectortranslator.cpp | 27 ++++++++++++------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/hphp/runtime/base/runtime_option.h b/hphp/runtime/base/runtime_option.h index f66371b41..de6af3f16 100644 --- a/hphp/runtime/base/runtime_option.h +++ b/hphp/runtime/base/runtime_option.h @@ -437,7 +437,9 @@ public: F(bool, DumpAst, false) \ F(bool, MapTCHuge, true) \ F(bool, RandomHotFuncs, false) \ - F(uint32_t, ConstEstimate, 10000) + F(uint32_t, ConstEstimate, 10000) \ + F(bool, DisableSomeRepoAuthNotices, true) \ + /* */ \ #define F(type, name, unused) \ static type Eval ## name; diff --git a/hphp/runtime/vm/translator/hopt/vectortranslator.cpp b/hphp/runtime/vm/translator/hopt/vectortranslator.cpp index f75a05089..2533707a8 100644 --- a/hphp/runtime/vm/translator/hopt/vectortranslator.cpp +++ b/hphp/runtime/vm/translator/hopt/vectortranslator.cpp @@ -31,6 +31,11 @@ TRACE_SET_MOD(hhir); using Transl::MInstrState; using Transl::mInstrHasUnknownOffsets; +static bool wantPropSpecializedWarnings() { + return !RuntimeOption::RepoAuthoritative || + !RuntimeOption::EvalDisableSomeRepoAuthNotices; +} + bool VectorEffects::supported(Opcode op) { return opcodeHasFlags(op, VectorProp | VectorElem); } @@ -353,14 +358,18 @@ void HhbcTranslator::VectorTranslator::checkMIState() { } /* - * In pretty much any case the vector translator will do operations - * that can throw. Currently this means we have to have a spillStack - * so the unwinder can handle it (eventually we'll hook this into an - * unwind codepath). TODO(#2162354) + * If we're planning on RaiseUndefProp generation + * (wantPropSpecializedWarnings) then pretty much in any case the + * vector translator will do operations that can throw. * - * We handle one special case where we know a spillStack won't be - * needed: in a simple CGetM of a single property where hphpc has - * told us it can't be KindOfUninit. + * Currently this means we have to have a spillStack so the unwinder + * can handle it (TODO(#2162354): eventually we'll hook this into an + * unwind codepath). + * + * We also handle one special case where we know a spillStack won't + * be needed: in a simple CGetM of a single property where hphpc has + * told us it can't be KindOfUninit, even if + * wantPropSpecializedWarnings we can't throw. */ if (isCGetM && isSingle && simpleProp) { auto info = getFinalPropertyOffset(m_ni, m_mii); @@ -368,7 +377,7 @@ void HhbcTranslator::VectorTranslator::checkMIState() { if (info.hphpcType == KindOfInvalid) { m_ht.spillStack(); } - } else { + } else if (wantPropSpecializedWarnings()) { m_ht.spillStack(); } } @@ -837,7 +846,7 @@ SSATmp* HhbcTranslator::VectorTranslator::checkInitProp( // a pointer to InitNull, either in the object or // init_null_variant. m_tb.hint(Block::Unlikely); - if (doWarn) { + if (doWarn && wantPropSpecializedWarnings()) { // We did the spillStack for this back in emitMPre. m_tb.gen(RaiseUndefProp, baseAsObj, key); }