[project @ 2000-04-07 16:25:19 by sewardj]
[ghc-hetmet.git] / ghc / interpreter / storage.h
index 87dacff..4949a40 100644 (file)
  * included in the distribution.
  *
  * $RCSfile: storage.h,v $
- * $Revision: 1.35 $
- * $Date: 2000/03/22 18:14:23 $
+ * $Revision: 1.42 $
+ * $Date: 2000/04/07 16:25:20 $
  * ------------------------------------------------------------------------*/
 
-#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,9 +62,9 @@ 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
- * CHAR_MIN(3,000)     .. CHAR_MAX(3,255)             chars
+ * CHARR_MIN(3,000)    .. CHARR_MAX(3,255)            chars
  *
  * SMALL_INT_MIN(100,000) .. SMALL_INT_MAX(499,999)   smallish ints
  *              (300,000 denotes 0)
@@ -146,7 +147,6 @@ extern  Syntax syntaxOf   ( Text );
  * ------------------------------------------------------------------------*/
 
 #define heapAlloc(s) (Heap)(farCalloc(s,sizeof(Cell)))
-#define heapBuilt()  (heapFst)
 extern  Int          heapSize;
 extern  Heap         heapFst, heapSnd;
 extern  Heap         heapTopFst;
@@ -160,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))
@@ -456,7 +451,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)
 
@@ -499,6 +494,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:
@@ -601,8 +600,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.            */
@@ -635,7 +634,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)
 
@@ -689,11 +689,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)
@@ -706,6 +706,9 @@ extern Tycon addPrimTycon ( Text,Kind,Int,Cell,Cell );
 
 extern Tycon findQualTyconWithoutConsultingExportList ( QualId q );
 
+extern Int numQualifiers   ( Type );
+
+
 /* --------------------------------------------------------------------------
  * Globally defined name values:
  * ------------------------------------------------------------------------*/
@@ -738,6 +741,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* */
@@ -889,11 +893,11 @@ extern Class findQualClassWithoutConsultingExportList ( QualId q );
  * ------------------------------------------------------------------------*/
 
 /* I think this assumes that NUM_CHARS==256. */
-#define CHAR_MIN     3000
-#define CHAR_MAX     3255
-#define isChar(c)    (CHAR_MIN<=(c) && (c)<=CHAR_MAX)
-#define charOf(c)    ((Char)((c)-CHAR_MIN))
-#define mkChar(c)    (CHAR_MIN+(((Cell)(c)) & 0xFF))
+#define CHARR_MIN    3000
+#define CHARR_MAX    3255
+#define isChar(c)    (CHARR_MIN<=(c) && (c)<=CHARR_MAX)
+#define charOf(c)    ((Char)((c)-CHARR_MIN))
+#define mkChar(c)    (CHARR_MIN+(((Cell)(c)) & 0xFF))
 #define MAXCHARVAL   (NUM_CHARS-1)
 
 /* --------------------------------------------------------------------------
@@ -1064,6 +1068,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 );