/* -----------------------------------------------------------------------------
- * $Id: PrimOps.hc,v 1.63 2000/12/12 12:19:57 simonmar Exp $
+ * $Id: PrimOps.hc,v 1.68 2001/01/16 11:57:06 simonmar Exp $
*
* (c) The GHC Team, 1998-2000
*
classes CCallable and CReturnable don't really exist, but the
compiler insists on generating dictionaries containing references
to GHC_ZcCCallable_static_info etc., so we provide dummy symbols
- for these.
+ for these. Some C compilers can't cope with zero-length static arrays,
+ so we have to make these one element long.
*/
-W_ GHC_ZCCCallable_static_info[0];
-W_ GHC_ZCCReturnable_static_info[0];
-
-
+StgWord GHC_ZCCCallable_static_info[1];
+StgWord GHC_ZCCReturnable_static_info[1];
+
/* -----------------------------------------------------------------------------
Macros for Hand-written primitives.
-------------------------------------------------------------------------- */
Bytecode object primitives
------------------------------------------------------------------------- */
+#ifdef GHCI
FN_(newBCOzh_fast)
{
/* R1.p = instrs
R2.p = literals
R3.p = ptrs
+ R4.p = itbls
*/
StgBCO *bco;
FB_
- HP_CHK_GEN_TICKY(sizeofW(StgBCO),R1_PTR|R2_PTR|R3_PTR, newBCOzh_fast,);
+ HP_CHK_GEN_TICKY(sizeofW(StgBCO),R1_PTR|R2_PTR|R3_PTR|R4_PTR, newBCOzh_fast,);
TICK_ALLOC_PRIM(sizeofW(StgHeader), sizeofW(StgBCO)-sizeofW(StgHeader), 0);
CCS_ALLOC(CCCS,sizeofW(StgBCO)); /* ccs prof */
-
- bco = (StgBCO *) (Hp + 1 - sizeof(StgBCO));
+ bco = (StgBCO *) (Hp + 1 - sizeofW(StgBCO));
SET_HDR(bco, &stg_BCO_info, CCCS);
- bco->instrs = R1.cl;
- bco->literals = R2.cl;
- bco->ptrs = R3.cl;
+ bco->instrs = (StgArrWords*)R1.cl;
+ bco->literals = (StgArrWords*)R2.cl;
+ bco->ptrs = (StgMutArrPtrs*)R3.cl;
+ bco->itbls = (StgArrWords*)R4.cl;
TICK_RET_UNBOXED_TUP(1);
RET_P(bco);
FE_
}
+FN_(mkApUpd0zh_fast)
+{
+ /* R1.p = the fn for the AP_UPD
+ */
+ StgAP_UPD* ap;
+ FB_
+ HP_CHK_GEN_TICKY(AP_sizeW(0), R1_PTR, mkApUpd0zh_fast,);
+ TICK_ALLOC_PRIM(sizeofW(StgHeader), AP_sizeW(0)-sizeofW(StgHeader), 0);
+ CCS_ALLOC(CCCS,AP_sizeW(0)); /* ccs prof */
+ ap = (StgAP_UPD *) (Hp + 1 - AP_sizeW(0));
+ SET_HDR(ap, &stg_AP_UPD_info, CCCS);
+
+ ap->n_args = 0;
+ ap->fun = R1.cl;
+
+ TICK_RET_UNBOXED_TUP(1);
+ RET_P(ap);
+ FE_
+}
+#endif
+
/* -----------------------------------------------------------------------------
Thread I/O blocking primitives
-------------------------------------------------------------------------- */