Commit ab0e778c authored by Simon Marlow's avatar Simon Marlow
Browse files

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.
parent 2246c514
......@@ -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"
......
......@@ -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 );
......
......@@ -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
......
......@@ -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 );
......
......@@ -23,6 +23,7 @@
#include "Rts.h"
#include "RtsFlags.h"
#include "Storage.h"
#include "Stable.h"
#include "OSThreads.h"
#include "Capability.h"
......
......@@ -41,6 +41,7 @@ Haskell side.
#include "RtsExternal.h"
#include "RtsUtils.h"
#include "Storage.h"
#include "Stable.h"
#include <stdlib.h>
#if defined(_WIN32)
......
......@@ -20,7 +20,6 @@
#include "Rts.h"
#include "RtsUtils.h"
#include "BlockAlloc.h"
#include "Arena.h"
#include <stdlib.h>
......
......@@ -23,6 +23,7 @@
#include "STM.h"
#include "OSThreads.h"
#include "Capability.h"
#include "Storage.h"
#include "Schedule.h"
#include "Sparks.h"
#include "Trace.h"
......
......@@ -16,6 +16,7 @@
#include "RtsUtils.h"
#include "Closures.h"
#include "TSO.h"
#include "Storage.h"
#include "Schedule.h"
#include "Bytecodes.h"
......
......@@ -3,11 +3,11 @@
#include "RtsFlags.h"
#include "RtsUtils.h"
#include "StgRun.h"
#include "Storage.h"
#include "Schedule.h"
#include "Printer.h"
#include "Sanity.h"
#include "STM.h"
#include "Storage.h"
#include "SchedAPI.h"
#include "Timer.h"
#include "ProfHeap.h"
......@@ -20,3 +20,4 @@
#include "ThreadLabels.h"
#include "Threads.h"
#include "Prelude.h"
#include "Stable.h"
......@@ -8,6 +8,8 @@
#include "HsFFI.h"
#include "Rts.h"
#include "Storage.h"
#include "Stable.h"
// hs_init and hs_exit are defined in RtsStartup.c
......
......@@ -10,9 +10,9 @@
#include "RtsUtils.h"
#include "Closures.h"
#include "TSO.h"
#include "Storage.h"
#include "Schedule.h"
#include "RtsFlags.h"
#include "Storage.h"
#include "LdvProfile.h"
#include "Updates.h"
#include "Sanity.h"
......
......@@ -21,11 +21,12 @@
#include "RtsFlags.h"
#include "HsFFI.h"
#include "Hash.h"
#include "Storage.h"
#include "Stable.h"
#include "Linker.h"
#include "LinkerInternals.h"
#include "RtsUtils.h"
#include "Schedule.h"
#include "Storage.h"
#include "Sparks.h"
#include "RtsTypeable.h"
......
......@@ -12,7 +12,6 @@
#include "Rts.h"
#include "RtsAPI.h"
#include "SchedAPI.h"
#include "Schedule.h"
#include "RtsFlags.h"
#include "RtsUtils.h"
#include "Prelude.h"
......
......@@ -44,7 +44,7 @@ endif
NON_HS_PACKAGE = YES
# grab sources from these subdirectories
ALL_DIRS = hooks parallel
ALL_DIRS = hooks parallel sm
ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
ALL_DIRS += win32
......@@ -88,7 +88,7 @@ H_FILES = $(wildcard ../includes/*.h) $(wildcard *.h)
# gcc provides lots of useful warnings if you ask it.
# This is a pretty good list to start with - use a # to comment out
# any you don't like.
WARNING_OPTS += -Wall
WARNING_OPTS += -Wall
WARNING_OPTS += -W
WARNING_OPTS += -Wstrict-prototypes
WARNING_OPTS += -Wmissing-prototypes
......@@ -105,7 +105,7 @@ WARNING_OPTS += -Wbad-function-cast
#WARNING_OPTS += -Wredundant-decls
#WARNING_OPTS += -Wconversion
STANDARD_OPTS += -I../includes -I. -Iparallel
STANDARD_OPTS += -I../includes -I. -Iparallel -Ism
# COMPILING_RTS is only used when building Win32 DLL support.
STANDARD_OPTS += -DCOMPILING_RTS
......
......@@ -12,8 +12,8 @@
#include "Trace.h"
#include "RaiseAsync.h"
#include "SMP.h"
#include "Schedule.h"
#include "Storage.h"
#include "Schedule.h"
#include "LdvProfile.h"
#include "Updates.h"
#include "STM.h"
......
......@@ -45,7 +45,7 @@ void awakenBlockedExceptionQueue (Capability *cap, StgTSO *tso);
* indefinitely). Interruptible threads can be sent an exception with
* killThread# even if they have async exceptions blocked.
*/
STATIC_INLINE int
INLINE_HEADER int
interruptible(StgTSO *t)
{
switch (t->why_blocked) {
......
......@@ -20,15 +20,15 @@
#include "RtsUtils.h"
#include "RetainerProfile.h"
#include "RetainerSet.h"
#include "Storage.h"
#include "Schedule.h"
#include "Stable.h"
#include "Printer.h"
#include "Storage.h"
#include "RtsFlags.h"
#include "Weak.h"
#include "Sanity.h"
#include "Profiling.h"
#include "Stats.h"
#include "BlockAlloc.h"
#include "ProfHeap.h"
#include "Apply.h"
......
......@@ -17,6 +17,7 @@
#include "Prelude.h"
#include "Schedule.h"
#include "Capability.h"
#include "Stable.h"
#include <stdlib.h>
......
......@@ -11,7 +11,6 @@
#include "Rts.h"
#include "RtsFlags.h"
#include "RtsUtils.h"
#include "BlockAlloc.h"
#include "Profiling.h"
#ifdef HAVE_CTYPE_H
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment