Skip to content

Commit 3e87041

Browse files
committed
fix
1 parent 1307a67 commit 3e87041

File tree

2 files changed

+39
-44
lines changed

2 files changed

+39
-44
lines changed

src/coreclr/vm/ceemain.cpp

Lines changed: 39 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -837,35 +837,6 @@ void EEStartupHelper()
837837
InitializeDebugger(); // throws on error
838838
#endif // DEBUGGING_SUPPORTED
839839

840-
#ifdef PROFILING_SUPPORTED
841-
// Initialize the profiling services.
842-
hr = ProfilingAPIUtility::InitializeProfiling();
843-
844-
_ASSERTE(SUCCEEDED(hr));
845-
IfFailGo(hr);
846-
#endif // PROFILING_SUPPORTED
847-
848-
InitializeExceptionHandling();
849-
850-
//
851-
// Install our global exception filter
852-
//
853-
if (!InstallUnhandledExceptionFilter())
854-
{
855-
IfFailGo(E_FAIL);
856-
}
857-
858-
// throws on error
859-
SetupThread();
860-
861-
#ifdef DEBUGGING_SUPPORTED
862-
// Notify debugger once the first thread is created to finish initialization.
863-
if (g_pDebugInterface != NULL)
864-
{
865-
g_pDebugInterface->StartupPhase2(GetThread());
866-
}
867-
#endif
868-
869840
// This isn't done as part of InitializeGarbageCollector() above because
870841
// debugger must be initialized before creating EE thread objects
871842
FinalizerThread::FinalizerThreadCreate();
@@ -882,8 +853,6 @@ void EEStartupHelper()
882853
// of the JIT helpers.
883854
InitJITHelpers1();
884855

885-
SyncBlockCache::Attach();
886-
887856
// Set up the sync block
888857
SyncBlockCache::Start();
889858

@@ -898,6 +867,43 @@ void EEStartupHelper()
898867

899868
IfFailGo(hr);
900869

870+
#ifdef PROFILING_SUPPORTED
871+
// Initialize the profiling services.
872+
hr = ProfilingAPIUtility::InitializeProfiling();
873+
874+
_ASSERTE(SUCCEEDED(hr));
875+
IfFailGo(hr);
876+
#endif // PROFILING_SUPPORTED
877+
878+
InitializeExceptionHandling();
879+
880+
//
881+
// Install our global exception filter
882+
//
883+
if (!InstallUnhandledExceptionFilter())
884+
{
885+
IfFailGo(E_FAIL);
886+
}
887+
888+
#ifdef TARGET_WINDOWS
889+
// g_pGCHeap->Initialize() above could take nontrivial time, so by now the finalizer thread
890+
// should have initialized FLS slot for thread cleanup notifications.
891+
// And ensured that COM is initialized (must happen before allocating FLS slot).
892+
// Make sure that this was done.
893+
FinalizerThread::WaitForFinalizerThreadStart();
894+
#endif
895+
896+
// throws on error
897+
SetupThread();
898+
899+
#ifdef DEBUGGING_SUPPORTED
900+
// Notify debugger once the first thread is created to finish initialization.
901+
if (g_pDebugInterface != NULL)
902+
{
903+
g_pDebugInterface->StartupPhase2(GetThread());
904+
}
905+
#endif
906+
901907
#ifdef FEATURE_PERFTRACING
902908
// Finish setting up rest of EventPipe - specifically enable SampleProfiler if it was requested at startup.
903909
// SampleProfiler needs to cooperate with the GC which hasn't fully finished setting up in the first part of the
@@ -957,12 +963,6 @@ void EEStartupHelper()
957963
g_MiniMetaDataBuffMaxSize, MEM_COMMIT, PAGE_READWRITE);
958964
#endif // FEATURE_MINIMETADATA_IN_TRIAGEDUMPS
959965

960-
#ifdef TARGET_WINDOWS
961-
// By now finalizer thread should have initialized FLS slot for thread cleanup notifications.
962-
// And ensured that COM is initialized (must happen before allocating FLS slot).
963-
// Make sure that this was done.
964-
FinalizerThread::WaitForFinalizerThreadStart();
965-
#endif
966966
g_fEEStarted = TRUE;
967967
g_EEStartupStatus = S_OK;
968968
hr = S_OK;
@@ -1764,6 +1764,8 @@ void InitFlsSlot()
17641764
// thread - thread to attach
17651765
static void OsAttachThread(void* thread)
17661766
{
1767+
_ASSERTE(g_flsIndex != FLS_OUT_OF_INDEXES);
1768+
17671769
if (t_flsState == FLS_STATE_INVOKED)
17681770
{
17691771
_ASSERTE_ALL_BUILDS(!"Attempt to execute managed code after the .NET runtime thread state has been destroyed.");

src/coreclr/vm/syncblk.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -591,13 +591,6 @@ void SyncBlockCache::CleanupSyncBlocks()
591591
} EE_END_FINALLY;
592592
}
593593

594-
// create the sync block cache
595-
/* static */
596-
void SyncBlockCache::Attach()
597-
{
598-
LIMITED_METHOD_CONTRACT;
599-
}
600-
601594
// create the sync block cache
602595
/* static */
603596
void SyncBlockCache::Start()

0 commit comments

Comments
 (0)