From ab9d26d0a7eca623074701bd1f046012f94dfb00 Mon Sep 17 00:00:00 2001 From: Adam Perlin Date: Mon, 30 Nov 2026 15:47:56 -0800 Subject: [PATCH] Add WasmLocals JIT metric, defined as the total count of declared locals at codegen time across all funclets --- src/coreclr/jit/codegenwasm.cpp | 2 ++ src/coreclr/jit/jitmetadatalist.h | 1 + 2 files changed, 3 insertions(+) diff --git a/src/coreclr/jit/codegenwasm.cpp b/src/coreclr/jit/codegenwasm.cpp index b553d91408eeef..086d5e0dce3fc2 100644 --- a/src/coreclr/jit/codegenwasm.cpp +++ b/src/coreclr/jit/codegenwasm.cpp @@ -124,6 +124,7 @@ void CodeGen::genBeginFnProlog() GetEmitter()->emitIns_I_Ty(INS_local_decl, decl.Count, decl.Type, localsCount); localsCount += decl.Count; } + m_compiler->Metrics.WasmLocals += static_cast(localsCount); } //------------------------------------------------------------------------ @@ -618,6 +619,7 @@ void CodeGen::genFuncletProlog(BasicBlock* block) GetEmitter()->emitIns_I_Ty(INS_local_decl, decl.Count, decl.Type, localsCount); localsCount += decl.Count; } + m_compiler->Metrics.WasmLocals += static_cast(localsCount); // All the funclet params are used from their home registers, so nothing // needs homing here. diff --git a/src/coreclr/jit/jitmetadatalist.h b/src/coreclr/jit/jitmetadatalist.h index 731d8e679bc3c1..56becc794b48b5 100644 --- a/src/coreclr/jit/jitmetadatalist.h +++ b/src/coreclr/jit/jitmetadatalist.h @@ -98,6 +98,7 @@ JITMETADATAMETRIC(GlobalAssertionCount, int, 0) JITMETADATAMETRIC(GlobalAssertionOverflow, int, 0) JITMETADATAMETRIC(MorphTrackedLocals, int, 0) JITMETADATAMETRIC(MorphLocals, int, 0) +JITMETADATAMETRIC(WasmLocals, int, JIT_METADATA_LOWER_IS_BETTER) JITMETADATAMETRIC(EnumeratorGDVProvisionalNoEscape, int, 0) JITMETADATAMETRIC(EnumeratorGDVCanCloneToEnsureNoEscape, int, 0) JITMETADATAMETRIC(SuspensionPointsMerged, int, 0)