projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[project @ 2002-12-05 23:49:43 by mthomas]
[ghc-hetmet.git]
/
ghc
/
includes
/
StgTypes.h
diff --git
a/ghc/includes/StgTypes.h
b/ghc/includes/StgTypes.h
index
ee15623
..
e864d81
100644
(file)
--- a/
ghc/includes/StgTypes.h
+++ b/
ghc/includes/StgTypes.h
@@
-1,68
+1,78
@@
/* -----------------------------------------------------------------------------
/* -----------------------------------------------------------------------------
- * $Id: StgTypes.h,v 1.2 1998/12/02 13:21:41 simonm Exp $
+ * $Id: StgTypes.h,v 1.18 2001/10/03 13:57:42 simonmar Exp $
+ *
+ * (c) The GHC Team, 1998-2000
+ *
+ * Various C datatypes used in the run-time system. This is the
+ * lowest-level include file, after config.h and Derived.h.
+ *
+ * This module should define types *only*, all beginning with "Stg".
*
*
- * Various C datatypes used in the run-time system.
-
* Specifically:
* Specifically:
- StgInt8, 16, 32, 64
- StgNat8, 16, 32, 64
+ StgInt8, 16, 32, 64
+ StgWord8, 16, 32, 64
StgChar, StgFloat, StgDouble
StgChar, StgFloat, StgDouble
- ***** All the same size: *****
+ ***** All the same size (i.e. sizeof(void *)): *****
StgPtr Basic pointer type
StgWord Unit of heap allocation
StgInt Signed version of StgWord
StgAddr Generic address type
StgPtr Basic pointer type
StgWord Unit of heap allocation
StgInt Signed version of StgWord
StgAddr Generic address type
+ StgBool, StgVoid, StgClosurePtr, StgPtr, StgOffset,
+ StgTSOPtr, StgForeignPtr, StgStackOffset, StgStackPtr,
+ StgCode, StgArray, StgByteArray, StgStablePtr, StgFunPtr,
+ StgUnion.
+ * WARNING: Keep this file, MachDeps.h, and HsFFI.h in synch!
+ *
+ * NOTE: assumes #include "config.h"
+ *
+ * Works with or without _POSIX_SOURCE.
*
* ---------------------------------------------------------------------------*/
#ifndef STGTYPES_H
#define STGTYPES_H
*
* ---------------------------------------------------------------------------*/
#ifndef STGTYPES_H
#define STGTYPES_H
+#include "Derived.h"
+
/*
* First, platform-dependent definitions of size-specific integers.
* Assume for now that the int type is 32 bits.
/*
* First, platform-dependent definitions of size-specific integers.
* Assume for now that the int type is 32 bits.
+ * NOTE: Synch the following definitions with MachDeps.h!
* ToDo: move these into a platform-dependent file.
*/
typedef signed char StgInt8;
* ToDo: move these into a platform-dependent file.
*/
typedef signed char StgInt8;
-typedef unsigned char StgNat8;
+typedef unsigned char StgWord8;
typedef signed short StgInt16;
typedef signed short StgInt16;
-typedef unsigned short StgNat16;
+typedef unsigned short StgWord16;
#if SIZEOF_UNSIGNED_INT == 4
typedef signed int StgInt32;
#if SIZEOF_UNSIGNED_INT == 4
typedef signed int StgInt32;
-typedef unsigned int StgNat32;
+typedef unsigned int StgWord32;
#else
#else
-#error GHC untested on this architecture: sizeof(unisgned int) != 4
-#endif
-
-/* This #define controls whether we need to support long longs on a particular
- * platform.
- *
- * ToDo: find a proper home for (derived) configuration information like this.
- */
-#if HAVE_LONG_LONG && SIZEOF_VOID_P < 8
-#define SUPPORT_LONG_LONGS
+#error GHC untested on this architecture: sizeof(unsigned int) != 4
#endif
#ifdef SUPPORT_LONG_LONGS
/* assume long long is 64 bits */
#endif
#ifdef SUPPORT_LONG_LONGS
/* assume long long is 64 bits */
-typedef unsigned long long int StgNat64;
typedef signed long long int StgInt64;
typedef signed long long int StgInt64;
+typedef unsigned long long int StgWord64;
#elif SIZEOF_LONG == 8
typedef signed long StgInt64;
#elif SIZEOF_LONG == 8
typedef signed long StgInt64;
-typedef unsigned long StgNat64;
+typedef unsigned long StgWord64;
+#elif defined(__MSVC__)
+typedef __int64 StgInt64;
+typedef unsigned __int64 StgWord64;
#else
#error GHC untested on this architecture: sizeof(void *) < 8 and no long longs.
#endif
#else
#error GHC untested on this architecture: sizeof(void *) < 8 and no long longs.
#endif
-
/*
* Define the standard word size we'll use on this machine: make it
* big enough to hold a pointer.
/*
* Define the standard word size we'll use on this machine: make it
* big enough to hold a pointer.
@@
-70,60
+80,51
@@
typedef unsigned long StgNat64;
#if SIZEOF_VOID_P == 8
typedef StgInt64 StgInt;
#if SIZEOF_VOID_P == 8
typedef StgInt64 StgInt;
-typedef StgNat64 StgWord;
+typedef StgWord64 StgWord;
#else
#if SIZEOF_VOID_P == 4
typedef StgInt32 StgInt;
#else
#if SIZEOF_VOID_P == 4
typedef StgInt32 StgInt;
-typedef StgNat32 StgWord;
+typedef StgWord32 StgWord;
#else
#error GHC untested on this architecture: sizeof(void *) != 4 or 8
#endif
#endif
#else
#error GHC untested on this architecture: sizeof(void *) != 4 or 8
#endif
#endif
+#define W_MASK (sizeof(W_)-1)
+
typedef void* StgAddr;
/*
* Other commonly-used STG datatypes.
*/
typedef void* StgAddr;
/*
* Other commonly-used STG datatypes.
*/
-typedef StgNat8 StgChar;
-
-/*
- * If a double fits in an StgWord, don't bother using floats.
- */
+typedef StgWord32 StgChar;
+typedef int StgBool;
-#if SIZEOF_DOUBLE == SIZEOF_VOID_P
-typedef double StgFloat;
-typedef double StgDouble;
-#define FLOATS_AS_DOUBLES 1
-#else
typedef float StgFloat;
typedef double StgDouble;
typedef float StgFloat;
typedef double StgDouble;
-#endif
typedef void StgVoid;
typedef void StgVoid;
-typedef struct StgClosure_* StgClosurePtr;
+typedef struct StgClosure_ StgClosure;
+typedef StgClosure* StgClosurePtr;
typedef StgWord* StgPtr; /* pointer into closure */
typedef StgWord StgOffset; /* byte offset within closure */
typedef struct StgTSO_* StgTSOPtr;
typedef StgWord* StgPtr; /* pointer into closure */
typedef StgWord StgOffset; /* byte offset within closure */
typedef struct StgTSO_* StgTSOPtr;
-typedef StgWord StgStablePtr;
-typedef void * StgForeignPtr;
+typedef void* StgForeignPtr;
typedef StgInt StgStackOffset; /* offset in words! */
typedef StgWord* StgStackPtr;
typedef StgInt StgStackOffset; /* offset in words! */
typedef StgWord* StgStackPtr;
-typedef StgNat8 StgCode; /* close enough */
-typedef StgCode* StgCodePtr;
+typedef StgWord8 StgCode; /* close enough */
typedef StgPtr* StgArray; /* the goods of an Array# */
typedef char* StgByteArray; /* the goods of a ByteArray# */
typedef StgPtr* StgArray; /* the goods of an Array# */
typedef char* StgByteArray; /* the goods of a ByteArray# */
-typedef StgInt64 LI_;
-typedef StgNat64 LW_;
+typedef void* StgStablePtr;
/*
Types for the generated C functions
/*
Types for the generated C functions
@@
-146,6
+147,7
@@
typedef union {
StgWord w;
StgAddr a;
StgChar c;
StgWord w;
StgAddr a;
StgChar c;
+ StgInt8 i8;
StgFloat f;
StgInt i;
StgPtr p;
StgFloat f;
StgInt i;
StgPtr p;
@@
-155,33
+157,4
@@
typedef union {
StgTSOPtr t;
} StgUnion;
StgTSOPtr t;
} StgUnion;
-/*
- * Shorthand forms
- */
-
-typedef StgChar C_;
-typedef StgWord W_;
-typedef StgWord* P_;
-typedef P_* PP_;
-typedef StgInt I_;
-typedef StgAddr A_;
-typedef const StgWord* D_;
-typedef StgFunPtr F_;
-typedef StgByteArray B_;
-typedef StgClosurePtr L_;
-
-/*
- * We often want to know the size of something in units of an
- * StgWord... (rounded up, of course!)
- */
-
-#define sizeofW(t) ((sizeof(t)+sizeof(W_)-1)/sizeof(W_))
-
-/*
- * It's nice to be able to grep for casts
- */
-
-#define stgCast(ty,e) ((ty)(e))
-
-#endif STGTYPES_H
-
+#endif /* STGTYPES_H */