[project @ 2001-08-04 06:11:24 by ken]
[ghc-hetmet.git] / ghc / compiler / prelude / primops.txt
index d021264..1ec7e39 100644 (file)
@@ -1,5 +1,5 @@
 -----------------------------------------------------------------------
--- $Id: primops.txt,v 1.4 2000/09/11 12:20:57 sewardj Exp $
+-- $Id: primops.txt,v 1.23 2001/07/26 03:08:38 ken Exp $
 --
 -- Primitive Operations
 --
@@ -25,6 +25,9 @@
 --     - the User's Guide
 --
 
+#include "config.h"
+#include "Derived.h"
+
 -- The default attribute values which apply if you don't specify
 -- other ones.  Attribute values can be True, False, or arbitrary
 -- text between curly brackets.  This is a kludge to enable 
@@ -43,13 +46,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
 
 
 ------------------------------------------------------------------------
@@ -65,10 +78,6 @@ primop   AddrLeOp  "leAddr#"   Compare   Addr# -> Addr# -> Bool
 
 primop   Addr2IntOp  "addr2Int#"     GenPrimOp   Addr# -> Int#
 
-primop   Addr2IntegerOp  "addr2Integer#" GenPrimOp   
-   Addr# -> (# Int#, ByteArr# #)
-   with out_of_line = True
-
 
 ------------------------------------------------------------------------
 --- Char#                                                            ---
@@ -347,18 +356,17 @@ primop   ISrlOp   "iShiftRL#" GenPrimOp Int# -> Int# -> Int#
 --- Int64#                                                           ---
 ------------------------------------------------------------------------
 
+#ifdef SUPPORT_LONG_LONGS
 primop   Int64ToIntegerOp   "int64ToInteger#" GenPrimOp 
    Int64# -> (# Int#, ByteArr# #)
    with out_of_line = True
+#endif
 
 
 ------------------------------------------------------------------------
 --- Integer#                                                         ---
 ------------------------------------------------------------------------
 
-primop   IntegerNegOp   "negateInteger#" GenPrimOp    
-   Int# -> ByteArr# -> (# Int#, ByteArr# #)
-
 primop   IntegerAddOp   "plusInteger#" GenPrimOp   
    Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
    with commutable = True
@@ -420,96 +428,172 @@ primop   Integer2WordOp   "integer2Word#"   GenPrimOp
    Int# -> ByteArr# -> Word#
    with needs_wrapper = True
 
+#ifdef SUPPORT_LONG_LONGS
 primop   IntegerToInt64Op   "integerToInt64#" GenPrimOp
    Int# -> ByteArr# -> Int64#
 
 primop   IntegerToWord64Op   "integerToWord64#" GenPrimOp
    Int# -> ByteArr# -> Word64#
+#endif
+
+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#                                                            ---
 ------------------------------------------------------------------------
 
-primop   WordQuotOp   "quotWord#" Dyadic  Word# -> Word# -> Word#
-primop   WordRemOp   "remWord#" Dyadic          Word# -> Word# -> Word#
+primop   WordAddOp   "plusWord#"   Dyadic   Word# -> Word# -> Word#
+   with commutable = True
+
+primop   WordSubOp   "minusWord#"   Dyadic   Word# -> Word# -> Word#
 
-primop   AndOp   "and#"  Dyadic      
-   Word# -> Word# -> Word#
+primop   WordMulOp   "timesWord#"   Dyadic   Word# -> Word# -> Word#
    with commutable = True
 
-primop   OrOp   "or#"          Dyadic      
-   Word# -> Word# -> Word#
+primop   WordQuotOp   "quotWord#"   Dyadic   Word# -> Word# -> Word#
+   with can_fail = True
+
+primop   WordRemOp   "remWord#"   Dyadic   Word# -> Word# -> Word#
+   with can_fail = True
+
+primop   AndOp   "and#"   Dyadic   Word# -> Word# -> Word#
    with commutable = True
 
-primop   XorOp   "xor#"  Dyadic      
-   Word# -> Word# -> Word#
+primop   OrOp   "or#"   Dyadic   Word# -> Word# -> Word#
    with commutable = True
 
-primop   NotOp   "not#"  Monadic        Word# -> Word#
+primop   XorOp   "xor#"   Dyadic   Word# -> Word# -> Word#
+   with commutable = True
 
