/* ----------------------------------------------------------------------------
- * $Id: RtsAPI.c,v 1.23 2000/12/04 12:31:21 simonmar Exp $
+ * $Id: RtsAPI.c,v 1.26 2001/03/22 03:51:10 hwloidl Exp $
*
- * (c) The GHC Team, 1998-2000
+ * (c) The GHC Team, 1998-2001
*
* API for invoking Haskell functions via the RTS
*
rts_mkInt8 (HsInt8 i)
{
StgClosure *p = (StgClosure *)allocate(CONSTR_sizeW(0,1));
- /* This is a 'cheat', using the static info table for Ints,
- instead of the one for Int8, but the types have identical
- representation.
- */
- p->header.info = Izh_con_info;
+ p->header.info = I8zh_con_info;
/* Make sure we mask out the bits above the lowest 8 */
p->payload[0] = (StgClosure *)(StgInt)((unsigned)i & 0xff);
return p;
rts_mkInt16 (HsInt16 i)
{
StgClosure *p = (StgClosure *)allocate(CONSTR_sizeW(0,1));
- /* This is a 'cheat', using the static info table for Ints,
- instead of the one for Int8, but the types have identical
- representation.
- */
- p->header.info = Izh_con_info;
+ p->header.info = I16zh_con_info;
/* Make sure we mask out the relevant bits */
p->payload[0] = (StgClosure *)(StgInt)((unsigned)i & 0xffff);
return p;
rts_mkInt32 (HsInt32 i)
{
StgClosure *p = (StgClosure *)allocate(CONSTR_sizeW(0,1));
- /* see mk_Int8 comment */
- p->header.info = Izh_con_info;
+ p->header.info = I32zh_con_info;
p->payload[0] = (StgClosure *)(StgInt)i;
return p;
}
{
long long *tmp;
StgClosure *p = (StgClosure *)allocate(CONSTR_sizeW(0,2));
- /* see mk_Int8 comment */
p->header.info = I64zh_con_info;
tmp = (long long*)&(p->payload[0]);
*tmp = (StgInt64)i;
{
/* see rts_mkInt* comments */
StgClosure *p = (StgClosure *)allocate(CONSTR_sizeW(0,1));
- p->header.info = Wzh_con_info;
+ p->header.info = W8zh_con_info;
p->payload[0] = (StgClosure *)(StgWord)(w & 0xff);
return p;
}
{
/* see rts_mkInt* comments */
StgClosure *p = (StgClosure *)allocate(CONSTR_sizeW(0,1));
- p->header.info = Wzh_con_info;
+ p->header.info = W16zh_con_info;
p->payload[0] = (StgClosure *)(StgWord)(w & 0xffff);
return p;
}
{
/* see rts_mkInt* comments */
StgClosure *p = (StgClosure *)allocate(CONSTR_sizeW(0,1));
- p->header.info = Wzh_con_info;
+ p->header.info = W32zh_con_info;
p->payload[0] = (StgClosure *)(StgWord)w;
return p;
}
}
HaskellObj
-rts_mkAddr (HsAddr a)
+rts_mkPtr (HsPtr a)
{
StgClosure *p = (StgClosure *)allocate(sizeofW(StgHeader)+1);
- p->header.info = Azh_con_info;
+ p->header.info = Ptr_con_info;
p->payload[0] = (StgClosure *)a;
return p;
}
HaskellObj
rts_mkString (char *s)
{
- return rts_apply((StgClosure *)unpackCString_closure, rts_mkAddr(s));
+ return rts_apply((StgClosure *)unpackCString_closure, rts_mkPtr(s));
}
#endif /* COMPILER */
rts_getInt32 (HaskellObj p)
{
if ( 1 ||
- p->header.info == Izh_con_info ||
- p->header.info == Izh_static_info ) {
+ p->header.info == I32zh_con_info ||
+ p->header.info == I32zh_static_info ) {
return (int)(p->payload[0]);
} else {
barf("getInt: not an Int");
rts_getWord32 (HaskellObj p)
{
if ( 1 || /* see above comment */
- p->header.info == Wzh_con_info ||
- p->header.info == Wzh_static_info ) {
+ p->header.info == W32zh_con_info ||
+ p->header.info == W32zh_static_info ) {
return (unsigned int)(p->payload[0]);
} else {
barf("getWord: not a Word");
}
}
-HsAddr
-rts_getAddr (HaskellObj p)
+HsPtr
+rts_getPtr (HaskellObj p)
{
- if ( p->header.info == Azh_con_info ||
- p->header.info == Azh_static_info ) {
-
+ if ( p->header.info == Ptr_con_info ||
+ p->header.info == Ptr_static_info ) {
return (void *)(p->payload[0]);
} else {
- barf("getAddr: not an Addr");
+ barf("getPtr: not an Ptr");
}
}
return waitThread(tso, ret);
}
-#if defined(PAR) || defined(SMP)
-/*
- Needed in the parallel world for non-Main PEs, which do not get a piece
- of work to start with --- they have to humbly ask for it
-*/
-
-SchedulerStatus
-rts_evalNothing(unsigned int stack_size)
-{
- /* ToDo: propagate real SchedulerStatus back to caller */
- scheduleThread(END_TSO_QUEUE);
- return Success;
-}
-#endif
-
/* Convenience function for decoding the returned status. */
void