Skip to content

Commit

Permalink
Remove code for GC Poll marking and insertion.
Browse files Browse the repository at this point in the history
This is a follow-up to
dotnet#13582 (comment)
and
dotnet#13582 (comment)

The code to insert gc polls was added in desktop for gc suspension not based
on hijaking. All platforms we target support hijaking so this code is not exercised
or tested. It also clutters other code and adds a bit of runtime overhead.
This change removes all that code.

There are minimal asm diffs because of a removed call to `fgRenumberBlocks`.
  • Loading branch information
erozenfeld committed Sep 24, 2020
1 parent b36bb89 commit d90e704
Show file tree
Hide file tree
Showing 18 changed files with 81 additions and 608 deletions.
1 change: 0 additions & 1 deletion src/coreclr/src/inc/clrconfigvalues.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@ RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_gcServer, W("gcServer"), 0, "Enables server
CONFIG_STRING_INFO(INTERNAL_GcCoverage, W("GcCoverage"), "Specify a method or regular expression of method names to run with GCStress")
CONFIG_STRING_INFO(INTERNAL_SkipGCCoverage, W("SkipGcCoverage"), "Specify a list of assembly names to skip with GC Coverage")
RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_StatsUpdatePeriod, W("StatsUpdatePeriod"), 60, "Specifies the interval, in seconds, at which to update the statistics")
RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(EXTERNAL_GCPollType, W("GCPollType"), "")
RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_GCRetainVM, W("GCRetainVM"), 0, "When set we put the segments that should be deleted on a standby list (instead of releasing them back to the OS) which will be considered to satisfy new segment requests (note that the same thing can be specified via API which is the supported way)")
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_GCLOHThreshold, W("GCLOHThreshold"), 0, "Specifies the size that will make objects go on LOH")
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_gcAllowVeryLargeObjects, W("gcAllowVeryLargeObjects"), 1, "Allow allocation of 2GB+ objects on GC heap")
Expand Down
60 changes: 30 additions & 30 deletions src/coreclr/src/inc/corjitflags.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class CORJIT_FLAGS
CORJIT_FLAG_DEBUG_EnC = 3, // We are in Edit-n-Continue mode
CORJIT_FLAG_DEBUG_INFO = 4, // generate line and local-var info
CORJIT_FLAG_MIN_OPT = 5, // disable all jit optimizations (not necesarily debuggable code)
CORJIT_FLAG_GCPOLL_CALLS = 6, // Emit calls to JIT_POLLGC for thread suspension.
CORJIT_FLAG_UNUSED1 = 6,
CORJIT_FLAG_MCJIT_BACKGROUND = 7, // Calling from multicore JIT background thread, do not call JitComplete

#if defined(TARGET_X86)
Expand All @@ -44,11 +44,11 @@ class CORJIT_FLAGS

#else // !defined(TARGET_X86)

CORJIT_FLAG_UNUSED1 = 8,
CORJIT_FLAG_UNUSED2 = 9,
CORJIT_FLAG_UNUSED3 = 10,
CORJIT_FLAG_UNUSED4 = 11,
CORJIT_FLAG_UNUSED5 = 12,
CORJIT_FLAG_UNUSED2 = 8,
CORJIT_FLAG_UNUSED3 = 9,
CORJIT_FLAG_UNUSED4 = 10,
CORJIT_FLAG_UNUSED5 = 11,
CORJIT_FLAG_UNUSED6 = 12,

#endif // !defined(TARGET_X86)

Expand Down Expand Up @@ -81,43 +81,43 @@ class CORJIT_FLAGS
CORJIT_FLAG_FRAMED = 31, // All methods have an EBP frame
CORJIT_FLAG_ALIGN_LOOPS = 32, // add NOPs before loops to align them at 16 byte boundaries
CORJIT_FLAG_PUBLISH_SECRET_PARAM = 33, // JIT must place stub secret param into local 0. (used by IL stubs)
CORJIT_FLAG_GCPOLL_INLINE = 34, // JIT must inline calls to GCPoll when possible
CORJIT_FLAG_UNUSED11 = 34,
CORJIT_FLAG_SAMPLING_JIT_BACKGROUND = 35, // JIT is being invoked as a result of stack sampling for hot methods in the background
CORJIT_FLAG_USE_PINVOKE_HELPERS = 36, // The JIT should use the PINVOKE_{BEGIN,END} helpers instead of emitting inline transitions
CORJIT_FLAG_REVERSE_PINVOKE = 37, // The JIT should insert REVERSE_PINVOKE_{ENTER,EXIT} helpers into method prolog/epilog
// CORJIT_FLAG_UNUSED = 38,
CORJIT_FLAG_UNUSED12 = 38,
CORJIT_FLAG_TIER0 = 39, // This is the initial tier for tiered compilation which should generate code as quickly as possible
CORJIT_FLAG_TIER1 = 40, // This is the final tier (for now) for tiered compilation which should generate high quality code

