diff options
author | Bruce Forstall <Bruce_Forstall@msn.com> | 2018-10-22 21:39:16 -0700 |
---|---|---|
committer | Bruce Forstall <Bruce_Forstall@msn.com> | 2018-10-22 21:39:16 -0700 |
commit | c8a63947382b0db428db602238199ca81badbe8e (patch) | |
tree | a51bcb7a20b1aea58fd47e0810423c29f4766a32 /src/jit | |
parent | 692925708ac2f600d41c07eeaf729d219264d0d5 (diff) | |
download | coreclr-c8a63947382b0db428db602238199ca81badbe8e.tar.gz coreclr-c8a63947382b0db428db602238199ca81badbe8e.tar.bz2 coreclr-c8a63947382b0db428db602238199ca81badbe8e.zip |
Remove the LocAllocSP slot for non-x86 platforms
This special local variable is only needed on x86 when a function
contains localloc.
Diffstat (limited to 'src/jit')
-rw-r--r-- | src/jit/codegenarm.cpp | 6 | ||||
-rw-r--r-- | src/jit/codegenarm64.cpp | 6 | ||||
-rw-r--r-- | src/jit/codegencommon.cpp | 9 | ||||
-rw-r--r-- | src/jit/codegenxarch.cpp | 7 | ||||
-rw-r--r-- | src/jit/compiler.h | 6 | ||||
-rw-r--r-- | src/jit/gentree.cpp | 2 | ||||
-rw-r--r-- | src/jit/lclvars.cpp | 33 |
7 files changed, 40 insertions, 29 deletions
diff --git a/src/jit/codegenarm.cpp b/src/jit/codegenarm.cpp index 7c2058c4e5..b198da5a36 100644 --- a/src/jit/codegenarm.cpp +++ b/src/jit/codegenarm.cpp @@ -527,12 +527,6 @@ BAILOUT: if (endLabel != nullptr) genDefineTempLabel(endLabel); - // Write the lvaLocAllocSPvar stack frame slot - if (compiler->lvaLocAllocSPvar != BAD_VAR_NUM) - { - getEmitter()->emitIns_S_R(ins_Store(TYP_I_IMPL), EA_PTRSIZE, regCnt, compiler->lvaLocAllocSPvar, 0); - } - #if STACK_PROBES if (compiler->opts.compNeedStackProbes) { diff --git a/src/jit/codegenarm64.cpp b/src/jit/codegenarm64.cpp index 3d5cedd690..6aad5d957a 100644 --- a/src/jit/codegenarm64.cpp +++ b/src/jit/codegenarm64.cpp @@ -2139,12 +2139,6 @@ BAILOUT: if (endLabel != nullptr) genDefineTempLabel(endLabel); - // Write the lvaLocAllocSPvar stack frame slot - if (compiler->lvaLocAllocSPvar != BAD_VAR_NUM) - { - getEmitter()->emitIns_S_R(ins_Store(TYP_I_IMPL), EA_PTRSIZE, targetReg, compiler->lvaLocAllocSPvar, 0); - } - #if STACK_PROBES if (compiler->opts.compNeedStackProbes) { diff --git a/src/jit/codegencommon.cpp b/src/jit/codegencommon.cpp index 4d908dafc4..0d4cd7da5f 100644 --- a/src/jit/codegencommon.cpp +++ b/src/jit/codegencommon.cpp @@ -8361,16 +8361,13 @@ void CodeGen::genFnProlog() (compiler->lvaTable[compiler->lvaSecurityObject].lvOnFrame && compiler->lvaTable[compiler->lvaSecurityObject].lvMustInit)); - // Initialize any "hidden" slots/locals - +#ifdef JIT32_GCENCODER + // Initialize the LocalAllocSP slot if there is localloc in the function. if (compiler->lvaLocAllocSPvar != BAD_VAR_NUM) { -#ifdef _TARGET_ARM64_ - getEmitter()->emitIns_S_R(ins_Store(TYP_I_IMPL), EA_PTRSIZE, REG_FPBASE, compiler->lvaLocAllocSPvar, 0); -#else getEmitter()->emitIns_S_R(ins_Store(TYP_I_IMPL), EA_PTRSIZE, REG_SPBASE, compiler->lvaLocAllocSPvar, 0); -#endif } +#endif // JIT32_GCENCODER // Set up the GS security cookie diff --git a/src/jit/codegenxarch.cpp b/src/jit/codegenxarch.cpp index 49464213bc..54ff6dcd7e 100644 --- a/src/jit/codegenxarch.cpp +++ b/src/jit/codegenxarch.cpp @@ -2130,7 +2130,9 @@ void CodeGen::genMultiRegCallStoreToLocal(GenTree* treeNode) // The ESP tracking is used to report stack pointer-relative GC info, which is not // interesting while doing the localloc construction. Also, for functions with localloc, // we have EBP frames, and EBP-relative locals, and ESP-relative accesses only for function -// call arguments. We store the ESP after the localloc is complete in the LocAllocSP +// call arguments. +// +// For x86, we store the ESP after the localloc is complete in the LocAllocSP // variable. This variable is implicitly reported to the VM in the GC info (its position // is defined by convention relative to other items), and is used by the GC to find the // "base" stack pointer in functions with localloc. @@ -2456,11 +2458,12 @@ ALLOC_DONE: BAILOUT: - // Write the lvaLocAllocSPvar stack frame slot +#ifdef JIT32_GCENCODER if (compiler->lvaLocAllocSPvar != BAD_VAR_NUM) { getEmitter()->emitIns_S_R(ins_Store(TYP_I_IMPL), EA_PTRSIZE, REG_SPBASE, compiler->lvaLocAllocSPvar, 0); } +#endif // JIT32_GCENCODER #if STACK_PROBES if (compiler->opts.compNeedStackProbes) diff --git a/src/jit/compiler.h b/src/jit/compiler.h index c1b60d8ea9..87ab444222 100644 --- a/src/jit/compiler.h +++ b/src/jit/compiler.h @@ -2884,7 +2884,11 @@ public: int lvaCachedGenericContextArgOffset(); // For CORINFO_CALLCONV_PARAMTYPE and if generic context is passed as // THIS pointer - unsigned lvaLocAllocSPvar; // variable which has the result of the last alloca/localloc +#ifdef JIT32_GCENCODER + + unsigned lvaLocAllocSPvar; // variable which stores the value of ESP after the the last alloca/localloc + +#endif // JIT32_GCENCODER unsigned lvaNewObjArrayArgs; // variable with arguments for new MD array helper diff --git a/src/jit/gentree.cpp b/src/jit/gentree.cpp index 443aec296b..926aab75fb 100644 --- a/src/jit/gentree.cpp +++ b/src/jit/gentree.cpp @@ -10113,10 +10113,12 @@ void Compiler::gtGetLclVarNameInfo(unsigned lclNum, const char** ilKindOut, cons ilName = "EHSlots"; } #endif // !FEATURE_EH_FUNCLETS +#ifdef JIT32_GCENCODER else if (lclNum == lvaLocAllocSPvar) { ilName = "LocAllocSP"; } +#endif // JIT32_GCENCODER #if FEATURE_EH_FUNCLETS else if (lclNum == lvaPSPSym) { diff --git a/src/jit/lclvars.cpp b/src/jit/lclvars.cpp index 7cee828c4a..645f3fe280 100644 --- a/src/jit/lclvars.cpp +++ b/src/jit/lclvars.cpp @@ -57,7 +57,9 @@ void Compiler::lvaInit() #ifdef _TARGET_ARM_ lvaPromotedStructAssemblyScratchVar = BAD_VAR_NUM; #endif // _TARGET_ARM_ - lvaLocAllocSPvar = BAD_VAR_NUM; +#ifdef JIT32_GCENCODER + lvaLocAllocSPvar = BAD_VAR_NUM; +#endif // JIT32_GCENCODER lvaNewObjArrayArgs = BAD_VAR_NUM; lvaGSSecurityCookie = BAD_VAR_NUM; #ifdef _TARGET_X86_ @@ -3951,14 +3953,27 @@ void Compiler::lvaMarkLocalVars() } #endif // FEATURE_EH_FUNCLETS - // TODO: LocAllocSPvar should be only required by the implicit frame layout expected by the VM on x86. - // It should be removed on other platforms once we check there are no other implicit dependencies. +#ifdef JIT32_GCENCODER + // LocAllocSPvar is only required by the implicit frame layout expected by the VM on x86. Whether + // a function contains a Localloc is conveyed in the GC information, in the InfoHdrSmall.localloc + // field. The function must have an EBP frame. Then, the VM finds the LocAllocSP slot by assuming + // the following stack layout: + // + // -- higher addresses -- + // saved EBP <-- EBP points here + // other callee-saved registers // InfoHdrSmall.savedRegsCountExclFP specifies this size + // optional GS cookie // InfoHdrSmall.security is 1 if this exists + // LocAllocSP slot + // -- lower addresses -- + // + // See also eetwain.cpp::GetLocallocSPOffset() and its callers. if (compLocallocUsed) { lvaLocAllocSPvar = lvaGrabTempWithImplicitUse(false DEBUGARG("LocAllocSPvar")); LclVarDsc* locAllocSPvar = &lvaTable[lvaLocAllocSPvar]; locAllocSPvar->lvType = TYP_I_IMPL; } +#endif // JIT32_GCENCODER } // Ref counting is now enabled normally. @@ -5688,13 +5703,13 @@ void Compiler::lvaAssignVirtualFrameOffsetsToLocals() stkOffs = lvaAllocLocalAndSetVirtualOffset(lvaSecurityObject, TARGET_POINTER_SIZE, stkOffs); } +#ifdef JIT32_GCENCODER if (lvaLocAllocSPvar != BAD_VAR_NUM) { -#ifdef JIT32_GCENCODER noway_assert(codeGen->isFramePointerUsed()); // else offsets of locals of frameless methods will be incorrect -#endif stkOffs = lvaAllocLocalAndSetVirtualOffset(lvaLocAllocSPvar, TARGET_POINTER_SIZE, stkOffs); } +#endif // JIT32_GCENCODER if (lvaReportParamTypeArg()) { @@ -5886,7 +5901,10 @@ void Compiler::lvaAssignVirtualFrameOffsetsToLocals() #else lclNum == lvaShadowSPslotsVar || #endif // FEATURE_EH_FUNCLETS - lclNum == lvaLocAllocSPvar || lclNum == lvaSecurityObject) +#ifdef JIT32_GCENCODER + lclNum == lvaLocAllocSPvar || +#endif // JIT32_GCENCODER + lclNum == lvaSecurityObject) { assert(varDsc->lvStkOffs != BAD_STK_OFFS); continue; @@ -6658,8 +6676,7 @@ void Compiler::lvaDumpRegLocation(unsigned lclNum) /***************************************************************************** * * Dump the frame location assigned to a local. - * For non-LSRA, this will only be valid if there is no assigned register. - * For LSRA, it's the home location, even though the variable doesn't always live + * It's the home location, even though the variable doesn't always live * in its home location. */ |