Commit bc5c8021 authored by sewardj's avatar sewardj

[project @ 2001-08-14 13:40:07 by sewardj]

Change the story about POSIX headers in C compilation.

Until now, all C code in the RTS and library cbits has by default been
compiled with settings for POSIXness enabled, that is:
   #define _POSIX_SOURCE   1
   #define _POSIX_C_SOURCE 199309L
   #define _ISOC9X_SOURCE
If you wanted to negate this, you'd have to define NON_POSIX_SOURCE
before including headers.

This scheme has some bad effects:

* It means that ccall-unfoldings exported via interfaces from a
  module compiled with -DNON_POSIX_SOURCE may not compile when
  imported into a module which does not -DNON_POSIX_SOURCE.

* It overlaps with the feature tests we do with autoconf.

* It seems to have caused borkage in the Solaris builds for some
  considerable period of time.

The New Way is:

* The default changes to not-being-in-Posix mode.

* If you want to force a C file into Posix mode, #include as
  the **first** include the new file ghc/includes/PosixSource.h.
  Most of the RTS C sources have this include now.

* NON_POSIX_SOURCE is almost totally expunged.  Unfortunately
  we have to retain some vestiges of it in ghc/compiler so that
  modules compiled via C on Solaris using older compilers don't
  break.
parent b19d9770
......@@ -626,7 +626,7 @@ dnl ** check for full ANSI header (.h) files
AC_HEADER_STDC
dnl ** check for specific header (.h) files that we are interested in
AC_CHECK_HEADERS(Files.h arpa/inet.h assert.h console.h ctype.h dirent.h errno.h fcntl.h float.h ftw.h grp.h ieee754.h inttypes.h malloc.h memory.h nlist.h pascal.h pwd.h sgtty.h siginfo.h signal.h stat.h stdint.h stdlib.h stdarg.h string.h sys/fault.h sys/file.h sys/ioctl.h sys/limits.h sys/mman.h sys/param.h sys/procfs.h sys/resource.h sys/signal.h sys/socket.h netdb.h netinet/in.h netinet/tcp.h sys/stat.h sys/syscall.h sys/time.h sys/timeb.h sys/timers.h sys/times.h sys/types.h sys/un.h sys/utsname.h sys/vadvise.h sys/wait.h termio.h termios.h time.h types.h unistd.h utime.h values.h vfork.h bfd.h winsock.h)
AC_CHECK_HEADERS(Files.h arpa/inet.h assert.h console.h ctype.h dirent.h errno.h fcntl.h float.h ftw.h grp.h ieee754.h inttypes.h limits.h malloc.h memory.h nlist.h pascal.h pwd.h sgtty.h siginfo.h signal.h stat.h stdint.h stdlib.h stdarg.h string.h sys/fault.h sys/file.h sys/ioctl.h sys/limits.h sys/mman.h sys/param.h sys/procfs.h sys/resource.h sys/signal.h sys/socket.h netdb.h netinet/in.h netinet/tcp.h sys/stat.h sys/syscall.h sys/time.h sys/timeb.h sys/timers.h sys/times.h sys/types.h sys/un.h sys/utsname.h sys/vadvise.h sys/wait.h termio.h termios.h time.h types.h unistd.h utime.h values.h vfork.h bfd.h winsock.h)
AC_CHECK_HEADER(readline/readline.h, HaveReadlineReadlineH=YES, HaveReadlineReadlineH=NO)
AC_CHECK_HEADER(readline/history.h, HaveReadlineHistoryH=YES, HaveReadlineHistoryH=NO)
......
......@@ -4,6 +4,9 @@
\section[ByteCodeItbls]{Generate infotables for interpreter-made bytecodes}
\begin{code}
{-# OPTIONS -optc-DNON_POSIX_SOURCE #-}
module ByteCodeItbls ( ItblEnv, ItblPtr, mkITbls ) where
#include "HsVersions.h"
......
......@@ -4,6 +4,9 @@
\section[ByteCodeLink]{Bytecode assembler and linker}
\begin{code}
{-# OPTIONS -optc-DNON_POSIX_SOURCE #-}
module ByteCodeLink ( UnlinkedBCO, UnlinkedBCOExpr, assembleBCO,
ClosureEnv, HValue, filterNameMap,
linkIModules, linkIExpr,
......
-----------------------------------------------------------------------------
-- $Id: DriverState.hs,v 1.53 2001/08/13 15:49:38 simonmar Exp $
-- $Id: DriverState.hs,v 1.54 2001/08/14 13:40:08 sewardj Exp $
--
-- Settings for the driver
--
......@@ -146,7 +146,7 @@ GLOBAL_VAR(v_minus_o2_for_C, False, Bool)
GLOBAL_VAR(v_MaxSimplifierIterations, 4, Int)
GLOBAL_VAR(v_StgStats, False, Bool)
GLOBAL_VAR(v_UsageSPInf, False, Bool) -- Off by default
GLOBAL_VAR(v_Strictness, True, Bool)
GLOBAL_VAR(v_Strictness, False{-True-}, Bool)
GLOBAL_VAR(v_CPR, True, Bool)
GLOBAL_VAR(v_CSE, True, Bool)
......
{-# OPTIONS -fno-warn-incomplete-patterns #-}
{-# OPTIONS -fno-warn-incomplete-patterns -optc-DNON_POSIX_SOURCE #-}
-----------------------------------------------------------------------------
-- $Id: Main.hs,v 1.86 2001/08/13 15:49:38 simonmar Exp $
-- $Id: Main.hs,v 1.87 2001/08/14 13:40:08 sewardj Exp $
--
-- GHC Driver program
--
......
......@@ -12,6 +12,9 @@ ToDo:
(i1 + i2) only if it results in a valid Float.
\begin{code}
{-# OPTIONS -optc-DNON_POSIX_SOURCE #-}
module PrelRules ( primOpRule, builtinRules ) where
#include "HsVersions.h"
......
......@@ -8,7 +8,7 @@ of bytes (character strings). Used by the interface lexer input
subsystem, mostly.
\begin{code}
{-# OPTIONS -fvia-C -monly-3-regs #-}
{-# OPTIONS -monly-3-regs -optc-DNON_POSIX_SOURCE #-}
module PrimPacked
(
strLength, -- :: _Addr -> Int
......
......@@ -7,7 +7,7 @@ Buffers for scanning string input stored in external arrays.
\begin{code}
{-# OPTIONS -fvia-C #-}
{-# OPTIONS -optc-DNON_POSIX_SOURCE #-}
module StringBuffer
(
......
/* -----------------------------------------------------------------------------
* $Id: PosixSource.h,v 1.1 2001/08/14 13:40:08 sewardj Exp $
*
* (c) The GHC Team, 1998-2001
*
* Include this file into sources which should not need any non-Posix services.
* That includes most RTS C sources.
* ---------------------------------------------------------------------------*/
#ifndef POSIXSOURCE_H
#define POSIXSOURCE_H
#define _POSIX_SOURCE 1
#define _POSIX_C_SOURCE 199309L
#define _ISOC9X_SOURCE
/* Let's be ISO C9X too... */
#endif
/* -----------------------------------------------------------------------------
* $Id: Stg.h,v 1.36 2001/03/01 12:25:32 rrt Exp $
* $Id: Stg.h,v 1.37 2001/08/14 13:40:08 sewardj Exp $
*
* (c) The GHC Team, 1998-1999
*
......@@ -12,13 +12,6 @@
#ifndef STG_H
#define STG_H
#ifndef NON_POSIX_SOURCE
#define _POSIX_SOURCE 1
#define _POSIX_C_SOURCE 199309L
#define _ISOC9X_SOURCE
#endif
/* Let's be ISO C9X too... */
/* If we include "Stg.h" directly, we're in STG code, and we therefore
* get all the global register variables, macros etc. that go along
......
{-# OPTIONS -fno-implicit-prelude -optc-DNON_POSIX_SOURCE #-}
{-# OPTIONS -fno-implicit-prelude #-}
-- ---------------------------------------------------------------------------
-- $Id: PrelPosix.hsc,v 1.10 2001/08/10 11:02:00 simonmar Exp $
-- $Id: PrelPosix.hsc,v 1.11 2001/08/14 13:40:08 sewardj Exp $
--
-- POSIX support layer for the standard libraries
--
-- NON_POSIX_SOURCE needed for the following features:
-- Non-posix compliant in order to support the following features:
-- * S_ISSOCK (no sockets in POSIX)
module PrelPosix where
-- See above comment for non-Posixness reasons.
-- #include "PosixSource.h"
#include "HsStd.h"
import PrelBase
......
{-# OPTIONS -optc-DNON_POSIX_SOURCE #-}
-- JRS 010117: we had to say NON_POSIX_SOURCE to get the resulting .hc
-- to compile on sparc-solaris. Blargh.
-- -----------------------------------------------------------------------------
-- $Id: Time.hsc,v 1.19 2001/07/24 05:53:27 ken Exp $
-- $Id: Time.hsc,v 1.20 2001/08/14 13:40:08 sewardj Exp $
--
-- (c) The University of Glasgow, 1995-2001
--
......
/*
* (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
*
* $Id: inputReady.c,v 1.8 2001/07/09 16:30:50 sof Exp $
* $Id: inputReady.c,v 1.9 2001/08/14 13:40:08 sewardj Exp $
*
* hReady Runtime Support
*/
/* select and supporting types is not */
#ifndef _AIX
#define NON_POSIX_SOURCE
#endif
/* select and supporting types is not Posix */
/* #include "PosixSource.h" */
#include "HsStd.h"
/*
......
/*
* (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
*
* $Id: system.c,v 1.17 2001/08/07 08:18:15 rrt Exp $
* $Id: system.c,v 1.18 2001/08/14 13:40:08 sewardj Exp $
*
* system Runtime Support
*/
/* The itimer stuff in this module is non-posix */
#define NON_POSIX_SOURCE
/* #include "PosixSource.h" */
#include "HsStd.h"
......
......@@ -36,6 +36,7 @@ and C resources. Failure to do so result in memory leaks on both the C and
Haskell side.
*/
#include "PosixSource.h"
#include "Rts.h"
#include "RtsUtils.h"
#include "RtsFlags.h"
......
/* -----------------------------------------------------------------------------
* $Id: BlockAlloc.c,v 1.9 2001/07/23 17:23:19 simonmar Exp $
* $Id: BlockAlloc.c,v 1.10 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team 1998-2000
*
......@@ -16,6 +16,7 @@
*
* ---------------------------------------------------------------------------*/
#include "PosixSource.h"
#include "Rts.h"
#include "RtsFlags.h"
#include "RtsUtils.h"
......
/* -----------------------------------------------------------------------------
* $Id: ClosureFlags.c,v 1.10 2001/07/23 17:23:19 simonmar Exp $
* $Id: ClosureFlags.c,v 1.11 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team 1998-1999
*
......@@ -7,6 +7,7 @@
*
* ---------------------------------------------------------------------------*/
#include "PosixSource.h"
#include "Rts.h"
StgWord16 closure_flags[] = {
......
......@@ -5,12 +5,13 @@
* Copyright (c) 1994-1998.
*
* $RCSfile: Disassembler.c,v $
* $Revision: 1.23 $
* $Date: 2001/08/09 11:19:16 $
* $Revision: 1.24 $
* $Date: 2001/08/14 13:40:09 $
* ---------------------------------------------------------------------------*/
#ifdef DEBUG
#include "PosixSource.h"
#include "Rts.h"
#include "RtsAPI.h"
#include "RtsUtils.h"
......
/* -----------------------------------------------------------------------------
* $Id: FrontPanel.c,v 1.4 2001/01/19 11:08:05 simonmar Exp $
* $Id: FrontPanel.c,v 1.5 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team 2000
*
......@@ -9,7 +9,8 @@
#ifdef RTS_GTK_FRONTPANEL
#define NON_POSIX_SOURCE
/* Alas, not Posix. */
/* #include "PosixSource.h" */
#include "Rts.h"
#include "RtsUtils.h"
......
/* -----------------------------------------------------------------------------
* $Id: GC.c,v 1.119 2001/08/10 10:52:12 simonmar Exp $
* $Id: GC.c,v 1.120 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team 1998-1999
*
......@@ -7,6 +7,7 @@
*
* ---------------------------------------------------------------------------*/
#include "PosixSource.h"
#include "Rts.h"
#include "RtsFlags.h"
#include "RtsUtils.h"
......
/* -----------------------------------------------------------------------------
* $Id: GCCompact.c,v 1.8 2001/08/10 09:40:11 simonmar Exp $
* $Id: GCCompact.c,v 1.9 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team 2001
*
......@@ -7,6 +7,7 @@
*
* ---------------------------------------------------------------------------*/
#include "PosixSource.h"
#include "Rts.h"
#include "RtsUtils.h"
#include "RtsFlags.h"
......
/*-----------------------------------------------------------------------------
* $Id: Hash.c,v 1.5 2001/06/27 11:29:10 sewardj Exp $
* $Id: Hash.c,v 1.6 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The AQUA Project, Glasgow University, 1995-1998
* (c) The GHC Team, 1999
......@@ -9,6 +9,7 @@
* pp. 446 -- 457.
* -------------------------------------------------------------------------- */
#include "PosixSource.h"
#include "Rts.h"
#include "Hash.h"
#include "RtsUtils.h"
......
......@@ -5,10 +5,11 @@
* Copyright (c) 1994-2000.
*
* $RCSfile: Interpreter.c,v $
* $Revision: 1.29 $
* $Date: 2001/08/09 11:23:19 $
* $Revision: 1.30 $
* $Date: 2001/08/14 13:40:09 $
* ---------------------------------------------------------------------------*/
#include "PosixSource.h"
#include "Rts.h"
#include "RtsAPI.h"
#include "RtsUtils.h"
......
/* -----------------------------------------------------------------------------
* $Id: Itimer.c,v 1.22 2001/03/02 10:52:15 simonmar Exp $
* $Id: Itimer.c,v 1.23 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team, 1995-1999
*
......@@ -18,9 +18,8 @@
* to support. So much for standards.
*/
#if !defined(_AIX)
# define NON_POSIX_SOURCE
#endif
/* This is not posix compliant. */
/* #include "PosixSource.h" */
#include "Rts.h"
#include "RtsFlags.h"
......
/* -----------------------------------------------------------------------------
* $Id: Linker.c,v 1.56 2001/08/13 14:34:40 simonmar Exp $
* $Id: Linker.c,v 1.57 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team, 2000
*
......@@ -7,6 +7,7 @@
*
* ---------------------------------------------------------------------------*/
#include "PosixSource.h"
#include "Rts.h"
#include "RtsFlags.h"
#include "HsFFI.h"
......
/* -----------------------------------------------------------------------------
* $Id: LinkerBasic.c,v 1.2 2001/02/12 13:03:17 sewardj Exp $
* $Id: LinkerBasic.c,v 1.3 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team, 2000
*
......@@ -7,6 +7,7 @@
*
* ---------------------------------------------------------------------------*/
#include "PosixSource.h"
#include "Rts.h"
#include "Hash.h"
#include "StoragePriv.h"
......
/* -----------------------------------------------------------------------------
* $Id: MBlock.c,v 1.22 2001/07/24 06:31:36 ken Exp $
* $Id: MBlock.c,v 1.23 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team 1998-1999
*
......@@ -9,7 +9,8 @@
*
* ---------------------------------------------------------------------------*/
#define NON_POSIX_SOURCE
/* This is non-posix compliant. */
/* #include "PosixSource.h" */
#include "Rts.h"
#include "RtsUtils.h"
......
/* -----------------------------------------------------------------------------
* $Id: Main.c,v 1.29 2001/08/07 20:10:30 ken Exp $
* $Id: Main.c,v 1.30 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team 1998-2000
*
......@@ -9,6 +9,7 @@
#define COMPILING_RTS_MAIN
#include "PosixSource.h"
#include "Rts.h"
#include "RtsAPI.h"
#include "SchedAPI.h"
......
/* -----------------------------------------------------------------------------
* $Id: Printer.c,v 1.44 2001/08/09 11:19:16 sewardj Exp $
* $Id: Printer.c,v 1.45 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team, 1994-2000.
*
......@@ -7,6 +7,7 @@
*
* ---------------------------------------------------------------------------*/
#include "PosixSource.h"
#include "Rts.h"
#include "Printer.h"
......
/* -----------------------------------------------------------------------------
* $Id: ProfHeap.c,v 1.24 2001/08/07 19:34:01 ken Exp $
* $Id: ProfHeap.c,v 1.25 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team, 1998-2000
*
......@@ -15,6 +15,7 @@
#if defined(PROFILING) || defined(DEBUG_HEAP_PROF)
#include "PosixSource.h"
#include "Rts.h"
#include "RtsUtils.h"
#include "RtsFlags.h"
......
/* -----------------------------------------------------------------------------
* $Id: Profiling.c,v 1.21 2001/07/23 23:37:35 andy Exp $
* $Id: Profiling.c,v 1.22 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team, 1998-2000
*
......@@ -9,6 +9,7 @@
#ifdef PROFILING
#include "PosixSource.h"
#include "Rts.h"
#include "RtsUtils.h"
#include "RtsFlags.h"
......
/* -----------------------------------------------------------------------------
* $Id: Proftimer.c,v 1.6 2000/04/03 15:54:49 simonmar Exp $
* $Id: Proftimer.c,v 1.7 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team, 1998-1999
*
......@@ -9,6 +9,7 @@
#if defined (PROFILING)
#include "PosixSource.h"
#include "Rts.h"
#include "Profiling.h"
#include "Itimer.h"
......
/* ----------------------------------------------------------------------------
* $Id: RtsAPI.c,v 1.27 2001/08/03 16:30:13 sof Exp $
* $Id: RtsAPI.c,v 1.28 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team, 1998-2001
*
......@@ -7,6 +7,7 @@
*
* --------------------------------------------------------------------------*/
#include "PosixSource.h"
#include "Rts.h"
#include "Storage.h"
#include "RtsAPI.h"
......
/* ----------------------------------------------------------------------------
* $Id: RtsAPIDeprec.c,v 1.1 2001/01/11 17:25:56 simonmar Exp $
* $Id: RtsAPIDeprec.c,v 1.2 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team, 1998-2001
*
......@@ -7,6 +7,7 @@
*
* --------------------------------------------------------------------------*/
#include "PosixSource.h"
#include "Rts.h"
#include "RtsUtils.h"
#include "Storage.h"
......
/* -----------------------------------------------------------------------------
* $Id: RtsDllMain.c,v 1.2 2000/04/26 17:27:00 rrt Exp $
* $Id: RtsDllMain.c,v 1.3 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team 1999-2000
*
......@@ -7,6 +7,7 @@
*
* ---------------------------------------------------------------------------*/
#include "PosixSource.h"
#include "Rts.h"
#include "RtsAPI.h"
......
/* -----------------------------------------------------------------------------
* $Id: RtsFlags.c,v 1.48 2001/08/13 12:34:37 simonmar Exp $
* $Id: RtsFlags.c,v 1.49 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The AQUA Project, Glasgow University, 1994-1997
* (c) The GHC Team, 1998-1999
......@@ -21,6 +21,7 @@
//@node Includes, Constants
//@subsection Includes
#include "PosixSource.h"
#include "Rts.h"
#include "RtsFlags.h"
#include "RtsUtils.h"
......
/* -----------------------------------------------------------------------------
* $Id: RtsStartup.c,v 1.51 2001/05/25 18:33:46 sof Exp $
* $Id: RtsStartup.c,v 1.52 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team, 1998-2000
*
......@@ -7,6 +7,7 @@
*
* ---------------------------------------------------------------------------*/
#include "PosixSource.h"
#include "Rts.h"
#include "RtsAPI.h"
#include "RtsUtils.h"
......
/* -----------------------------------------------------------------------------
* $Id: RtsUtils.c,v 1.19 2001/07/24 06:31:36 ken Exp $
* $Id: RtsUtils.c,v 1.20 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team, 1998-1999
*
......@@ -8,7 +8,7 @@
* ---------------------------------------------------------------------------*/
/* gettimeofday isn't POSIX */
#define NON_POSIX_SOURCE
/* #include "PosixSource.h" */
#include "Rts.h"
#include "RtsTypes.h"
......
/* -----------------------------------------------------------------------------
* $Id: Sanity.c,v 1.29 2001/07/24 05:04:59 ken Exp $
* $Id: Sanity.c,v 1.30 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team, 1998-2001
*
......@@ -14,6 +14,7 @@
*
* ---------------------------------------------------------------------------*/
#include "PosixSource.h"
#include "Rts.h"
#ifdef DEBUG /* whole file */
......
/* ---------------------------------------------------------------------------
* $Id: Schedule.c,v 1.99 2001/07/30 09:47:13 simonmar Exp $
* $Id: Schedule.c,v 1.100 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team, 1998-2000
*
......@@ -74,6 +74,7 @@
//@node Includes, Variables and Data structures, Main scheduling code, Main scheduling code
//@subsection Includes
#include "PosixSource.h"
#include "Rts.h"
#include "SchedAPI.h"
#include "RtsUtils.h"
......
/* -----------------------------------------------------------------------------
* $Id: Select.c,v 1.16 2001/02/28 14:23:55 sewardj Exp $
* $Id: Select.c,v 1.17 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team 1995-1999
*
......@@ -8,7 +8,7 @@
* ---------------------------------------------------------------------------*/
/* we're outside the realms of POSIX here... */
#define NON_POSIX_SOURCE
/* #include "PosixSource.h" */
#include "Rts.h"
#include "Schedule.h"
......
/* -----------------------------------------------------------------------------
* $Id: Signals.c,v 1.20 2001/07/26 03:24:01 ken Exp $
* $Id: Signals.c,v 1.21 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team, 1998-1999
*
......@@ -7,8 +7,9 @@
*
* ---------------------------------------------------------------------------*/
#define NON_POSIX_SOURCE
/* This is non=Posix compliant.
#include "PosixSource.h"
*/
#include "Rts.h"
#include "SchedAPI.h"
#include "Schedule.h"
......
/* ---------------------------------------------------------------------------
* $Id: Sparks.c,v 1.3 2001/03/22 03:51:10 hwloidl Exp $
* $Id: Sparks.c,v 1.4 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team, 2000
*
......@@ -20,6 +20,7 @@
//@node Includes, GUM code, Spark Management Routines, Spark Management Routines
//@subsection Includes
#include "PosixSource.h"
#include "Rts.h"
#include "Schedule.h"
#include "SchedAPI.h"
......
/* -----------------------------------------------------------------------------
* $Id: Stable.c,v 1.16 2001/08/08 16:03:47 simonmar Exp $
* $Id: Stable.c,v 1.17 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team, 1998-1999
*
......@@ -7,6 +7,7 @@
*
* ---------------------------------------------------------------------------*/
#include "PosixSource.h"
#include "Rts.h"
#include "Hash.h"
#include "StablePriv.h"
......
/* -----------------------------------------------------------------------------
* $Id: Stats.c,v 1.31 2001/07/23 17:23:20 simonmar Exp $
* $Id: Stats.c,v 1.32 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team, 1998-1999
*
......@@ -7,7 +7,9 @@
*
* ---------------------------------------------------------------------------*/
#define NON_POSIX_SOURCE
/* Alas, no. This source is non-posix.
#include "PosixSource.h"
*/
#include "Rts.h"
#include "RtsFlags.h"
......
/* -----------------------------------------------------------------------------
* $Id: StgCRun.c,v 1.25 2001/08/07 20:06:41 ken Exp $
* $Id: StgCRun.c,v 1.26 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team, 1998-2000
*
......@@ -33,6 +33,8 @@
*
* -------------------------------------------------------------------------- */
#include "PosixSource.h"
/*
* We define the following (unused) global register variables, because for
......@@ -78,19 +80,6 @@ register double fake_f9 __asm__("$f9");
any architecture (using miniinterpreter)
-------------------------------------------------------------------------- */
/* The static @jmp_environment@ variable allows @miniInterpret@ to
* communicate with @StgReturn@.
*
* Because @StgRun@ may be used recursively, we carefully
* save and restore the whole of @jmp_environment@.
*/
#include <setjmp.h>
#include <string.h> /* for memcpy */
static jmp_buf jmp_environment;
#if 1
extern StgThreadReturnCode StgRun(StgFunPtr f, StgRegTable *basereg)
{
while (f) {
......@@ -109,144 +98,6 @@ EXTFUN(StgReturn)
return 0;
}
#else
#define CHECK_STACK 0
#define STACK_DETAILS 0
static int enters = 0;
static void scanStackSeg ( W_* ptr, int nwords )
{
W_ w;
#if CHECK_STACK
int nwords0 = nwords;
#if STACK_DETAILS
while (nwords > 0) {
w = *ptr;
if (IS_ARG_TAG(w)) {
fprintf ( stderr, "%d",w ); nwords--; ptr++;
while (w) { fprintf(stderr, "_"); w--; nwords--; ptr++; }
}
else {
fprintf(stderr, "p");
nwords--; ptr++;
}
}
if (nwords < 0) fprintf(stderr, "erk: nwords < 0\n");
#endif
checkStackChunk ( ptr, ptr-nwords0 );
#endif
}
extern StgFunPtr stg_enterStackTop;
extern StgThreadReturnCode StgRun(StgFunPtr f, StgRegTable *basereg)
{
char* nm;
while (1) {
#if CHECK_STACK
{
int i;
StgTSO* tso = basereg->rCurrentTSO;
StgWord* sb = tso->stack + tso->stack_size;
StgWord* sp;
StgWord* su;
int ws;
if (f == &stg_enterStackTop) {
sp = tso->sp;
su = tso->su;
} else {
sp = basereg->rSp;
su = basereg->rSu;
}
#if STACK_DETAILS
fprintf(stderr,
"== SB = %p SP = %p(%p) SU = %p SpLim = %p(%p)\n",