diff --git a/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp b/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp index 2ab37dc..297865f 100644 --- a/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp @@ -1591,27 +1591,30 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) { __ add(rlocals, esp, r2, ext::uxtx, 3); __ sub(rlocals, rlocals, wordSize); - // Make room for locals - __ sub(rscratch1, esp, r3, ext::uxtx, 3); - - // Padding between locals and fixed part of activation frame to ensure - // SP is always 16-byte aligned. - __ andr(sp, rscratch1, -16); + __ mov(rscratch1, esp); // r3 - # of additional locals // allocate space for locals // explicitly initialize locals + // Initializing memory allocated for locals in the same direction as + // the stack grows to ensure page initialization order according + // to windows-aarch64 stack page growth requirement (see + // https://docs.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions?view=msvc-160#stack) { Label exit, loop; __ ands(zr, r3, r3); __ br(Assembler::LE, exit); // do nothing if r3 <= 0 __ bind(loop); - __ str(zr, Address(__ post(rscratch1, wordSize))); + __ str(zr, Address(__ pre(rscratch1, -wordSize))); __ sub(r3, r3, 1); // until everything initialized __ cbnz(r3, loop); __ bind(exit); } + // Padding between locals and fixed part of activation frame to ensure + // SP is always 16-byte aligned. + __ andr(sp, rscratch1, -16); + // And the base dispatch table __ get_dispatch();