X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FRtsStartup.c;h=266c04808d863c82c58c435f77a31702bc0b4cdf;hb=159fdb19228cfb04c3fd871ab3f41f8ef7984b58;hp=b0cddbd18fa99343f5308343191b8f92fb78ffab;hpb=243c043271d295c98ac0f69b4bc8fccca3b61d2d;p=ghc-hetmet.git diff --git a/rts/RtsStartup.c b/rts/RtsStartup.c index b0cddbd..266c048 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(); @@ -351,6 +345,11 @@ hs_exit_(rtsBool wait_foreign) OnExitHook(); + // sanity check +#if defined(DEBUG) + checkFPUStack(); +#endif + // Free the full argv storage freeFullProgArgv(); @@ -450,13 +449,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); }