[project @ 2001-01-15 16:55:24 by sewardj]
[ghc-hetmet.git] / ghc / compiler / prelude / primops.txt
index 5eff2f5..73d145e 100644 (file)
@@ -1,5 +1,5 @@
 -----------------------------------------------------------------------
--- $Id: primops.txt,v 1.5 2000/09/26 16:45:34 simonpj Exp $
+-- $Id: primops.txt,v 1.15 2001/01/15 16:55:24 sewardj Exp $
 --
 -- Primitive Operations
 --
@@ -43,13 +43,23 @@ defaults
 
 
 ------------------------------------------------------------------------
---- Support for the metacircular interpreter                         ---
+--- Support for the bytecode interpreter and linker                  ---
 ------------------------------------------------------------------------
 
-primop   IndexOffClosureOp_Ptr  "indexPtrOffClosure#"  GenPrimOp
-   a -> Int# -> (# b #)
-primop   IndexOffClosureOp_Word "indexWordOffClosure#"  GenPrimOp
-   a -> Int# -> Word#
+-- 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
 
 
 ------------------------------------------------------------------------
@@ -352,9 +362,6 @@ primop   Int64ToIntegerOp   "int64ToInteger#" GenPrimOp
 --- Integer#                                                         ---
 ------------------------------------------------------------------------
 
-primop   IntegerNegOp   "negateInteger#" GenPrimOp    
-   Int# -> ByteArr# -> (# Int#, ByteArr# #)
-
 primop   IntegerAddOp   "plusInteger#" GenPrimOp   
    Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
    with commutable = True
@@ -422,6 +429,22 @@ primop   IntegerToInt64Op   "integerToInt64#" GenPrimOp
 primop   IntegerToWord64Op   "integerToWord64#" GenPrimOp
    Int# -> ByteArr# -> Word64#
 
+primop   IntegerAndOp  "andInteger#" GenPrimOp
+   Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
+   with out_of_line = True
+
+primop   IntegerOrOp  "orInteger#" GenPrimOp
+   Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
+   with out_of_line = True
+
+primop   IntegerXorOp  "xorInteger#" GenPrimOp
+   Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
+   with out_of_line = True
+
+primop   IntegerComplementOp  "complementInteger#" GenPrimOp
+   Int# -> ByteArr# -> (# Int#, ByteArr# #)
+   with out_of_line = True
+
 ------------------------------------------------------------------------
 --- Word#                                                            ---
 ------------------------------------------------------------------------
@@ -473,35 +496,10 @@ primop   Word64ToIntegerOp   "word64ToInteger#" GenPrimOp
 --- Arrays                                                           ---
 ------------------------------------------------------------------------
 
-primop  NewByteArrayOp_Char "newCharArray#" GenPrimOp
+primop  NewByteArrayOp_Char "newByteArray#" GenPrimOp
    Int# -> State# s -> (# State# s, MutByteArr# s #)
    with out_of_line = True
 
-primop  NewByteArrayOp_Int "newIntArray#" GenPrimOp
-   Int# -> State# s -> (# State# s, MutByteArr# s #)
-   with out_of_line = True
-
-primop  NewByteArrayOp_Word "newWordArray#" GenPrimOp
-   Int# -> State# s -> (# State# s, MutByteArr# s #)
-   with out_of_line = True
-
-primop  NewByteArrayOp_Addr "newAddrArray#" GenPrimOp
-   Int# -> State# s -> (# State# s, MutByteArr# s #)
-   with out_of_line = True
-
-primop  NewByteArrayOp_Float "newFloatArray#" GenPrimOp
-   Int# -> State# s -> (# State# s, MutByteArr# s #)
-   with out_of_line = True
-
-primop  NewByteArrayOp_Double "newDoubleArray#" GenPrimOp
-   Int# -> State# s -> (# State# s, MutByteArr# s #)
-   with out_of_line = True
-
-primop  NewByteArrayOp_StablePtr "newStablePtrArray#" GenPrimOp
-   Int# -> State# s -> (# State# s, MutByteArr# s #)
-   with out_of_line = True
-
-
 
 primop  ReadByteArrayOp_Char "readCharArray#" GenPrimOp
    MutByteArr# s -> Int# -> State# s -> (# State# s, Char# #)