-primop   SllOp   "shiftL#" GenPrimOp  Word# -> Int# -> Word#
-primop   SrlOp   "shiftRL#" GenPrimOp Word# -> Int# -> Word#
+primop   NotOp   "not#"   Monadic   Word# -> Word#
 
+primop   SllOp   "shiftL#"   GenPrimOp   Word# -> Int# -> Word#
 
-primop   Word2IntOp "word2Int#" GenPrimOp Word# -> Int#
+primop   SrlOp   "shiftRL#"   GenPrimOp   Word# -> Int# -> Word#
 
-primop   Word2IntegerOp   "word2Integer#" GenPrimOp 
+primop   Word2IntOp   "word2Int#"   GenPrimOp   Word# -> Int#
+
+primop   Word2IntegerOp   "word2Integer#"   GenPrimOp 
    Word# -> (# Int#, ByteArr# #)
    with out_of_line = True
 
-primop   WordGtOp  "gtWord#"   Compare   Word# -> Word# -> Bool
-primop   WordGeOp  "geWord#"   Compare   Word# -> Word# -> Bool
-primop   WordEqOp  "eqWord#"   Compare   Word# -> Word# -> Bool
-primop   WordNeOp  "neWord#"   Compare   Word# -> Word# -> Bool
-primop   WordLtOp  "ltWord#"   Compare   Word# -> Word# -> Bool
-primop   WordLeOp  "leWord#"   Compare   Word# -> Word# -> Bool
+primop   WordGtOp   "gtWord#"   Compare   Word# -> Word# -> Bool
+primop   WordGeOp   "geWord#"   Compare   Word# -> Word# -> Bool
+primop   WordEqOp   "eqWord#"   Compare   Word# -> Word# -> Bool
+primop   WordNeOp   "neWord#"   Compare   Word# -> Word# -> Bool
+primop   WordLtOp   "ltWord#"   Compare   Word# -> Word# -> Bool
+primop   WordLeOp   "leWord#"   Compare   Word# -> Word# -> Bool
 
 ------------------------------------------------------------------------
 --- Word64#                                                          ---
 ------------------------------------------------------------------------
 
+#ifdef SUPPORT_LONG_LONGS
 primop   Word64ToIntegerOp   "word64ToInteger#" GenPrimOp
    Word64# -> (# Int#, ByteArr# #)
    with out_of_line = True
+#endif
+
+------------------------------------------------------------------------
+--- Explicitly sized Int# and Word#                                  ---
+------------------------------------------------------------------------
 
+primop   IntToInt8Op       "intToInt8#"       Monadic   Int# -> Int#
+primop   IntToInt16Op      "intToInt16#"      Monadic   Int# -> Int#
+primop   IntToInt32Op      "intToInt32#"      Monadic   Int# -> Int#
+primop   WordToWord8Op     "wordToWord8#"     Monadic   Word# -> Word#
+primop   WordToWord16Op    "wordToWord16#"    Monadic   Word# -> Word#
+primop   WordToWord32Op    "wordToWord32#"    Monadic   Word# -> Word#
 
 ------------------------------------------------------------------------
 --- Arrays                                                           ---
 ------------------------------------------------------------------------
 
-primop  NewByteArrayOp_Char "newCharArray#" GenPrimOp
-   Int# -> State# s -> (# State# s, MutByteArr# s #)
-   with out_of_line = True
+primop  NewArrayOp "newArray#" GenPrimOp
+   Int# -> a -> State# s -> (# State# s, MutArr# s a #)
+   with
+   strictness  = { \ arity -> StrictnessInfo [wwPrim, wwLazy, wwPrim] False }
+   usage       = { mangle NewArrayOp [mkP, mkM, mkP] mkM }
+   out_of_line = True
 
-primop  NewByteArrayOp_Int "newIntArray#" GenPrimOp
+primop  NewByteArrayOp_Char "newByteArray#" 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 IndexByteArrayOp_Char "indexCharArray#" GenPrimOp
+   ByteArr# -> Int# -> Char#
 
-primop  NewByteArrayOp_Float "newFloatArray#" GenPrimOp
-   Int# -> State# s -> (# State# s, MutByteArr# s #)
-   with out_of_line = True
+primop IndexByteArrayOp_WideChar "indexWideCharArray#" GenPrimOp
+   ByteArr# -> Int# -> Char#
 
