// The CompileTaskState of a ModuleGenerator contains the mutable state shared // between helper threads executing CompileTasks. Each CompileTask started on a // helper thread eventually either ends up in the 'finished' list or increments // 'numFailed'.
// A ModuleGenerator encapsulates the creation of a wasm module. During the // lifetime of a ModuleGenerator, a sequence of FunctionGenerators are created // and destroyed to compile the individual function bodies. After generating all // functions, ModuleGenerator::finish() must be called to complete the // compilation and extract the resulting wasm module.
class MOZ_STACK_CLASS ModuleGenerator { using CompileTaskVector = Vector<CompileTask, 0, SystemAllocPolicy>; using CodeOffsetVector = Vector<jit::CodeOffset, 0, SystemAllocPolicy>;
// Encapsulates the macro assembler state so that we can create a new one for // each code block. Not heap allocated because the macro assembler is a // 'stack class'. struct MacroAssemblerScope {
jit::TempAllocator masmAlloc;
jit::WasmMacroAssembler masm;
// Data that is used for partial tiering
SharedCode partialTieringCode_;
const CodeTailMetadata* existingCodeTailMeta_;
// Data that is used for compiling a complete tier
mozilla::TimeStamp completeTierStartTime_;
// Data that is moved into the Module/Code as the result of finish()
BytecodeRangeVector funcDefRanges_;
FeatureUsageVector funcDefFeatureUsages_;
CallRefMetricsRangeVector funcDefCallRefMetrics_;
AllocSitesRangeVector funcDefAllocSites_;
FuncImportVector funcImports_;
CodeBlockResult sharedStubs_;
MutableCodeMetadataForAsmJS codeMetaForAsmJS_;
FeatureUsage featureUsage_;
// Data that is used to construct a CodeBlock
UniqueCodeBlock codeBlock_;
UniqueLinkData linkData_;
LifoAlloc lifo_;
mozilla::Maybe<MacroAssemblerScope> masmScope_;
jit::WasmMacroAssembler* masm_;
uint32_t debugStubCodeOffset_;
uint32_t requestTierUpStubCodeOffset_;
uint32_t updateCallRefMetricsStubCodeOffset_; #ifdef ENABLE_WASM_JSPI
uint32_t contBaseFrameOffset_; #endif
CallFarJumpVector callFarJumps_;
CallSiteTargetVector callSiteTargets_;
FuncIonPerfSpewerVector funcIonSpewers_;
FuncBaselinePerfSpewerVector funcBaselineSpewers_;
uint32_t lastPatchedCallSite_;
uint32_t startOfUnpatchedCallsites_;
uint32_t numCallRefMetrics_;
uint32_t numAllocSites_;
CompileAndLinkStats tierStats_;
// Begins the creation of a code block. All code compiled during this time // will go into this code block. All previous code blocks must be finished.
[[nodiscard]] bool startCodeBlock(CodeBlockKind kind); // Finish the creation of a code block. This will move all the compiled code // and metadata into the code block and initialize it.
[[nodiscard]] bool finishCodeBlock(CodeBlockResult* result);
// Generate a code block containing all stubs that are shared between the // different tiers.
[[nodiscard]] bool prepareTier1();
// Starts the creation of a complete tier of wasm code. Every function // defined in this module must be compiled, then finishTier must be // called.
[[nodiscard]] bool startCompleteTier(); // Starts the creation of a partial tier of wasm code. The specified function // must be compiled, then finishTier must be called.
[[nodiscard]] bool startPartialTier(uint32_t funcIndex); // Finishes a complete or partial tier of wasm code.
[[nodiscard]] bool finishTier(CompileAndLinkStats* tierStats,
CodeBlockResult* result);
// Must be called after the last compileFuncDef() and before finishModule() // or finishTier2().
[[nodiscard]] bool finishFuncDefs();
// If env->mode is Once or Tier1, finishModule() must be called to generate // a new Module. Otherwise, if env->mode is Tier2, finishTier2() must be // called to augment the given Module with tier 2 code. `moduleMeta` // is passed as mutable only because we have to std::move field(s) out of // it; if that in future gets cleaned up, the parameter should be changed // to being SharedModuleMetadata.
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.