@@ -524,9 +522,27 @@ primop  ReadByteArrayOp_Double "readDoubleArray#" GenPrimOp
 primop  ReadByteArrayOp_StablePtr "readStablePtrArray#" GenPrimOp
    MutByteArr# s -> Int# -> State# s -> (# State# s, StablePtr# a #)
 
+primop  ReadByteArrayOp_Int8 "readInt8Array#" GenPrimOp
+   MutByteArr# s -> Int# -> State# s -> (# State# s, Int# #)
+
+primop  ReadByteArrayOp_Int16 "readInt16Array#" GenPrimOp
+   MutByteArr# s -> Int# -> State# s -> (# State# s, Int# #)
+
+primop  ReadByteArrayOp_Int32 "readInt32Array#" GenPrimOp
+   MutByteArr# s -> Int# -> State# s -> (# State# s, Int# #)
+
 primop  ReadByteArrayOp_Int64 "readInt64Array#" GenPrimOp
    MutByteArr# s -> Int# -> State# s -> (# State# s, Int64# #)
 
+primop  ReadByteArrayOp_Word8 "readWord8Array#" GenPrimOp
+   MutByteArr# s -> Int# -> State# s -> (# State# s, Word# #)
+
+primop  ReadByteArrayOp_Word16 "readWord16Array#" GenPrimOp
+   MutByteArr# s -> Int# -> State# s -> (# State# s, Word# #)
+
+primop  ReadByteArrayOp_Word32 "readWord32Array#" GenPrimOp
+   MutByteArr# s -> Int# -> State# s -> (# State# s, Word# #)
+
 primop  ReadByteArrayOp_Word64 "readWord64Array#" GenPrimOp
    MutByteArr# s -> Int# -> State# s -> (# State# s, Word64# #)
 
@@ -560,6 +576,30 @@ primop  WriteByteArrayOp_StablePtr "writeStablePtrArray#" GenPrimOp
    MutByteArr# s -> Int# -> StablePtr# a -> State# s -> State# s
    with has_side_effects = True
 
+primop  WriteByteArrayOp_Int8 "writeInt8Array#" GenPrimOp
+   MutByteArr# s -> Int# -> Int# -> State# s -> State# s
+   with has_side_effects = True
+
+primop  WriteByteArrayOp_Word8 "writeWord8Array#" GenPrimOp
+   MutByteArr# s -> Int# -> Word# -> State# s -> State# s
+   with has_side_effects = True
+
+primop  WriteByteArrayOp_Int16 "writeInt16Array#" GenPrimOp
+   MutByteArr# s -> Int# -> Int# -> State# s -> State# s
+   with has_side_effects = True
+
+primop  WriteByteArrayOp_Word16 "writeWord16Array#" GenPrimOp
+   MutByteArr# s -> Int# -> Word# -> State# s -> State# s
+   with has_side_effects = True
+
+primop  WriteByteArrayOp_Int32 "writeInt32Array#" GenPrimOp
+   MutByteArr# s -> Int# -> Int# -> State# s -> State# s
+   with has_side_effects = True
+
+primop  WriteByteArrayOp_Word32 "writeWord32Array#" GenPrimOp
+   MutByteArr# s -> Int# -> Word# -> State# s -> State# s
+   with has_side_effects = True
+
 primop  WriteByteArrayOp_Int64 "writeInt64Array#" GenPrimOp
    MutByteArr# s -> Int# -> Int64# -> State# s -> State# s
    with has_side_effects = True
@@ -590,6 +630,24 @@ primop IndexByteArrayOp_Double "indexDoubleArray#" GenPrimOp
 primop IndexByteArrayOp_StablePtr "indexStablePtrArray#" GenPrimOp
    ByteArr# -> Int# -> StablePtr# a
 
+primop IndexByteArrayOp_Int8 "indexInt8Array#" GenPrimOp
+   ByteArr# -> Int# -> Int#
+
+primop IndexByteArrayOp_Word8 "indexWord8Array#" GenPrimOp
+   ByteArr# -> Int# -> Word#
+
+primop IndexByteArrayOp_Int16 "indexInt16Array#" GenPrimOp
+   ByteArr# -> Int# -> Int#
+
+primop IndexByteArrayOp_Word16 "indexWord16Array#" GenPrimOp
+   ByteArr# -> Int# -> Word#
+
+primop IndexByteArrayOp_Int32 "indexInt32Array#" GenPrimOp
+   ByteArr# -> Int# -> Int#
+
+primop IndexByteArrayOp_Word32 "indexWord32Array#" GenPrimOp
+   ByteArr# -> Int# -> Word#
+
 primop IndexByteArrayOp_Int64 "indexInt64Array#" GenPrimOp
    ByteArr# -> Int# -> Int64#
 
