зеркало из https://github.com/dotnet/llilc.git
Merge pull request #451 from swaroop-sridhar/option
Separate options for ConservativeGC and Inserting Safepoints
This commit is contained in:
Коммит
803c0f695f
|
@ -241,7 +241,7 @@ public:
|
|||
|
||||
/// \name CoreCLR GC information
|
||||
//@{
|
||||
bool ShouldUseConservativeGC; ///< Whether the GC is conservative/precise
|
||||
bool ShouldInsertStatepoints; ///< Whether to insert gc.statepoint intrinsics
|
||||
//@}
|
||||
|
||||
private:
|
||||
|
|
|
@ -53,6 +53,12 @@ bool shouldUseConservativeGC() {
|
|||
return (LevelCStr != nullptr) && (strcmp(LevelCStr, "1") == 0);
|
||||
}
|
||||
|
||||
// Determine if GC statepoints should be inserted.
|
||||
bool shouldInsertStatepoints() {
|
||||
const char *LevelCStr = getenv("COMPLUS_INSERTSTATEPOINTS");
|
||||
return (LevelCStr != nullptr) && (strcmp(LevelCStr, "1") == 0);
|
||||
}
|
||||
|
||||
// The one and only Jit Object.
|
||||
LLILCJit *LLILCJit::TheJit = nullptr;
|
||||
|
||||
|
@ -84,7 +90,9 @@ LLILCJit::LLILCJit() {
|
|||
InitializeNativeTargetAsmParser();
|
||||
llvm::linkStatepointExampleGC();
|
||||
|
||||
ShouldUseConservativeGC = shouldUseConservativeGC();
|
||||
ShouldInsertStatepoints = shouldInsertStatepoints();
|
||||
assert(ShouldInsertStatepoints ||
|
||||
shouldUseConservativeGC() && "Statepoints required for precise-GC");
|
||||
}
|
||||
|
||||
#ifdef LLVM_ON_WIN32
|
||||
|
@ -211,7 +219,7 @@ CorJitResult LLILCJit::compileMethod(ICorJitInfo *JitInfo,
|
|||
|
||||
if (HasMethod) {
|
||||
|
||||
if (!ShouldUseConservativeGC) {
|
||||
if (ShouldInsertStatepoints) {
|
||||
// If using Precise GC, run the GC-Safepoint insertion
|
||||
// and lowering passes before generating code.
|
||||
legacy::PassManager Passes;
|
||||
|
|
|
@ -238,7 +238,7 @@ Function *ABIMethodSignature::createFunction(GenIR &Reader, Module &M) {
|
|||
}
|
||||
F->setCallingConv(CC);
|
||||
|
||||
if (!LLILCJit::TheJit->ShouldUseConservativeGC) {
|
||||
if (LLILCJit::TheJit->ShouldInsertStatepoints) {
|
||||
F->setGC("statepoint-example");
|
||||
}
|
||||
|
||||
|
|
|
@ -279,7 +279,7 @@ void GenIR::readerPrePass(uint8_t *Buffer, uint32_t NumBytes) {
|
|||
ASSERTNR(UNREACHED);
|
||||
}
|
||||
|
||||
if (!LLILCJit::TheJit->ShouldUseConservativeGC) {
|
||||
if (LLILCJit::TheJit->ShouldInsertStatepoints) {
|
||||
createSafepointPoll();
|
||||
}
|
||||
|
||||
|
@ -431,7 +431,7 @@ void GenIR::readerPostPass(bool IsImportOnly) {
|
|||
insertIRForSecurityObject();
|
||||
}
|
||||
|
||||
if (!LLILCJit::TheJit->ShouldUseConservativeGC) {
|
||||
if (LLILCJit::TheJit->ShouldInsertStatepoints) {
|
||||
|
||||
// Precise GC using statepoints cannot handle aggregates that contain
|
||||
// managed pointers yet. So, check if this function deals with such values
|
||||
|
|
Загрузка…
Ссылка в новой задаче