#if defined(TARGET_ARM)
CORJIT_FLAG_RELATIVE_CODE_RELOCS = 41, // JIT should generate PC-relative address computations instead of EE relocation records
#else // !defined(TARGET_ARM)
CORJIT_FLAG_UNUSED11 = 41,
CORJIT_FLAG_UNUSED13 = 41,
#endif // !defined(TARGET_ARM)

CORJIT_FLAG_NO_INLINING = 42, // JIT should not inline any called method into this method

CORJIT_FLAG_UNUSED12 = 43,
CORJIT_FLAG_UNUSED13 = 44,
CORJIT_FLAG_UNUSED14 = 45,
CORJIT_FLAG_UNUSED15 = 46,
CORJIT_FLAG_UNUSED16 = 47,
CORJIT_FLAG_UNUSED17 = 48,
CORJIT_FLAG_UNUSED18 = 49,
CORJIT_FLAG_UNUSED19 = 50,
CORJIT_FLAG_UNUSED20 = 51,
CORJIT_FLAG_UNUSED21 = 52,
CORJIT_FLAG_UNUSED22 = 53,
CORJIT_FLAG_UNUSED23 = 54,
CORJIT_FLAG_UNUSED24 = 55,
CORJIT_FLAG_UNUSED25 = 56,
CORJIT_FLAG_UNUSED26 = 57,
CORJIT_FLAG_UNUSED27 = 58,
CORJIT_FLAG_UNUSED28 = 59,
CORJIT_FLAG_UNUSED29 = 60,
CORJIT_FLAG_UNUSED30 = 61,
CORJIT_FLAG_UNUSED31 = 62,
CORJIT_FLAG_UNUSED32 = 63
CORJIT_FLAG_UNUSED14 = 43,
CORJIT_FLAG_UNUSED15 = 44,
CORJIT_FLAG_UNUSED16 = 45,
CORJIT_FLAG_UNUSED17 = 46,
CORJIT_FLAG_UNUSED18 = 47,
CORJIT_FLAG_UNUSED19 = 48,
CORJIT_FLAG_UNUSED20 = 49,
CORJIT_FLAG_UNUSED21 = 50,
CORJIT_FLAG_UNUSED22 = 51,
CORJIT_FLAG_UNUSED23 = 52,
CORJIT_FLAG_UNUSED24 = 53,
CORJIT_FLAG_UNUSED25 = 54,
CORJIT_FLAG_UNUSED26 = 55,
CORJIT_FLAG_UNUSED27 = 56,
CORJIT_FLAG_UNUSED28 = 57,
CORJIT_FLAG_UNUSED29 = 58,
CORJIT_FLAG_UNUSED30 = 59,
CORJIT_FLAG_UNUSED31 = 60,
CORJIT_FLAG_UNUSED32 = 61,
CORJIT_FLAG_UNUSED33 = 62,
CORJIT_FLAG_UNUSED34 = 63
};

CORJIT_FLAGS()
Expand Down
3 changes: 0 additions & 3 deletions src/coreclr/src/inc/switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@
#define ALLOW_SXS_JIT
#define ALLOW_SXS_JIT_NGEN

//master switch for gc suspension not based on hijacking
#define FEATURE_ENABLE_GCPOLL

