summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2009-11-06 14:05:27 +0000
committerSimon Marlow <marlowsd@gmail.com>2009-11-06 14:05:27 +0000
commitc3685050fd288d928c4e26fb2e43fc33e304391c (patch)
treecea68c62071287793c4b76000f779f5b97b58d51
parent3035c581282adb24ae1f63c5bc970cfa5c2292ce (diff)
downloadhaskell-c3685050fd288d928c4e26fb2e43fc33e304391c.tar.gz
Rollback #1185 fix
As far as I can tell, the hack I was using in rts/Linker.c won't work on OS X. Back to the drawing board. rolling back: Tue Nov 3 16:05:47 GMT 2009 Simon Marlow <marlowsd@gmail.com> * Fix #1185 (RTS part, also needs corresponding change to libraries/base) GHC.Conc.ensureIOManagerIsRunning now creates an IO manager thread if one does not exist or has died/exited. Unfortunately this exposed a problem caused by the fact that we have two base packages, and hence two IO managers, in GHCi: see NOTE [io-manager-ghci] in rts/Linker.c. The workaround can go away if/when we switch to a dynamically linked GHCi. M ./rts/Linker.c -6 +47 M ./rts/Schedule.c +4 M ./rts/package.conf.in +16 M ./rts/posix/Signals.c -1 +7 M ./rts/posix/Signals.h +2 Wed Nov 4 10:11:03 GMT 2009 Simon Marlow <marlowsd@gmail.com> * hopefully fix validate breakage on OS X and Windows M ./rts/Linker.c -1 +1 Wed Nov 4 16:27:40 GMT 2009 Simon Marlow <marlowsd@gmail.com> * fix build failure on Windows M ./rts/Linker.c -1 +1
-rw-r--r--rts/Linker.c53
-rw-r--r--rts/Schedule.c4
-rw-r--r--rts/package.conf.in16
-rw-r--r--rts/posix/Signals.c8
-rw-r--r--rts/posix/Signals.h2
5 files changed, 7 insertions, 76 deletions
diff --git a/rts/Linker.c b/rts/Linker.c
index a7ceb66c4c..a2b69f93dd 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -957,37 +957,6 @@ typedef struct _RtsSymbolVal {
#define RTS_LIBGCC_SYMBOLS
#endif
-/* NOTE [io-manager-ghci]
-
- When GHCi loads the base package, it gets another copy of the CAFs
- in GHC.Conc that record the IO manager's ThreadId, and the blocking
- queues, so we get another IO manager. This is bad enough, but what
- is worse is that GHCi by default reverts all CAFs on every :load,
- so we'll get *another* IO manager thread (and an associated pipe)
- every time the user does :load. Miraculously, this actually
- manages to just about work in GHC 6.10 and earlier, but broke when
- I tried to fix #1185 (restarting the IO manager after a fork()).
-
- To work around it and ensure that we only have a single IO manager,
- we map the CAFs in the dynamically-loaded GHC.Conc to the
- statically-linked GHC.Conc. This is an ugly hack, but it's the
- least ugly hack that I could think of (SDM 3/11/2009)
-*/
-
-#define RTS_GHC_CONC_SYMBOLS \
- SymI_NeedsProto(base_GHCziConc_pendingDelays_closure) \
- SymI_NeedsProto(base_GHCziConc_ioManagerThread_closure)
-
-#ifdef mingw32_HOST_OS
-#define RTS_GHC_CONC_OS_SYMBOLS /* empty */
-#else
-#define RTS_GHC_CONC_OS_SYMBOLS \
- SymI_NeedsProto(base_GHCziConc_pendingEvents_closure) \
- SymI_NeedsProto(base_GHCziConc_prodding_closure) \
- SymI_NeedsProto(base_GHCziConc_sync_closure) \
- SymI_NeedsProto(base_GHCziConc_stick_closure)
-#endif
-
#if defined(darwin_HOST_OS) && defined(powerpc_HOST_ARCH)
// Symbols that don't have a leading underscore
// on Mac OS X. They have to receive special treatment,
@@ -1016,8 +985,6 @@ RTS_CYGWIN_ONLY_SYMBOLS
RTS_DARWIN_ONLY_SYMBOLS
RTS_LIBGCC_SYMBOLS
RTS_LIBFFI_SYMBOLS
-RTS_GHC_CONC_SYMBOLS
-RTS_GHC_CONC_OS_SYMBOLS
#undef SymI_NeedsProto
#undef SymI_HasProto
#undef SymI_HasProto_redirect
@@ -1053,8 +1020,6 @@ static RtsSymbolVal rtsSyms[] = {
RTS_DARWIN_ONLY_SYMBOLS
RTS_LIBGCC_SYMBOLS
RTS_LIBFFI_SYMBOLS
- RTS_GHC_CONC_SYMBOLS
- RTS_GHC_CONC_OS_SYMBOLS
#if defined(darwin_HOST_OS) && defined(i386_HOST_ARCH)
// dyld stub code contains references to this,
// but it should never be called because we treat
@@ -1076,18 +1041,12 @@ static void ghciInsertStrHashTable ( char* obj_name,
void *data
)
{
-#define GHC_CONC MAYBE_LEADING_UNDERSCORE_STR("base_GHCziConc")
-
- if (lookupHashTable(table, (StgWord)key) == NULL)
- {
+ if (lookupHashTable(table, (StgWord)key) == NULL)
+ {
insertStrHashTable(table, (StgWord)key, data);
return;
- }
- if (strncmp(key, GHC_CONC, strlen(GHC_CONC)) == 0) {
- /* see NOTE [io-manager-ghci] */
- return;
- }
- debugBelch(
+ }
+ debugBelch(
"\n\n"
"GHCi runtime linker: fatal error: I found a duplicate definition for symbol\n"
" %s\n"
@@ -1102,8 +1061,8 @@ static void ghciInsertStrHashTable ( char* obj_name,
"\n",
(char*)key,
obj_name
- );
- exit(1);
+ );
+ exit(1);
}
/* -----------------------------------------------------------------------------
* initialize the object linker
diff --git a/rts/Schedule.c b/rts/Schedule.c
index 998d8465a7..539e006fa6 100644
--- a/rts/Schedule.c
+++ b/rts/Schedule.c
@@ -1683,10 +1683,6 @@ forkProcess(HsStablePtr *entry
initTimer();
startTimer();
-#if defined(THREADED_RTS)
- cap = ioManagerStartCap(cap);
-#endif
-
cap = rts_evalStableIO(cap, entry, NULL); // run the action
rts_checkSchedStatus("forkProcess",cap);
diff --git a/rts/package.conf.in b/rts/package.conf.in
index 131f1e389b..087a7e9d66 100644
--- a/rts/package.conf.in
+++ b/rts/package.conf.in
@@ -99,14 +99,6 @@ ld-options:
, "-u", "_base_GHCziConc_ensureIOManagerIsRunning_closure"
, "-u", "_base_GHCziConc_runSparks_closure"
, "-u", "_base_GHCziConc_runHandlers_closure"
- , "-u", "_base_GHCziConc_pendingDelays_closure"
- , "-u", "_base_GHCziConc_pendingEvents_closure"
- , "-u", "_base_GHCziConc_ioManagerThread_closure"
-#if !defined(mingw32_HOST_OS)
- , "-u", "_base_GHCziConc_prodding_closure"
- , "-u", "_base_GHCziConc_sync_closure"
- , "-u", "_base_GHCziConc_stick_closure"
-#endif
#else
"-u", "ghczmprim_GHCziTypes_Izh_static_info"
, "-u", "ghczmprim_GHCziTypes_Czh_static_info"
@@ -145,14 +137,6 @@ ld-options:
, "-u", "base_GHCziConc_ensureIOManagerIsRunning_closure"
, "-u", "base_GHCziConc_runSparks_closure"
, "-u", "base_GHCziConc_runHandlers_closure"
- , "-u", "base_GHCziConc_pendingDelays_closure"
- , "-u", "base_GHCziConc_pendingEvents_closure"
- , "-u", "base_GHCziConc_ioManagerThread_closure"
-#if !defined(mingw32_HOST_OS)
- , "-u", "base_GHCziConc_prodding_closure"
- , "-u", "base_GHCziConc_sync_closure"
- , "-u", "base_GHCziConc_stick_closure"
-#endif
#endif
/* Pick up static libraries in preference over dynamic if in earlier search
diff --git a/rts/posix/Signals.c b/rts/posix/Signals.c
index aa7877452b..660065734b 100644
--- a/rts/posix/Signals.c
+++ b/rts/posix/Signals.c
@@ -124,12 +124,6 @@ ioManagerDie (void)
}
}
-Capability *
-ioManagerStartCap (Capability *cap)
-{
- return rts_evalIO(cap,&base_GHCziConc_ensureIOManagerIsRunning_closure,NULL);
-}
-
void
ioManagerStart (void)
{
@@ -137,7 +131,7 @@ ioManagerStart (void)
Capability *cap;
if (io_manager_pipe < 0) {
cap = rts_lock();
- cap = ioManagerStartCap(cap);
+ cap = rts_evalIO(cap,&base_GHCziConc_ensureIOManagerIsRunning_closure,NULL);
rts_unlock(cap);
}
}
diff --git a/rts/posix/Signals.h b/rts/posix/Signals.h
index b80f711b17..4d0a5a5fc7 100644
--- a/rts/posix/Signals.h
+++ b/rts/posix/Signals.h
@@ -24,8 +24,6 @@ extern siginfo_t *next_pending_handler;
void startSignalHandlers(Capability *cap);
#endif
-Capability *ioManagerStartCap (Capability *cap);
-
extern StgInt *signal_handlers;
END_RTS_PRIVATE