-primop  NewByteArrayOp_Double "newDoubleArray#" GenPrimOp
-   Int# -> State# s -> (# State# s, MutByteArr# s #)
-   with out_of_line = True
+primop IndexByteArrayOp_Int "indexIntArray#" GenPrimOp
+   ByteArr# -> Int# -> Int#
 
-primop  NewByteArrayOp_StablePtr "newStablePtrArray#" GenPrimOp
-   Int# -> State# s -> (# State# s, MutByteArr# s #)
-   with out_of_line = True
+primop IndexByteArrayOp_Word "indexWordArray#" GenPrimOp
+   ByteArr# -> Int# -> Word#
 
+primop IndexByteArrayOp_Addr "indexAddrArray#" GenPrimOp
+   ByteArr# -> Int# -> Addr#
+
+primop IndexByteArrayOp_Float "indexFloatArray#" GenPrimOp
+   ByteArr# -> Int# -> Float#
+
+primop IndexByteArrayOp_Double "indexDoubleArray#" GenPrimOp
+   ByteArr# -> Int# -> Double#
+
+primop IndexByteArrayOp_StablePtr "indexStablePtrArray#" GenPrimOp
+   ByteArr# -> Int# -> StablePtr# a
+
+primop IndexByteArrayOp_Int8 "indexInt8Array#" GenPrimOp
+   ByteArr# -> Int# -> Int#
+
+primop IndexByteArrayOp_Int16 "indexInt16Array#" GenPrimOp
+   ByteArr# -> Int# -> Int#
+
+primop IndexByteArrayOp_Int32 "indexInt32Array#" GenPrimOp
+   ByteArr# -> Int# -> Int#
+
+#ifdef SUPPORT_LONG_LONGS
+primop IndexByteArrayOp_Int64 "indexInt64Array#" GenPrimOp
+   ByteArr# -> Int# -> Int64#
+#endif
+
+primop IndexByteArrayOp_Word8 "indexWord8Array#" GenPrimOp
+   ByteArr# -> Int# -> Word#
+
+primop IndexByteArrayOp_Word16 "indexWord16Array#" GenPrimOp
+   ByteArr# -> Int# -> Word#
+
+primop IndexByteArrayOp_Word32 "indexWord32Array#" GenPrimOp
+   ByteArr# -> Int# -> Word#
+
+#ifdef SUPPORT_LONG_LONGS
+primop IndexByteArrayOp_Word64 "indexWord64Array#" GenPrimOp
+   ByteArr# -> Int# -> Word64#
+#endif
 
 
 primop  ReadByteArrayOp_Char "readCharArray#" GenPrimOp
    MutByteArr# s -> Int# -> State# s -> (# State# s, Char# #)
 
+primop  ReadByteArrayOp_WideChar "readWideCharArray#" GenPrimOp
+   MutByteArr# s -> Int# -> State# s -> (# State# s, Char# #)
+
 primop  ReadByteArrayOp_Int "readIntArray#" GenPrimOp
    MutByteArr# s -> Int# -> State# s -> (# State# s, Int# #)
 
@@ -528,11 +612,33 @@ 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# #)
+
+#ifdef SUPPORT_LONG_LONGS
 primop  ReadByteArrayOp_Int64 "readInt64Array#" GenPrimOp
    MutByteArr# s -> Int# -> State# s -> (# State# s, Int64# #)
+#endif
 
+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# #)
+
+#ifdef SUPPORT_LONG_LONGS
 primop  ReadByteArrayOp_Word64 "readWord64Array#" GenPrimOp
    MutByteArr# s -> Int# -> State# s -> (# State# s, Word64# #)
+#endif
 
 
 
@@ -540,6 +646,10 @@ primop  WriteByteArrayOp_Char "writeCharArray#" GenPrimOp
    MutByteArr# s -> Int# -> Char# -> State# s -> State# s
    with has_side_effects = True
 
+primop  WriteByteArrayOp_WideChar "writeWideCharArray#" GenPrimOp
+   MutByteArr# s -> Int# -> Char# -> State# s -> State# s
+   with has_side_effects = True
+
 primop  WriteByteArrayOp_Int "writeIntArray#" GenPrimOp
    MutByteArr# s -> Int# -> Int# -> State# s -> State# s
    with has_side_effects = True
