Skip to content
New issue

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

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

Already on GitHub? # to your account

[NativeAOT] Make conservative stack reporting configurable. #75803

Merged
merged 4 commits into from
Sep 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/coreclr/nativeaot/Bootstrap/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ static char& __unbox_z = __stop___unbox;
#endif // _MSC_VER

extern "C" bool RhInitialize();
extern "C" void RhpEnableConservativeStackReporting();
extern "C" void RhpShutdown();
extern "C" void RhSetRuntimeInitializationCallback(int (*fPtr)());

Expand Down Expand Up @@ -152,8 +151,6 @@ static int InitializeRuntime()
if (!RhInitialize())
return -1;

// RhpEnableConservativeStackReporting();

void * osModule = PalGetModuleHandleFromPointer((void*)&NATIVEAOT_ENTRYPOINT);

// TODO: pass struct with parameters instead of the large signature of RhRegisterOSModule
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/nativeaot/Runtime/RhConfigValues.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ DEBUG_CONFIG_VALUE_WITH_DEFAULT(BreakOnAssert, 1)
RETAIL_CONFIG_VALUE(StressLogLevel)
RETAIL_CONFIG_VALUE(TotalStressLogSize)
RETAIL_CONFIG_VALUE(gcServer)
RETAIL_CONFIG_VALUE(gcConservative) // Enables conservative stack reporting
DEBUG_CONFIG_VALUE(GcStressThrottleMode) // gcstm_TriggerAlways / gcstm_TriggerOnFirstHit / gcstm_TriggerRandom
DEBUG_CONFIG_VALUE(GcStressFreqCallsite) // Number of times to force GC out of GcStressFreqDenom (for GCSTM_RANDOM)
DEBUG_CONFIG_VALUE(GcStressFreqLoop) // Number of times to force GC out of GcStressFreqDenom (for GCSTM_RANDOM)
Expand Down
5 changes: 5 additions & 0 deletions src/coreclr/nativeaot/Runtime/gcrhenv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@ bool RedhawkGCInterface::InitializeSubsystems()
g_heap_type = GC_HEAP_WKS;
#endif

if (g_pRhConfig->GetgcConservative())
{
GetRuntimeInstance()->EnableConservativeStackReporting();
}

HRESULT hr = GCHeapUtilities::InitializeDefaultGC();
if (FAILED(hr))
return false;
Expand Down
5 changes: 0 additions & 5 deletions src/coreclr/nativeaot/Runtime/startup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -466,11 +466,6 @@ extern "C" bool RhInitialize()
return true;
}

COOP_PINVOKE_HELPER(void, RhpEnableConservativeStackReporting, ())
{
GetRuntimeInstance()->EnableConservativeStackReporting();
}

//
// Currently called only from a managed executable once Main returns, this routine does whatever is needed to
// cleanup managed state before exiting. There's not a lot here at the moment since we're always about to let
Expand Down