Commit 343a20c0 authored by sewardj's avatar sewardj

[project @ 2001-01-15 09:55:41 by sewardj]

Add mkApUpd0# primop, used to make sure bytecode-compiled top-level things
are updateable.
parent 6db8367a
-----------------------------------------------------------------------
-- $Id: primops.txt,v 1.13 2001/01/03 16:44:29 sewardj Exp $
-- $Id: primops.txt,v 1.14 2001/01/15 09:55:41 sewardj Exp $
--
-- Primitive Operations
--
......@@ -43,13 +43,24 @@ defaults
------------------------------------------------------------------------
--- Support for the bytecode linker ---
--- Support for the bytecode interpreter and linker ---
------------------------------------------------------------------------
-- Convert an Addr# to a followable type
primop AddrToHValueOp "addrToHValue#" GenPrimOp
Addr# -> (# a #)
primop MkApUpd0_Op "mkApUpd0#" GenPrimOp
a -> (# a #)
with
out_of_line = True
primop NewBCOOp "newBCO#" GenPrimOp
ByteArr# -> ByteArr# -> Array# a -> ByteArr# -> State# s -> (# State# s, BCO# #)
with
has_side_effects = True
out_of_line = True
------------------------------------------------------------------------
--- Addr# ---
......@@ -1098,16 +1109,6 @@ primop TouchOp "touch#" GenPrimOp
with
strictness = { \ arity -> StrictnessInfo [wwLazy, wwPrim] False }
------------------------------------------------------------------------
--- Bytecode objects ---
------------------------------------------------------------------------
primop NewBCOOp "newBCO#" GenPrimOp
ByteArr# -> ByteArr# -> Array# a -> ByteArr# -> State# s -> (# State# s, BCO# #)
with
has_side_effects = True
out_of_line = True
------------------------------------------------------------------------
--- Weak pointers ---
......
/* -----------------------------------------------------------------------------
* $Id: PrimOps.h,v 1.71 2001/01/03 16:44:29 sewardj Exp $
* $Id: PrimOps.h,v 1.72 2001/01/15 09:55:41 sewardj Exp $
*
* (c) The GHC Team, 1998-2000
*
......@@ -934,10 +934,11 @@ EXTFUN_RTS(mkForeignObjzh_fast);
/* tagToEnum# is handled directly by the code generator. */
/* -----------------------------------------------------------------------------
BCOs
BCOs and BCO linkery
-------------------------------------------------------------------------- */
EXTFUN_RTS(newBCOzh_fast);
EXTFUN_RTS(mkApUpd0zh_fast);
/* -----------------------------------------------------------------------------
Signal processing. Not really primops, but called directly from
......
......@@ -386,6 +386,7 @@ __export PrelGHC
newBCOzh
BCOzh
mkApUpd0zh
unsafeCoercezh
addrToHValuezh
......
......@@ -5,8 +5,8 @@
* Copyright (c) 1994-2000.
*
* $RCSfile: Interpreter.c,v $
* $Revision: 1.11 $
* $Date: 2001/01/12 12:06:24 $
* $Revision: 1.12 $
* $Date: 2001/01/15 09:55:41 $
* ---------------------------------------------------------------------------*/
#ifdef GHCI
......@@ -344,6 +344,7 @@ StgThreadReturnCode interpretBCO ( Capability* cap )
//fprintf(stderr, "---PACK p %d, np %d\n",
// (int) itbl->layout.payload.ptrs,
// (int) itbl->layout.payload.nptrs );
ASSERT( itbl->layout.payload.ptrs + itbl->layout.payload.nptrs > 0);
SET_HDR(con, BCO_ITBL(o_itbl), CCS_SYSTEM/*ToDo*/);
for (i = 0; i < n_words; i++)
con->payload[i] = (StgClosure*)StackWord(i);
......
/* -----------------------------------------------------------------------------
* $Id: PrimOps.hc,v 1.66 2000/12/20 15:17:55 rrt Exp $
* $Id: PrimOps.hc,v 1.67 2001/01/15 09:55:41 sewardj Exp $
*
* (c) The GHC Team, 1998-2000
*
......@@ -1042,6 +1042,26 @@ FN_(newBCOzh_fast)
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
/* -----------------------------------------------------------------------------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment