-----------------------------------------------------------------------
--- $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
--
------------------------------------------------------------------------
---- 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
------------------------------------------------------------------------
--- Integer# ---
------------------------------------------------------------------------
-primop IntegerNegOp "negateInteger#" GenPrimOp
- Int# -> ByteArr# -> (# Int#, ByteArr# #)
-
primop IntegerAddOp "plusInteger#" GenPrimOp
Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
with commutable = True
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# ---
------------------------------------------------------------------------
--- 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# #)
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# #)
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
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#
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#
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#
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# #)
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
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 #)
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
------------------------------------------------------------------------