projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix build
[ghc-hetmet.git]
/
includes
/
Storage.h
diff --git
a/includes/Storage.h
b/includes/Storage.h
index
3a6bb2f
..
238b858
100644
(file)
--- a/
includes/Storage.h
+++ b/
includes/Storage.h
@@
-114,10
+114,20
@@
extern void freeStorage(void);
/* -----------------------------------------------------------------------------
Generic allocation
/* -----------------------------------------------------------------------------
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
+ the current Capability. This can be
+ done without taking a global lock,
+ unlike allocate().
+
StgPtr allocatePinned(nat n) Allocates a chunk of contiguous store
n words long, which is at a fixed
address (won't be moved by GC).
StgPtr allocatePinned(nat n) Allocates a chunk of contiguous store
n words long, which is at a fixed
address (won't be moved by GC).
@@
-137,18
+147,17
@@
extern void freeStorage(void);
rtsBool doYouWantToGC(void) Returns True if the storage manager is
ready to perform a GC, False otherwise.
rtsBool doYouWantToGC(void) Returns True if the storage manager is
ready to perform a GC, False otherwise.
- lnat allocated_bytes(void) Returns the number of bytes allocated
+ lnat allocatedBytes(void) Returns the number of bytes allocated
via allocate() since the last GC.
Used in the reporting of statistics.
via allocate() since the last GC.
Used in the reporting of statistics.
- THREADED_RTS: allocate and doYouWantToGC can be used from STG code, they are
- surrounded by a mutex.
-------------------------------------------------------------------------- */
extern StgPtr allocate ( nat n );
-------------------------------------------------------------------------- */
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 StgPtr allocateLocal ( Capability *cap, nat n );
extern StgPtr allocatePinned ( nat n );
-extern lnat allocated_bytes ( void );
+extern lnat allocatedBytes ( void );
extern bdescr * RTS_VAR(small_alloc_list);
extern bdescr * RTS_VAR(large_alloc_list);
extern bdescr * RTS_VAR(small_alloc_list);
extern bdescr * RTS_VAR(large_alloc_list);
@@
-166,6
+175,10
@@
doYouWantToGC( void )
return (alloc_blocks >= alloc_blocks_lim);
}
return (alloc_blocks >= alloc_blocks_lim);
}
+/* memory allocator for executable memory */
+extern void *allocateExec (nat bytes);
+extern void freeExec (void *p);
+
/* -----------------------------------------------------------------------------
Performing Garbage Collection
/* -----------------------------------------------------------------------------
Performing Garbage Collection
@@
-177,7
+190,7
@@
doYouWantToGC( void )
MarkRoot(StgClosure *p) Returns the new location of the root.
-------------------------------------------------------------------------- */
MarkRoot(StgClosure *p) Returns the new location of the root.
-------------------------------------------------------------------------- */
-extern void GarbageCollect(void (*get_roots)(evac_fn),rtsBool force_major_gc);
+extern void GarbageCollect(rtsBool force_major_gc);
/* -----------------------------------------------------------------------------
Generational garbage collection support
/* -----------------------------------------------------------------------------
Generational garbage collection support
@@
-291,11
+304,14
@@
void dirty_MUT_VAR(StgRegTable *reg, StgClosure *p);
-------------------------------------------------------------------------- */
#define LOOKS_LIKE_INFO_PTR(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) \
((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)
/* -----------------------------------------------------------------------------
Macros for calculating how big a closure will be (used during allocation)
@@
-354,7
+370,7
@@
INLINE_HEADER StgWord tso_sizeW ( StgTSO *tso )
INLINE_HEADER StgWord bco_sizeW ( StgBCO *bco )
{ return bco->size; }
INLINE_HEADER StgWord bco_sizeW ( StgBCO *bco )
{ return bco->size; }
-STATIC_INLINE nat
+INLINE_HEADER nat
closure_sizeW_ (StgClosure *p, StgInfoTable *info)
{
switch (info->type) {
closure_sizeW_ (StgClosure *p, StgInfoTable *info)
{
switch (info->type) {
@@
-384,6
+400,7
@@
closure_sizeW_ (StgClosure *p, StgInfoTable *info)
case AP_STACK:
return ap_stack_sizeW((StgAP_STACK *)p);
case AP:
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:
case PAP:
return pap_sizeW((StgPAP *)p);
case IND:
@@
-402,21
+419,25
@@
closure_sizeW_ (StgClosure *p, StgInfoTable *info)
return tso_sizeW((StgTSO *)p);
case BCO:
return bco_sizeW((StgBCO *)p);
return tso_sizeW((StgTSO *)p);
case BCO:
return bco_sizeW((StgBCO *)p);
- case TVAR_WAIT_QUEUE:
- return sizeofW(StgTVarWaitQueue);
+ case TVAR_WATCH_QUEUE:
+ return sizeofW(StgTVarWatchQueue);
case TVAR:
return sizeofW(StgTVar);
case TREC_CHUNK:
return sizeofW(StgTRecChunk);
case TREC_HEADER:
return sizeofW(StgTRecHeader);
case TVAR:
return sizeofW(StgTVar);
case TREC_CHUNK:
return sizeofW(StgTRecChunk);
case TREC_HEADER:
return sizeofW(StgTRecHeader);
+ case ATOMIC_INVARIANT:
+ return sizeofW(StgAtomicInvariant);
+ case INVARIANT_CHECK_QUEUE:
+ return sizeofW(StgInvariantCheckQueue);
default:
return sizeW_fromITBL(info);
}
}
// The definitive way to find the size, in words, of a heap-allocated closure
default:
return sizeW_fromITBL(info);
}
}
// The definitive way to find the size, in words, of a heap-allocated closure
-STATIC_INLINE nat
+INLINE_HEADER nat
closure_sizeW (StgClosure *p)
{
return closure_sizeW_(p, get_itbl(p));
closure_sizeW (StgClosure *p)
{
return closure_sizeW_(p, get_itbl(p));
@@
-445,7
+466,6
@@
INLINE_HEADER StgWord stack_frame_sizeW( StgClosure *frame )
return sizeofW(StgRetFun) + ((StgRetFun *)frame)->size;
case RET_BIG:
return sizeofW(StgRetFun) + ((StgRetFun *)frame)->size;
case RET_BIG:
- case RET_VEC_BIG:
return 1 + GET_LARGE_BITMAP(&info->i)->size;
case RET_BCO:
return 1 + GET_LARGE_BITMAP(&info->i)->size;
case RET_BCO:
@@
-464,13
+484,14
@@
extern void allocNurseries ( void );
extern void resetNurseries ( void );
extern void resizeNurseries ( nat blocks );
extern void resizeNurseriesFixed ( nat blocks );
extern void resetNurseries ( void );
extern void resizeNurseries ( nat blocks );
extern void resizeNurseriesFixed ( nat blocks );
-extern void tidyAllocateLists ( void );
extern lnat countNurseryBlocks ( void );
/* -----------------------------------------------------------------------------
Functions from GC.c
-------------------------------------------------------------------------- */
extern lnat countNurseryBlocks ( void );
/* -----------------------------------------------------------------------------
Functions from GC.c
-------------------------------------------------------------------------- */
+typedef void (*evac_fn)(StgClosure **);
+
extern void threadPaused ( Capability *cap, StgTSO * );
extern StgClosure * isAlive ( StgClosure *p );
extern void markCAFs ( evac_fn evac );
extern void threadPaused ( Capability *cap, StgTSO * );
extern StgClosure * isAlive ( StgClosure *p );
extern void markCAFs ( evac_fn evac );