Cope with libraries in libraries/foo/bar rather than just libraries/foo
[ghc-hetmet.git] / includes / Storage.h
index 12be6d1..238b858 100644 (file)
@@ -114,9 +114,13 @@ extern void freeStorage(void);
 /* -----------------------------------------------------------------------------
    Generic allocation
 
-   StgPtr allocate(nat n)       Allocates a chunk of contiguous store
-                               n words long, returning a pointer to
-                               the first word.  Always succeeds.
+   StgPtr allocateInGen(generation *g, nat n)
+                                Allocates a chunk of contiguous store
+                               n words long in generation g,
+                               returning a pointer to the first word.
+                               Always succeeds.
+                               
+   StgPtr allocate(nat n)       Equaivalent to allocateInGen(g0)
                                
    StgPtr allocateLocal(Capability *cap, nat n)
                                 Allocates memory from the nursery in
@@ -150,6 +154,7 @@ extern void freeStorage(void);
    -------------------------------------------------------------------------- */
 
 extern StgPtr  allocate        ( nat n );
+extern StgPtr  allocateInGen   ( generation *g, nat n );
 extern StgPtr  allocateLocal   ( Capability *cap, nat n );
 extern StgPtr  allocatePinned  ( nat n );
 extern lnat    allocatedBytes  ( void );
@@ -299,11 +304,14 @@ void dirty_MUT_VAR(StgRegTable *reg, StgClosure *p);
    -------------------------------------------------------------------------- */
 
 #define LOOKS_LIKE_INFO_PTR(p) \
-   (p && ((StgInfoTable *)(INFO_PTR_TO_STRUCT(p)))->type != INVALID_OBJECT && \
+   (p && LOOKS_LIKE_INFO_PTR_NOT_NULL(p))
+
+#define LOOKS_LIKE_INFO_PTR_NOT_NULL(p) \
+   (((StgInfoTable *)(INFO_PTR_TO_STRUCT(p)))->type != INVALID_OBJECT && \
     ((StgInfoTable *)(INFO_PTR_TO_STRUCT(p)))->type < N_CLOSURE_TYPES)
 
 #define LOOKS_LIKE_CLOSURE_PTR(p) \
-   (LOOKS_LIKE_INFO_PTR(((StgClosure *)(p))->header.info))
+  (LOOKS_LIKE_INFO_PTR((UNTAG_CLOSURE((StgClosure *)(p)))->header.info))
 
 /* -----------------------------------------------------------------------------
    Macros for calculating how big a closure will be (used during allocation)
@@ -392,6 +400,7 @@ closure_sizeW_ (StgClosure *p, StgInfoTable *info)
     case AP_STACK:
        return ap_stack_sizeW((StgAP_STACK *)p);
     case AP:
+       return ap_sizeW((StgAP *)p);
     case PAP:
        return pap_sizeW((StgPAP *)p);
     case IND:
@@ -457,7 +466,6 @@ INLINE_HEADER StgWord stack_frame_sizeW( StgClosure *frame )
        return sizeofW(StgRetFun) + ((StgRetFun *)frame)->size;
 
     case RET_BIG:
-    case RET_VEC_BIG:
        return 1 + GET_LARGE_BITMAP(&info->i)->size;
 
     case RET_BCO:
@@ -476,7 +484,6 @@ extern void     allocNurseries       ( void );
 extern void     resetNurseries       ( void );
 extern void     resizeNurseries      ( nat blocks );
 extern void     resizeNurseriesFixed ( nat blocks );
-extern void     tidyAllocateLists    ( void );
 extern lnat     countNurseryBlocks   ( void );
 
 /* -----------------------------------------------------------------------------