Skip to content

Commit a5b7321

Browse files
committed
fix
1 parent 80c9f51 commit a5b7321

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
@@ -844,35 +844,6 @@ void EEStartupHelper()
844844
InitializeDebugger(); // throws on error
845845
#endif // DEBUGGING_SUPPORTED
846846

847-
#ifdef PROFILING_SUPPORTED
848-
// Initialize the profiling services.
849-
hr = ProfilingAPIUtility::InitializeProfiling();
850-
851-
_ASSERTE(SUCCEEDED(hr));
852-
IfFailGo(hr);
853-
#endif // PROFILING_SUPPORTED
854-
855-
InitializeExceptionHandling();
856-
857-
//
858-
// Install our global exception filter
859-
//
860-
if (!InstallUnhandledExceptionFilter())
861-
{
862-
IfFailGo(E_FAIL);
863-
}
864-
865-
// throws on error
866-
SetupThread();
867-
868-
#ifdef DEBUGGING_SUPPORTED
869-
// Notify debugger once the first thread is created to finish initialization.
870-
if (g_pDebugInterface != NULL)
871-
{
872-
g_pDebugInterface->StartupPhase2(GetThread());
873-
}
874-
#endif
875-
876847
// This isn't done as part of InitializeGarbageCollector() above because
877848
// debugger must be initialized before creating EE thread objects
878849
FinalizerThread::FinalizerThreadCreate();
@@ -889,8 +860,6 @@ void EEStartupHelper()
889860
// of the JIT helpers.
890861
InitJITHelpers1();
891862

892-
SyncBlockCache::Attach();
893-
894863
// Set up the sync block
895864
SyncBlockCache::Start();
896865

@@ -905,6 +874,43 @@ void EEStartupHelper()
905874

906875
IfFailGo(hr);
907876

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

967-
#ifdef TARGET_WINDOWS
968-
// By now finalizer thread should have initialized FLS slot for thread cleanup notifications.
969-
// And ensured that COM is initialized (must happen before allocating FLS slot).
970-
// Make sure that this was done.
971-
FinalizerThread::WaitForFinalizerThreadStart();
972-
#endif
973973
g_fEEStarted = TRUE;
974974
g_EEStartupStatus = S_OK;
975975
hr = S_OK;
@@ -1771,6 +1771,8 @@ void InitFlsSlot()
17711771
// thread - thread to attach
17721772
static void OsAttachThread(void* thread)
17731773
{
1774+
_ASSERTE(g_flsIndex != FLS_OUT_OF_INDEXES);
1775+
17741776
if (t_flsState == FLS_STATE_INVOKED)
17751777
{
17761778
_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)