summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Bohe <brianbohe@gmail.com>2019-03-21 11:19:03 -0700
committerSergey Andreenko <seandree@microsoft.com>2019-03-21 11:19:03 -0700
commit9497b0c77819d7b64a0f3c8bf22921182c99c09d (patch)
treeb8c773d09027ed678e5c920a23a7ec3e5be82f45
parent9d8fc0a06eae4a657383929ba8ccfebb66730b61 (diff)
downloadcoreclr-9497b0c77819d7b64a0f3c8bf22921182c99c09d.tar.gz
coreclr-9497b0c77819d7b64a0f3c8bf22921182c99c09d.tar.bz2
coreclr-9497b0c77819d7b64a0f3c8bf22921182c99c09d.zip
Moving gen stack level to code gen interface (#23328)
* Make genStackLevel accessible from CodeGenInterface * Initializing stackLevel before fist BasicBlock's code is generated * Typo * Removing extra line on comments
-rw-r--r--src/jit/codegen.h4
-rw-r--r--src/jit/codegencommon.cpp5
-rw-r--r--src/jit/codegeninterface.h7
-rw-r--r--src/jit/codegenlinear.cpp4
4 files changed, 16 insertions, 4 deletions
diff --git a/src/jit/codegen.h b/src/jit/codegen.h
index 11c81c4b91..046addff4c 100644
--- a/src/jit/codegen.h
+++ b/src/jit/codegen.h
@@ -126,10 +126,6 @@ private:
bool genUseBlockInit; // true if we plan to block-initialize the local stack frame
unsigned genInitStkLclCnt; // The count of local variables that we need to zero init
- // Keeps track of how many bytes we've pushed on the processor's stack.
- //
- unsigned genStackLevel;
-
void SubtractStackLevel(unsigned adjustment)
{
assert(genStackLevel >= adjustment);
diff --git a/src/jit/codegencommon.cpp b/src/jit/codegencommon.cpp
index 2b5236b82a..2e15383025 100644
--- a/src/jit/codegencommon.cpp
+++ b/src/jit/codegencommon.cpp
@@ -11578,3 +11578,8 @@ void CodeGen::genStackPointerCheck(bool doStackPointerCheck, unsigned lvaStackPo
}
#endif // defined(DEBUG) && defined(_TARGET_XARCH_)
+
+unsigned CodeGenInterface::getCurrentStackLevel() const
+{
+ return genStackLevel;
+}
diff --git a/src/jit/codegeninterface.h b/src/jit/codegeninterface.h
index 9a67649084..6935a77e3f 100644
--- a/src/jit/codegeninterface.h
+++ b/src/jit/codegeninterface.h
@@ -542,6 +542,13 @@ public:
const LclVarDsc* varDsc, var_types type, regNumber baseReg, int offset, bool isFramePointerUsed);
};
+public:
+ unsigned getCurrentStackLevel() const;
+
+protected:
+ // Keeps track of how many bytes we've pushed on the processor's stack.
+ unsigned genStackLevel;
+
#ifdef LATE_DISASM
public:
virtual const char* siRegVarName(size_t offs, size_t size, unsigned reg) = 0;
diff --git a/src/jit/codegenlinear.cpp b/src/jit/codegenlinear.cpp
index c0a20343a3..595f86016e 100644
--- a/src/jit/codegenlinear.cpp
+++ b/src/jit/codegenlinear.cpp
@@ -114,6 +114,10 @@ void CodeGen::genInitialize()
// Make sure a set is allocated for compiler->compCurLife (in the long case), so we can set it to empty without
// allocation at the start of each basic block.
VarSetOps::AssignNoCopy(compiler, compiler->compCurLife, VarSetOps::MakeEmpty(compiler));
+
+ // We initialize the stack level before first "BasicBlock" code is generated in case we need to report stack
+ // variable needs home and so its stack offset.
+ SetStackLevel(0);
}
//------------------------------------------------------------------------