Commit 7457757f authored by simonmar's avatar simonmar
Browse files

[project @ 2002-07-17 09:21:48 by simonmar]

Remove most #includes of system headers from Stg.h, and instead
#include any required headers directly in each RTS source file.

The idea is to (a) reduce namespace pollution from system headers that
we don't need, (c) be clearer about dependencies on system things in
the RTS, and (c) improve via-C compilation times (maybe).

In practice though, HsBase.h #includes everything anyway, so the
difference from the point of view of .hc source is minimal.  However,
this makes it easier to move to zero-includes if we wanted to (see
discussion on the FFI list; I'm still not sure that's possible but
at least this is a step in the right direction).
parent 2790095b
/* -----------------------------------------------------------------------------
* $Id: PrimOps.h,v 1.95 2002/06/04 16:13:53 sof Exp $
* $Id: PrimOps.h,v 1.96 2002/07/17 09:21:48 simonmar Exp $
*
* (c) The GHC Team, 1998-2000
*
......@@ -326,11 +326,10 @@ EXTFUN_RTS(mkApUpd0zh_fast);
#define STG_SIG_ERR (-3)
#define STG_SIG_HAN (-4)
extern StgInt stg_sig_install (StgInt, StgInt, StgStablePtr, sigset_t *);
#define stg_sig_default(sig,mask) stg_sig_install(sig,STG_SIG_DFL,0,(sigset_t *)mask)
#define stg_sig_ignore(sig,mask) stg_sig_install(sig,STG_SIG_IGN,0,(sigset_t *)mask)
#define stg_sig_catch(sig,ptr,mask) stg_sig_install(sig,STG_SIG_HAN,ptr,(sigset_t *)mask)
extern StgInt stg_sig_install (StgInt, StgInt, StgStablePtr, void *);
#define stg_sig_default(sig,mask) stg_sig_install(sig,STG_SIG_DFL,0,(void *)mask)
#define stg_sig_ignore(sig,mask) stg_sig_install(sig,STG_SIG_IGN,0,(void *)mask)
#define stg_sig_catch(sig,ptr,mask) stg_sig_install(sig,STG_SIG_HAN,ptr,(void *)mask)
/* ------------------------------------------------------------------------
Parallel PrimOps
......
/* -----------------------------------------------------------------------------
* $Id: RtsFlags.h,v 1.41 2001/12/12 14:58:26 simonmar Exp $
* $Id: RtsFlags.h,v 1.42 2002/07/17 09:21:49 simonmar Exp $
*
* (c) The GHC Team, 1998-1999
*
......@@ -10,6 +10,8 @@
#ifndef RTSFLAGS_H
#define RTSFLAGS_H
#include <stdio.h>
/* For defaults, see the @initRtsFlagsDefaults@ routine. */
struct GC_FLAGS {
......
/* -----------------------------------------------------------------------------
* $Id: Stg.h,v 1.46 2002/06/03 13:08:41 matthewc Exp $
* $Id: Stg.h,v 1.47 2002/07/17 09:21:49 simonmar Exp $
*
* (c) The GHC Team, 1998-1999
*
......@@ -186,22 +186,6 @@ typedef StgWord64 LW_;
/* RTS public interface */
#include "RtsAPI.h"
/* these are all ANSI C headers */
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#ifdef HAVE_SIGNAL_H
#include <signal.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef SMP
#include <pthread.h>
#endif
......
/* --------------------------------------------------------------------------
* $Id: mkNativeHdr.c,v 1.8 2002/01/08 10:36:24 sewardj Exp $
* $Id: mkNativeHdr.c,v 1.9 2002/07/17 09:21:49 simonmar Exp $
*
* (c) The GHC Team, 1992-1998
*
......@@ -7,6 +7,8 @@
*
* ------------------------------------------------------------------------*/
#include <stdio.h>
#include "Stg.h"
#define OFFSET(table, x) ((StgUnion *) &(x) - (StgUnion *) (&table))
......
/* -----------------------------------------------------------------------------
$Id: Arena.c,v 1.1 2001/10/18 14:41:01 simonmar Exp $
$Id: Arena.c,v 1.2 2002/07/17 09:21:49 simonmar Exp $
(c) The University of Glasgow 2001
Arena allocation. Arenas provide fast memory allocation at the
......@@ -24,6 +24,8 @@
#include "BlockAlloc.h"
#include "Arena.h"
#include <stdlib.h>
// Each arena struct is allocated using malloc().
struct _Arena {
bdescr *current;
......
/* -----------------------------------------------------------------------------
* $Id: BlockAlloc.c,v 1.13 2001/11/08 14:42:11 simonmar Exp $
* $Id: BlockAlloc.c,v 1.14 2002/07/17 09:21:49 simonmar Exp $
*
* (c) The GHC Team 1998-2000
*
......@@ -23,6 +23,8 @@
#include "BlockAlloc.h"
#include "MBlock.h"
#include <string.h>
static void initMBlock(void *mblock);
static bdescr *allocMegaGroup(nat mblocks);
static void freeMegaGroup(bdescr *bd);
......
......@@ -5,8 +5,8 @@
* Copyright (c) 1994-1998.
*
* $RCSfile: Disassembler.c,v $
* $Revision: 1.24 $
* $Date: 2001/08/14 13:40:09 $
* $Revision: 1.25 $
* $Date: 2002/07/17 09:21:49 $
* ---------------------------------------------------------------------------*/
#ifdef DEBUG
......@@ -24,6 +24,8 @@
#include "Disassembler.h"
#include "Interpreter.h"
#include <stdio.h>
/* --------------------------------------------------------------------------
* Disassembler
* ------------------------------------------------------------------------*/
......
/* -----------------------------------------------------------------------------
* $Id: GC.c,v 1.136 2002/07/10 09:28:54 simonmar Exp $
* $Id: GC.c,v 1.137 2002/07/17 09:21:49 simonmar Exp $
*
* (c) The GHC Team 1998-1999
*
......@@ -45,6 +45,8 @@
#include "RetainerProfile.h"
#include "LdvProfile.h"
#include <string.h>
/* STATIC OBJECT LIST.
*
* During GC:
......
/*-----------------------------------------------------------------------------
* $Id: Hash.c,v 1.8 2002/04/09 12:55:11 simonmar Exp $
* $Id: Hash.c,v 1.9 2002/07/17 09:21:49 simonmar Exp $
*
* (c) The AQUA Project, Glasgow University, 1995-1998
* (c) The GHC Team, 1999
......@@ -14,6 +14,9 @@
#include "Hash.h"
#include "RtsUtils.h"
#include <stdlib.h>
#include <string.h>
#define HSEGSIZE 1024 /* Size of a single hash table segment */
/* Also the minimum size of a hash table */
#define HDIRSIZE 1024 /* Size of the segment directory */
......
/* -----------------------------------------------------------------------------
* $Id: Itimer.c,v 1.29 2001/11/27 01:57:59 sof Exp $
* $Id: Itimer.c,v 1.30 2002/07/17 09:21:49 simonmar Exp $
*
* (c) The GHC Team, 1995-1999
*
......@@ -43,6 +43,10 @@
# include <windows.h>
#endif
#ifdef HAVE_SIGNAL_H
# include <signal.h>
#endif
lnat total_ticks = 0;
/* ticks left before next pre-emptive context switch */
......
/* -----------------------------------------------------------------------------
* $Id: MBlock.c,v 1.28 2002/04/12 04:00:35 sof Exp $
* $Id: MBlock.c,v 1.29 2002/07/17 09:21:50 simonmar Exp $
*
* (c) The GHC Team 1998-1999
*
......@@ -40,6 +40,8 @@
#include <windows.h>
#endif
#include <errno.h>
lnat mblocks_allocated = 0;
void *
......
/* -----------------------------------------------------------------------------
* $Id: PrimOps.hc,v 1.99 2002/06/26 08:18:41 stolz Exp $
* $Id: PrimOps.hc,v 1.100 2002/07/17 09:21:50 simonmar Exp $
*
* (c) The GHC Team, 1998-2000
*
......@@ -22,6 +22,12 @@
#include "Itimer.h"
#include "Prelude.h"
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <stdlib.h>
/* ** temporary **
classes CCallable and CReturnable don't really exist, but the
......
/* -----------------------------------------------------------------------------
* $Id: Printer.c,v 1.51 2002/02/04 20:26:25 sof Exp $
* $Id: Printer.c,v 1.52 2002/07/17 09:21:50 simonmar Exp $
*
* (c) The GHC Team, 1994-2000.
*
......@@ -11,6 +11,8 @@
#include "Rts.h"
#include "Printer.h"
#include <stdio.h>
#ifdef DEBUG
#include "RtsUtils.h"
......@@ -20,7 +22,8 @@
#include "Bytecodes.h" /* for InstrPtr */
#include "Disassembler.h"
#include "Printer.h"
#include <stdlib.h>
#include <string.h>
#if defined(GRAN) || defined(PAR)
// HWL: explicit fixed header size to make debugging easier
......
/* -----------------------------------------------------------------------------
* $Id: RtsFlags.c,v 1.56 2001/12/12 14:31:43 simonmar Exp $
* $Id: RtsFlags.c,v 1.57 2002/07/17 09:21:50 simonmar Exp $
*
* (c) The AQUA Project, Glasgow University, 1994-1997
* (c) The GHC Team, 1998-1999
......@@ -37,6 +37,9 @@
#include <ctype.h>
#endif
#include <stdlib.h>
#include <string.h>
extern struct RTS_FLAGS RtsFlags;
/*
......
/* -----------------------------------------------------------------------------
* $Id: RtsStartup.c,v 1.64 2002/06/26 08:18:41 stolz Exp $
* $Id: RtsStartup.c,v 1.65 2002/07/17 09:21:50 simonmar Exp $
*
* (c) The GHC Team, 1998-2000
*
......@@ -50,6 +50,8 @@
# include "LLC.h"
#endif
#include <stdlib.h>
/*
* Flag Structure
*/
......
/* -----------------------------------------------------------------------------
* $Id: RtsUtils.c,v 1.25 2002/05/18 05:28:14 ken Exp $
* $Id: RtsUtils.c,v 1.26 2002/07/17 09:21:50 simonmar Exp $
*
* (c) The GHC Team, 1998-1999
*
......@@ -31,6 +31,8 @@
#include <sys/time.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
/* variable-argument error function. */
......
/* ---------------------------------------------------------------------------
* $Id: Schedule.c,v 1.147 2002/07/10 09:28:56 simonmar Exp $
* $Id: Schedule.c,v 1.148 2002/07/17 09:21:50 simonmar Exp $
*
* (c) The GHC Team, 1998-2000
*
......@@ -122,6 +122,8 @@
#include <unistd.h>
#endif
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
//@node Variables and Data structures, Prototypes, Includes, Main scheduling code
......
/* -----------------------------------------------------------------------------
* $Id: Select.c,v 1.20 2002/07/09 20:44:24 sof Exp $
* $Id: Select.c,v 1.21 2002/07/17 09:21:51 simonmar Exp $
*
* (c) The GHC Team 1995-1999
* (c) The GHC Team 1995-2002
*
* Support for concurrent non-blocking I/O and thread waiting.
*
......@@ -29,6 +29,9 @@
# include <windows.h>
# endif
#include <errno.h>
#include <string.h>
/* last timestamp */
nat timestamp = 0;
......
/* -----------------------------------------------------------------------------
* $Id: Signals.c,v 1.25 2002/07/02 12:24:48 simonmar Exp $
* $Id: Signals.c,v 1.26 2002/07/17 09:21:51 simonmar Exp $
*
* (c) The GHC Team, 1998-1999
*
......@@ -19,9 +19,19 @@
#include "StablePriv.h"
#ifdef alpha_TARGET_ARCH
#include <machine/fpu.h>
# include <machine/fpu.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef HAVE_SIGNAL_H
# include <signal.h>
#endif
#include <stdlib.h>
#ifndef mingw32_TARGET_OS
#ifndef PAR
......@@ -187,7 +197,7 @@ awaitUserSignals(void)
* -------------------------------------------------------------------------- */
StgInt
stg_sig_install(StgInt sig, StgInt spi, StgStablePtr handler, sigset_t *mask)
stg_sig_install(StgInt sig, StgInt spi, StgStablePtr handler, void *mask)
{
sigset_t signals;
struct sigaction action;
......@@ -228,8 +238,8 @@ stg_sig_install(StgInt sig, StgInt spi, StgStablePtr handler, sigset_t *mask)
barf("stg_sig_install: bad spi");
}
if (mask != 0)
action.sa_mask = *mask;
if (mask != NULL)
action.sa_mask = *(sigset_t *)mask;
else
sigemptyset(&action.sa_mask);
......
/* -----------------------------------------------------------------------------
* $Id: StgPrimFloat.c,v 1.8 2001/08/14 13:40:09 sewardj Exp $
* $Id: StgPrimFloat.c,v 1.9 2002/07/17 09:21:51 simonmar Exp $
*
* (c) The GHC Team, 1998-2000
*
......@@ -10,6 +10,8 @@
#include "PosixSource.h"
#include "Rts.h"
#include <math.h>
/*
* Encoding and decoding Doubles. Code based on the HBC code
* (lib/fltcode.c).
......
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