@@ -618,6 +676,24 @@ primop IndexOffAddrOp_Double "indexDoubleOffAddr#" GenPrimOp
 primop IndexOffAddrOp_StablePtr "indexStablePtrOffAddr#" GenPrimOp
    Addr# -> Int# -> StablePtr# a
 
+primop IndexOffAddrOp_Int8 "indexInt8OffAddr#" GenPrimOp
+   Addr# -> Int# -> Int#
+
+primop IndexOffAddrOp_Word8 "indexWord8OffAddr#" GenPrimOp
+   Addr# -> Int# -> Word#
+
+primop IndexOffAddrOp_Int16 "indexInt16OffAddr#" GenPrimOp
+   Addr# -> Int# -> Int#
+
+primop IndexOffAddrOp_Word16 "indexWord16OffAddr#" GenPrimOp
+   Addr# -> Int# -> Word#
+
+primop IndexOffAddrOp_Int32 "indexInt32OffAddr#" GenPrimOp
+   Addr# -> Int# -> Int#
+
+primop IndexOffAddrOp_Word32 "indexWord32OffAddr#" GenPrimOp
+   Addr# -> Int# -> Word#
+
 primop IndexOffAddrOp_Int64 "indexInt64OffAddr#" GenPrimOp
    Addr# -> Int# -> Int64#
 
@@ -646,6 +722,24 @@ primop IndexOffForeignObjOp_Double "indexDoubleOffForeignObj#" GenPrimOp
 primop IndexOffForeignObjOp_StablePtr "indexStablePtrOffForeignObj#" GenPrimOp
    ForeignObj# -> Int# -> StablePtr# a
 
+primop IndexOffForeignObjOp_Int8 "indexInt8OffForeignObj#" GenPrimOp
+   ForeignObj# -> Int# -> Int#
+
+primop IndexOffForeignObjOp_Word8 "indexWord8OffForeignObj#" GenPrimOp
+   ForeignObj# -> Int# -> Word#
+
+primop IndexOffForeignObjOp_Int16 "indexInt16OffForeignObj#" GenPrimOp
+   ForeignObj# -> Int# -> Int#
+
+primop IndexOffForeignObjOp_Word16 "indexWord16OffForeignObj#" GenPrimOp
+   ForeignObj# -> Int# -> Word#
+
+primop IndexOffForeignObjOp_Int32 "indexInt32OffForeignObj#" GenPrimOp
+   ForeignObj# -> Int# -> Int#
+
+primop IndexOffForeignObjOp_Word32 "indexWord32OffForeignObj#" GenPrimOp
+   ForeignObj# -> Int# -> Word#
+
 primop IndexOffForeignObjOp_Int64 "indexInt64OffForeignObj#" GenPrimOp
    ForeignObj# -> Int# -> Int64#
 
@@ -675,8 +769,23 @@ primop ReadOffAddrOp_Double "readDoubleOffAddr#" GenPrimOp
 primop ReadOffAddrOp_StablePtr "readStablePtrOffAddr#" GenPrimOp
    Addr# -> Int# -> State# s -> (# State# s, StablePtr# a #)
 
-primop ReadOffAddrOp_ForeignObj "readForeignObjOffAddr#" GenPrimOp
-   Addr# -> Int# -> State# s -> (# State# s, ForeignObj# #)
+primop ReadOffAddrOp_Int8 "readInt8OffAddr#" GenPrimOp
+   Addr# -> Int# -> State# s -> (# State# s, Int# #)
+
+primop ReadOffAddrOp_Word8 "readWord8OffAddr#" GenPrimOp
+   Addr# -> Int# -> State# s -> (# State# s, Word# #)
+
+primop ReadOffAddrOp_Int16 "readInt16OffAddr#" GenPrimOp
+   Addr# -> Int# -> State# s -> (# State# s, Int# #)
+
+primop ReadOffAddrOp_Word16 "readWord16OffAddr#" GenPrimOp
+   Addr# -> Int# -> State# s -> (# State# s, Word# #)
+
+primop ReadOffAddrOp_Int32 "readInt32OffAddr#" GenPrimOp
+   Addr# -> Int# -> State# s -> (# State# s, Int# #)
+
+primop ReadOffAddrOp_Word32 "readWord32OffAddr#" GenPrimOp
+   Addr# -> Int# -> State# s -> (# State# s, Word# #)
 
 primop ReadOffAddrOp_Int64 "readInt64OffAddr#" GenPrimOp
    Addr# -> Int# -> State# s -> (# State# s, Int64# #)