@@ -564,46 +674,49 @@ primop  WriteByteArrayOp_StablePtr "writeStablePtrArray#" GenPrimOp
    MutByteArr# s -> Int# -> StablePtr# a -> State# s -> State# s
    with has_side_effects = True
 
-primop  WriteByteArrayOp_Int64 "writeInt64Array#" GenPrimOp
-   MutByteArr# s -> Int# -> Int64# -> State# s -> State# s
+primop  WriteByteArrayOp_Int8 "writeInt8Array#" GenPrimOp
+   MutByteArr# s -> Int# -> Int# -> State# s -> State# s
    with has_side_effects = True
 
-primop  WriteByteArrayOp_Word64 "writeWord64Array#" GenPrimOp
-   MutByteArr# s -> Int# -> Word64# -> State# s -> State# s
+primop  WriteByteArrayOp_Int16 "writeInt16Array#" GenPrimOp
+   MutByteArr# s -> Int# -> Int# -> 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 IndexByteArrayOp_Char "indexCharArray#" GenPrimOp
-   ByteArr# -> Int# -> Char#
-
-primop IndexByteArrayOp_Int "indexIntArray#" GenPrimOp
-   ByteArr# -> Int# -> Int#
-
-primop IndexByteArrayOp_Word "indexWordArray#" GenPrimOp
-   ByteArr# -> Int# -> Word#
-
-primop IndexByteArrayOp_Addr "indexAddrArray#" GenPrimOp
-   ByteArr# -> Int# -> Addr#
-
-primop IndexByteArrayOp_Float "indexFloatArray#" GenPrimOp
-   ByteArr# -> Int# -> Float#
+#ifdef SUPPORT_LONG_LONGS
+primop  WriteByteArrayOp_Int64 "writeInt64Array#" GenPrimOp
+   MutByteArr# s -> Int# -> Int64# -> State# s -> State# s
+   with has_side_effects = True
+#endif
 
-primop IndexByteArrayOp_Double "indexDoubleArray#" GenPrimOp
-   ByteArr# -> Int# -> Double#
+primop  WriteByteArrayOp_Word8 "writeWord8Array#" GenPrimOp
+   MutByteArr# s -> Int# -> Word# -> State# s -> State# s
+   with has_side_effects = True
 
-primop IndexByteArrayOp_StablePtr "indexStablePtrArray#" GenPrimOp
-   ByteArr# -> Int# -> StablePtr# a
+primop  WriteByteArrayOp_Word16 "writeWord16Array#" GenPrimOp
+   MutByteArr# s -> Int# -> Word# -> State# s -> State# s
+   with has_side_effects = True
 
-primop IndexByteArrayOp_Int64 "indexInt64Array#" GenPrimOp
-   ByteArr# -> Int# -> Int64#
+primop  WriteByteArrayOp_Word32 "writeWord32Array#" GenPrimOp
+   MutByteArr# s -> Int# -> Word# -> State# s -> State# s
+   with has_side_effects = True
 
-primop IndexByteArrayOp_Word64 "indexWord64Array#" GenPrimOp
-   ByteArr# -> Int# -> Word64#
+#ifdef SUPPORT_LONG_LONGS
+primop  WriteByteArrayOp_Word64 "writeWord64Array#" GenPrimOp
+   MutByteArr# s -> Int# -> Word64# -> State# s -> State# s
+   with has_side_effects = True
+#endif
 
 
 primop IndexOffAddrOp_Char "indexCharOffAddr#" GenPrimOp
    Addr# -> Int# -> Char#
 
+primop IndexOffAddrOp_WideChar "indexWideCharOffAddr#" GenPrimOp
+   Addr# -> Int# -> Char#
+
 primop IndexOffAddrOp_Int "indexIntOffAddr#" GenPrimOp
    Addr# -> Int# -> Int#
 
@@ -622,16 +735,45 @@ primop IndexOffAddrOp_Double "indexDoubleOffAddr#" GenPrimOp
 primop IndexOffAddrOp_StablePtr "indexStablePtrOffAddr#" GenPrimOp
    Addr# -> Int# -> StablePtr# a
 
