Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jit preparation for arm64 apple: Use bytes in fgArgTabEntry. #42503

Merged
merged 10 commits into from
Oct 1, 2020
12 changes: 6 additions & 6 deletions src/coreclr/src/jit/codegencommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2355,25 +2355,25 @@ void CodeGen::genEmitMachineCode()
}
#endif

#if EMIT_TRACK_STACK_DEPTH
#if EMIT_TRACK_STACK_DEPTH && defined(DEBUG) && !defined(OSX_ARM64_ABI)
// Check our max stack level. Needed for fgAddCodeRef().
// We need to relax the assert as our estimation won't include code-gen
// stack changes (which we know don't affect fgAddCodeRef()).
// NOTE: after emitEndCodeGen (including here), emitMaxStackDepth is a
// count of DWORD-sized arguments, NOT argument size in bytes.
{
unsigned maxAllowedStackDepth = compiler->fgPtrArgCntMax + // Max number of pointer-sized stack arguments.
compiler->compHndBBtabCount + // Return address for locally-called finallys
genTypeStSz(TYP_LONG) + // longs/doubles may be transferred via stack, etc
unsigned maxAllowedStackDepth = compiler->fgGetPtrArgCntMax() + // Max number of pointer-sized stack arguments.
compiler->compHndBBtabCount + // Return address for locally-called finallys
genTypeStSz(TYP_LONG) + // longs/doubles may be transferred via stack, etc
(compiler->compTailCallUsed ? 4 : 0); // CORINFO_HELP_TAILCALL args
#if defined(UNIX_X86_ABI)
// Convert maxNestedAlignment to DWORD count before adding to maxAllowedStackDepth.
assert(maxNestedAlignment % sizeof(int) == 0);
maxAllowedStackDepth += maxNestedAlignment / sizeof(int);
#endif
noway_assert(GetEmitter()->emitMaxStackDepth <= maxAllowedStackDepth);
assert(GetEmitter()->emitMaxStackDepth <= maxAllowedStackDepth);
}
#endif // EMIT_TRACK_STACK_DEPTH
#endif // EMIT_TRACK_STACK_DEPTH && DEBUG

*nativeSizeOfCode = codeSize;
compiler->info.compNativeCodeSize = (UNATIVE_OFFSET)codeSize;
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/src/jit/codegenxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8547,7 +8547,7 @@ void CodeGen::genProfilingEnterCallback(regNumber initReg, bool* pInitRegZeroed)
EA_UNKNOWN); // retSize

// Check that we have place for the push.
assert(compiler->fgPtrArgCntMax >= 1);
assert(compiler->fgGetPtrArgCntMax() >= 1);

#if defined(UNIX_X86_ABI)
// Restoring alignment manually. This is similar to CodeGen::genRemoveAlignmentAfterCall
Expand Down Expand Up @@ -8628,7 +8628,7 @@ void CodeGen::genProfilingLeaveCallback(unsigned helper)
genEmitHelperCall(helper, argSize, EA_UNKNOWN /* retSize */);

// Check that we have place for the push.
assert(compiler->fgPtrArgCntMax >= 1);
assert(compiler->fgGetPtrArgCntMax() >= 1);

#if defined(UNIX_X86_ABI)
// Restoring alignment manually. This is similar to CodeGen::genRemoveAlignmentAfterCall
Expand Down
7 changes: 5 additions & 2 deletions src/coreclr/src/jit/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4921,10 +4921,13 @@ void Compiler::compCompile(void** methodCodePtr, ULONG* methodCodeSize, JitFlags
m_pLowering = new (this, CMK_LSRA) Lowering(this, m_pLinearScan); // PHASE_LOWERING
m_pLowering->Run();

// Set stack levels
//
#if !defined(OSX_ARM64_ABI)
// Set stack levels, this informmation is necessary for x86
sandreenko marked this conversation as resolved.
Show resolved Hide resolved
// but on other platforms it is used only in asserts
// TODO: do not run it in release on other platforms, see https://github.com/dotnet/runtime/issues/42673.
StackLevelSetter stackLevelSetter(this);
stackLevelSetter.Run();
#endif // !OSX_ARM64_ABI

// We can not add any new tracked variables after this point.
lvaTrackedFixed = true;
Expand Down