#if !defined(TARGET_UNIX)
// PLATFORM_SUPPORTS_THREADSUSPEND is defined for platforms where it is safe to call
// SuspendThread. This API is dangerous on non-Windows platforms, as it can lead to
Expand Down
4 changes: 0 additions & 4 deletions src/coreclr/src/jit/block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,6 @@ void BasicBlock::dspFlags()
{
printf("try ");
}
if (bbFlags & BBF_NEEDS_GCPOLL)
{
printf("poll ");
}
if (bbFlags & BBF_RUN_RARELY)
{
printf("rare ");
Expand Down
5 changes: 2 additions & 3 deletions src/coreclr/src/jit/block.h
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,6 @@ struct BasicBlock : private LIR::Range
#define BBF_TRY_BEG 0x00000100 // BB starts a 'try' block
#define BBF_FUNCLET_BEG 0x00000200 // BB is the beginning of a funclet
#define BBF_HAS_NULLCHECK 0x00000400 // BB contains a null check
#define BBF_NEEDS_GCPOLL 0x00000800 // This BB is the source of a back edge and needs a GC Poll

#define BBF_RUN_RARELY 0x00001000 // BB is rarely run (catch clauses, blocks with throws etc)
#define BBF_LOOP_HEAD 0x00002000 // BB is the head of a loop
Expand Down Expand Up @@ -465,8 +464,8 @@ struct BasicBlock : private LIR::Range
// Flags to update when two blocks are compacted

#define BBF_COMPACT_UPD \
(BBF_CHANGED | BBF_GC_SAFE_POINT | BBF_HAS_JMP | BBF_NEEDS_GCPOLL | BBF_HAS_IDX_LEN | BBF_BACKWARD_JUMP | \
BBF_HAS_NEWARRAY | BBF_HAS_NEWOBJ | BBF_HAS_NULLCHECK | BBF_HAS_VTABREF)
(BBF_CHANGED | BBF_GC_SAFE_POINT | BBF_HAS_JMP | BBF_HAS_IDX_LEN | BBF_BACKWARD_JUMP | BBF_HAS_NEWARRAY | \
BBF_HAS_NEWOBJ | BBF_HAS_NULLCHECK | BBF_HAS_VTABREF)

// Flags a block should not have had before it is split.

Expand Down
24 changes: 0 additions & 24 deletions src/coreclr/src/jit/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3261,18 +3261,6 @@ void Compiler::compInitOptions(JitFlags* jitFlags)
}
#endif

opts.compGCPollType = GCPOLL_NONE;
if (jitFlags->IsSet(JitFlags::JIT_FLAG_GCPOLL_CALLS))
{
opts.compGCPollType = GCPOLL_CALL;
}
else if (jitFlags->IsSet(JitFlags::JIT_FLAG_GCPOLL_INLINE))
{
// make sure that the EE didn't set both flags.
assert(opts.compGCPollType == GCPOLL_NONE);
opts.compGCPollType = GCPOLL_INLINE;
}

#ifdef PROFILING_SUPPORTED
#ifdef UNIX_AMD64_ABI
if (compIsProfilerHookNeeded())
Expand Down Expand Up @@ -4650,18 +4638,6 @@ void Compiler::compCompile(void** methodCodePtr, ULONG* methodCodeSize, JitFlags
};
DoPhase(this, PHASE_GS_COOKIE, gsPhase);

// If we need to emit GC Poll calls, mark the blocks that need them now.
// This is conservative and can be optimized later.
//
// GC Poll marking assumes block bbnums match lexical block order,
// so make sure this is the case.
//
auto gcPollPhase = [this]() {
fgRenumberBlocks();
fgMarkGCPollBlocks();
};
DoPhase(this, PHASE_MARK_GC_POLL_BLOCKS, gcPollPhase);

// Compute the block and edge weights
//
DoPhase(this, PHASE_COMPUTE_EDGE_WEIGHTS, &Compiler::fgComputeBlockAndEdgeWeights);
Expand Down
6 changes: 0 additions & 6 deletions src/coreclr/src/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -5025,10 +5025,6 @@ class Compiler
// Initialize the per-block variable sets (used for liveness analysis).
void fgInitBlockVarSets();

// true if we've gone through and created GC Poll calls.
bool fgGCPollsCreated;
void fgMarkGCPollBlocks();
void fgCreateGCPolls();
PhaseStatus fgInsertGCPolls();
BasicBlock* fgCreateGCPoll(GCPollType pollType, BasicBlock* block);

Expand Down Expand Up @@ -8888,8 +8884,6 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#else // !ARM_SOFTFP
static const bool compUseSoftFP = false;
#endif

GCPollType compGCPollType;
} opts;

#ifdef ALT_JIT
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/src/jit/compphases.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ CompPhaseNameMacro(PHASE_PROMOTE_STRUCTS, "Morph - Promote Structs",
CompPhaseNameMacro(PHASE_MORPH_GLOBAL, "Morph - Global", "MOR-GLOB", false, -1, false)
CompPhaseNameMacro(PHASE_MORPH_END, "Morph - Finish", "MOR-END", false, -1, true)
CompPhaseNameMacro(PHASE_GS_COOKIE, "GS Cookie", "GS-COOK", false, -1, false)
CompPhaseNameMacro(PHASE_MARK_GC_POLL_BLOCKS, "Mark GC poll blocks", "GC-POLL", false, -1, false)
CompPhaseNameMacro(PHASE_COMPUTE_EDGE_WEIGHTS, "Compute edge weights (1, false)", "EDG-WGT", false, -1, false)
#if defined(FEATURE_EH_FUNCLETS)
CompPhaseNameMacro(PHASE_CREATE_FUNCLETS, "Create EH funclets", "EH-FUNC", false, -1, false)
Expand Down
Loading

0 comments on commit d90e704

Please sign in to comment.