+primop IndexOffAddrOp_Int8 "indexInt8OffAddr#" GenPrimOp
+   Addr# -> Int# -> Int#
+
+primop IndexOffAddrOp_Int16 "indexInt16OffAddr#" GenPrimOp
+   Addr# -> Int# -> Int#
+
+primop IndexOffAddrOp_Int32 "indexInt32OffAddr#" GenPrimOp
+   Addr# -> Int# -> Int#
+
+#ifdef SUPPORT_LONG_LONGS
 primop IndexOffAddrOp_Int64 "indexInt64OffAddr#" GenPrimOp
    Addr# -> Int# -> Int64#
+#endif
+
+primop IndexOffAddrOp_Word8 "indexWord8OffAddr#" GenPrimOp
+   Addr# -> Int# -> Word#
 
+primop IndexOffAddrOp_Word16 "indexWord16OffAddr#" GenPrimOp
+   Addr# -> Int# -> Word#
+
+primop IndexOffAddrOp_Word32 "indexWord32OffAddr#" GenPrimOp
+   Addr# -> Int# -> Word#
+
+#ifdef SUPPORT_LONG_LONGS
 primop IndexOffAddrOp_Word64 "indexWord64OffAddr#" GenPrimOp
    Addr# -> Int# -> Word64#
+#endif
 
 
+primop EqForeignObj "eqForeignObj#" GenPrimOp
+   ForeignObj# -> ForeignObj# -> Bool
+   with commutable = True
+
 primop IndexOffForeignObjOp_Char "indexCharOffForeignObj#" GenPrimOp
    ForeignObj# -> Int# -> Char#
 
+primop IndexOffForeignObjOp_WideChar "indexWideCharOffForeignObj#" GenPrimOp
+   ForeignObj# -> Int# -> Char#
+
 primop IndexOffForeignObjOp_Int "indexIntOffForeignObj#" GenPrimOp
    ForeignObj# -> Int# -> Int#
 
@@ -650,17 +792,40 @@ primop IndexOffForeignObjOp_Double "indexDoubleOffForeignObj#" GenPrimOp
 primop IndexOffForeignObjOp_StablePtr "indexStablePtrOffForeignObj#" GenPrimOp
    ForeignObj# -> Int# -> StablePtr# a
 
+primop IndexOffForeignObjOp_Int8 "indexInt8OffForeignObj#" GenPrimOp
+   ForeignObj# -> Int# -> Int#
+
+primop IndexOffForeignObjOp_Int16 "indexInt16OffForeignObj#" GenPrimOp
+   ForeignObj# -> Int# -> Int#
+
+primop IndexOffForeignObjOp_Int32 "indexInt32OffForeignObj#" GenPrimOp
+   ForeignObj# -> Int# -> Int#
+
+#ifdef SUPPORT_LONG_LONGS
 primop IndexOffForeignObjOp_Int64 "indexInt64OffForeignObj#" GenPrimOp
    ForeignObj# -> Int# -> Int64#
+#endif
 
-primop IndexOffForeignObjOp_Word64 "indexWord64OffForeignObj#" GenPrimOp
-   ForeignObj# -> Int# -> Word64#
+primop IndexOffForeignObjOp_Word8 "indexWord8OffForeignObj#" GenPrimOp
+   ForeignObj# -> Int# -> Word#
 
+primop IndexOffForeignObjOp_Word16 "indexWord16OffForeignObj#" GenPrimOp
+   ForeignObj# -> Int# -> Word#
+
+primop IndexOffForeignObjOp_Word32 "indexWord32OffForeignObj#" GenPrimOp
+   ForeignObj# -> Int# -> Word#
 
+#ifdef SUPPORT_LONG_LONGS
+primop IndexOffForeignObjOp_Word64 "indexWord64OffForeignObj#" GenPrimOp
+   ForeignObj# -> Int# -> Word64#
+#endif
 
 primop ReadOffAddrOp_Char "readCharOffAddr#" GenPrimOp
    Addr# -> Int# -> State# s -> (# State# s, Char# #)
 
+primop ReadOffAddrOp_WideChar "readWideCharOffAddr#" GenPrimOp
+   Addr# -> Int# -> State# s -> (# State# s, Char# #)
+
 primop ReadOffAddrOp_Int "readIntOffAddr#" GenPrimOp
    Addr# -> Int# -> State# s -> (# State# s, Int# #)
 
