summaryrefslogtreecommitdiff
path: root/ghc/includes/StgStorage.h
blob: 964757bb45e4aaaada245f63c90cfddf44885fa3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* -----------------------------------------------------------------------------
 * $Id: StgStorage.h,v 1.2 1998/12/02 13:21:41 simonm Exp $
 *
 * STG Storage Manger Interface
 *
 * ---------------------------------------------------------------------------*/

#ifndef STGSTORAGE_H
#define STGSTORAGE_H

#include "Block.h"

extern bdescr *current_nursery;

/* -----------------------------------------------------------------------------
   Allocation area for compiled code

   OpenNursery(hp,hplim)        Opens the allocation area, and sets hp
   				and hplim appropriately.

   CloseNursery(hp)		Closes the allocation area.

   PleaseStopAllocating(void)   Arranges that the next call to
   				ExtendNursery() will fail, triggering
				a return to the scheduler.  This is
				useful for asynchronous interupts etc.
   -------------------------------------------------------------------------- */

#define OpenNursery(hp,hplim)				\
  (hp    = current_nursery->free-1,			\
   hplim = current_nursery->start + BLOCK_SIZE_W - 1)
  
#define CloseNursery(hp)  (current_nursery->free = (P_)(hp)+1)

/* -----------------------------------------------------------------------------
   Trigger a GC from Haskell land.
   -------------------------------------------------------------------------- */

extern void performGC(void);
extern void performGCWithRoots(void (*get_roots)(void));

#endif /* STGSTORAGE_H */