[project @ 2000-04-26 09:29:37 by simonmar]
[ghc-hetmet.git] / ghc / interpreter / storage.h
index d0013f6..069d730 100644 (file)
  * included in the distribution.
  *
  * $RCSfile: storage.h,v $
- * $Revision: 1.37 $
- * $Date: 2000/03/28 10:20:56 $
+ * $Revision: 1.44 $
+ * $Date: 2000/04/25 17:43:50 $
  * ------------------------------------------------------------------------*/
 
-#define DEBUG_STORAGE
+#define DEBUG_STORAGE               /* a moderate level of sanity checking */
+#define DEBUG_STORAGE_EXTRA         /* max paranoia in sanity checks       */
 
 /* --------------------------------------------------------------------------
  * Typedefs for main data types:
@@ -61,7 +62,7 @@ typedef Cell         ConVarId;
  *
  * TAG_NONPTR_MIN(100) .. TAG_NONPTR_MAX(115)         non pointer tags
  * TAG_PTR_MIN(200)    .. TAG_PTR_MAX(298)            pointer tags
- * TAG_SPEC_MIN(400)   .. TAG_SPEC_MAX(425)           special tags
+ * TAG_SPEC_MIN(400)   .. TAG_SPEC_MAX(431)           special tags
  * OFF_MIN(1,000)      .. OFF_MAX(1,999)              offsets
  * CHARR_MIN(3,000)    .. CHARR_MAX(3,255)            chars
  *
@@ -159,12 +160,7 @@ extern  Int          cellsRecovered;    /* cells recovered by last gc      */
 
 extern  Pair         pair            ( Cell,Cell );
 extern  Void         garbageCollect  ( Void );
-
-extern  Void         overwrite       ( Pair,Pair );
-extern  Cell         markExpr        ( Cell );
-extern  Void         markWithoutMove ( Cell );
-
-#define mark(v)      v=markExpr(v)
+extern  Void         mark            ( Cell );
 
 #define isPair(c)    ((c)<0)
 #define isGenPair(c) ((c)<0 && -heapSize<=(c))
@@ -282,7 +278,7 @@ extern  Ptr             cptrOf          ( Cell );
  * ------------------------------------------------------------------------*/
 
 #define TAG_PTR_MIN 200
-#define TAG_PTR_MAX 298
+#define TAG_PTR_MAX 299
 
 #define LETREC       200          /* LETREC     snd :: ([Decl],Exp)        */
 #define COND         201          /* COND       snd :: (Exp,Exp,Exp)       */
@@ -448,6 +444,7 @@ extern  Ptr             cptrOf          ( Cell );
 #define ZTUP4        297          /* snd :: (Cell,(Cell,(Cell,Cell)))      */
 #define ZTUP5        298       /* snd :: (Cell,(Cell,(Cell,(Cell,Cell))))  */
 
+#define MDOCOMP      299          /* MDOCOMP     snd :: (Exp,[Qual])       */
 
 
 /* --------------------------------------------------------------------------
@@ -455,7 +452,7 @@ extern  Ptr             cptrOf          ( Cell );
  * ------------------------------------------------------------------------*/
 
 #define TAG_SPEC_MIN 400
-#define TAG_SPEC_MAX 428
+#define TAG_SPEC_MAX 431
 
 #define isSpec(c) (TAG_SPEC_MIN<=(c) && (c)<=TAG_SPEC_MAX)
 
@@ -498,6 +495,10 @@ extern  Ptr             cptrOf          ( Cell );
 #define INVAR        427          /* whatIs code for isInventedVar         */
 #define INDVAR       428          /* whatIs code for isInventedDictVar     */
 
+#define FM_SOURCE    429          /* denotes source module (FileMode)      */
+#define FM_OBJECT    430          /* denotes object module                 */
+#define FM_EITHER    431          /* no restriction; either is allowed     */
+
 
 /* --------------------------------------------------------------------------
  * Tuple data/type constructors:
@@ -600,8 +601,8 @@ struct strModule {
    Bool   completed;   /* Fully loaded or just parsed?                     */
    Time   lastStamp;   /* Time of last parse                               */
 
-   Bool   fromSrc;     /* is it from source ?                              */
-   Text   srcExt;      /* if yes, ".lhs", ".hs", etc"                      */
+   Cell   mode;        /* FM_SOURCE or FM_OBJECT                           */
+   Text   srcExt;      /* if mode==FM_SOURCE ".lhs", ".hs", etc            */
    List   uses;        /* :: [CONID] -- names of mods imported by this one */
 
    Text   objName;     /* Name of the primary object code file.            */
@@ -619,7 +620,7 @@ extern Module currentModule;           /* Module currently being processed */
 extern List   moduleGraph;             /* :: [GRP_REC | GRP_NONREC]        */
 extern List   prelModules;             /* :: [CONID]                       */
 extern List   targetModules;           /* :: [CONID]                       */
-
+extern Bool   nukeModule_needs_major_gc; /* see comment in compiler.c      */
 
 extern Bool         isValidModule   ( Module );
 extern Module       newModule       ( Text );
@@ -634,7 +635,8 @@ extern char*        nameFromOPtr    ( void* );
 
 extern void         addSection      ( Module,void*,void*,OSectionKind );
 extern OSectionKind lookupSection   ( void* );
-extern void*    lookupOExtraTabName ( char* sym );
+extern void*    lookupOExtraTabName                ( char* sym );
+extern void*    lookupOTabNameAbsolutelyEverywhere ( char* sym );
 
 #define isPrelude(m) (m==modulePrelude)
 
@@ -688,11 +690,11 @@ struct strTycon {
 extern struct strTycon* tabTycon;
 extern Int              tabTyconSz;
 
-extern Tycon newTycon     ( Text );
-extern Tycon findTycon    ( Text );
-extern Tycon addTycon     ( Tycon );
+extern Tycon newTycon      ( Text );
+extern Tycon findTycon     ( Text );
+extern Tycon addTycon      ( Tycon );
 extern Tycon findQualTycon ( Cell );
-extern Tycon addPrimTycon ( Text,Kind,Int,Cell,Cell );
+extern Tycon addPrimTycon  ( Text,Kind,Int,Cell,Cell );
 
 #define isSynonym(h)    (isTycon(h) && tycon(h).what==SYNONYM)
 #define isQualType(t)  (isPair(t) && fst(t)==QUAL)
@@ -705,6 +707,9 @@ extern Tycon addPrimTycon ( Text,Kind,Int,Cell,Cell );
 
 extern Tycon findQualTyconWithoutConsultingExportList ( QualId q );
 
+extern Int numQualifiers   ( Type );
+
+
 /* --------------------------------------------------------------------------
  * Globally defined name values:
  * ------------------------------------------------------------------------*/
@@ -737,6 +742,7 @@ struct strName {
     Int    number;
     Cell   type;
     Cell   defn;
+    Bool   hasStrict;          /* does constructor have strict components? */
     Cell   stgVar;                                      /* really StgVar   */
     Text   callconv;                          /* for foreign import/export */
     void*  primop;                                      /* really StgPrim* */
@@ -1063,6 +1069,7 @@ extern  StackPtr sp;
 #define pushed(n)    stack(sp-(n))
 #define topfun(f)    top()=ap((f),top())
 #define toparg(x)    top()=ap(top(),(x))
+#define getsp()      sp
 
 extern  Void hugsStackOverflow ( Void );