@@ -679,20 +844,43 @@ 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_Int16 "readInt16OffAddr#" GenPrimOp
+   Addr# -> Int# -> State# s -> (# State# s, Int# #)
+
+primop ReadOffAddrOp_Int32 "readInt32OffAddr#" GenPrimOp
+   Addr# -> Int# -> State# s -> (# State# s, Int# #)
 
+#ifdef SUPPORT_LONG_LONGS
 primop ReadOffAddrOp_Int64 "readInt64OffAddr#" GenPrimOp
    Addr# -> Int# -> State# s -> (# State# s, Int64# #)
+#endif
+
+primop ReadOffAddrOp_Word8 "readWord8OffAddr#" GenPrimOp
+   Addr# -> Int# -> State# s -> (# State# s, Word# #)
+
+primop ReadOffAddrOp_Word16 "readWord16OffAddr#" GenPrimOp
+   Addr# -> Int# -> State# s -> (# State# s, Word# #)
+
+primop ReadOffAddrOp_Word32 "readWord32OffAddr#" GenPrimOp
+   Addr# -> Int# -> State# s -> (# State# s, Word# #)
 
+#ifdef SUPPORT_LONG_LONGS
 primop ReadOffAddrOp_Word64 "readWord64OffAddr#" GenPrimOp
    Addr# -> Int# -> State# s -> (# State# s, Word64# #)
+#endif
 
 
 primop  WriteOffAddrOp_Char "writeCharOffAddr#" GenPrimOp
    Addr# -> Int# -> Char# -> State# s -> State# s
    with has_side_effects = True
 
+primop  WriteOffAddrOp_WideChar "writeWideCharOffAddr#" GenPrimOp
+   Addr# -> Int# -> Char# -> State# s -> State# s
+   with has_side_effects = True
+
 primop  WriteOffAddrOp_Int "writeIntOffAddr#" GenPrimOp
    Addr# -> Int# -> Int# -> State# s -> State# s
    with has_side_effects = True
@@ -705,6 +893,10 @@ primop  WriteOffAddrOp_Addr "writeAddrOffAddr#" GenPrimOp
    Addr# -> Int# -> Addr# -> State# s -> State# s
    with has_side_effects = True
 
+primop  WriteOffAddrOp_ForeignObj "writeForeignObjOffAddr#" GenPrimOp
+   Addr# -> Int# -> ForeignObj# -> State# s -> State# s
+   with has_side_effects = True
+
 primop  WriteOffAddrOp_Float "writeFloatOffAddr#" GenPrimOp
    Addr# -> Int# -> Float# -> State# s -> State# s
    with has_side_effects = True
@@ -717,27 +909,44 @@ primop  WriteOffAddrOp_StablePtr "writeStablePtrOffAddr#" GenPrimOp
    Addr# -> Int# -> StablePtr# a -> State# s -> State# s
    with has_side_effects = True
 
-primop  WriteOffAddrOp_ForeignObj "writeForeignObjOffAddr#" GenPrimOp
-   Addr# -> Int# -> ForeignObj# -> State# s -> State# s
+primop  WriteOffAddrOp_Int8 "writeInt8OffAddr#" GenPrimOp
+   Addr# -> Int# -> Int# -> 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_Int32 "writeInt32OffAddr#" GenPrimOp
+   Addr# -> Int# -> Int# -> State# s -> State# s
+   with has_side_effects = True
+
+#ifdef SUPPORT_LONG_LONGS
 primop  WriteOffAddrOp_Int64 "writeInt64OffAddr#" GenPrimOp
    Addr# -> Int# -> Int64# -> State# s -> State# s
    with has_side_effects = True
+#endif
+
+primop  WriteOffAddrOp_Word8 "writeWord8OffAddr#" GenPrimOp
+   Addr# -> Int# -> Word# -> 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_Word32 "writeWord32OffAddr#" GenPrimOp
+   Addr# -> Int# -> Word# -> State# s -> State# s
+   with has_side_effects = True
+
+#ifdef SUPPORT_LONG_LONGS
 primop  WriteOffAddrOp_Word64 "writeWord64OffAddr#" GenPrimOp
    Addr# -> Int# -> Word64# -> State# s -> State# s
    with has_side_effects = True
