From 3c111e8b4305864edde7fe496455b0a0de4427a6 Mon Sep 17 00:00:00 2001 From: Kunal Pathak Date: Wed, 7 Oct 2020 11:02:14 -0700 Subject: [PATCH] fix condition to align method at 32 bytes (#42909) In #2249, we started doing alignment of methods to 32-byte boundary for Tier1. However, a method having loops bypass tiering and hence this condition was never executed. Fixed it to make sure we do the alignment for optimized methods only and don't do it for prejitted methods. --- src/coreclr/src/jit/emit.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/coreclr/src/jit/emit.cpp b/src/coreclr/src/jit/emit.cpp index 4cd4e8537ac5d..8e13a0496d28d 100644 --- a/src/coreclr/src/jit/emit.cpp +++ b/src/coreclr/src/jit/emit.cpp @@ -4776,10 +4776,11 @@ unsigned emitter::emitEndCodeGen(Compiler* comp, #endif #ifdef TARGET_XARCH - // For x64/x86, align Tier1 methods to 32 byte boundaries if + // For x64/x86, align methods that are "optimizations enabled" to 32 byte boundaries if // they are larger than 16 bytes and contain a loop. // - if (emitComp->opts.jitFlags->IsSet(JitFlags::JIT_FLAG_TIER1) && (emitTotalHotCodeSize > 16) && emitComp->fgHasLoops) + if (emitComp->opts.OptimizationEnabled() && !emitComp->opts.jitFlags->IsSet(JitFlags::JIT_FLAG_PREJIT) && + (emitTotalHotCodeSize > 16) && emitComp->fgHasLoops) { allocMemFlag = CORJIT_ALLOCMEM_FLG_32BYTE_ALIGN; }