bool InitDLL(HANDLE hPalInstance) { CheckForPalFallback(); #ifdef FEATURE_CACHED_INTERFACE_DISPATCH // // Initialize interface dispatch. // if (!InitializeInterfaceDispatch()) return false; #endif // // Initialize support for registering GC and HandleTable callouts. // if (!RestrictedCallouts::Initialize()) return false; #ifndef APP_LOCAL_RUNTIME PalAddVectoredExceptionHandler(1, RhpVectoredExceptionHandler); #endif // // init per-instance state // HANDLE hRuntimeInstance = RtuCreateRuntimeInstance(hPalInstance); if (NULL == hRuntimeInstance) return false; STARTUP_TIMELINE_EVENT(NONGC_INIT_COMPLETE); // @TODO: currently we're always forcing a workstation GC. // @TODO: GC per-instance vs per-DLL state separation if (!RedhawkGCInterface::InitializeSubsystems(RedhawkGCInterface::GCType_Workstation)) return false; STARTUP_TIMELINE_EVENT(GC_INIT_COMPLETE); #ifdef STRESS_LOG UInt32 dwTotalStressLogSize = g_pRhConfig->GetTotalStressLogSize(); UInt32 dwStressLogLevel = g_pRhConfig->GetStressLogLevel(); unsigned facility = (unsigned)LF_ALL; #ifdef _DEBUG if (dwTotalStressLogSize == 0) dwTotalStressLogSize = 1024 * STRESSLOG_CHUNK_SIZE; if (dwStressLogLevel == 0) dwStressLogLevel = LL_INFO1000; #endif unsigned dwPerThreadChunks = (dwTotalStressLogSize / 24) / STRESSLOG_CHUNK_SIZE; if (dwTotalStressLogSize != 0) { StressLog::Initialize(facility, dwStressLogLevel, dwPerThreadChunks * STRESSLOG_CHUNK_SIZE, (unsigned)dwTotalStressLogSize, hPalInstance); } #endif // STRESS_LOG DetectCPUFeatures(); return true; }
static bool InitDLL(HANDLE hPalInstance) { CheckForPalFallback(); #ifdef FEATURE_CACHED_INTERFACE_DISPATCH // // Initialize interface dispatch. // if (!InitializeInterfaceDispatch()) return false; #endif // // Initialize support for registering GC and HandleTable callouts. // if (!RestrictedCallouts::Initialize()) return false; #if !defined(APP_LOCAL_RUNTIME) && !defined(USE_PORTABLE_HELPERS) #ifndef PLATFORM_UNIX PalAddVectoredExceptionHandler(1, RhpVectoredExceptionHandler); #else PalSetHardwareExceptionHandler(RhpHardwareExceptionHandler); #endif #endif // !APP_LOCAL_RUNTIME && !USE_PORTABLE_HELPERS // // init per-instance state // if (!RuntimeInstance::Initialize(hPalInstance)) return false; STARTUP_TIMELINE_EVENT(NONGC_INIT_COMPLETE); RedhawkGCInterface::GCType gcType = g_pRhConfig->GetUseServerGC() ? RedhawkGCInterface::GCType_Server : RedhawkGCInterface::GCType_Workstation; if (!RedhawkGCInterface::InitializeSubsystems(gcType)) return false; STARTUP_TIMELINE_EVENT(GC_INIT_COMPLETE); #ifdef STRESS_LOG UInt32 dwTotalStressLogSize = g_pRhConfig->GetTotalStressLogSize(); UInt32 dwStressLogLevel = g_pRhConfig->GetStressLogLevel(); unsigned facility = (unsigned)LF_ALL; unsigned dwPerThreadChunks = (dwTotalStressLogSize / 24) / STRESSLOG_CHUNK_SIZE; if (dwTotalStressLogSize != 0) { StressLog::Initialize(facility, dwStressLogLevel, dwPerThreadChunks * STRESSLOG_CHUNK_SIZE, (unsigned)dwTotalStressLogSize, hPalInstance); } #endif // STRESS_LOG DetectCPUFeatures(); if (!g_CastCacheLock.InitNoThrow(CrstType::CrstCastCache)) return false; if (!g_ThunkPoolLock.InitNoThrow(CrstType::CrstCastCache)) return false; return true; }