+#endif
 
 
 
-primop  NewArrayOp "newArray#" GenPrimOp
-   Int# -> a -> State# s -> (# State# s, MutArr# s a #)
-   with
-   strictness  = { \ arity -> StrictnessInfo [wwPrim, wwLazy, wwPrim] False }
-   usage       = { mangle NewArrayOp [mkP, mkM, mkP] mkM }
-   out_of_line = True
-
 primop  SameMutableArrayOp "sameMutableArray#" GenPrimOp
    MutArr# s a -> MutArr# s a -> Bool
    with
@@ -845,14 +1054,14 @@ primop  BlockAsyncExceptionsOp "blockAsyncExceptions#" GenPrimOp
         (State# RealWorld -> (# State# RealWorld, a #))
      -> (State# RealWorld -> (# State# RealWorld, a #))
    with
-   strictness  = { \ arity -> StrictnessInfo [wwLazy] False }
+   strictness  = { \ arity -> StrictnessInfo [wwLazy,wwPrim] False }
    out_of_line = True
 
 primop  UnblockAsyncExceptionsOp "unblockAsyncExceptions#" GenPrimOp
         (State# RealWorld -> (# State# RealWorld, a #))
      -> (State# RealWorld -> (# State# RealWorld, a #))
    with
-   strictness  = { \ arity -> StrictnessInfo [wwLazy] False }
+   strictness  = { \ arity -> StrictnessInfo [wwLazy,wwPrim] False }
    out_of_line = True
 
 ------------------------------------------------------------------------
@@ -872,6 +1081,13 @@ primop  TakeMVarOp "takeMVar#" GenPrimOp
    has_side_effects = True
    out_of_line      = True
 
+primop  TryTakeMVarOp "tryTakeMVar#" GenPrimOp
+   MVar# s a -> State# s -> (# State# s, Int#, a #)
+   with
+   usage            = { mangle TryTakeMVarOp [mkM, mkP] mkM }
+   has_side_effects = True
+   out_of_line      = True
+
 primop  PutMVarOp "putMVar#" GenPrimOp
    MVar# s a -> a -> State# s -> State# s
    with
@@ -880,18 +1096,19 @@ primop  PutMVarOp "putMVar#" GenPrimOp
    has_side_effects = True
    out_of_line      = True
 
+primop  TryPutMVarOp "tryPutMVar#" GenPrimOp
+   MVar# s a -> a -> State# s -> (# State# s, Int# #)
+   with
+   strictness       = { \ arity -> StrictnessInfo [wwPrim, wwLazy, wwPrim] False }
+   usage            = { mangle TryPutMVarOp [mkM, mkM, mkP] mkR }
+   has_side_effects = True
+   out_of_line      = True
+
 primop  SameMVarOp "sameMVar#" GenPrimOp
    MVar# s a -> MVar# s a -> Bool
    with
    usage = { mangle SameMVarOp [mkP, mkP] mkM }
 
-primop  TryTakeMVarOp "tryTakeMVar#" GenPrimOp
-   MVar# s a -> State# s -> (# State# s, Int#, a #)
-   with
-   usage            = { mangle TryTakeMVarOp [mkM, mkP] mkM }
-   has_side_effects = True
-   out_of_line      = True
-
 primop  IsEmptyMVarOp "isEmptyMVar#" GenPrimOp
    MVar# s a -> State# s -> (# State# s, Int# #)
    with
@@ -972,62 +1189,14 @@ primop ForeignObjToAddrOp "foreignObjToAddr#" GenPrimOp
 primop TouchOp "touch#" GenPrimOp
    o -> State# RealWorld -> State# RealWorld
    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 }
-
+   strictness       = { \ arity -> StrictnessInfo [wwLazy, wwPrim] False }
 
 ------------------------------------------------------------------------
 --- 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 #)
@@ -1053,7 +1222,6 @@ primop  FinalizeWeakOp "finalizeWeak#" GenPrimOp
    has_side_effects = True
    out_of_line      = True
 
-
 ------------------------------------------------------------------------
 --- Stable pointers and names                                        ---
 ------------------------------------------------------------------------
@@ -1169,17 +1337,19 @@ 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# are yet to be implemented (for GpH)
+--
+--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
 
 
 ------------------------------------------------------------------------