X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FRtsStartup.c;h=bc169ff0eb4ad6fe79bc03d5744909a1b67153c9;hb=26f4bfc82f2b2359259578e9c54d476fc2de650f;hp=6a01e85a1fbb0062e7b71d2a269a1cfdd33bf93c;hpb=e020e387b3da272ef9750bad5f585119cbaf3871;p=ghc-hetmet.git diff --git a/rts/RtsStartup.c b/rts/RtsStartup.c index 6a01e85..bc169ff 100644 --- a/rts/RtsStartup.c +++ b/rts/RtsStartup.c @@ -69,8 +69,8 @@ void exitLinker( void ); // there is no Linker.h file to include static int hs_init_count = 0; /* ----------------------------------------------------------------------------- - Initialise floating point unit on x86 (currently disabled. why?) - (see comment in ghc/compiler/nativeGen/MachInstrs.lhs). + Initialise floating point unit on x86 (currently disabled; See Note + [x86 Floating point precision] in compiler/nativeGen/X86/Instr.hs) -------------------------------------------------------------------------- */ #define X86_INIT_FPU 0 @@ -119,12 +119,6 @@ hs_init(int *argc, char **argv[]) */ stat_startInit(); -#if defined(DEBUG) - /* Start off by initialising the allocator debugging so we can - * use it anywhere */ - initAllocator(); -#endif - /* Set the RTS flags to default values. */ initRtsFlagsDefaults(); @@ -171,13 +165,22 @@ hs_init(int *argc, char **argv[]) */ getStablePtr((StgPtr)runIO_closure); getStablePtr((StgPtr)runNonIO_closure); + + getStablePtr((StgPtr)runFinalizerBatch_closure); + getStablePtr((StgPtr)stackOverflow_closure); getStablePtr((StgPtr)heapOverflow_closure); - getStablePtr((StgPtr)runFinalizerBatch_closure); getStablePtr((StgPtr)unpackCString_closure); getStablePtr((StgPtr)blockedIndefinitelyOnMVar_closure); getStablePtr((StgPtr)nonTermination_closure); getStablePtr((StgPtr)blockedIndefinitelyOnSTM_closure); + getStablePtr((StgPtr)nestedAtomically_closure); + + getStablePtr((StgPtr)runSparks_closure); + getStablePtr((StgPtr)ensureIOManagerIsRunning_closure); +#ifndef mingw32_HOST_OS + getStablePtr((StgPtr)runHandlers_closure); +#endif /* initialise the shared Typeable store */ initGlobalStore(); @@ -363,7 +366,7 @@ hs_exit_(rtsBool wait_foreign) /* stop the ticker */ stopTimer(); - exitTimer(); + exitTimer(wait_foreign); // set the terminal settings back to what they were #if !defined(mingw32_HOST_OS) @@ -441,13 +444,11 @@ hs_exit_(rtsBool wait_foreign) /* free hash table storage */ exitHashTable(); - // Finally, free all our storage - freeStorage(); - -#if defined(DEBUG) - /* and shut down the allocator debugging */ - shutdownAllocator(); -#endif + // Finally, free all our storage. However, we only free the heap + // memory if we have waited for foreign calls to complete; + // otherwise a foreign call in progress may still be referencing + // heap memory (e.g. by being passed a ByteArray#). + freeStorage(wait_foreign); }