/* -----------------------------------------------------------------------------
- * $Id: Block.h,v 1.4 1999/02/05 16:02:19 simonm Exp $
+ * $Id: Block.h,v 1.5 1999/03/02 19:44:07 sof Exp $
*
* (c) The GHC Team, 1998-1999
*
struct _bdescr *back; /* used (occasionally) for doubly-linked lists*/
struct _generation *gen; /* generation */
struct _step *step; /* step */
- StgNat32 blocks; /* no. of blocks (if grp head, 0 otherwise) */
- StgNat32 evacuated; /* block is in to-space */
+ StgWord32 blocks; /* no. of blocks (if grp head, 0 otherwise) */
+ StgWord32 evacuated; /* block is in to-space */
#if SIZEOF_VOID_P == 8
- StgNat32 _padding[2];
+ StgWord32 _padding[2];
#else
- StgNat32 _padding[0];
+ StgWord32 _padding[0];
#endif
} bdescr;
/* ----------------------------------------------------------------------------
- * $Id: ClosureMacros.h,v 1.4 1999/02/05 16:02:20 simonm Exp $
+ * $Id: ClosureMacros.h,v 1.5 1999/03/02 19:44:08 sof Exp $
*
* (c) The GHC Team, 1998-1999
*
#define IS_DATA_PTR(p) ((P_)(p) >= (P_)&TEXT_SECTION_END_MARKER && (P_)(p) < (P_)&DATA_SECTION_END_MARKER)
#define IS_USER_PTR(p) ((P_)(p) >= (P_)&DATA_SECTION_END_MARKER)
+#ifdef HAVE_WIN32_DLL_SUPPORT
+/* ToDo: clean up */
+extern char* base_non_committed;
+#define HEAP_ALLOCED(x) (((char*)(x) >= base_non_committed) && ((char*)(x) <= (base_non_committed + 128 * 1024 * 1024)))
+#endif
+
+#ifndef HAVE_WIN32_DLL_SUPPORT
+#define LOOKS_LIKE_STATIC(r) IS_DATA_PTR(r)
+#else
+/* Static closures are 'identified' by being prefixed with a zero. This is
+ so that they can be distinguished from pointers to info tables. Relies
+ on the fact that info tables are reversed.
+
+ LOOKS_LIKE_STATIC_CLOSURE() - discriminates between static closures and info tbls
+ (needed by LOOKS_LIKE_GHC_INFO() below - [Win32 DLLs only.])
+ LOOKS_LIKE_STATIC() - distinguishes between static and heap allocated data.
+ */
+#define LOOKS_LIKE_STATIC(r) (!(HEAP_ALLOCED(r)))
+#define LOOKS_LIKE_STATIC_CLOSURE(r) ((*(((unsigned long *)(r))-1)) == 0)
+#endif
+
+
/* -----------------------------------------------------------------------------
Macros for distinguishing infotables from closures.
#define LOOKS_LIKE_GHC_INFO(info) IS_CODE_PTR(info)
#else
/* otherwise we have entry pointers on closures */
-#define LOOKS_LIKE_GHC_INFO(info) IS_CODE_PTR(info)
+# ifdef HAVE_WIN32_DLL_SUPPORT
+# define LOOKS_LIKE_GHC_INFO(info) (!HEAP_ALLOCED(info) && !LOOKS_LIKE_STATIC_CLOSURE(info))
+# else
+# define LOOKS_LIKE_GHC_INFO(info) IS_CODE_PTR(info)
+# endif
#endif
-#define LOOKS_LIKE_STATIC(r) IS_DATA_PTR(r)
-
/* -----------------------------------------------------------------------------
Macros for calculating how big a closure will be (used during allocation)
-------------------------------------------------------------------------- */
#define bcoConstChar( bco, i ) (*stgCast(StgChar*, ((bco)->payload+(bco)->n_ptrs+i)))
#define bcoConstFloat( bco, i ) (PK_FLT(stgCast(StgWord*,(bco)->payload+(bco)->n_ptrs+i)))
#define bcoConstDouble( bco, i ) (PK_DBL(stgCast(StgWord*,(bco)->payload+(bco)->n_ptrs+i)))
-#define bcoInstr( bco, i ) (stgCast(StgNat8*, ((bco)->payload+(bco)->n_ptrs+(bco)->n_words))[i])
+#define bcoInstr( bco, i ) (stgCast(StgWord8*, ((bco)->payload+(bco)->n_ptrs+(bco)->n_words))[i])
#endif /* CLOSUREMACROS_H */
/* ----------------------------------------------------------------------------
- * $Id: InfoMacros.h,v 1.3 1999/02/05 16:02:22 simonm Exp $
+ * $Id: InfoMacros.h,v 1.4 1999/03/02 19:44:09 sof Exp $
*
* (c) The GHC Team, 1998-1999
*
prof_descr, prof_type) \
entry_class(entry); \
info_class StgInfoTable info = { \
- layout : { bitmap : (StgNat32)bitmap_ },\
+ layout : { bitmap : (StgWord32)bitmap_ },\
SRT_INFO(type,srt_,srt_off_,srt_len_), \
INIT_ENTRY(entry) \
}
#define VEC_INFO_TABLE(bitmap_,srt_,srt_off_,srt_len_,type) \
i : { \
- layout : { bitmap : (StgNat32)bitmap_ }, \
+ layout : { bitmap : (StgWord32)bitmap_ }, \
SRT_INFO(type,srt_,srt_off_,srt_len_) \
}
#define VEC_POLY_INFO_TABLE(nm,bitmap_,srt_,srt_off_,srt_len_,type) \
StgFunPtr nm##_vec[8] = POLY_VEC(nm); \
const StgInfoTable nm##_info = { \
- layout : { bitmap : (StgNat32)bitmap_ }, \
+ layout : { bitmap : (StgWord32)bitmap_ }, \
SRT_INFO(type,srt_,srt_off_,srt_len_), \
vector : &nm##_vec, \
INIT_ENTRY(nm##_entry) \
const vec_info_8 nm##_info = { \
vec : POLY_VEC(nm), \
i : { \
- layout : { bitmap : (StgNat32)bitmap_ }, \
+ layout : { bitmap : (StgWord32)bitmap_ }, \
SRT_INFO(type,srt_,srt_off_,srt_len_), \
INIT_ENTRY(nm##_entry) \
} \
#define BITMAP(lbl,size) \
static const StgLargeBitmap lbl = { size, {
+/* DLL_SRT_ENTRY is used on the Win32 side when filling initialising
+ an entry in an SRT table with a reference to a closure that's
+ living in a DLL. See elsewhere for reasons as to why we need
+ to distinguish these kinds of references.
+ (ToDo: fill in a more precise href.)
+*/
+#ifdef HAVE_WIN32_DLL_SUPPORT
+#define DLL_SRT_ENTRY(x) ((StgClosure*)(((char*)&DLL_IMPORT_DATA_VAR(x)) + 1))
+#else
+#define DLL_SRT_ENTRY(x) no-can-do
+#endif
+
#endif /* INFOMACROS_H */
/* ----------------------------------------------------------------------------
- * $Id: InfoTables.h,v 1.11 1999/02/15 12:12:55 simonm Exp $
+ * $Id: InfoTables.h,v 1.12 1999/03/02 19:44:10 sof Exp $
*
* (c) The GHC Team, 1998-1999
*
*/
typedef union {
-
- StgWord bitmap; /* bit pattern, 1 = pointer, 0 = non-pointer */
- StgWord selector_offset; /* used in THUNK_SELECTORs */
- StgLargeBitmap* large_bitmap; /* pointer to large bitmap structure */
-
#if SIZEOF_VOID_P == 8
struct {
- StgNat32 ptrs; /* number of pointers */
- StgNat32 nptrs; /* number of non-pointers */
+ StgWord32 ptrs; /* number of pointers */
+ StgWord32 nptrs; /* number of non-pointers */
} payload;
#else
struct {
- StgNat16 ptrs; /* number of pointers */
- StgNat16 nptrs; /* number of non-pointers */
+ StgWord16 ptrs; /* number of pointers */
+ StgWord16 nptrs; /* number of non-pointers */
} payload;
+
+ StgWord bitmap; /* bit pattern, 1 = pointer, 0 = non-pointer */
+ StgWord selector_offset; /* used in THUNK_SELECTORs */
+ StgLargeBitmap* large_bitmap; /* pointer to large bitmap structure */
+
#endif
} StgClosureInfo;
#endif
StgClosureInfo layout; /* closure layout info (pointer-sized) */
#if SIZEOF_VOID_P == 8
- StgNat16 flags; /* } */
+ StgWord16 flags; /* } */
StgClosureType type : 16; /* } These 4 elements fit into 64 bits */
- StgNat32 srt_len; /* } */
+ StgWord32 srt_len; /* } */
#else
- StgNat8 flags; /* } */
+ StgWord8 flags; /* } */
StgClosureType type : 8; /* } These 4 elements fit into 32 bits */
- StgNat16 srt_len; /* } */
+ StgWord16 srt_len; /* } */
#endif
#if USE_MINIINTERPRETER
StgFunPtr (*vector)[];
/* -----------------------------------------------------------------------------
- * $Id: Prelude.h,v 1.5 1999/02/05 16:02:24 simonm Exp $
+ * $Id: Prelude.h,v 1.6 1999/03/02 19:44:11 sof Exp $
*
* (c) The GHC Team, 1998-1999
*
#ifndef PRELUDE_H
#define PRELUDE_H
+#ifdef COMPILING_RTS
+
#ifdef COMPILER
-extern const StgClosure PrelBase_Z91Z93_static_closure;
-extern const StgClosure PrelBase_Z40Z41_static_closure;
-extern const StgClosure PrelBase_True_static_closure;
-extern const StgClosure PrelBase_False_static_closure;
+extern DLL_IMPORT const StgClosure PrelBase_Z91Z93_static_closure;
+extern DLL_IMPORT const StgClosure PrelBase_Z40Z41_static_closure;
+extern DLL_IMPORT const StgClosure PrelBase_True_static_closure;
+extern DLL_IMPORT const StgClosure PrelBase_False_static_closure;
+extern DLL_IMPORT const StgClosure PrelPack_unpackCString_closure;
extern const StgClosure PrelMain_mainIO_closure;
-extern const StgClosure PrelPack_unpackCString_closure;
-extern const StgInfoTable PrelBase_Czh_static_info;
-extern const StgInfoTable PrelBase_Izh_static_info;
-extern const StgInfoTable PrelBase_Fzh_static_info;
-extern const StgInfoTable PrelBase_Dzh_static_info;
-extern const StgInfoTable PrelAddr_Azh_static_info;
-extern const StgInfoTable PrelAddr_Wzh_static_info;
-extern const StgInfoTable PrelBase_Czh_con_info;
-extern const StgInfoTable PrelBase_Izh_con_info;
-extern const StgInfoTable PrelBase_Fzh_con_info;
-extern const StgInfoTable PrelBase_Dzh_con_info;
-extern const StgInfoTable PrelAddr_Azh_con_info;
-extern const StgInfoTable PrelAddr_Wzh_con_info;
-extern const StgInfoTable PrelAddr_I64zh_con_info;
-extern const StgInfoTable PrelAddr_W64zh_con_info;
-extern const StgInfoTable PrelStable_StablePtr_static_info;
-extern const StgInfoTable PrelStable_StablePtr_con_info;
+extern DLL_IMPORT const StgInfoTable PrelBase_Czh_static_info;
+extern DLL_IMPORT const StgInfoTable PrelBase_Izh_static_info;
+extern DLL_IMPORT const StgInfoTable PrelBase_Fzh_static_info;
+extern DLL_IMPORT const StgInfoTable PrelBase_Dzh_static_info;
+extern DLL_IMPORT const StgInfoTable PrelAddr_Azh_static_info;
+extern DLL_IMPORT const StgInfoTable PrelAddr_Wzh_static_info;
+extern DLL_IMPORT const StgInfoTable PrelBase_Czh_con_info;
+extern DLL_IMPORT const StgInfoTable PrelBase_Izh_con_info;
+extern DLL_IMPORT const StgInfoTable PrelBase_Fzh_con_info;
+extern DLL_IMPORT const StgInfoTable PrelBase_Dzh_con_info;
+extern DLL_IMPORT const StgInfoTable PrelAddr_Azh_con_info;
+extern DLL_IMPORT const StgInfoTable PrelAddr_Wzh_con_info;
+extern DLL_IMPORT const StgInfoTable PrelAddr_I64zh_con_info;
+extern DLL_IMPORT const StgInfoTable PrelAddr_W64zh_con_info;
+extern DLL_IMPORT const StgInfoTable PrelStable_StablePtr_static_info;
+extern DLL_IMPORT const StgInfoTable PrelStable_StablePtr_con_info;
/* Define canonical names so we can abstract away from the actual
* module these names are defined in.
#endif
+#endif
+
#endif /* PRELUDE_H */
/* -----------------------------------------------------------------------------
- * $Id: PrimOps.h,v 1.21 1999/03/01 10:25:20 simonm Exp $
+ * $Id: PrimOps.h,v 1.22 1999/03/02 19:44:12 sof Exp $
*
* (c) The GHC Team, 1998-1999
*
#define zlzezhzh(r,a,b) r=(I_)((a)<=(b))
/* used by returning comparison primops, defined in Prims.hc. */
-extern const StgClosure *PrelBase_Bool_closure_tbl[];
+extern DLL_IMPORT_RTS const StgClosure *PrelBase_Bool_closure_tbl[];
/* -----------------------------------------------------------------------------
Char# PrimOps.
#define integerToWord64zh(r, sa,da) \
{ unsigned long int* d; \
I_ aa; \
- StgNat64 res; \
+ StgWord64 res; \
\
d = (unsigned long int *) (BYTE_ARR_CTS(da)); \
aa = ((StgArrWords *)da)->words; \
/* The rest are (way!) out of line, implemented via C entry points.
*/
-I_ stg_gtWord64 (StgNat64, StgNat64);
-I_ stg_geWord64 (StgNat64, StgNat64);
-I_ stg_eqWord64 (StgNat64, StgNat64);
-I_ stg_neWord64 (StgNat64, StgNat64);
-I_ stg_ltWord64 (StgNat64, StgNat64);
-I_ stg_leWord64 (StgNat64, StgNat64);
+I_ stg_gtWord64 (StgWord64, StgWord64);
+I_ stg_geWord64 (StgWord64, StgWord64);
+I_ stg_eqWord64 (StgWord64, StgWord64);
+I_ stg_neWord64 (StgWord64, StgWord64);
+I_ stg_ltWord64 (StgWord64, StgWord64);
+I_ stg_leWord64 (StgWord64, StgWord64);
I_ stg_gtInt64 (StgInt64, StgInt64);
I_ stg_geInt64 (StgInt64, StgInt64);
I_ stg_ltInt64 (StgInt64, StgInt64);
I_ stg_leInt64 (StgInt64, StgInt64);
-LW_ stg_remWord64 (StgNat64, StgNat64);
-LW_ stg_quotWord64 (StgNat64, StgNat64);
+LW_ stg_remWord64 (StgWord64, StgWord64);
+LW_ stg_quotWord64 (StgWord64, StgWord64);
LI_ stg_remInt64 (StgInt64, StgInt64);
LI_ stg_quotInt64 (StgInt64, StgInt64);
LI_ stg_minusInt64 (StgInt64, StgInt64);
LI_ stg_timesInt64 (StgInt64, StgInt64);
-LW_ stg_and64 (StgNat64, StgNat64);
-LW_ stg_or64 (StgNat64, StgNat64);
-LW_ stg_xor64 (StgNat64, StgNat64);
-LW_ stg_not64 (StgNat64);
+LW_ stg_and64 (StgWord64, StgWord64);
+LW_ stg_or64 (StgWord64, StgWord64);
+LW_ stg_xor64 (StgWord64, StgWord64);
+LW_ stg_not64 (StgWord64);
-LW_ stg_shiftL64 (StgNat64, StgInt);
-LW_ stg_shiftRL64 (StgNat64, StgInt);
+LW_ stg_shiftL64 (StgWord64, StgInt);
+LW_ stg_shiftRL64 (StgWord64, StgInt);
LI_ stg_iShiftL64 (StgInt64, StgInt);
LI_ stg_iShiftRL64 (StgInt64, StgInt);
LI_ stg_iShiftRA64 (StgInt64, StgInt);
LW_ stg_int64ToWord64 (StgInt64);
LW_ stg_wordToWord64 (StgWord);
-W_ stg_word64ToWord (StgNat64);
-LI_ stg_word64ToInt64 (StgNat64);
+W_ stg_word64ToWord (StgWord64);
+LI_ stg_word64ToInt64 (StgWord64);
#endif
/* -----------------------------------------------------------------------------
/* -----------------------------------------------------------------------------
- * $Id: Regs.h,v 1.3 1999/02/05 16:02:26 simonm Exp $
+ * $Id: Regs.h,v 1.4 1999/03/02 19:44:14 sof Exp $
*
* (c) The GHC Team, 1998-1999
*
StgFloat rF4;
StgDouble rD1;
StgDouble rD2;
- StgNat64 rL1;
+ StgWord64 rL1;
StgPtr rSp;
StgUpdateFrame *rSu;
StgPtr rSpLim;
StgPtr rHpLim;
} StgRegTable;
-extern StgRegTable MainRegTable;
+extern DLL_IMPORT_RTS StgRegTable MainRegTable;
/*
* Registers Hp and HpLim are global across the entire system, and are
#endif
#ifdef REG_L1
-GLOBAL_REG_DECL(StgNat64,L1,REG_L1)
+GLOBAL_REG_DECL(StgWord64,L1,REG_L1)
#else
#define L1 (BaseReg->rL1)
#endif
/* ----------------------------------------------------------------------------
- * $Id: RtsAPI.h,v 1.3 1999/02/05 16:02:27 simonm Exp $
+ * $Id: RtsAPI.h,v 1.4 1999/03/02 19:44:15 sof Exp $
*
* (c) The GHC Team, 1998-1999
*
------------------------------------------------------------------------- */
char rts_getChar ( HaskellObj );
int rts_getInt ( HaskellObj );
+int rts_getInt32 ( HaskellObj );
unsigned int rts_getWord ( HaskellObj );
+unsigned int rts_getWord32 ( HaskellObj );
float rts_getFloat ( HaskellObj );
double rts_getDouble ( HaskellObj );
StgStablePtr rts_getStablePtr ( HaskellObj );
/* -----------------------------------------------------------------------------
- * $Id: Stable.h,v 1.3 1999/02/26 12:46:45 simonm Exp $
+ * $Id: Stable.h,v 1.4 1999/03/02 19:44:16 sof Exp $
*
* (c) The GHC Team, 1998-1999
*
StgClosure *sn_obj; /* the StableName object (or NULL) */
} snEntry;
-extern snEntry *stable_ptr_table;
-extern snEntry *stable_ptr_free;
+extern DLL_IMPORT_RTS snEntry *stable_ptr_table;
+extern DLL_IMPORT_RTS snEntry *stable_ptr_free;
-extern unsigned int SPT_size;
+extern DLL_IMPORT_RTS unsigned int SPT_size;
extern inline StgPtr
deRefStablePtr(StgStablePtr sp)
/* -----------------------------------------------------------------------------
- * $Id: Stg.h,v 1.6 1999/02/05 16:02:28 simonm Exp $
+ * $Id: Stg.h,v 1.7 1999/03/02 19:44:17 sof Exp $
*
* (c) The GHC Team, 1998-1999
*
#define COMPILER 1
#endif
+/* This is a feature test - doesn't belong here. FixMe. */
+#ifdef __MINGW32__
+#define HAVE_WIN32_DLL_SUPPORT
+#endif
+
+#ifdef HAVE_WIN32_DLL_SUPPORT
+# if __GNUC__ && !defined(__declspec)
+# define DLLIMPORT
+# else
+# define DLLIMPORT __declspec(dllimport)
+# define DLLIMPORT_DATA(x) _imp__##x
+# endif
+#else
+# define DLLIMPORT
+#endif
+
+#ifdef COMPILING_RTS
+#define DLL_IMPORT DLLIMPORT
+#define DLL_IMPORT_RTS
+#define DLL_IMPORT_DATA
+#define DLL_IMPORT_DATA_VAR(x) x
+#else
+#define DLL_IMPORT
+#define DLL_IMPORT_RTS DLLIMPORT
+#define DLL_IMPORT_DATA DLLIMPORT
+#define DLL_IMPORT_DATA_VAR(x) _imp__##x
+#endif
+
/* bit macros
*/
#define BITS_PER_BYTE 8
#include "Hooks.h"
/* Misc stuff without a home */
+#ifdef BUILDING_RTS_DLL
+extern DLLIMPORT char **prog_argv; /* so we can get at these from Haskell */
+extern DLLIMPORT int prog_argc;
+#else
extern char **prog_argv; /* so we can get at these from Haskell */
extern int prog_argc;
+#endif
extern char **environ;
/* -----------------------------------------------------------------------------
- * $Id: StgMacros.h,v 1.6 1999/02/26 09:28:43 simonm Exp $
+ * $Id: StgMacros.h,v 1.7 1999/03/02 19:44:18 sof Exp $
*
* (c) The GHC Team, 1998-1999
*
--------------------------------------------------------------------------- */
#define STGFUN(f) StgFunPtr f(void)
-#define STATICFUN(f) static StgFunPtr f(void)
#define EXTFUN(f) extern StgFunPtr f(void)
+#define EXTFUN_RTS(f) extern DLL_IMPORT_RTS StgFunPtr f(void)
#define FN_(f) F_ f(void)
#define IFN_(f) static F_ f(void)
#define IF_(f) static F_ f(void)
#define EF_(f) extern F_ f(void)
+#define EDF_(f) extern DLLIMPORT F_ f(void)
#define ED_ extern
+#define EDD_ extern DLLIMPORT
#define ED_RO_ extern const
#define ID_ extern
#define ID_RO_ extern const
#define EI_ extern const StgInfoTable
+#define EDI_ extern DLLIMPORT const StgInfoTable
#define II_ extern const StgInfoTable
#define EC_ extern StgClosure
+#define EDC_ extern DLLIMPORT StgClosure
#define IC_ extern StgClosure
/* -----------------------------------------------------------------------------
/* -----------------------------------------------------------------------------
Argument checks.
- If (Sp + <n_args>) > Su { JMP_(stg_updatePAP); }
+ If (Sp + <n_args>) > Su { JMP_(stg_update_PAP); }
Sp points to the topmost used word on the stack, and Su points to
the most recently pushed update frame.
#define STK_CHK(headroom,ret,r,layout,tag_assts) \
if (Sp - headroom < SpLim) { \
- EXTFUN(stg_chk_##layout); \
+ EXTFUN_RTS(stg_chk_##layout); \
tag_assts \
(r) = (P_)ret; \
JMP_(stg_chk_##layout); \
#define HP_CHK(headroom,ret,r,layout,tag_assts) \
if ((Hp += headroom) > HpLim) { \
- EXTFUN(stg_chk_##layout); \
+ EXTFUN_RTS(stg_chk_##layout); \
tag_assts \
(r) = (P_)ret; \
JMP_(stg_chk_##layout); \
#define HP_STK_CHK(stk_headroom,hp_headroom,ret,r,layout,tag_assts) \
if (Sp - stk_headroom < SpLim || (Hp += hp_headroom) > HpLim) { \
- EXTFUN(stg_chk_##layout); \
+ EXTFUN_RTS(stg_chk_##layout); \
tag_assts \
(r) = (P_)ret; \
JMP_(stg_chk_##layout); \
#define STK_CHK_NP(headroom,ptrs,tag_assts) \
if ((Sp - (headroom)) < SpLim) { \
- EXTFUN(stg_gc_enter_##ptrs); \
+ EXTFUN_RTS(stg_gc_enter_##ptrs); \
tag_assts \
JMP_(stg_gc_enter_##ptrs); \
}
#define HP_CHK_NP(headroom,ptrs,tag_assts) \
if ((Hp += (headroom)) > HpLim) { \
- EXTFUN(stg_gc_enter_##ptrs); \
+ EXTFUN_RTS(stg_gc_enter_##ptrs); \
tag_assts \
JMP_(stg_gc_enter_##ptrs); \
} \
#define HP_CHK_SEQ_NP(headroom,ptrs,tag_assts) \
if ((Hp += (headroom)) > HpLim) { \
- EXTFUN(stg_gc_seq_##ptrs); \
+ EXTFUN_RTS(stg_gc_seq_##ptrs); \
tag_assts \
JMP_(stg_gc_seq_##ptrs); \
} \
#define HP_STK_CHK_NP(stk_headroom, hp_headroom, ptrs, tag_assts) \
if ((Sp - (stk_headroom)) < SpLim || (Hp += (hp_headroom)) > HpLim) { \
- EXTFUN(stg_gc_enter_##ptrs); \
+ EXTFUN_RTS(stg_gc_enter_##ptrs); \
tag_assts \
JMP_(stg_gc_enter_##ptrs); \
} \
#define GEN_HP_CHK_ALT(headroom,lbl,tag_assts) \
if ((Hp += (headroom)) > HpLim) { \
- EXTFUN(lbl); \
+ EXTFUN_RTS(lbl); \
tag_assts \
JMP_(lbl); \
} \
out to be slowing us down we can make specialised ones.
-------------------------------------------------------------------------- */
+EF_(stg_gen_yield);
+EF_(stg_gen_block);
+
#define YIELD(liveness,reentry) \
{ \
- EF_(stg_gen_yield); \
R9.w = (W_)LIVENESS_MASK(liveness); \
R10.w = (W_)reentry; \
JMP_(stg_gen_yield); \
#define BLOCK(liveness,reentry) \
{ \
- EF_(stg_gen_block); \
R9.w = (W_)LIVENESS_MASK(liveness); \
R10.w = (W_)reentry; \
JMP_(stg_gen_block); \
#define BLOCK_NP(ptrs) \
{ \
- EF_(stg_bock_##ptrs); \
+ EF_(stg_block_##ptrs); \
JMP_(stg_block_##ptrs); \
}
We use a RET_DYN frame the same as for a dynamic heap check.
------------------------------------------------------------------------- */
+#if COMPILING_RTS
EI_(stg_gen_chk_info);
-
+#else
+EDI_(stg_gen_chk_info);
+#endif
/* -----------------------------------------------------------------------------
Vectored Returns
} int64_thing;
typedef union
- { StgNat64 w;
+ { StgWord64 w;
unpacked_double_word wu;
} word64_thing;
-static inline void ASSIGN_Word64(W_ p_dest[], StgNat64 src)
+static inline void ASSIGN_Word64(W_ p_dest[], StgWord64 src)
{
word64_thing y;
y.w = src;
p_dest[1] = y.wu.dlo;
}
-static inline StgNat64 PK_Word64(W_ p_src[])
+static inline StgWord64 PK_Word64(W_ p_src[])
{
word64_thing y;
y.wu.dhi = p_src[0];
Catch frames
-------------------------------------------------------------------------- */
-extern const StgPolyInfoTable catch_frame_info;
+extern DLL_IMPORT_DATA const StgPolyInfoTable catch_frame_info;
/* -----------------------------------------------------------------------------
Seq frames
an update...
-------------------------------------------------------------------------- */
-extern const StgPolyInfoTable seq_frame_info;
+extern DLL_IMPORT_DATA const StgPolyInfoTable seq_frame_info;
#define PUSH_SEQ_FRAME(sp) \
{ \
LoadThreadState (void)
{
#ifdef REG_Base
- BaseReg = &MainRegTable;
+ BaseReg = (StgRegTable*)&MainRegTable;
#endif
Sp = CurrentTSO->sp;
/* -----------------------------------------------------------------------------
- * $Id: StgMiscClosures.h,v 1.10 1999/02/11 17:40:23 simonm Exp $
+ * $Id: StgMiscClosures.h,v 1.11 1999/03/02 19:44:20 sof Exp $
*
* (c) The GHC Team, 1998-1999
*
/* info tables */
-extern const StgInfoTable IND_info;
-extern const StgInfoTable IND_STATIC_info;
-extern const StgInfoTable IND_PERM_info;
-extern const StgInfoTable IND_OLDGEN_info;
-extern const StgInfoTable IND_OLDGEN_PERM_info;
-extern const StgInfoTable CAF_UNENTERED_info;
-extern const StgInfoTable CAF_ENTERED_info;
-extern const StgInfoTable CAF_BLACKHOLE_info;
-extern const StgInfoTable BLACKHOLE_info;
-extern const StgInfoTable BLACKHOLE_BQ_info;
-extern const StgInfoTable BCO_info;
-extern const StgInfoTable EVACUATED_info;
-extern const StgInfoTable FOREIGN_info;
-extern const StgInfoTable WEAK_info;
-extern const StgInfoTable DEAD_WEAK_info;
-extern const StgInfoTable NO_FINALIZER_info;
-extern const StgInfoTable STABLE_NAME_info;
-extern const StgInfoTable FULL_MVAR_info;
-extern const StgInfoTable EMPTY_MVAR_info;
-extern const StgInfoTable TSO_info;
-extern const StgInfoTable ARR_WORDS_info;
-extern const StgInfoTable MUT_ARR_PTRS_info;
-extern const StgInfoTable MUT_ARR_PTRS_FROZEN_info;
-extern const StgInfoTable MUT_VAR_info;
-extern const StgInfoTable END_TSO_QUEUE_info;
-extern const StgInfoTable MUT_CONS_info;
-extern const StgInfoTable END_MUT_LIST_info;
-extern const StgInfoTable catch_info;
-extern const StgInfoTable seq_info;
-extern const StgInfoTable dummy_ret_info;
+extern DLL_IMPORT_RTS const StgInfoTable IND_info;
+extern DLL_IMPORT_RTS const StgInfoTable IND_STATIC_info;
+extern DLL_IMPORT_RTS const StgInfoTable IND_PERM_info;
+extern DLL_IMPORT_RTS const StgInfoTable IND_OLDGEN_info;
+extern DLL_IMPORT_RTS const StgInfoTable IND_OLDGEN_PERM_info;
+extern DLL_IMPORT_RTS const StgInfoTable CAF_UNENTERED_info;
+extern DLL_IMPORT_RTS const StgInfoTable CAF_ENTERED_info;
+extern DLL_IMPORT_RTS const StgInfoTable CAF_BLACKHOLE_info;
+extern DLL_IMPORT_RTS const StgInfoTable BLACKHOLE_info;
+extern DLL_IMPORT_RTS const StgInfoTable BLACKHOLE_BQ_info;
+extern DLL_IMPORT_RTS const StgInfoTable BCO_info;
+extern DLL_IMPORT_RTS const StgInfoTable EVACUATED_info;
+extern DLL_IMPORT_RTS const StgInfoTable FOREIGN_info;
+extern DLL_IMPORT_RTS const StgInfoTable WEAK_info;
+extern DLL_IMPORT_RTS const StgInfoTable DEAD_WEAK_info;
+extern DLL_IMPORT_RTS const StgInfoTable STABLE_NAME_info;
+extern DLL_IMPORT_RTS const StgInfoTable FULL_MVAR_info;
+extern DLL_IMPORT_RTS const StgInfoTable EMPTY_MVAR_info;
+extern DLL_IMPORT_RTS const StgInfoTable TSO_info;
+extern DLL_IMPORT_RTS const StgInfoTable ARR_WORDS_info;
+extern DLL_IMPORT_RTS const StgInfoTable MUT_ARR_WORDS_info;
+extern DLL_IMPORT_RTS const StgInfoTable MUT_ARR_PTRS_info;
+extern DLL_IMPORT_RTS const StgInfoTable MUT_ARR_PTRS_FROZEN_info;
+extern DLL_IMPORT_RTS const StgInfoTable MUT_VAR_info;
+extern DLL_IMPORT_RTS const StgInfoTable END_TSO_QUEUE_info;
+extern DLL_IMPORT_RTS const StgInfoTable MUT_CONS_info;
+extern DLL_IMPORT_RTS const StgInfoTable END_MUT_LIST_info;
+extern DLL_IMPORT_RTS const StgInfoTable catch_info;
+extern DLL_IMPORT_RTS const StgInfoTable seq_info;
+extern DLL_IMPORT_RTS const StgInfoTable dummy_ret_info;
#ifdef INTERPRETER
/* closures */
-extern StgClosure END_TSO_QUEUE_closure;
-extern StgClosure END_MUT_LIST_closure;
-extern StgClosure NO_FINALIZER_closure;
-extern StgClosure dummy_ret_closure;
+extern DLL_IMPORT_DATA StgClosure END_TSO_QUEUE_closure;
+extern DLL_IMPORT_DATA StgClosure END_MUT_LIST_closure;
+extern DLL_IMPORT_DATA StgClosure NO_FINALIZER_closure;
+extern DLL_IMPORT_DATA StgClosure dummy_ret_closure;
-extern StgIntCharlikeClosure CHARLIKE_closure[];
-extern StgIntCharlikeClosure INTLIKE_closure[];
+extern DLL_IMPORT_DATA StgIntCharlikeClosure CHARLIKE_closure[];
+extern DLL_IMPORT_DATA StgIntCharlikeClosure INTLIKE_closure[];
/* standard entry points */
/* standard selector thunks */
-EI_ __sel_0_upd_info;
-EI_ __sel_1_upd_info;
-EI_ __sel_2_upd_info;
-EI_ __sel_3_upd_info;
-EI_ __sel_4_upd_info;
-EI_ __sel_5_upd_info;
-EI_ __sel_6_upd_info;
-EI_ __sel_7_upd_info;
-EI_ __sel_8_upd_info;
-EI_ __sel_8_upd_info;
-EI_ __sel_9_upd_info;
-EI_ __sel_10_upd_info;
-EI_ __sel_11_upd_info;
-EI_ __sel_12_upd_info;
-EI_ __sel_13_upd_info;
-EI_ __sel_14_upd_info;
-EI_ __sel_15_upd_info;
-
-EI_ __sel_0_noupd_info;
-EI_ __sel_1_noupd_info;
-EI_ __sel_2_noupd_info;
-EI_ __sel_3_noupd_info;
-EI_ __sel_4_noupd_info;
-EI_ __sel_5_noupd_info;
-EI_ __sel_6_noupd_info;
-EI_ __sel_7_noupd_info;
-EI_ __sel_8_noupd_info;
-EI_ __sel_9_noupd_info;
-EI_ __sel_10_noupd_info;
-EI_ __sel_11_noupd_info;
-EI_ __sel_12_noupd_info;
-EI_ __sel_13_noupd_info;
-EI_ __sel_14_noupd_info;
-EI_ __sel_15_noupd_info;
+#ifdef COMPILING_RTS
+#define EI__ EI_
+#else
+#define EI__ EDI_
+#endif
+
+EI__ __sel_0_upd_info;
+EI__ __sel_1_upd_info;
+EI__ __sel_2_upd_info;
+EI__ __sel_3_upd_info;
+EI__ __sel_4_upd_info;
+EI__ __sel_5_upd_info;
+EI__ __sel_6_upd_info;
+EI__ __sel_7_upd_info;
+EI__ __sel_8_upd_info;
+EI__ __sel_8_upd_info;
+EI__ __sel_9_upd_info;
+EI__ __sel_10_upd_info;
+EI__ __sel_11_upd_info;
+EI__ __sel_12_upd_info;
+EI__ __sel_13_upd_info;
+EI__ __sel_14_upd_info;
+EI__ __sel_15_upd_info;
+
+EI__ __sel_0_noupd_info;
+EI__ __sel_1_noupd_info;
+EI__ __sel_2_noupd_info;
+EI__ __sel_3_noupd_info;
+EI__ __sel_4_noupd_info;
+EI__ __sel_5_noupd_info;
+EI__ __sel_6_noupd_info;
+EI__ __sel_7_noupd_info;
+EI__ __sel_8_noupd_info;
+EI__ __sel_9_noupd_info;
+EI__ __sel_10_noupd_info;
+EI__ __sel_11_noupd_info;
+EI__ __sel_12_noupd_info;
+EI__ __sel_13_noupd_info;
+EI__ __sel_14_noupd_info;
+EI__ __sel_15_noupd_info;
/* standard ap thunks */
-EI_ __ap_1_upd_info;
-EI_ __ap_2_upd_info;
-EI_ __ap_3_upd_info;
-EI_ __ap_4_upd_info;
-EI_ __ap_5_upd_info;
-EI_ __ap_6_upd_info;
-EI_ __ap_7_upd_info;
-EI_ __ap_8_upd_info;
+EI__ __ap_1_upd_info;
+EI__ __ap_2_upd_info;
+EI__ __ap_3_upd_info;
+EI__ __ap_4_upd_info;
+EI__ __ap_5_upd_info;
+EI__ __ap_6_upd_info;
+EI__ __ap_7_upd_info;
+EI__ __ap_8_upd_info;
/* -----------------------------------------------------------------------------
- * $Id: StgStorage.h,v 1.3 1999/02/05 16:02:29 simonm Exp $
+ * $Id: StgStorage.h,v 1.4 1999/03/02 19:44:21 sof Exp $
*
* (c) The GHC Team, 1998-1999
*
#include "Block.h"
-extern bdescr *current_nursery;
+extern DLL_IMPORT_RTS bdescr *current_nursery;
/* -----------------------------------------------------------------------------
Allocation area for compiled code
/* -----------------------------------------------------------------------------
- * $Id: StgTypes.h,v 1.4 1999/02/05 16:02:30 simonm Exp $
+ * $Id: StgTypes.h,v 1.5 1999/03/02 19:44:21 sof Exp $
*
* (c) The GHC Team, 1998-1999
*
* Specifically:
- StgInt8, 16, 32, 64
- StgNat8, 16, 32, 64
+ StgInt8, 16, 32, 64
+ StgWord8, 16, 32, 64
StgChar, StgFloat, StgDouble
***** All the same size: *****
*/
typedef signed char StgInt8;
-typedef unsigned char StgNat8;
+typedef unsigned char StgWord8;
typedef signed short StgInt16;
-typedef unsigned short StgNat16;
+typedef unsigned short StgWord16;
#if SIZEOF_UNSIGNED_INT == 4
typedef signed int StgInt32;
-typedef unsigned int StgNat32;
+typedef unsigned int StgWord32;
#else
#error GHC untested on this architecture: sizeof(unisgned int) != 4
#endif
#ifdef SUPPORT_LONG_LONGS
/* assume long long is 64 bits */
-typedef unsigned long long int StgNat64;
+typedef unsigned long long int StgWord64;
typedef signed long long int StgInt64;
#elif SIZEOF_LONG == 8
typedef signed long StgInt64;
-typedef unsigned long StgNat64;
+typedef unsigned long StgWord64;
#else
#error GHC untested on this architecture: sizeof(void *) < 8 and no long longs.
#endif
#if SIZEOF_VOID_P == 8
typedef StgInt64 StgInt;
-typedef StgNat64 StgWord;
+typedef StgWord64 StgWord;
#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
* Other commonly-used STG datatypes.
*/
-typedef StgNat8 StgChar;
+typedef StgWord8 StgChar;
/*
* If a double fits in an StgWord, don't bother using floats.
typedef StgWord* StgStackPtr;
-typedef StgNat8 StgCode; /* close enough */
+typedef StgWord8 StgCode; /* close enough */
typedef StgCode* StgCodePtr;
typedef StgPtr* StgArray; /* the goods of an Array# */
typedef char* StgByteArray; /* the goods of a ByteArray# */
typedef StgInt64 LI_;
-typedef StgNat64 LW_;
+typedef StgWord64 LW_;
/* Stable Pointers: A stable pointer is represented as an index into
* the stable pointer table in the low 24 bits with a weight in the
/* -----------------------------------------------------------------------------
- * $Id: TSO.h,v 1.4 1999/02/05 16:02:30 simonm Exp $
+ * $Id: TSO.h,v 1.5 1999/03/02 19:44:22 sof Exp $
*
* (c) The GHC Team, 1998-1999
*
* having to worry about overflow. A little calculation shows that
* even doing 10^6 forks per second would take 35 million years to
* overflow a 64 bit thread ID :-)
+ *
*/
-typedef StgNat32 StgThreadID;
+typedef StgWord32 StgThreadID;
/*
* This type is returned to the scheduler by a thread that has
StgWord stack[0];
} StgTSO;
-extern StgTSO *CurrentTSO;
+extern DLL_IMPORT_RTS StgTSO *CurrentTSO;
/* Workaround for a bug/quirk in gcc on certain architectures.
/* -----------------------------------------------------------------------------
- * $Id: Updates.h,v 1.7 1999/02/05 16:02:31 simonm Exp $
+ * $Id: Updates.h,v 1.8 1999/03/02 19:44:23 sof Exp $
*
* (c) The GHC Team, 1998-1999
*
#define PUSH_STD_CCCS(frame)
#endif
-extern const StgPolyInfoTable Upd_frame_info;
+extern DLL_IMPORT_DATA const StgPolyInfoTable Upd_frame_info;
#define PUSH_UPD_FRAME(target, Sp_offset) \
{ \
#define UPD_CAF(cafptr, bhptr) \
{ \
- SET_INFO((StgInd *)cafptr,&IND_STATIC_info); \
+ SET_INFO((StgInd *)cafptr,(const StgInfoTable*)&IND_STATIC_info); \
((StgInd *)cafptr)->indirectee = (StgClosure *)(bhptr); \
STGCALL1(newCAF,(StgClosure *)cafptr); \
}
Update-related prototypes
-------------------------------------------------------------------------- */
-extern STGFUN(Upd_frame_entry);
+DLL_IMPORT_RTS extern STGFUN(Upd_frame_entry);
-extern const StgInfoTable PAP_info;
-STGFUN(PAP_entry);
+extern DLL_IMPORT_DATA const StgInfoTable PAP_info;
+DLL_IMPORT_RTS STGFUN(PAP_entry);
-EXTFUN(stg_update_PAP);
+EXTFUN_RTS(stg_update_PAP);
-extern const StgInfoTable AP_UPD_info;
-STGFUN(AP_UPD_entry);
+extern DLL_IMPORT_DATA const StgInfoTable AP_UPD_info;
+DLL_IMPORT_RTS STGFUN(AP_UPD_entry);
-extern const StgInfoTable raise_info;
+extern DLL_IMPORT_DATA const StgInfoTable raise_info;
#endif /* UPDATES_H */