summaryrefslogtreecommitdiff
path: root/rts/sm
diff options
context:
space:
mode:
Diffstat (limited to 'rts/sm')
-rw-r--r--rts/sm/BlockAlloc.c6
-rw-r--r--rts/sm/BlockAlloc.h4
-rw-r--r--rts/sm/Evac.h2
-rw-r--r--rts/sm/GC.c24
-rw-r--r--rts/sm/GCThread.h18
-rw-r--r--rts/sm/GCUtils.c2
-rw-r--r--rts/sm/MBlock.c6
-rw-r--r--rts/sm/OSMem.h4
-rw-r--r--rts/sm/Sanity.c10
-rw-r--r--rts/sm/Scav.c8
-rw-r--r--rts/sm/Storage.c58
-rw-r--r--rts/sm/Storage.h24
12 files changed, 83 insertions, 83 deletions
diff --git a/rts/sm/BlockAlloc.c b/rts/sm/BlockAlloc.c
index 72d5b294c8..113031a20b 100644
--- a/rts/sm/BlockAlloc.c
+++ b/rts/sm/BlockAlloc.c
@@ -142,8 +142,8 @@ static bdescr *free_mblock_list;
// To find the free list in which to place a block, use log_2(size).
// To find a free block of the right size, use log_2_ceil(size).
-lnat n_alloc_blocks; // currently allocated blocks
-lnat hw_alloc_blocks; // high-water allocated blocks
+W_ n_alloc_blocks; // currently allocated blocks
+W_ hw_alloc_blocks; // high-water allocated blocks
/* -----------------------------------------------------------------------------
Initialisation
@@ -810,7 +810,7 @@ nat /* BLOCKS */
countFreeList(void)
{
bdescr *bd;
- lnat total_blocks = 0;
+ W_ total_blocks = 0;
nat ln;
for (ln=0; ln < MAX_FREE_LIST; ln++) {
diff --git a/rts/sm/BlockAlloc.h b/rts/sm/BlockAlloc.h
index a4890e5c24..1df81d83ea 100644
--- a/rts/sm/BlockAlloc.h
+++ b/rts/sm/BlockAlloc.h
@@ -26,8 +26,8 @@ void markBlocks (bdescr *bd);
void reportUnmarkedBlocks (void);
#endif
-extern lnat n_alloc_blocks; // currently allocated blocks
-extern lnat hw_alloc_blocks; // high-water allocated blocks
+extern W_ n_alloc_blocks; // currently allocated blocks
+extern W_ hw_alloc_blocks; // high-water allocated blocks
#include "EndPrivate.h"
diff --git a/rts/sm/Evac.h b/rts/sm/Evac.h
index ad56c644d8..cea2be63ae 100644
--- a/rts/sm/Evac.h
+++ b/rts/sm/Evac.h
@@ -35,7 +35,7 @@
REGPARM1 void evacuate (StgClosure **p);
REGPARM1 void evacuate1 (StgClosure **p);
-extern lnat thunk_selector_depth;
+extern W_ thunk_selector_depth;
#include "EndPrivate.h"
diff --git a/rts/sm/GC.c b/rts/sm/GC.c
index 6098e7955c..52bf199175 100644
--- a/rts/sm/GC.c
+++ b/rts/sm/GC.c
@@ -102,7 +102,7 @@ rtsBool major_gc;
/* Data used for allocation area sizing.
*/
-static lnat g0_pcnt_kept = 30; // percentage of g0 live at last minor GC
+static W_ g0_pcnt_kept = 30; // percentage of g0 live at last minor GC
/* Mut-list stats */
#ifdef DEBUG
@@ -149,7 +149,7 @@ static StgWord dec_running (void);
static void wakeup_gc_threads (nat me);
static void shutdown_gc_threads (nat me);
static void collect_gct_blocks (void);
-static lnat collect_pinned_object_blocks (void);
+static StgWord collect_pinned_object_blocks (void);
#if 0 && defined(DEBUG)
static void gcCAFs (void);
@@ -179,7 +179,7 @@ GarbageCollect (nat collect_gen,
{
bdescr *bd;
generation *gen;
- lnat live_blocks, live_words, allocated, par_max_copied, par_tot_copied;
+ StgWord live_blocks, live_words, allocated, par_max_copied, par_tot_copied;
#if defined(THREADED_RTS)
gc_thread *saved_gct;
#endif
@@ -1275,14 +1275,14 @@ prepare_collected_gen (generation *gen)
// for a compacted generation, we need to allocate the bitmap
if (gen->mark) {
- lnat bitmap_size; // in bytes
+ StgWord bitmap_size; // in bytes
bdescr *bitmap_bdescr;
StgWord *bitmap;
bitmap_size = gen->n_old_blocks * BLOCK_SIZE / (sizeof(W_)*BITS_PER_BYTE);
-
+
if (bitmap_size > 0) {
- bitmap_bdescr = allocGroup((lnat)BLOCK_ROUND_UP(bitmap_size)
+ bitmap_bdescr = allocGroup((StgWord)BLOCK_ROUND_UP(bitmap_size)
/ BLOCK_SIZE);
gen->bitmap = bitmap_bdescr;
bitmap = bitmap_bdescr->start;
@@ -1405,12 +1405,12 @@ collect_gct_blocks (void)
purposes.
-------------------------------------------------------------------------- */
-static lnat
+static StgWord
collect_pinned_object_blocks (void)
{
nat n;
bdescr *bd, *prev;
- lnat allocated = 0;
+ StgWord allocated = 0;
for (n = 0; n < n_capabilities; n++) {
prev = NULL;
@@ -1510,8 +1510,8 @@ resize_generations (void)
nat g;
if (major_gc && RtsFlags.GcFlags.generations > 1) {
- lnat live, size, min_alloc, words;
- const nat max = RtsFlags.GcFlags.maxHeapSize;
+ W_ live, size, min_alloc, words;
+ const nat max = RtsFlags.GcFlags.maxHeapSize;
const nat gens = RtsFlags.GcFlags.generations;
// live in the oldest generations
@@ -1604,7 +1604,7 @@ resize_generations (void)
static void
resize_nursery (void)
{
- const lnat min_nursery = RtsFlags.GcFlags.minAllocAreaSize * n_capabilities;
+ const StgWord min_nursery = RtsFlags.GcFlags.minAllocAreaSize * n_capabilities;
if (RtsFlags.GcFlags.generations == 1)
{ // Two-space collector:
@@ -1664,7 +1664,7 @@ resize_nursery (void)
if (RtsFlags.GcFlags.heapSizeSuggestion)
{
long blocks;
- lnat needed;
+ StgWord needed;
calcNeeded(rtsFalse, &needed); // approx blocks needed at next GC
diff --git a/rts/sm/GCThread.h b/rts/sm/GCThread.h
index 1b811e43fc..7d163cb48a 100644
--- a/rts/sm/GCThread.h
+++ b/rts/sm/GCThread.h
@@ -134,7 +134,7 @@ typedef struct gc_thread_ {
StgClosure* static_objects; // live static objects
StgClosure* scavenged_static_objects; // static objects scavenged so far
- lnat gc_count; // number of GCs this thread has done
+ W_ gc_count; // number of GCs this thread has done
// block that is currently being scanned
bdescr * scan_bd;
@@ -166,7 +166,7 @@ typedef struct gc_thread_ {
// instead of the to-space
// corresponding to the object
- lnat thunk_selector_depth; // used to avoid unbounded recursion in
+ W_ thunk_selector_depth; // used to avoid unbounded recursion in
// evacuate() for THUNK_SELECTOR
#ifdef USE_PAPI
@@ -176,17 +176,17 @@ typedef struct gc_thread_ {
// -------------------
// stats
- lnat allocated; // result of clearNursery()
- lnat copied;
- lnat scanned;
- lnat any_work;
- lnat no_work;
- lnat scav_find_work;
+ W_ allocated; // result of clearNursery()
+ W_ copied;
+ W_ scanned;
+ W_ any_work;
+ W_ no_work;
+ W_ scav_find_work;
Time gc_start_cpu; // process CPU time
Time gc_start_elapsed; // process elapsed time
Time gc_start_thread_cpu; // thread CPU time
- lnat gc_start_faults;
+ W_ gc_start_faults;
// -------------------
// workspaces
diff --git a/rts/sm/GCUtils.c b/rts/sm/GCUtils.c
index 677998ff14..996b5f6280 100644
--- a/rts/sm/GCUtils.c
+++ b/rts/sm/GCUtils.c
@@ -263,7 +263,7 @@ alloc_todo_block (gen_workspace *ws, nat size)
// bd = hd;
if (size > BLOCK_SIZE_W) {
- bd = allocGroup_sync((lnat)BLOCK_ROUND_UP(size*sizeof(W_))
+ bd = allocGroup_sync((W_)BLOCK_ROUND_UP(size*sizeof(W_))
/ BLOCK_SIZE);
} else {
bd = allocBlock_sync();
diff --git a/rts/sm/MBlock.c b/rts/sm/MBlock.c
index 1801086c2a..6bc4049959 100644
--- a/rts/sm/MBlock.c
+++ b/rts/sm/MBlock.c
@@ -18,9 +18,9 @@
#include <string.h>
-lnat peak_mblocks_allocated = 0;
-lnat mblocks_allocated = 0;
-lnat mpc_misses = 0;
+W_ peak_mblocks_allocated = 0;
+W_ mblocks_allocated = 0;
+W_ mpc_misses = 0;
/* -----------------------------------------------------------------------------
The MBlock Map: provides our implementation of HEAP_ALLOCED()
diff --git a/rts/sm/OSMem.h b/rts/sm/OSMem.h
index b3003edd1e..a0d615b424 100644
--- a/rts/sm/OSMem.h
+++ b/rts/sm/OSMem.h
@@ -16,8 +16,8 @@ void *osGetMBlocks(nat n);
void osFreeMBlocks(char *addr, nat n);
void osReleaseFreeMemory(void);
void osFreeAllMBlocks(void);
-lnat getPageSize (void);
-void setExecutable (void *p, lnat len, rtsBool exec);
+W_ getPageSize (void);
+void setExecutable (void *p, W_ len, rtsBool exec);
#include "EndPrivate.h"
diff --git a/rts/sm/Sanity.c b/rts/sm/Sanity.c
index ec8921cb43..ffd5d30551 100644
--- a/rts/sm/Sanity.c
+++ b/rts/sm/Sanity.c
@@ -830,7 +830,7 @@ checkRunQueue(Capability *cap)
void findSlop(bdescr *bd);
void findSlop(bdescr *bd)
{
- lnat slop;
+ W_ slop;
for (; bd != NULL; bd = bd->link) {
slop = (bd->blocks * BLOCK_SIZE_W) - (bd->free - bd->start);
@@ -841,7 +841,7 @@ void findSlop(bdescr *bd)
}
}
-static lnat
+static W_
genBlocks (generation *gen)
{
ASSERT(countBlocks(gen->blocks) == gen->n_blocks);
@@ -854,10 +854,10 @@ void
memInventory (rtsBool show)
{
nat g, i;
- lnat gen_blocks[RtsFlags.GcFlags.generations];
- lnat nursery_blocks, retainer_blocks,
+ W_ gen_blocks[RtsFlags.GcFlags.generations];
+ W_ nursery_blocks, retainer_blocks,
arena_blocks, exec_blocks;
- lnat live_blocks = 0, free_blocks = 0;
+ W_ live_blocks = 0, free_blocks = 0;
rtsBool leak;
// count the blocks we current have
diff --git a/rts/sm/Scav.c b/rts/sm/Scav.c
index e7e02e6c99..cbdf01b720 100644
--- a/rts/sm/Scav.c
+++ b/rts/sm/Scav.c
@@ -98,7 +98,7 @@ scavengeTSO (StgTSO *tso)
static StgPtr scavenge_mut_arr_ptrs (StgMutArrPtrs *a)
{
- lnat m;
+ W_ m;
rtsBool any_failed;
StgPtr p, q;
@@ -140,7 +140,7 @@ static StgPtr scavenge_mut_arr_ptrs (StgMutArrPtrs *a)
// scavenge only the marked areas of a MUT_ARR_PTRS
static StgPtr scavenge_mut_arr_ptrs_marked (StgMutArrPtrs *a)
{
- lnat m;
+ W_ m;
StgPtr p, q;
rtsBool any_failed;
@@ -322,8 +322,8 @@ scavenge_srt (StgClosure **srt, nat srt_bitmap)
//
// If the SRT entry hasn't got bit 0 set, the SRT entry points to a
// closure that's fixed at link-time, and no extra magic is required.
- if ( (lnat)(*srt) & 0x1 ) {
- evacuate( (StgClosure**) ((lnat) (*srt) & ~0x1));
+ if ( (W_)(*srt) & 0x1 ) {
+ evacuate( (StgClosure**) ((W_) (*srt) & ~0x1));
} else {
evacuate(p);
}
diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c
index 1345705046..5bdaeee443 100644
--- a/rts/sm/Storage.c
+++ b/rts/sm/Storage.c
@@ -235,7 +235,7 @@ void storageAddCapabilities (nat from, nat to)
void
exitStorage (void)
{
- lnat allocated = updateNurseriesStats();
+ W_ allocated = updateNurseriesStats();
stat_exit(allocated);
}
@@ -504,15 +504,15 @@ allocNurseries (nat from, nat to)
assignNurseriesToCapabilities(from, to);
}
-lnat
+W_
clearNursery (Capability *cap)
{
bdescr *bd;
- lnat allocated = 0;
+ W_ allocated = 0;
for (bd = nurseries[cap->no].blocks; bd; bd = bd->link) {
- allocated += (lnat)(bd->free - bd->start);
- cap->total_allocated += (lnat)(bd->free - bd->start);
+ allocated += (W_)(bd->free - bd->start);
+ cap->total_allocated += (W_)(bd->free - bd->start);
bd->free = bd->start;
ASSERT(bd->gen_no == 0);
ASSERT(bd->gen == g0);
@@ -528,11 +528,11 @@ resetNurseries (void)
assignNurseriesToCapabilities(0, n_capabilities);
}
-lnat
+W_
countNurseryBlocks (void)
{
nat i;
- lnat blocks = 0;
+ W_ blocks = 0;
for (i = 0; i < n_capabilities; i++) {
blocks += nurseries[i].n_blocks;
@@ -633,7 +633,7 @@ move_STACK (StgStack *src, StgStack *dest)
-------------------------------------------------------------------------- */
StgPtr
-allocate (Capability *cap, lnat n)
+allocate (Capability *cap, W_ n)
{
bdescr *bd;
StgPtr p;
@@ -642,7 +642,7 @@ allocate (Capability *cap, lnat n)
CCS_ALLOC(cap->r.rCCCS,n);
if (n >= LARGE_OBJECT_THRESHOLD/sizeof(W_)) {
- lnat req_blocks = (lnat)BLOCK_ROUND_UP(n*sizeof(W_)) / BLOCK_SIZE;
+ W_ req_blocks = (W_)BLOCK_ROUND_UP(n*sizeof(W_)) / BLOCK_SIZE;
// Attempting to allocate an object larger than maxHeapSize
// should definitely be disallowed. (bug #1791)
@@ -740,7 +740,7 @@ allocate (Capability *cap, lnat n)
------------------------------------------------------------------------- */
StgPtr
-allocatePinned (Capability *cap, lnat n)
+allocatePinned (Capability *cap, W_ n)
{
StgPtr p;
bdescr *bd;
@@ -920,10 +920,10 @@ dirty_MVAR(StgRegTable *reg, StgClosure *p)
* need this function for the final stats when the RTS is shutting down.
* -------------------------------------------------------------------------- */
-lnat
+W_
updateNurseriesStats (void)
{
- lnat allocated = 0;
+ W_ allocated = 0;
nat i;
for (i = 0; i < n_capabilities; i++) {
@@ -935,15 +935,15 @@ updateNurseriesStats (void)
return allocated;
}
-lnat
+W_
countLargeAllocated (void)
{
return g0->n_new_large_words;
}
-lnat countOccupied (bdescr *bd)
+W_ countOccupied (bdescr *bd)
{
- lnat words;
+ W_ words;
words = 0;
for (; bd != NULL; bd = bd->link) {
@@ -953,19 +953,19 @@ lnat countOccupied (bdescr *bd)
return words;
}
-lnat genLiveWords (generation *gen)
+W_ genLiveWords (generation *gen)
{
return gen->n_words + countOccupied(gen->large_objects);
}
-lnat genLiveBlocks (generation *gen)
+W_ genLiveBlocks (generation *gen)
{
return gen->n_blocks + gen->n_large_blocks;
}
-lnat gcThreadLiveWords (nat i, nat g)
+W_ gcThreadLiveWords (nat i, nat g)
{
- lnat words;
+ W_ words;
words = countOccupied(gc_threads[i]->gens[g].todo_bd);
words += countOccupied(gc_threads[i]->gens[g].part_list);
@@ -974,9 +974,9 @@ lnat gcThreadLiveWords (nat i, nat g)
return words;
}
-lnat gcThreadLiveBlocks (nat i, nat g)
+W_ gcThreadLiveBlocks (nat i, nat g)
{
- lnat blocks;
+ W_ blocks;
blocks = countBlocks(gc_threads[i]->gens[g].todo_bd);
blocks += gc_threads[i]->gens[g].n_part_blocks;
@@ -987,10 +987,10 @@ lnat gcThreadLiveBlocks (nat i, nat g)
// Return an accurate count of the live data in the heap, excluding
// generation 0.
-lnat calcLiveWords (void)
+W_ calcLiveWords (void)
{
nat g;
- lnat live;
+ W_ live;
live = 0;
for (g = 0; g < RtsFlags.GcFlags.generations; g++) {
@@ -999,10 +999,10 @@ lnat calcLiveWords (void)
return live;
}
-lnat calcLiveBlocks (void)
+W_ calcLiveBlocks (void)
{
nat g;
- lnat live;
+ W_ live;
live = 0;
for (g = 0; g < RtsFlags.GcFlags.generations; g++) {
@@ -1021,10 +1021,10 @@ lnat calcLiveBlocks (void)
* that will be collected next time will therefore need twice as many
* blocks since all the data will be copied.
*/
-extern lnat
-calcNeeded (rtsBool force_major, lnat *blocks_needed)
+extern W_
+calcNeeded (rtsBool force_major, memcount *blocks_needed)
{
- lnat needed = 0, blocks;
+ W_ needed = 0, blocks;
nat g, N;
generation *gen;
@@ -1137,7 +1137,7 @@ void *allocateExec (nat bytes, void **exec_ret)
if (exec_block == NULL ||
exec_block->free + n + 1 > exec_block->start + BLOCK_SIZE_W) {
bdescr *bd;
- lnat pagesize = getPageSize();
+ W_ pagesize = getPageSize();
bd = allocGroup(stg_max(1, pagesize / BLOCK_SIZE));
debugTrace(DEBUG_gc, "allocate exec block %p", bd->start);
bd->gen_no = 0;
diff --git a/rts/sm/Storage.h b/rts/sm/Storage.h
index b87a32ce09..251e951edc 100644
--- a/rts/sm/Storage.h
+++ b/rts/sm/Storage.h
@@ -81,28 +81,28 @@ void dirty_MVAR(StgRegTable *reg, StgClosure *p);
extern nursery *nurseries;
void resetNurseries ( void );
-lnat clearNursery ( Capability *cap );
+W_ clearNursery ( Capability *cap );
void resizeNurseries ( nat blocks );
void resizeNurseriesFixed ( nat blocks );
-lnat countNurseryBlocks ( void );
+W_ countNurseryBlocks ( void );
/* -----------------------------------------------------------------------------
Stats 'n' DEBUG stuff
-------------------------------------------------------------------------- */
-lnat updateNurseriesStats (void);
-lnat countLargeAllocated (void);
-lnat countOccupied (bdescr *bd);
-lnat calcNeeded (rtsBool force_major, lnat *blocks_needed);
+W_ updateNurseriesStats (void);
+W_ countLargeAllocated (void);
+W_ countOccupied (bdescr *bd);
+W_ calcNeeded (rtsBool force_major, W_ *blocks_needed);
-lnat gcThreadLiveWords (nat i, nat g);
-lnat gcThreadLiveBlocks (nat i, nat g);
+W_ gcThreadLiveWords (nat i, nat g);
+W_ gcThreadLiveBlocks (nat i, nat g);
-lnat genLiveWords (generation *gen);
-lnat genLiveBlocks (generation *gen);
+W_ genLiveWords (generation *gen);
+W_ genLiveBlocks (generation *gen);
-lnat calcLiveBlocks (void);
-lnat calcLiveWords (void);
+W_ calcLiveBlocks (void);
+W_ calcLiveWords (void);
/* ----------------------------------------------------------------------------
Storage manager internal APIs and globals