summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorSimon Marlow <simonmar@microsoft.com>2006-10-24 09:13:57 +0000
committerSimon Marlow <simonmar@microsoft.com>2006-10-24 09:13:57 +0000
commitab0e778ccfde61aed4c22679b24d175fc6cc9bf3 (patch)
treea0f6148a77644c5a7baa68b521bf3b1116dce50b /includes
parent2246c514eade324d70058ba3135dc0c51ee9353b (diff)
downloadhaskell-ab0e778ccfde61aed4c22679b24d175fc6cc9bf3.tar.gz
Split GC.c, and move storage manager into sm/ directory
In preparation for parallel GC, split up the monolithic GC.c file into smaller parts. Also in this patch (and difficult to separate, unfortunatley): - Don't include Stable.h in Rts.h, instead just include it where necessary. - consistently use STATIC_INLINE in source files, and INLINE_HEADER in header files. STATIC_INLINE is now turned off when DEBUG is on, to make debugging easier. - The GC no longer takes the get_roots function as an argument. We weren't making use of this generalisation.
Diffstat (limited to 'includes')
-rw-r--r--includes/Rts.h11
-rw-r--r--includes/RtsExternal.h3
-rw-r--r--includes/Stg.h4
-rw-r--r--includes/Storage.h8
-rw-r--r--includes/mkDerivedConstants.c1
5 files changed, 16 insertions, 11 deletions
diff --git a/includes/Rts.h b/includes/Rts.h
index 7a30d9ee52..7ed9c2d9b4 100644
--- a/includes/Rts.h
+++ b/includes/Rts.h
@@ -18,6 +18,12 @@ extern "C" {
#endif
#include "Stg.h"
+// Turn off inlining when debugging - it obfuscates things
+#ifdef DEBUG
+# undef STATIC_INLINE
+# define STATIC_INLINE static
+#endif
+
#include "RtsTypes.h"
#if __GNUC__ >= 3
@@ -138,16 +144,13 @@ extern void _assertFail (const char *, unsigned int);
#include "OSThreads.h"
#include "SMP.h"
-/* STG/Optimised-C related stuff */
-#include "Block.h"
-
/* GNU mp library */
#include "gmp.h"
/* Macros for STG/C code */
+#include "Block.h"
#include "ClosureMacros.h"
#include "StgTicky.h"
-#include "Stable.h"
/* Runtime-system hooks */
#include "Hooks.h"
diff --git a/includes/RtsExternal.h b/includes/RtsExternal.h
index 3000059cc3..d96762020e 100644
--- a/includes/RtsExternal.h
+++ b/includes/RtsExternal.h
@@ -83,9 +83,6 @@ extern void* allocateExec(unsigned int len);
Storage manager stuff exported
-------------------------------------------------------------------------- */
-/* Prototype for an evacuate-like function */
-typedef void (*evac_fn)(StgClosure **);
-
extern void performGC(void);
extern void performMajorGC(void);
extern HsInt64 getAllocations( void );
diff --git a/includes/Stg.h b/includes/Stg.h
index 5cd3701c0f..1facd5f405 100644
--- a/includes/Stg.h
+++ b/includes/Stg.h
@@ -66,7 +66,9 @@
#define BITS_IN(x) (BITS_PER_BYTE * sizeof(x))
/*
- * 'Portable' inlining
+ * 'Portable' inlining:
+ * INLINE_HEADER is for inline functions in header files
+ * STATIC_INLINE is for inline functions in source files
*/
#if defined(__GNUC__) || defined( __INTEL_COMPILER)
# define INLINE_HEADER static inline
diff --git a/includes/Storage.h b/includes/Storage.h
index 09b1b04881..12be6d19d0 100644
--- a/includes/Storage.h
+++ b/includes/Storage.h
@@ -185,7 +185,7 @@ extern void freeExec (void *p);
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
@@ -362,7 +362,7 @@ INLINE_HEADER StgWord tso_sizeW ( StgTSO *tso )
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) {
@@ -428,7 +428,7 @@ closure_sizeW_ (StgClosure *p, StgInfoTable *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));
@@ -483,6 +483,8 @@ 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 );
diff --git a/includes/mkDerivedConstants.c b/includes/mkDerivedConstants.c
index ded645ca03..ec081fb945 100644
--- a/includes/mkDerivedConstants.c
+++ b/includes/mkDerivedConstants.c
@@ -23,6 +23,7 @@
#include "Rts.h"
#include "RtsFlags.h"
#include "Storage.h"
+#include "Stable.h"
#include "OSThreads.h"
#include "Capability.h"