Bug 1528184: Rename stack map fields in the baseline compiler; r=jseward
authorBenjamin Bouvier <benj@benj.me>
Fri, 15 Feb 2019 14:14:33 +0000
changeset 459541 25e2d821be0762477db0e87b5bc601a0b6e10b61
parent 459540 d4e4095c9584edc865fdd924c389429980992bd9
child 459542 ac36d71cc3170523b35ba018b46e82e416579689
push id111964
push usercsabou@mozilla.com
push dateFri, 15 Feb 2019 18:54:44 +0000
treeherdermozilla-inbound@db3c4f905082 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjseward
bugs1528184
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1528184: Rename stack map fields in the baseline compiler; r=jseward - public struct fields usually don't use the trailing underscore in names, so remove it. - makes a few names more explicit (smgen -> stackMapGen, mst -> machineStateTracker). Differential Revision: https://phabricator.services.mozilla.com/D19915
js/src/wasm/WasmBaselineCompile.cpp
--- a/js/src/wasm/WasmBaselineCompile.cpp
+++ b/js/src/wasm/WasmBaselineCompile.cpp
@@ -2088,25 +2088,25 @@ struct StackMapGenerator {
 
   // So as to be able to get current offset when creating stack maps
   const MacroAssembler& masm_;
 
  public:
   // --- These are constant once we've completed beginFunction() ---
 
   // The number of words of arguments passed to this function in memory.
-  size_t numStackArgWords_;
-
-  MachineStackTracker mst_;  // tracks machine stack pointerness
+  size_t numStackArgWords;
+
+  MachineStackTracker machineStackTracker;  // tracks machine stack pointerness
 
   // This holds masm.framePushed at entry to the function's body.  It is a
   // Maybe because createStackMap needs to know whether or not we're still
   // in the prologue.  It makes a Nothing-to-Some transition just once per
   // function.
-  Maybe<uint32_t> framePushedAtEntryToBody_;
+  Maybe<uint32_t> framePushedAtEntryToBody;
 
   // --- These can change at any point ---
 
   // This holds masm.framePushed at it would be be for a function call
   // instruction, but excluding the stack area used to pass arguments in
   // memory.  That is, for an upcoming function call, this will hold
   //
   //   masm.framePushed() at the call instruction -
@@ -2117,36 +2117,36 @@ struct StackMapGenerator {
   // area of the callee's stackmap.  Note that all alignment padding above the
   // arguments-in-memory themselves belongs to the caller's stack map, which
   // is why this is defined in terms of StackArgAreaSizeUnaligned() rather than
   // StackArgAreaSizeAligned().
   //
   // When not inside a function call setup/teardown sequence, it is Nothing.
   // It can make Nothing-to/from-Some transitions arbitrarily as we progress
   // through the function body.
-  Maybe<uint32_t> framePushedExcludingOutboundCallArgs_;
+  Maybe<uint32_t> framePushedExcludingOutboundCallArgs;
 
   // The number of memory-resident, ref-typed entries on the containing
   // BaseCompiler::stk_.
-  size_t memRefsOnStk_;
-
-  // This is a copy of mst_ that is used only within individual calls to
-  // createStackMap.  It is here only to avoid possible heap allocation costs
-  // resulting from making it local to createStackMap().
-  MachineStackTracker augmentedMst_;
+  size_t memRefsOnStk;
+
+  // This is a copy of machineStackTracker that is used only within individual
+  // calls to createStackMap. It is here only to avoid possible heap allocation
+  // costs resulting from making it local to createStackMap().
+  MachineStackTracker augmentedMst;
 
   StackMapGenerator(StackMaps* stackMaps, const MachineState& trapExitLayout,
                     const size_t trapExitLayoutNumWords,
                     const MacroAssembler& masm)
       : trapExitLayout_(trapExitLayout),
         trapExitLayoutNumWords_(trapExitLayoutNumWords),
         stackMaps_(stackMaps),
         masm_(masm),
-        numStackArgWords_(0),
-        memRefsOnStk_(0) {}
+        numStackArgWords(0),
+        memRefsOnStk(0) {}
 
   // At the beginning of a function, we may have live roots in registers (as
   // arguments) at the point where we perform a stack overflow check.  This
   // method generates the "extra" stackmap entries to describe that, in the
   // case that the check fails and we wind up calling into the wasm exit
   // stub, as generated by GenerateTrapExit().
   //
   // The resulting map must correspond precisely with the stack layout
@@ -2195,17 +2195,17 @@ struct StackMapGenerator {
   // stack |stk|, incorporating possible extra pointers in |extra| at the
   // lower addressed end, and possibly with the associated frame having a
   // ref-typed DebugFrame as indicated by |refDebugFrame|.
   MOZ_MUST_USE bool createStackMap(const char* who,
                                    const ExitStubMapVector& extras,
                                    uint32_t assemblerOffset,
                                    HasRefTypedDebugFrame refDebugFrame,
                                    const StkVector& stk) {
-    size_t countedPointers = mst_.numPtrs() + memRefsOnStk_;
+    size_t countedPointers = machineStackTracker.numPtrs() + memRefsOnStk;
 #ifndef DEBUG
     // An important optimization.  If there are obviously no pointers, as
     // we expect in the majority of cases, exit quickly.
     if (countedPointers == 0 && extras.empty() &&
         refDebugFrame == HasRefTypedDebugFrame::No) {
       return true;
     }
 #else
@@ -2215,76 +2215,76 @@ struct StackMapGenerator {
     // DebugFrame, but they do not appear in the map's bitmap.  Note that
     // |countedPointers| is debug-only from this point onwards.
     for (bool b : extras) {
       countedPointers += (b ? 1 : 0);
     }
 #endif
 
     // Start with the frame-setup map, and add operand-stack information to
-    // that.  augmentedMst_ holds live data only within individual calls to
+    // that.  augmentedMst holds live data only within individual calls to
     // createStackMap.
-    augmentedMst_.clear();
-    if (!mst_.cloneTo(&augmentedMst_)) {
+    augmentedMst.clear();
+    if (!machineStackTracker.cloneTo(&augmentedMst)) {
       return false;
     }
 
     // At this point, augmentedMst only contains entries covering the
     // incoming argument area (if any) and for the area allocated by this
     // function's prologue.  We now need to calculate how far the machine's
     // stack pointer is below where it was at the start of the body.  But we
     // must take care not to include any words pushed as arguments to an
     // upcoming function call, since those words "belong" to the stackmap of
     // the callee, not to the stackmap of this function.  Note however that
     // any alignment padding pushed prior to pushing the args *does* belong to
     // this function.
     //
     // That padding is taken into account at the point where
-    // framePushedExcludingOutboundCallArgs_ is set, viz, in startCallArgs(),
+    // framePushedExcludingOutboundCallArgs is set, viz, in startCallArgs(),
     // and comprises two components:
     //
     // * call->frameAlignAdjustment
     // * the padding applied to the stack arg area itself.  That is:
     //   StackArgAreaSize(argTys) - StackArgAreaSizeUnpadded(argTys)
     Maybe<uint32_t> framePushedExcludingArgs;
-    if (framePushedAtEntryToBody_.isNothing()) {
+    if (framePushedAtEntryToBody.isNothing()) {
       // Still in the prologue.  framePushedExcludingArgs remains Nothing.
-      MOZ_ASSERT(framePushedExcludingOutboundCallArgs_.isNothing());
+      MOZ_ASSERT(framePushedExcludingOutboundCallArgs.isNothing());
     } else {
       // In the body.
-      MOZ_ASSERT(masm_.framePushed() >= framePushedAtEntryToBody_.value());
-      if (framePushedExcludingOutboundCallArgs_.isSome()) {
+      MOZ_ASSERT(masm_.framePushed() >= framePushedAtEntryToBody.value());
+      if (framePushedExcludingOutboundCallArgs.isSome()) {
         // In the body, and we've potentially pushed some args onto the stack.
         // We must ignore them when sizing the stackmap.
         MOZ_ASSERT(masm_.framePushed() >=
-                   framePushedExcludingOutboundCallArgs_.value());
-        MOZ_ASSERT(framePushedExcludingOutboundCallArgs_.value() >=
-                   framePushedAtEntryToBody_.value());
+                   framePushedExcludingOutboundCallArgs.value());
+        MOZ_ASSERT(framePushedExcludingOutboundCallArgs.value() >=
+                   framePushedAtEntryToBody.value());
         framePushedExcludingArgs =
-            Some(framePushedExcludingOutboundCallArgs_.value());
+            Some(framePushedExcludingOutboundCallArgs.value());
       } else {
         // In the body, but not with call args on the stack.  The stackmap
         // must be sized so as to extend all the way "down" to
         // masm_.framePushed().
         framePushedExcludingArgs = Some(masm_.framePushed());
       }
     }
 
     if (framePushedExcludingArgs.isSome()) {
       uint32_t bodyPushedBytes =
-          framePushedExcludingArgs.value() - framePushedAtEntryToBody_.value();
+          framePushedExcludingArgs.value() - framePushedAtEntryToBody.value();
       MOZ_ASSERT(0 == bodyPushedBytes % sizeof(void*));
-      if (!augmentedMst_.pushNonGCPointers(bodyPushedBytes / sizeof(void*))) {
+      if (!augmentedMst.pushNonGCPointers(bodyPushedBytes / sizeof(void*))) {
         return false;
       }
     }
 
     // Scan the operand stack, marking pointers in the just-added new
     // section.
-    MOZ_ASSERT_IF(framePushedAtEntryToBody_.isNothing(), stk.empty());
+    MOZ_ASSERT_IF(framePushedAtEntryToBody.isNothing(), stk.empty());
     MOZ_ASSERT_IF(framePushedExcludingArgs.isNothing(), stk.empty());
 
     for (const Stk& v : stk) {
 #ifndef DEBUG
       // We don't track roots in registers, per rationale below, so if this
       // doesn't hold, something is seriously wrong, and we're likely to get a
       // GC-related crash.
       MOZ_RELEASE_ASSERT(v.kind() != Stk::RegisterRef);
@@ -2307,35 +2307,36 @@ struct StackMapGenerator {
           continue;
         case Stk::LocalI32:
         case Stk::LocalI64:
         case Stk::LocalF32:
         case Stk::LocalF64:
           // These also have uninteresting type.  Check that they live in the
           // section of stack set up by beginFunction().  The unguarded use of
           // |value()| here is safe due to the assertion above this loop.
-          MOZ_ASSERT(v.offs() <= framePushedAtEntryToBody_.value());
+          MOZ_ASSERT(v.offs() <= framePushedAtEntryToBody.value());
           continue;
         case Stk::RegisterI32:
         case Stk::RegisterI64:
         case Stk::RegisterF32:
         case Stk::RegisterF64:
           // These also have uninteresting type, but more to the point: all
           // registers holding live values should have been flushed to the
           // machine stack immediately prior to the instruction to which this
           // stackmap pertains.  So these can't happen.
           MOZ_CRASH("createStackMap: operand stack has Register-non-Ref");
         case Stk::MemRef:
           // This is the only case we care about.  We'll handle it after the
           // switch.
           break;
         case Stk::LocalRef:
           // We need the stackmap to mention this pointer, but it should
-          // already be in the mst_ section created by beginFunction().
-          MOZ_ASSERT(v.offs() <= framePushedAtEntryToBody_.value());
+          // already be in the machineStackTracker section created by
+          // beginFunction().
+          MOZ_ASSERT(v.offs() <= framePushedAtEntryToBody.value());
           continue;
         case Stk::ConstRef:
           // This can currently only be a null pointer.
           MOZ_ASSERT(v.refval() == 0);
           continue;
         case Stk::RegisterRef:
           // This can't happen, per rationale above.
           MOZ_CRASH("createStackMap: operand stack contains RegisterRef");
@@ -2344,23 +2345,23 @@ struct StackMapGenerator {
       }
 #endif
       // v.offs() holds masm.framePushed() at the point immediately after it
       // was pushed on the stack.  Since it's still on the stack,
       // masm.framePushed() can't be less.
       MOZ_ASSERT(v.offs() <= framePushedExcludingArgs.value());
       uint32_t offsFromMapLowest = framePushedExcludingArgs.value() - v.offs();
       MOZ_ASSERT(0 == offsFromMapLowest % sizeof(void*));
-      augmentedMst_.setGCPointer(offsFromMapLowest / sizeof(void*));
+      augmentedMst.setGCPointer(offsFromMapLowest / sizeof(void*));
     }
 
     // Create the final StackMap.  The initial map is zeroed out, so there's
     // no need to write zero bits in it.
     const uint32_t extraWords = extras.length();
-    const uint32_t augmentedMstWords = augmentedMst_.length();
+    const uint32_t augmentedMstWords = augmentedMst.length();
     const uint32_t numMappedWords = extraWords + augmentedMstWords;
     StackMap* stackMap = StackMap::create(numMappedWords);
     if (!stackMap) {
       return false;
     }
 
     {
       // First the exit stub extra words, if any.
@@ -2369,27 +2370,27 @@ struct StackMapGenerator {
         if (b) {
           stackMap->setBit(i);
         }
         i++;
       }
     }
     // Followed by the "main" part of the map.
     for (uint32_t i = 0; i < augmentedMstWords; i++) {
-      if (augmentedMst_.isGCPointer(i)) {
+      if (augmentedMst.isGCPointer(i)) {
         stackMap->setBit(numMappedWords - 1 - i);
       }
     }
 
     stackMap->setExitStubWords(extraWords);
 
     // Record in the map, how far down from the highest address the Frame* is.
     // Take the opportunity to check that we haven't marked any part of the
     // Frame itself as a pointer.
-    stackMap->setFrameOffsetFromTop(numStackArgWords_ +
+    stackMap->setFrameOffsetFromTop(numStackArgWords +
                                     sizeof(Frame) / sizeof(void*));
 #ifdef DEBUG
     for (uint32_t i = 0; i < sizeof(Frame) / sizeof(void*); i++) {
       MOZ_ASSERT(stackMap->getBit(stackMap->numMappedWords -
                                   stackMap->frameOffsetFromTop + i) == 0);
     }
 #endif
 
@@ -2566,17 +2567,17 @@ class BaseCompiler final : public BaseCo
       latentDoubleCmp_;  // Comparison operator, if latentOp_ == Compare, float
                          // types
 
   FuncOffsets offsets_;
   MacroAssembler& masm;  // No '_' suffix - too tedious...
   BaseRegAlloc ra;       // Ditto
   BaseStackFrame fr;
 
-  StackMapGenerator smgen_;
+  StackMapGenerator stackMapGenerator_;
 
   BaseStackFrame::LocalVector localInfo_;
   Vector<OutOfLineCode*, 8, SystemAllocPolicy> outOfLine_;
 
   // On specific platforms we sometimes need to use specific registers.
 
   SpecificRegs specific_;
 
@@ -2908,17 +2909,17 @@ class BaseCompiler final : public BaseCo
     }
     return nRefs;
   }
 #endif
 
   template <typename T>
   void push(T item) {
     // None of the single-arg Stk constructors create a Stk::MemRef, so
-    // there's no need to increment smgen_.memRefsOnStk_ here.
+    // there's no need to increment stackMapGenerator_.memRefsOnStk here.
     stk_.infallibleEmplaceBack(Stk(item));
   }
 
   void pushConstRef(intptr_t v) { stk_.infallibleEmplaceBack(Stk::StkRef(v)); }
 
   void loadConstI32(const Stk& src, RegI32 dest) {
     moveImm32(src.i32val(), dest);
   }
@@ -3241,24 +3242,24 @@ class BaseCompiler final : public BaseCo
           v.setOffs(Stk::MemF32, offs);
           break;
         }
         case Stk::LocalRef: {
           ScratchPtr scratch(*this);
           loadLocalRef(v, scratch);
           uint32_t offs = fr.pushPtr(scratch);
           v.setOffs(Stk::MemRef, offs);
-          smgen_.memRefsOnStk_++;
+          stackMapGenerator_.memRefsOnStk++;
           break;
         }
         case Stk::RegisterRef: {
           uint32_t offs = fr.pushPtr(v.refReg());
           freeRef(v.refReg());
           v.setOffs(Stk::MemRef, offs);
-          smgen_.memRefsOnStk_++;
+          stackMapGenerator_.memRefsOnStk++;
           break;
         }
         default: { break; }
       }
     }
   }
 
   // Various methods for creating a stack map.  Stack maps are indexed by the
@@ -3266,44 +3267,45 @@ class BaseCompiler final : public BaseCo
   // interest.  In practice that means either: the return point of a call, the
   // instruction immediately after a trap instruction (the "resume"
   // instruction), or the instruction immediately following a no-op (when
   // debugging is enabled).
 
   // Create a vanilla stack map.
   MOZ_MUST_USE bool createStackMap(const char* who) {
     const ExitStubMapVector noExtras;
-    return smgen_.createStackMap(who, noExtras, masm.currentOffset(),
-                                 HasRefTypedDebugFrame::No, stk_);
+    return stackMapGenerator_.createStackMap(
+        who, noExtras, masm.currentOffset(), HasRefTypedDebugFrame::No, stk_);
   }
 
   // Create a stack map as vanilla, but for a custom assembler offset.
   MOZ_MUST_USE bool createStackMap(const char* who,
                                    CodeOffset assemblerOffset) {
     const ExitStubMapVector noExtras;
-    return smgen_.createStackMap(who, noExtras, assemblerOffset.offset(),
-                                 HasRefTypedDebugFrame::No, stk_);
+    return stackMapGenerator_.createStackMap(who, noExtras,
+                                             assemblerOffset.offset(),
+                                             HasRefTypedDebugFrame::No, stk_);
   }
 
   // Create a stack map as vanilla, and note the presence of a ref-typed
   // DebugFrame on the stack.
   MOZ_MUST_USE bool createStackMap(const char* who,
                                    HasRefTypedDebugFrame refDebugFrame) {
     const ExitStubMapVector noExtras;
-    return smgen_.createStackMap(who, noExtras, masm.currentOffset(),
-                                 refDebugFrame, stk_);
+    return stackMapGenerator_.createStackMap(
+        who, noExtras, masm.currentOffset(), refDebugFrame, stk_);
   }
 
   // The most general stack map construction.
   MOZ_MUST_USE bool createStackMap(const char* who,
                                    const ExitStubMapVector& extras,
                                    uint32_t assemblerOffset,
                                    HasRefTypedDebugFrame refDebugFrame) {
-    return smgen_.createStackMap(who, extras, assemblerOffset, refDebugFrame,
-                                 stk_);
+    return stackMapGenerator_.createStackMap(who, extras, assemblerOffset,
+                                             refDebugFrame, stk_);
   }
 
   // This is an optimization used to avoid calling sync() for
   // setLocal(): if the local does not exist unresolved on the stack
   // then we can skip the sync.
 
   bool hasLocal(uint32_t slot) {
     for (size_t i = stk_.length(); i > 0; i--) {
@@ -3533,32 +3535,32 @@ class BaseCompiler final : public BaseCo
       popRef(v, specific);
       if (v.kind() == Stk::RegisterRef) {
         freeRef(v.refReg());
       }
     }
 
     stk_.popBack();
     if (v.kind() == Stk::MemRef) {
-      smgen_.memRefsOnStk_--;
+      stackMapGenerator_.memRefsOnStk--;
     }
     return specific;
   }
 
   MOZ_MUST_USE RegPtr popRef() {
     Stk& v = stk_.back();
     RegPtr r;
     if (v.kind() == Stk::RegisterRef) {
       r = v.refReg();
     } else {
       popRef(v, (r = needRef()));
     }
     stk_.popBack();
     if (v.kind() == Stk::MemRef) {
-      smgen_.memRefsOnStk_--;
+      stackMapGenerator_.memRefsOnStk--;
     }
     return r;
   }
 
   // Call only from other popF64() variants.
   // v must be the stack top.  May pop the CPU stack.
 
   void popF64(const Stk& v, RegF64 dest) {
@@ -3926,17 +3928,17 @@ class BaseCompiler final : public BaseCo
           break;
         case Stk::RegisterF32:
           freeF32(v.f32reg());
           break;
         case Stk::RegisterRef:
           freeRef(v.refReg());
           break;
         case Stk::MemRef:
-          smgen_.memRefsOnStk_--;
+          stackMapGenerator_.memRefsOnStk--;
           break;
         default:
           break;
       }
     }
     stk_.shrinkTo(stackSize);
   }
 
@@ -4059,64 +4061,67 @@ class BaseCompiler final : public BaseCo
     JitSpew(JitSpew_Codegen, "# ========================================");
     JitSpew(JitSpew_Codegen, "# Emitting wasm baseline code");
     JitSpew(JitSpew_Codegen,
             "# beginFunction: start of function prologue for index %d",
             (int)func_.index);
 
     // Make a start on the stack map for this function.  Inspect the args so
     // as to determine which of them are both in-memory and pointer-typed, and
-    // add entries to mst_ as appropriate.
+    // add entries to machineStackTracker as appropriate.
 
     const ValTypeVector& argTys = env_.funcTypes[func_.index]->args();
 
     size_t nInboundStackArgBytes = StackArgAreaSizeUnaligned(argTys);
     MOZ_ASSERT(nInboundStackArgBytes % sizeof(void*) == 0);
-    smgen_.numStackArgWords_ = nInboundStackArgBytes / sizeof(void*);
-
-    MOZ_ASSERT(smgen_.mst_.length() == 0);
-    if (!smgen_.mst_.pushNonGCPointers(smgen_.numStackArgWords_)) {
+    stackMapGenerator_.numStackArgWords = nInboundStackArgBytes / sizeof(void*);
+
+    MOZ_ASSERT(stackMapGenerator_.machineStackTracker.length() == 0);
+    if (!stackMapGenerator_.machineStackTracker.pushNonGCPointers(
+            stackMapGenerator_.numStackArgWords)) {
       return false;
     }
 
     for (ABIArgIter<const ValTypeVector> i(argTys); !i.done(); i++) {
       ABIArg argLoc = *i;
       const ValType& ty = argTys[i.index()];
       MOZ_ASSERT(ToMIRType(ty) != MIRType::Pointer);
       if (argLoc.kind() != ABIArg::Stack || !ty.isReference()) {
         continue;
       }
       uint32_t offset = argLoc.offsetFromArgBase();
       MOZ_ASSERT(offset < nInboundStackArgBytes);
       MOZ_ASSERT(offset % sizeof(void*) == 0);
-      smgen_.mst_.setGCPointer(offset / sizeof(void*));
+      stackMapGenerator_.machineStackTracker.setGCPointer(offset /
+                                                          sizeof(void*));
     }
 
     GenerateFunctionPrologue(
         masm, env_.funcTypes[func_.index]->id,
         env_.mode() == CompileMode::Tier1 ? Some(func_.index) : Nothing(),
         &offsets_);
 
     // GenerateFunctionPrologue pushes exactly one wasm::Frame's worth of
     // stuff, and none of the values are GC pointers.  Hence:
-    if (!smgen_.mst_.pushNonGCPointers(sizeof(Frame) / sizeof(void*))) {
+    if (!stackMapGenerator_.machineStackTracker.pushNonGCPointers(
+            sizeof(Frame) / sizeof(void*))) {
       return false;
     }
 
     // Initialize DebugFrame fields before the stack overflow trap so that
     // we have the invariant that all observable Frames in a debugEnabled
     // Module have valid DebugFrames.
     if (env_.debugEnabled()) {
 #ifdef JS_CODEGEN_ARM64
       static_assert(DebugFrame::offsetOfFrame() % WasmStackAlignment == 0,
                     "aligned");
 #endif
       masm.reserveStack(DebugFrame::offsetOfFrame());
-      if (!smgen_.mst_.pushNonGCPointers(DebugFrame::offsetOfFrame() /
-                                         sizeof(void*))) {
+      if (!stackMapGenerator_.machineStackTracker.pushNonGCPointers(
+              DebugFrame::offsetOfFrame() / sizeof(void*))) {
         return false;
       }
 
       masm.store32(
           Imm32(func_.index),
           Address(masm.getStackPointer(), DebugFrame::offsetOfFuncIndex()));
       masm.storePtr(ImmWord(0), Address(masm.getStackPointer(),
                                         DebugFrame::offsetOfFlagsWord()));
@@ -4137,30 +4142,31 @@ class BaseCompiler final : public BaseCo
     }
 
     // Generate a stack-overflow check and its associated stack map.
 
     fr.checkStack(ABINonArgReg0, BytecodeOffset(func_.lineOrBytecode));
 
     const ValTypeVector& args = funcType().args();
     ExitStubMapVector extras;
-    if (!smgen_.generateStackmapEntriesForTrapExit(args, extras)) {
+    if (!stackMapGenerator_.generateStackmapEntriesForTrapExit(args, extras)) {
       return false;
     }
     if (!createStackMap("stack check", extras, masm.currentOffset(),
                         HasRefTypedDebugFrame::No)) {
       return false;
     }
 
     size_t reservedBytes = fr.fixedAllocSize() - masm.framePushed();
     MOZ_ASSERT(0 == (reservedBytes % sizeof(void*)));
 
     masm.reserveStack(reservedBytes);
     fr.onFixedStackAllocated();
-    if (!smgen_.mst_.pushNonGCPointers(reservedBytes / sizeof(void*))) {
+    if (!stackMapGenerator_.machineStackTracker.pushNonGCPointers(
+            reservedBytes / sizeof(void*))) {
       return false;
     }
 
     // Copy arguments from registers to stack.
     for (ABIArgIter<const ValTypeVector> i(args); !i.done(); i++) {
       if (!i->argInRegister()) {
         continue;
       }
@@ -4171,17 +4177,18 @@ class BaseCompiler final : public BaseCo
           break;
         case MIRType::Int64:
           fr.storeLocalI64(RegI64(i->gpr64()), l);
           break;
         case MIRType::RefOrNull: {
           uint32_t offs = fr.localOffset(l);
           MOZ_ASSERT(0 == (offs % sizeof(void*)));
           fr.storeLocalPtr(RegPtr(i->gpr()), l);
-          smgen_.mst_.setGCPointer(offs / sizeof(void*));
+          stackMapGenerator_.machineStackTracker.setGCPointer(offs /
+                                                              sizeof(void*));
           break;
         }
         case MIRType::Double:
           fr.storeLocalF64(RegF64(i->fpu()), l);
           break;
         case MIRType::Float32:
           fr.storeLocalF32(RegF32(i->fpu()), l);
           break;
@@ -4197,18 +4204,18 @@ class BaseCompiler final : public BaseCo
       if (!createStackMap("debug: breakable point")) {
         return false;
       }
     }
 
     JitSpew(JitSpew_Codegen,
             "# beginFunction: enter body with masm.framePushed = %u",
             masm.framePushed());
-    MOZ_ASSERT(smgen_.framePushedAtEntryToBody_.isNothing());
-    smgen_.framePushedAtEntryToBody_.emplace(masm.framePushed());
+    MOZ_ASSERT(stackMapGenerator_.framePushedAtEntryToBody.isNothing());
+    stackMapGenerator_.framePushedAtEntryToBody.emplace(masm.framePushed());
 
     return true;
   }
 
   void saveResult() {
     MOZ_ASSERT(env_.debugEnabled());
     size_t debugFrameOffset = masm.framePushed() - DebugFrame::offsetOfFrame();
     Address resultsAddress(masm.getStackPointer(),
@@ -4391,18 +4398,19 @@ class BaseCompiler final : public BaseCo
     call.frameAlignAdjustment = ComputeByteAlignment(
         masm.framePushed() + sizeof(Frame), JitStackAlignment);
   }
 
   void endCall(FunctionCall& call, size_t stackSpace) {
     size_t adjustment = call.stackArgAreaSize + call.frameAlignAdjustment;
     fr.freeArgAreaAndPopBytes(adjustment, stackSpace);
 
-    MOZ_ASSERT(smgen_.framePushedExcludingOutboundCallArgs_.isSome());
-    smgen_.framePushedExcludingOutboundCallArgs_.reset();
+    MOZ_ASSERT(
+        stackMapGenerator_.framePushedExcludingOutboundCallArgs.isSome());
+    stackMapGenerator_.framePushedExcludingOutboundCallArgs.reset();
 
     if (call.isInterModule) {
       masm.loadWasmTlsRegFromFrame();
       masm.loadWasmPinnedRegsFromTls();
       masm.switchToWasmTlsRealm(ABINonArgReturnReg0, ABINonArgReturnReg1);
     } else if (call.usesSystemAbi) {
       // On x86 there are no pinned registers, so don't waste time
       // reloading the Tls.
@@ -4417,18 +4425,19 @@ class BaseCompiler final : public BaseCo
     size_t stackArgAreaSizeAligned
         = AlignStackArgAreaSize(stackArgAreaSizeUnaligned);
     MOZ_ASSERT(stackArgAreaSizeUnaligned <= stackArgAreaSizeAligned);
 
     // Record the masm.framePushed() value at this point, before we push args
     // for the call, but including the alignment space placed above the args.
     // This defines the lower limit of the stackmap that will be created for
     // this call.
-    MOZ_ASSERT(smgen_.framePushedExcludingOutboundCallArgs_.isNothing());
-    smgen_.framePushedExcludingOutboundCallArgs_.emplace(
+    MOZ_ASSERT(
+        stackMapGenerator_.framePushedExcludingOutboundCallArgs.isNothing());
+    stackMapGenerator_.framePushedExcludingOutboundCallArgs.emplace(
         // However much we've pushed so far
         masm.framePushed() +
         // Extra space we'll push to get the frame aligned
         call->frameAlignAdjustment +
         // Extra space we'll push to get the outbound arg area 16-aligned
         (stackArgAreaSizeAligned - stackArgAreaSizeUnaligned));
 
     call->stackArgAreaSize = stackArgAreaSizeAligned;
@@ -10790,17 +10799,17 @@ bool BaseCompiler::emitStructNarrow() {
   pushI32(mustUnboxAnyref);
   pushI32(outputStruct.moduleIndex_);
   pushRef(rp);
   return emitInstanceCall(lineOrBytecode, SigPIIR_, ExprType::AnyRef,
                           SymbolicAddress::StructNarrow);
 }
 
 bool BaseCompiler::emitBody() {
-  MOZ_ASSERT(smgen_.framePushedAtEntryToBody_.isSome());
+  MOZ_ASSERT(stackMapGenerator_.framePushedAtEntryToBody.isSome());
 
   if (!iter_.readFunctionStart(funcType().ret())) {
     return false;
   }
 
   initControl(controlItem());
 
   uint32_t overhead = 0;
@@ -10837,19 +10846,19 @@ bool BaseCompiler::emitBody() {
 
 #define emitIntDivCallout(doEmit, symbol, type)   \
   iter_.readBinary(type, &unused_a, &unused_b) && \
       (deadCode_ || doEmit(symbol, type))
 
 #ifdef DEBUG
     // Check that the number of ref-typed entries in the operand stack matches
     // reality.
-#  define CHECK_POINTER_COUNT                                  \
-    do {                                                       \
-      MOZ_ASSERT(countMemRefsOnStk() == smgen_.memRefsOnStk_); \
+#  define CHECK_POINTER_COUNT                                             \
+    do {                                                                  \
+      MOZ_ASSERT(countMemRefsOnStk() == stackMapGenerator_.memRefsOnStk); \
     } while (0)
 #else
 #  define CHECK_POINTER_COUNT \
     do {                      \
     } while (0)
 #endif
 
 #define CHECK(E) \
@@ -10897,23 +10906,25 @@ bool BaseCompiler::emitBody() {
       sync();
 
       insertBreakablePoint(CallSiteDesc::Breakpoint);
       if (!createStackMap("debug: per insn")) {
         return false;
       }
     }
 
-    // Going below framePushedAtEntryToBody_ would imply that we've
+    // Going below framePushedAtEntryToBody would imply that we've
     // popped off the machine stack, part of the frame created by
     // beginFunction().
-    MOZ_ASSERT(masm.framePushed() >= smgen_.framePushedAtEntryToBody_.value());
+    MOZ_ASSERT(masm.framePushed() >=
+               stackMapGenerator_.framePushedAtEntryToBody.value());
 
     // At this point we're definitely not generating code for a function call.
-    MOZ_ASSERT(smgen_.framePushedExcludingOutboundCallArgs_.isNothing());
+    MOZ_ASSERT(
+        stackMapGenerator_.framePushedExcludingOutboundCallArgs.isNothing());
 
     switch (op.b0) {
       case uint16_t(Op::End):
         if (!emitEnd()) {
           return false;
         }
 
         if (iter_.controlStackEmpty()) {
@@ -11849,17 +11860,18 @@ BaseCompiler::BaseCompiler(const ModuleE
       bceSafe_(0),
       latentOp_(LatentOp::None),
       latentType_(ValType::I32),
       latentIntCmp_(Assembler::Equal),
       latentDoubleCmp_(Assembler::DoubleEqual),
       masm(*masm),
       ra(*this),
       fr(*masm),
-      smgen_(stackMaps, trapExitLayout, trapExitLayoutNumWords, *masm),
+      stackMapGenerator_(stackMaps, trapExitLayout, trapExitLayoutNumWords,
+                         *masm),
       joinRegI32_(RegI32(ReturnReg)),
       joinRegI64_(RegI64(ReturnReg64)),
       joinRegPtr_(RegPtr(ReturnReg)),
       joinRegF32_(RegF32(ReturnFloat32Reg)),
       joinRegF64_(RegF64(ReturnDoubleReg)) {}
 
 bool BaseCompiler::init() {
   if (!SigD_.append(ValType::F64)) {
@@ -11925,17 +11937,17 @@ bool BaseCompiler::init() {
   return true;
 }
 
 FuncOffsets BaseCompiler::finish() {
   MOZ_ASSERT(done(), "all bytes must be consumed");
   MOZ_ASSERT(func_.callSiteLineNums.length() == lastReadCallSite_);
 
   MOZ_ASSERT(stk_.empty());
-  MOZ_ASSERT(smgen_.memRefsOnStk_ == 0);
+  MOZ_ASSERT(stackMapGenerator_.memRefsOnStk == 0);
 
   masm.flushBuffer();
 
   return offsets_;
 }
 
 }  // namespace wasm
 }  // namespace js