diff options
author | sewardj <unknown> | 2000-04-11 16:36:54 +0000 |
---|---|---|
committer | sewardj <unknown> | 2000-04-11 16:36:54 +0000 |
commit | d50874325473c23699a7d77222b1902f28c942af (patch) | |
tree | 49c8e0b72556cf586f548e6035380763226f551a /ghc/interpreter/storage.c | |
parent | 7007351bb709611fbb259aae2eb286d107355486 (diff) | |
download | haskell-d50874325473c23699a7d77222b1902f28c942af.tar.gz |
[project @ 2000-04-11 16:36:53 by sewardj]
Ensure that when Hugs decides to unload a module (nukeModule()), there are
no closures anywhere in the system which refers to infotables defined
in that module. That means reverting all CAFs and doing a major GC
prior to deleting the module. A flag is used to avoid redundant GCs.
Diffstat (limited to 'ghc/interpreter/storage.c')
-rw-r--r-- | ghc/interpreter/storage.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/ghc/interpreter/storage.c b/ghc/interpreter/storage.c index 401168f0c7..95627f4912 100644 --- a/ghc/interpreter/storage.c +++ b/ghc/interpreter/storage.c @@ -9,8 +9,8 @@ * included in the distribution. * * $RCSfile: storage.c,v $ - * $Revision: 1.68 $ - * $Date: 2000/04/07 16:25:19 $ + * $Revision: 1.69 $ + * $Date: 2000/04/11 16:36:53 $ * ------------------------------------------------------------------------*/ #include "hugsbasictypes.h" @@ -19,6 +19,7 @@ #include "errors.h" #include "object.h" #include <setjmp.h> +#include "Stg.h" /*#define DEBUG_SHOWUSE*/ @@ -1628,13 +1629,25 @@ Module newModule ( Text t ) /* add new module to module table */ return mod; } + +Bool nukeModule_needs_major_gc = TRUE; + void nukeModule ( Module m ) { ObjectCode* oc; ObjectCode* oc2; Int i; -assert(isModule(m)); -/*fprintf(stderr, "NUKEMODULE `%s'\n", textToStr(module(m).text)); */ + + if (!isModule(m)) internal("nukeModule"); + + /* see comment in compiler.c about this, + and interaction with info tables */ + if (nukeModule_needs_major_gc) { + /* fprintf ( stderr, "doing major GC in nukeModule\n"); */ + performMajorGC(); + nukeModule_needs_major_gc = FALSE; + } + oc = module(m).object; while (oc) { oc2 = oc->next; |