Use https links in user-facing startup and error messages
[ghc.git] / rts / Globals.c
index 01d8a8f..c9980d9 100644 (file)
@@ -7,8 +7,13 @@
  * even when multiple versions of the library are loaded.  e.g. see
  * Data.Typeable and GHC.Conc.
  *
- * If/when we switch to a dynamically-linked GHCi, this can all go
- * away, because there would be just one copy of each library.
+ * How are multiple versions of a library loaded? Examples:
+ *
+ *   base - a statically-linked ghci has its own copy, so might libraries it
+ *          dynamically loads
+ *
+ *   libHSghc - a statically-linked ghc has its own copy and so will Core
+ *              plugins it dynamically loads.
  *
  * ---------------------------------------------------------------------------*/
 
 #include "Rts.h"
 
 #include "Globals.h"
-#include "Stable.h"
+#include "StablePtr.h"
 
 typedef enum {
-    TypeableStore,
-    GHCConcSignalHandlerStore,
-    GHCConcPendingEventsStore,
-    GHCConcPendingDelaysStore,
-    GHCConcIOManagerThreadStore,
-    GHCConcProddingStore,
+    GHCConcSignalSignalHandlerStore,
+    GHCConcWindowsPendingDelaysStore,
+    GHCConcWindowsIOManagerThreadStore,
+    GHCConcWindowsProddingStore,
+    SystemEventThreadEventManagerStore,
+    SystemEventThreadIOManagerThreadStore,
+    SystemTimerThreadEventManagerStore,
+    SystemTimerThreadIOManagerThreadStore,
+    LibHSghcFastStringTable,
+    LibHSghcPersistentLinkerState,
+    LibHSghcInitLinkerDone,
+    LibHSghcGlobalDynFlags,
+    LibHSghcStaticOptions,
+    LibHSghcStaticOptionsReady,
     MaxStoreKey
 } StoreKey;
 
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
 Mutex globalStoreLock;
 #endif
 
@@ -37,11 +50,11 @@ static StgStablePtr store[MaxStoreKey];
 void
 initGlobalStore(void)
 {
-    nat i;
+    uint32_t i;
     for (i=0; i < MaxStoreKey; i++) {
         store[i] = 0;
     }
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
     initMutex(&globalStoreLock);
 #endif
 }
@@ -49,8 +62,8 @@ initGlobalStore(void)
 void
 exitGlobalStore(void)
 {
-    nat i;
-#ifdef THREADED_RTS
+    uint32_t i;
+#if defined(THREADED_RTS)
     closeMutex(&globalStoreLock);
 #endif
     for (i=0; i < MaxStoreKey; i++) {
@@ -65,53 +78,36 @@ static StgStablePtr getOrSetKey(StoreKey key, StgStablePtr ptr)
 {
     StgStablePtr ret = store[key];
     if(ret==0) {
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
         ACQUIRE_LOCK(&globalStoreLock);
         ret = store[key];
         if(ret==0) {
 #endif
             store[key] = ret = ptr;
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
         }
         RELEASE_LOCK(&globalStoreLock);
 #endif
     }
     return ret;
-}    
-
-
-StgStablePtr
-getOrSetTypeableStore(StgStablePtr ptr)
-{
-    return getOrSetKey(TypeableStore,ptr);
-}
-
-StgStablePtr
-getOrSetGHCConcSignalHandlerStore(StgStablePtr ptr)
-{
-    return getOrSetKey(GHCConcSignalHandlerStore,ptr);
-}
-
-StgStablePtr
-getOrSetGHCConcPendingEventsStore(StgStablePtr ptr)
-{
-    return getOrSetKey(GHCConcPendingEventsStore,ptr);
 }
 
-StgStablePtr
-getOrSetGHCConcPendingDelaysStore(StgStablePtr ptr)
-{
-    return getOrSetKey(GHCConcPendingDelaysStore,ptr);
-}
+#define mkStoreAccessor(name) \
+    StgStablePtr \
+    getOrSet##name(StgStablePtr ptr) \
+    { return getOrSetKey(name, ptr); }
 
-StgStablePtr
-getOrSetGHCConcIOManagerThreadStore(StgStablePtr ptr)
-{
-    return getOrSetKey(GHCConcIOManagerThreadStore,ptr);
-}
-
-StgStablePtr
-getOrSetGHCConcProddingStore(StgStablePtr ptr)
-{
-    return getOrSetKey(GHCConcProddingStore,ptr);
-}
+mkStoreAccessor(GHCConcSignalSignalHandlerStore)
+mkStoreAccessor(GHCConcWindowsPendingDelaysStore)
+mkStoreAccessor(GHCConcWindowsIOManagerThreadStore)
+mkStoreAccessor(GHCConcWindowsProddingStore)
+mkStoreAccessor(SystemEventThreadEventManagerStore)
+mkStoreAccessor(SystemEventThreadIOManagerThreadStore)
+mkStoreAccessor(SystemTimerThreadEventManagerStore)
+mkStoreAccessor(SystemTimerThreadIOManagerThreadStore)
+mkStoreAccessor(LibHSghcFastStringTable)
+mkStoreAccessor(LibHSghcPersistentLinkerState)
+mkStoreAccessor(LibHSghcInitLinkerDone)
+mkStoreAccessor(LibHSghcGlobalDynFlags)
+mkStoreAccessor(LibHSghcStaticOptions)
+mkStoreAccessor(LibHSghcStaticOptionsReady)