@@ -717,6 +826,30 @@ primop  WriteOffAddrOp_ForeignObj "writeForeignObjOffAddr#" GenPrimOp
    Addr# -> Int# -> ForeignObj# -> State# s -> State# s
    with has_side_effects = True
 
+primop  WriteOffAddrOp_Int8 "writeInt8OffAddr#" GenPrimOp
+   Addr# -> Int# -> Int# -> State# s -> State# s
+   with has_side_effects = True
+
+primop  WriteOffAddrOp_Word8 "writeWord8OffAddr#" GenPrimOp
+   Addr# -> Int# -> Word# -> State# s -> State# s
+   with has_side_effects = True
+
+primop  WriteOffAddrOp_Int16 "writeInt16OffAddr#" GenPrimOp
+   Addr# -> Int# -> Int# -> State# s -> State# s
+   with has_side_effects = True
+
+primop  WriteOffAddrOp_Word16 "writeWord16OffAddr#" GenPrimOp
+   Addr# -> Int# -> Word# -> State# s -> State# s
+   with has_side_effects = True
+
+primop  WriteOffAddrOp_Int32 "writeInt32OffAddr#" GenPrimOp
+   Addr# -> Int# -> Int# -> State# s -> State# s
+   with has_side_effects = True
+
+primop  WriteOffAddrOp_Word32 "writeWord32OffAddr#" GenPrimOp
+   Addr# -> Int# -> Word# -> State# s -> State# s
+   with has_side_effects = True
+
 primop  WriteOffAddrOp_Int64 "writeInt64OffAddr#" GenPrimOp
    Addr# -> Int# -> Int64# -> State# s -> State# s
    with has_side_effects = True
@@ -970,60 +1103,12 @@ primop TouchOp "touch#" GenPrimOp
    with
    strictness       = { \ arity -> StrictnessInfo [wwLazy, wwPrim] False }
 
-------------------------------------------------------------------------
---- Bytecode objects                                                 ---
-------------------------------------------------------------------------
-
-primop  NewBCOOp "newBCO#" GenPrimOp
-   Int# -> Int# -> Int# -> a -> State# RealWorld -> (# State# RealWorld, 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 }
-
 
 ------------------------------------------------------------------------
 --- Weak pointers                                                    ---
 ------------------------------------------------------------------------
 
--- note that tyvar "o" denoted openAlphaTyVar
+-- note that tyvar "o" denotes openAlphaTyVar
 
 primop  MkWeakOp "mkWeak#" GenPrimOp
    o -> b -> c -> State# RealWorld -> (# State# RealWorld, Weak# b #)
@@ -1165,17 +1250,21 @@ primop  ParAtForNowOp  "parAtForNow#" GenPrimOp
    usage            = { mangle ParAtForNowOp [mkO, mkZ, mkP, mkP, mkP, mkP, mkM] mkM }
    has_side_effects = True
 
-primop  CopyableOp  "copyable#" GenPrimOp
-   a -> Int#
-   with
-   usage            = { mangle CopyableOp [mkZ] mkR }
-   has_side_effects = True
-
-primop  NoFollowOp "noFollow#" GenPrimOp
-   a -> Int#
-   with
-   usage            = { mangle NoFollowOp [mkZ] mkR }
-   has_side_effects = True
+-- copyable# and noFollow# have no corresponding entry in
+-- PrelGHC.hi-boot, so I don't know whether they should still
+-- be here or not.  JRS, 15 Jan 01
+--
+--primop  CopyableOp  "copyable#" GenPrimOp
+--   a -> Int#
+--   with
+--   usage            = { mangle CopyableOp [mkZ] mkR }
+--   has_side_effects = True
+--
+--primop  NoFollowOp "noFollow#" GenPrimOp
+--   a -> Int#
+--   with
+--   usage            = { mangle NoFollowOp [mkZ] mkR }
+--   has_side_effects = True
 
 
 ------------------------------------------------------------------------