[project @ 2000-12-11 12:56:13 by simonmar]
authorsimonmar <unknown>
Mon, 11 Dec 2000 12:56:14 +0000 (12:56 +0000)
committersimonmar <unknown>
Mon, 11 Dec 2000 12:56:14 +0000 (12:56 +0000)
New BCO primops.

ghc/compiler/prelude/primops.txt
ghc/includes/PrimOps.h
ghc/lib/std/PrelGHC.hi-boot
ghc/rts/PrimOps.hc

index 592f818..63c6141 100644 (file)
@@ -1,5 +1,5 @@
 -----------------------------------------------------------------------
--- $Id: primops.txt,v 1.7 2000/12/04 12:31:19 simonmar Exp $
+-- $Id: primops.txt,v 1.8 2000/12/11 12:56:14 simonmar Exp $
 --
 -- Primitive Operations
 --
@@ -998,49 +998,13 @@ primop TouchOp "touch#" GenPrimOp
 ------------------------------------------------------------------------
 
 primop  NewBCOOp "newBCO#" GenPrimOp
-   Int# -> Int# -> Int# -> a -> State# RealWorld -> (# State# RealWorld, BCO# #)
+   ByteArr# -> ByteArr# -> MutArr# s a -> State# s -> (# State# s, BCO# #)
    with
    has_side_effects = True
    out_of_line      = True
-   strictness       = { \ arity -> StrictnessInfo 
-                                   [wwPrim, wwPrim, wwPrim, wwLazy, wwPrim] False }
-   usage            = { mangle NewBCOOp [mkP, mkP, mkP, mkM, mkP] mkR }
-
-primop  WriteBCOPtrOp "writeBCOPtr#" GenPrimOp
-   BCO# -> Int# -> o -> State# RealWorld -> State# RealWorld
-   with
-   usage            = { mangle WriteBCOPtrOp [mkP, mkP, mkM, mkP] mkR }
-   strictness       = { \ arity -> StrictnessInfo 
-                                   [wwPrim, wwPrim, wwLazy, wwPrim] False }
-   has_side_effects = True
-
-primop  WriteBCONonPtrOp "writeBCONonPtr#" GenPrimOp
-   BCO# -> Int# -> Word# -> State# RealWorld -> State# RealWorld
-   with
-   has_side_effects = True
-
-primop  WriteBCOInstrOp "writeBCOInstr#" GenPrimOp
-   BCO# -> Int# -> Word# -> State# RealWorld -> State# RealWorld
-   with
-   has_side_effects = True
-
-primop  ReadBCOPtrOp "readBCOPtr#"  GenPrimOp
-   BCO# -> Int# -> State# RealWorld -> (# State# RealWorld, Word# #)
-   with
-   usage = { mangle ReadBCOPtrOp [mkP, mkP] mkM }
-
-primop  ReadBCONonPtrOp "readBCONonPtr#"  GenPrimOp
-   BCO# -> Int# -> State# RealWorld -> (# State# RealWorld, Word# #)
-
-primop  ReadBCOInstrOp "readBCOInstr#" GenPrimOp
-   BCO# -> Int# -> State# RealWorld -> (# State# RealWorld, Word# #)
-
-primop  SameBCOOp "sameBCO#" GenPrimOp
-   BCO# -> BCO# -> Bool
-   with
-   -- is this usage right?
-   usage = { mangle SameMutableArrayOp [mkP, mkP] mkM }
 
+primop  GetBCOPtrsOp "getBCOPtrs#" GenPrimOp
+   BCO# -> State# s -> (# State# s, MutArr# s a #)
 
 ------------------------------------------------------------------------
 --- Weak pointers                                                    ---
index c4aa989..0813f7a 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: PrimOps.h,v 1.68 2000/12/04 12:31:20 simonmar Exp $
+ * $Id: PrimOps.h,v 1.69 2000/12/11 12:56:14 simonmar Exp $
  *
  * (c) The GHC Team, 1998-2000
  *
@@ -962,6 +962,13 @@ EXTFUN_RTS(mkForeignObjzh_fast);
 /*  tagToEnum# is handled directly by the code generator. */
 
 /* -----------------------------------------------------------------------------
+   BCOs
+   -------------------------------------------------------------------------- */
+
+EXTFUN_RTS(newBCOzh_fast);
+#define getBCOPtrszh(r,bco) r=((StgBCO *)bco)->ptrs
+
+/* -----------------------------------------------------------------------------
    Signal processing.  Not really primops, but called directly from
    Haskell. 
    -------------------------------------------------------------------------- */
index e64caba..2e1c77c 100644 (file)
@@ -348,6 +348,9 @@ __export PrelGHC
 
   reallyUnsafePtrEqualityzh
 
+  newBCOzh
+  getBCOPtrszh
+
   unsafeCoercezh
 ;
 
index f70d745..39a1503 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: PrimOps.hc,v 1.60 2000/12/04 12:31:21 simonmar Exp $
+ * $Id: PrimOps.hc,v 1.61 2000/12/11 12:56:14 simonmar Exp $
  *
  * (c) The GHC Team, 1998-2000
  *
@@ -1023,6 +1023,35 @@ FN_(makeStableNamezh_fast)
 }
 
 /* -----------------------------------------------------------------------------
+   Bytecode object primitives
+   -------------------------------------------------------------------------  */
+
+FN_(newBCOzh_fast)
+{
+  /* R1.p = instrs
+     R2.p = literals
+     R3.p = ptrs
+  */
+  StgBCO *bco;
+  FB_
+
+  HP_CHK_GEN_TICKY(sizeofW(StgBCO),R1_PTR|R2_PTR|R3_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));
+  SET_HDR(w, &stg_BCO_info, CCCS);
+
+  w->instrs     = R1.cl;
+  w->literals   = R2.cl;
+  w->ptrs       = R3.cl;
+
+  TICK_RET_UNBOXED_TUP(1);
+  RET_P(w);
+  FE_
+}
+
+/* -----------------------------------------------------------------------------
    Thread I/O blocking primitives
    -------------------------------------------------------------------------- */