README 3.55 KB
Newer Older
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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
-----------------------------------------------------------------------------
The External API to the GHC Runtime System.
-----------------------------------------------------------------------------

The header files in this directory form the external API for the
runtime.  The header files are used in the following scenarios:

  1. Included into the RTS source code itself.
	In this case we include "Rts.h", which includes everything
	else in the appropriate order.

	Pretty much everything falls into this category.

  2. Included into a .hc file generated by the compiler.
	In this case we include Stg.h, which includes a
	subset of the headers, in the appropriate order and
	with the appropriate settings (e.g. global register variables
	turned on).

	Includes everything below Stg.h in the hierarchy (see below).

  3. Included into external C source code.
	The following headers are designed to be included into
        external C  code (i.e. C code compiled using a GHC installation,
        not part of GHC itself or the RTS):

		HsFFI.h
		RtsAPI.h
		SchedAPI.h
		RtsFlags.h
		Linker.h

	These interfaces are intended to be relatively stable.

	Also Rts.h can be included to get hold of everything else, including
	definitions of heap objects, info tables, the storage manager interface
	and so on.  But be warned: none of this is guaranteed to remain stable
	from one GHC release to the next.

  4. Included into non-C source code, including Haskell (GHC itself)
     and C-- code in the RTS.

	The following headers are #included into non-C source, so
	cannot contain any C code or declarations:
		config.h
		RtsConfig.h
		Constants.h
		DerivedConstants.h
		ClosureTypes.h
		StgFun.h
		MachRegs.h
		Liveness.h
		StgLdvProf.h

Here is a rough hierarchy of the header files by dependency.

Rts.h
  Stg.h
59 60 61 62 63 64 65 66
    ghcconfig.h		/* configuration info derived by the configure script. */
    RtsConfig.h		/* settings for Rts things (eg. eager vs. lazy BH) */
    MachDeps.h		/* sizes of various basic types */
    StgTypes.h		/* basic types specific to the virtual machine */
    TailCalls.h		/* tail calls in .hc code */
    StgDLL.h		/* stuff related to Windows DLLs */
    MachRegs.h		/* global register assignments for this arch */
    Regs.h		/* "registers" in the virtual machine */
Simon Marlow's avatar
Simon Marlow committed
67
    TickyCounters.h
68
    StgMiscClosures.h	/* decls for closures & info tables in the RTS */
69
    SMP.h               /* basic primitives for synchronisation */
70

71
  RtsTypes.h		/* types used in the RTS */
72

73
  Constants.h		/* build-time constants */
74 75
  StgLdvProf.h
  StgFun.h
76
  StgProf.h		/* profiling gubbins */
77
  Closures.h
78
  Liveness.h		/* macros for constructing RET_DYN liveness masks */
79 80 81
  ClosureMacros.h
  ClosureTypes.h
  InfoTables.h
82 83
  SMPClosureOps.h       /* lockClosure/unlockClosure etc. */
  SpinLock.h
84
  TSO.h
85
  Updates.h		/* macros for performing updates */
86 87 88 89 90
  Parallel.h
  Block.h
  Stable.h
  Hooks.h
  Signals.h
Simon Marlow's avatar
Simon Marlow committed
91 92 93
  Adjustor.h            /* foreign import "wrapper", aka adjustors */
  StgPrimFloat.h        /* primitive floating-point operations */
  Hpc.h
94

95 96 97
Cmm.h			/* included into .cmm source only */
  DerivedConstants.h	/* generated by mkDerivedConstants.c from other */
			/* .h files. */
98 99 100 101 102 103 104
  (Constants.h)
  (ClosureTypes.h)
  (StgFun.h)
  (MachRegs.h)
  (Liveness.h)  
  (Block.h)

105 106 107 108 109
Bytecodes.h	/* Bytecode definitions for the interpreter */
Linker.h	/* External API to the linker */
RtsFlags.h	/* External API to the RTS runtime flags */
SchedAPI.h	/* External API to the RTS scheduler */
ieee-flpt.h	/* ToDo: needed? */
110

111 112
RtsAPI.h	/* The top-level interface to the RTS (rts_evalIO(), etc.) */
HsFFI.h		/* The external FFI api */