From 15bb34af72bf9fdb1220924b7b6667618c98d86d Mon Sep 17 00:00:00 2001 From: Katy Voor Date: Mon, 23 Oct 2023 16:18:08 -0700 Subject: [PATCH] Don't need to guard MBase Summary: After D8337098, we no longer need to guard on `MBase`. Reviewed By: ricklavoie Differential Revision: D50544898 fbshipit-source-id: 11ee112b513f0ea35eb4894dfb81d34710def845 --- hphp/runtime/vm/jit/region-tracelet.cpp | 20 ++++++++------------ hphp/runtime/vm/jit/translator.cpp | 11 +++-------- 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/hphp/runtime/vm/jit/region-tracelet.cpp b/hphp/runtime/vm/jit/region-tracelet.cpp index 9ea9c43fb16c2..a5d488ef0ebcf 100644 --- a/hphp/runtime/vm/jit/region-tracelet.cpp +++ b/hphp/runtime/vm/jit/region-tracelet.cpp @@ -123,20 +123,17 @@ SBInvOffset curSpOffset(const Env& env) { } /* - * Check if the current predicted type for the location in ii is specific - * enough for what the current opcode wants. If not, return false. + * Check if the input has a known datatype or whether we need + * to insert a guard. */ -bool consumeInput(Env& env, const InputInfo& input) { - if (input.dontGuard) return true; +bool needGuardForInput(Env& env, const InputInfo& input) { + if (input.dontGuard) return false; auto const type = irgen::provenType(env.irgs, input.loc); - if (!type.isKnownDataType()) { - // Trying to consume a value without a precise enough type. - FTRACE(1, "selectTracelet: {} tried to consume {}, type {}\n", - env.inst.toString(), show(input.loc), type.toString()); - return false; - } + if (type.isKnownDataType()) return false; + FTRACE(1, "selectTracelet: {} input {}, needs a guard due to unknown type {}\n", + env.inst.toString(), show(input.loc), type.toString()); return true; } @@ -242,9 +239,8 @@ bool prepareInstruction(Env& env) { addGuardIfUntracked(Location::Stack{sbInvOff}); } - // Check all the inputs for unknown values. for (auto const& input : inputInfos) { - if (!consumeInput(env, input)) { + if (needGuardForInput(env, input)) { FTRACE(2, "Stopping tracelet consuming {} input {}\n", opcodeToName(env.inst.op()), show(input.loc)); return false; diff --git a/hphp/runtime/vm/jit/translator.cpp b/hphp/runtime/vm/jit/translator.cpp index 505d59eb4d7fa..8c403901657a2 100644 --- a/hphp/runtime/vm/jit/translator.cpp +++ b/hphp/runtime/vm/jit/translator.cpp @@ -467,8 +467,7 @@ const InstrInfo& getInstrInfo(Op op) { namespace { int64_t countOperands(uint64_t mask) { const uint64_t ignore = Local | Iter | DontGuardStack1 | - DontGuardAny | This | MBase | StackI | StackI2 | MKey | LocalRange | - DontGuardBase; + DontGuardAny | This | MBase | StackI | StackI2 | MKey | LocalRange; mask &= ~ignore; static const uint64_t counts[][2] = { @@ -837,12 +836,8 @@ InputInfoVec getInputs(const NormalizedInstruction& ni, SBInvOffset bcSPOff) { break; } } - if (flags & MBase) { - inputs.emplace_back(Location::MBase{}); - if (flags & DontGuardBase) { - inputs.back().dontGuard = true; - } - } + + if (flags & MBase) inputs.emplace_back(Location::MBase{}); SKTRACE(1, sk, "stack args: virtual sfo now %d\n", stackOff.offset); TRACE(1, "%s\n", Trace::prettyNode("Inputs", inputs).c_str());