X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Fprelude%2Fprimops.txt.pp;h=ecde8821ebc8a0ec9eac6cf872221fde2afc761a;hb=ad68b91e2126681fba942f3038bcf32f9a1e7259;hp=a8a80db016b850d3a171b3275bb889bf0643acf7;hpb=d11e681f219f6e38c2e5bc87adfb66f82de5ea65;p=ghc-hetmet.git diff --git a/ghc/compiler/prelude/primops.txt.pp b/ghc/compiler/prelude/primops.txt.pp index a8a80db..ecde882 100644 --- a/ghc/compiler/prelude/primops.txt.pp +++ b/ghc/compiler/prelude/primops.txt.pp @@ -1,5 +1,5 @@ ----------------------------------------------------------------------- --- $Id: primops.txt.pp,v 1.10 2001/12/05 17:35:14 sewardj Exp $ +-- $Id: primops.txt.pp,v 1.37 2005/11/25 09:46:19 simonmar Exp $ -- -- Primitive Operations -- @@ -18,16 +18,15 @@ -- strictness attributes, whether it is defined as a macro -- or as out-of-line code, etc.) -- --- - ghc/lib/std/PrelGHC.hi-boot, to declare the primop --- -- - if the primop is inline (i.e. a macro), then: --- ghc/includes/PrimOps.h --- ghc/compiler/nativeGen/StixPrim.lhs --- ghc/compiler/nativeGen/MachCode.lhs (if implementation is machine-dependent) +-- ghc/compiler/AbsCUtils.lhs (dscCOpStmt) +-- defines the translation of the primop into simpler +-- abstract C operations. -- -- - or, for an out-of-line primop: --- ghc/includes/PrimOps.h (just add the declaration) --- ghc/rts/PrimOps.hc (define it here) +-- ghc/includes/StgMiscClosures.h (just add the declaration) +-- ghc/rts/PrimOps.cmm (define it here) +-- ghc/rts/Linker.c (declare the symbol for GHCi) -- -- - the User's Guide -- @@ -57,7 +56,7 @@ defaults commutable = False needs_wrapper = False can_fail = False - strictness = { \ arity -> StrictnessInfo (replicate arity wwPrim) False } + strictness = { \ arity -> mkStrictSig (mkTopDmdType (replicate arity lazyDmd) TopRes) } usage = { nomangle other } -- Currently, documentation is produced using latex, so contents of @@ -66,6 +65,11 @@ defaults #include "MachDeps.h" +-- We need platform defines (tests for mingw32 below). However, we only +-- test the TARGET platform, which doesn't vary between stages, so the +-- stage1 platform defines are fine: +#include "../stage1/ghc_boot_platform.h" + section "The word size story." {Haskell98 specifies that signed integers (type {\tt Int}) must contain at least 30 bits. GHC always implements {\tt @@ -114,11 +118,7 @@ section "The word size story." -> Int\#}; otherwise it has type {\tt ByteArr\# -> Int\# -> Int32\#}. This approach confines the necessary {\tt \#if}-defs to this file; no conditional compilation is needed - in the files that expose these primops, namely - \texttt{lib/std/PrelStorable.lhs}, - \texttt{hslibs/lang/ArrayBase.hs}, and (in deprecated - fashion) in \texttt{hslibs/lang/ForeignObj.lhs} and - \texttt{hslibs/lang/Addr.lhs}. + in the files that expose these primops. Finally, there are strongly deprecated primops for coercing between {\tt Addr\#}, the primitive type of machine @@ -180,6 +180,31 @@ primop IntSubOp "-#" Dyadic Int# -> Int# -> Int# primop IntMulOp "*#" Dyadic Int# -> Int# -> Int# + {Low word of signed integer multiply.} + with commutable = True + +primop IntMulMayOfloOp "mulIntMayOflo#" + Dyadic Int# -> Int# -> Int# + {Return non-zero if there is any possibility that the upper word of a + signed integer multiply might contain useful information. Return + zero only if you are completely sure that no overflow can occur. + On a 32-bit platform, the recommmended implementation is to do a + 32 x 32 -> 64 signed multiply, and subtract result[63:32] from + (result[31] >>signed 31). If this is zero, meaning that the + upper word is merely a sign extension of the lower one, no + overflow can occur. + + On a 64-bit platform it is not always possible to + acquire the top 64 bits of the result. Therefore, a recommended + implementation is to take the absolute value of both operands, and + return 0 iff bits[63:31] of them are zero, since that means that their + magnitudes fit within 31 bits, so the magnitude of the product must fit + into 62 bits. + + If in doubt, return non-zero, but do make an effort to create the + correct answer for small args, since otherwise the performance of + (*) :: Integer -> Integer -> Integer will be poor. + } with commutable = True primop IntQuotOp "quotInt#" Dyadic @@ -197,11 +222,12 @@ primop IntGcdOp "gcdInt#" Dyadic Int# -> Int# -> Int# primop IntNegOp "negateInt#" Monadic Int# -> Int# primop IntAddCOp "addIntC#" GenPrimOp Int# -> Int# -> (# Int#, Int# #) - {Add with carry. First member of result is (wrapped) sum; second member is 0 iff no overflow occured.} + {Add with carry. First member of result is (wrapped) sum; + second member is 0 iff no overflow occured.} primop IntSubCOp "subIntC#" GenPrimOp Int# -> Int# -> (# Int#, Int# #) - {Subtract with carry. First member of result is (wrapped) difference; second member is 0 iff no overflow occured.} -primop IntMulCOp "mulIntC#" GenPrimOp Int# -> Int# -> (# Int#, Int# #) - {Multiply with carry. First member of result is (wrapped) product; second member is 0 iff no overflow occured.} + {Subtract with carry. First member of result is (wrapped) difference; + second member is 0 iff no overflow occured.} + primop IntGtOp ">#" Compare Int# -> Int# -> Bool primop IntGeOp ">=#" Compare Int# -> Int# -> Bool @@ -226,12 +252,15 @@ primop Int2IntegerOp "int2Integer#" GenPrimOp Int# -> (# Int#, ByteArr# #) with out_of_line = True -primop ISllOp "iShiftL#" GenPrimOp Int# -> Int# -> Int# - {Shift left. Return 0 if shifted by more than size of an Int\#.} -primop ISraOp "iShiftRA#" GenPrimOp Int# -> Int# -> Int# - {Shift right arithemetic. Return 0 if shifted by more than size of an Int\#.} -primop ISrlOp "iShiftRL#" GenPrimOp Int# -> Int# -> Int# - {Shift right logical. Return 0 if shifted by more than size of an Int\#.} +primop ISllOp "uncheckedIShiftL#" GenPrimOp Int# -> Int# -> Int# + {Shift left. Result undefined if shift amount is not + in the range 0 to word size - 1 inclusive.} +primop ISraOp "uncheckedIShiftRA#" GenPrimOp Int# -> Int# -> Int# + {Shift right arithmetic. Result undefined if shift amount is not + in the range 0 to word size - 1 inclusive.} +primop ISrlOp "uncheckedIShiftRL#" GenPrimOp Int# -> Int# -> Int# + {Shift right logical. Result undefined if shift amount is not + in the range 0 to word size - 1 inclusive.} ------------------------------------------------------------------------ section "Word#" @@ -263,10 +292,12 @@ primop XorOp "xor#" Dyadic Word# -> Word# -> Word# primop NotOp "not#" Monadic Word# -> Word# -primop SllOp "shiftL#" GenPrimOp Word# -> Int# -> Word# - {Shift left logical. Return 0 if shifted by more than number of bits in a Word\#.} -primop SrlOp "shiftRL#" GenPrimOp Word# -> Int# -> Word# - {Shift right logical. Return 0 if shifted by more than number of bits in a Word\#.} +primop SllOp "uncheckedShiftL#" GenPrimOp Word# -> Int# -> Word# + {Shift left logical. Result undefined if shift amount is not + in the range 0 to word size - 1 inclusive.} +primop SrlOp "uncheckedShiftRL#" GenPrimOp Word# -> Int# -> Word# + {Shift right logical. Result undefined if shift amount is not + in the range 0 to word size - 1 inclusive.} primop Word2IntOp "word2Int#" GenPrimOp Word# -> Int# @@ -681,7 +712,6 @@ primop NewArrayOp "newArray#" GenPrimOp in the specified state thread, with each element containing the specified initial value.} with - strictness = { \ arity -> StrictnessInfo [wwPrim, wwLazy, wwPrim] False } usage = { mangle NewArrayOp [mkP, mkM, mkP] mkM } out_of_line = True @@ -701,7 +731,6 @@ primop WriteArrayOp "writeArray#" GenPrimOp {Write to specified index of mutable array.} with usage = { mangle WriteArrayOp [mkM, mkP, mkM, mkP] mkR } - strictness = { \ arity -> StrictnessInfo [wwPrim, wwPrim, wwLazy, wwPrim] False } has_side_effects = True primop IndexArrayOp "indexArray#" GenPrimOp @@ -1087,10 +1116,6 @@ 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 @@ -1136,88 +1161,6 @@ primop WriteOffAddrOp_Word64 "writeWord64OffAddr#" GenPrimOp with has_side_effects = True ------------------------------------------------------------------------ -section "ForeignObj#" - {Operations on ForeignObj\#. The indexing operations are - all deprecated.} ------------------------------------------------------------------------- - -primop MkForeignObjOp "mkForeignObj#" GenPrimOp - Addr# -> State# RealWorld -> (# State# RealWorld, ForeignObj# #) - with - has_side_effects = True - out_of_line = True - -primop WriteForeignObjOp "writeForeignObj#" GenPrimOp - ForeignObj# -> Addr# -> State# s -> State# s - with - has_side_effects = True - -primop ForeignObjToAddrOp "foreignObjToAddr#" GenPrimOp - ForeignObj# -> Addr# - -primop TouchOp "touch#" GenPrimOp - o -> State# RealWorld -> State# RealWorld - with - has_side_effects = True - strictness = { \ arity -> StrictnessInfo [wwLazy, wwPrim] False } - -primop EqForeignObj "eqForeignObj#" GenPrimOp - ForeignObj# -> ForeignObj# -> Bool - with commutable = True - -primop IndexOffForeignObjOp_Char "indexCharOffForeignObj#" GenPrimOp - ForeignObj# -> Int# -> Char# - {Read 8-bit character; offset in bytes.} - -primop IndexOffForeignObjOp_WideChar "indexWideCharOffForeignObj#" GenPrimOp - ForeignObj# -> Int# -> Char# - {Read 31-bit character; offset in 4-byte words.} - -primop IndexOffForeignObjOp_Int "indexIntOffForeignObj#" GenPrimOp - ForeignObj# -> Int# -> Int# - -primop IndexOffForeignObjOp_Word "indexWordOffForeignObj#" GenPrimOp - ForeignObj# -> Int# -> Word# - -primop IndexOffForeignObjOp_Addr "indexAddrOffForeignObj#" GenPrimOp - ForeignObj# -> Int# -> Addr# - -primop IndexOffForeignObjOp_Float "indexFloatOffForeignObj#" GenPrimOp - ForeignObj# -> Int# -> Float# - -primop IndexOffForeignObjOp_Double "indexDoubleOffForeignObj#" GenPrimOp - ForeignObj# -> Int# -> Double# - -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# -> INT32 - -primop IndexOffForeignObjOp_Int64 "indexInt64OffForeignObj#" GenPrimOp - ForeignObj# -> Int# -> INT64 - -primop IndexOffForeignObjOp_Word8 "indexWord8OffForeignObj#" GenPrimOp - ForeignObj# -> Int# -> Word# - -primop IndexOffForeignObjOp_Word16 "indexWord16OffForeignObj#" GenPrimOp - ForeignObj# -> Int# -> Word# - -primop IndexOffForeignObjOp_Word32 "indexWord32OffForeignObj#" GenPrimOp - ForeignObj# -> Int# -> WORD32 - -primop IndexOffForeignObjOp_Word64 "indexWord64OffForeignObj#" GenPrimOp - ForeignObj# -> Int# -> WORD64 - - - ------------------------------------------------------------------------- section "Mutable variables" {Operations on MutVar\#s, which behave like single-element mutable arrays.} ------------------------------------------------------------------------ @@ -1227,7 +1170,6 @@ primop NewMutVarOp "newMutVar#" GenPrimOp {Create MutVar\# with specified initial value in specified state thread.} with usage = { mangle NewMutVarOp [mkM, mkP] mkM } - strictness = { \ arity -> StrictnessInfo [wwLazy, wwPrim] False } out_of_line = True primop ReadMutVarOp "readMutVar#" GenPrimOp @@ -1240,7 +1182,6 @@ primop WriteMutVarOp "writeMutVar#" GenPrimOp MutVar# s a -> a -> State# s -> State# s {Write contents of MutVar\#.} with - strictness = { \ arity -> StrictnessInfo [wwPrim, wwLazy, wwPrim] False } usage = { mangle WriteMutVarOp [mkM, mkM, mkP] mkR } has_side_effects = True @@ -1249,6 +1190,18 @@ primop SameMutVarOp "sameMutVar#" GenPrimOp with usage = { mangle SameMutVarOp [mkP, mkP] mkM } +-- not really the right type, but we don't know about pairs here. The +-- correct type is +-- +-- MutVar# s a -> (a -> (a,b)) -> State# s -> (# State# s, b #) +-- +primop AtomicModifyMutVarOp "atomicModifyMutVar#" GenPrimOp + MutVar# s a -> (a -> b) -> State# s -> (# State# s, c #) + with + usage = { mangle AtomicModifyMutVarOp [mkP, mkM, mkP] mkM } + has_side_effects = True + out_of_line = True + ------------------------------------------------------------------------ section "Exceptions" ------------------------------------------------------------------------ @@ -1259,7 +1212,6 @@ primop CatchOp "catch#" GenPrimOp -> State# RealWorld -> (# State# RealWorld, a #) with - strictness = { \ arity -> StrictnessInfo [wwLazy, wwLazy, wwPrim] False } -- Catch is actually strict in its first argument -- but we don't want to tell the strictness -- analyser about that! @@ -1271,26 +1223,93 @@ primop CatchOp "catch#" GenPrimOp primop RaiseOp "raise#" GenPrimOp a -> b with - strictness = { \ arity -> StrictnessInfo [wwLazy] True } - -- NB: True => result is bottom + strictness = { \ arity -> mkStrictSig (mkTopDmdType [lazyDmd] BotRes) } + -- NB: result is bottom usage = { mangle RaiseOp [mkM] mkM } out_of_line = True +-- raiseIO# needs to be a primop, because exceptions in the IO monad +-- must be *precise* - we don't want the strictness analyser turning +-- one kind of bottom into another, as it is allowed to do in pure code. + +primop RaiseIOOp "raiseIO#" GenPrimOp + a -> State# RealWorld -> (# State# RealWorld, b #) + with + out_of_line = True + primop BlockAsyncExceptionsOp "blockAsyncExceptions#" GenPrimOp (State# RealWorld -> (# State# RealWorld, a #)) -> (State# RealWorld -> (# State# RealWorld, a #)) with - 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, wwPrim] False } out_of_line = True ------------------------------------------------------------------------ +section "STM-accessible Mutable Variables" +------------------------------------------------------------------------ + +primop AtomicallyOp "atomically#" GenPrimOp + (State# RealWorld -> (# State# RealWorld, a #) ) + -> State# RealWorld -> (# State# RealWorld, a #) + with + out_of_line = True + has_side_effects = True + +primop RetryOp "retry#" GenPrimOp + State# RealWorld -> (# State# RealWorld, a #) + with + out_of_line = True + has_side_effects = True + +primop CatchRetryOp "catchRetry#" GenPrimOp + (State# RealWorld -> (# State# RealWorld, a #) ) + -> (State# RealWorld -> (# State# RealWorld, a #) ) + -> (State# RealWorld -> (# State# RealWorld, a #) ) + with + out_of_line = True + has_side_effects = True + +primop CatchSTMOp "catchSTM#" GenPrimOp + (State# RealWorld -> (# State# RealWorld, a #) ) + -> (b -> State# RealWorld -> (# State# RealWorld, a #) ) + -> (State# RealWorld -> (# State# RealWorld, a #) ) + with + out_of_line = True + has_side_effects = True + +primop NewTVarOp "newTVar#" GenPrimOp + a + -> State# s -> (# State# s, TVar# s a #) + {Create a new Tar\# holding a specified initial value.} + with + out_of_line = True + +primop ReadTVarOp "readTVar#" GenPrimOp + TVar# s a + -> State# s -> (# State# s, a #) + {Read contents of TVar\#. Result is not yet evaluated.} + with + out_of_line = True + +primop WriteTVarOp "writeTVar#" GenPrimOp + TVar# s a + -> a + -> State# s -> State# s + {Write contents of TVar\#.} + with + out_of_line = True + has_side_effects = True + +primop SameTVarOp "sameTVar#" GenPrimOp + TVar# s a -> TVar# s a -> Bool + + +------------------------------------------------------------------------ section "Synchronized Mutable Variables" {Operations on MVar\#s, which are shared mutable variables ({\it not} the same as MutVar\#s!). (Note: in a non-concurrent implementation, @@ -1328,7 +1347,6 @@ primop PutMVarOp "putMVar#" GenPrimOp {If mvar is full, block until it becomes empty. Then store value arg as its new contents.} with - strictness = { \ arity -> StrictnessInfo [wwPrim, wwLazy, wwPrim] False } usage = { mangle PutMVarOp [mkM, mkM, mkP] mkR } has_side_effects = True out_of_line = True @@ -1338,7 +1356,6 @@ primop TryPutMVarOp "tryPutMVar#" GenPrimOp {If mvar is full, immediately return with integer 0. Otherwise, store value arg as mvar's new contents, and return with integer 1.} with - strictness = { \ arity -> StrictnessInfo [wwPrim, wwLazy, wwPrim] False } usage = { mangle TryPutMVarOp [mkM, mkM, mkP] mkR } has_side_effects = True out_of_line = True @@ -1383,6 +1400,33 @@ primop WaitWriteOp "waitWrite#" GenPrimOp has_side_effects = True out_of_line = True +#ifdef mingw32_TARGET_OS +primop AsyncReadOp "asyncRead#" GenPrimOp + Int# -> Int# -> Int# -> Addr# -> State# RealWorld-> (# State# RealWorld, Int#, Int# #) + {Asynchronously read bytes from specified file descriptor.} + with + needs_wrapper = True + has_side_effects = True + out_of_line = True + +primop AsyncWriteOp "asyncWrite#" GenPrimOp + Int# -> Int# -> Int# -> Addr# -> State# RealWorld-> (# State# RealWorld, Int#, Int# #) + {Asynchronously write bytes from specified file descriptor.} + with + needs_wrapper = True + has_side_effects = True + out_of_line = True + +primop AsyncDoProcOp "asyncDoProc#" GenPrimOp + Addr# -> Addr# -> State# RealWorld-> (# State# RealWorld, Int#, Int# #) + {Asynchronously perform procedure (first arg), passing it 2nd arg.} + with + needs_wrapper = True + has_side_effects = True + out_of_line = True + +#endif + ------------------------------------------------------------------------ section "Concurrency primitives" {(In a non-concurrent implementation, ThreadId\# can be as singleton @@ -1394,7 +1438,6 @@ primop ForkOp "fork#" GenPrimOp a -> State# RealWorld -> (# State# RealWorld, ThreadId# #) with usage = { mangle ForkOp [mkO, mkP] mkR } - strictness = { \ arity -> StrictnessInfo [wwLazy, wwPrim] False } has_side_effects = True out_of_line = True @@ -1416,6 +1459,17 @@ primop MyThreadIdOp "myThreadId#" GenPrimOp with out_of_line = True +primop LabelThreadOp "labelThread#" GenPrimOp + ThreadId# -> Addr# -> State# RealWorld -> State# RealWorld + with + has_side_effects = True + out_of_line = True + +primop IsCurrentThreadBoundOp "isCurrentThreadBound#" GenPrimOp + State# RealWorld -> (# State# RealWorld, Int# #) + with + out_of_line = True + ------------------------------------------------------------------------ section "Weak pointers" ------------------------------------------------------------------------ @@ -1425,7 +1479,6 @@ section "Weak pointers" primop MkWeakOp "mkWeak#" GenPrimOp o -> b -> c -> State# RealWorld -> (# State# RealWorld, Weak# b #) with - strictness = { \ arity -> StrictnessInfo [wwLazy, wwLazy, wwLazy, wwPrim] False } usage = { mangle MkWeakOp [mkZ, mkM, mkM, mkP] mkM } has_side_effects = True out_of_line = True @@ -1439,7 +1492,7 @@ primop DeRefWeakOp "deRefWeak#" GenPrimOp primop FinalizeWeakOp "finalizeWeak#" GenPrimOp Weak# a -> State# RealWorld -> (# State# RealWorld, Int#, - (State# RealWorld -> (# State# RealWorld, Unit #)) #) + (State# RealWorld -> (# State# RealWorld, () #)) #) with usage = { mangle FinalizeWeakOp [mkM, mkP] (mkR . (inUB FinalizeWeakOp @@ -1447,6 +1500,11 @@ primop FinalizeWeakOp "finalizeWeak#" GenPrimOp has_side_effects = True out_of_line = True +primop TouchOp "touch#" GenPrimOp + o -> State# RealWorld -> State# RealWorld + with + has_side_effects = True + ------------------------------------------------------------------------ section "Stable pointers and names" ------------------------------------------------------------------------ @@ -1454,7 +1512,6 @@ section "Stable pointers and names" primop MakeStablePtrOp "makeStablePtr#" GenPrimOp a -> State# RealWorld -> (# State# RealWorld, StablePtr# a #) with - strictness = { \ arity -> StrictnessInfo [wwLazy, wwPrim] False } usage = { mangle MakeStablePtrOp [mkM, mkP] mkM } has_side_effects = True out_of_line = True @@ -1477,7 +1534,6 @@ primop MakeStableNameOp "makeStableName#" GenPrimOp a -> State# RealWorld -> (# State# RealWorld, StableName# a #) with usage = { mangle MakeStableNameOp [mkZ, mkP] mkR } - strictness = { \ arity -> StrictnessInfo [wwLazy, wwPrim] False } needs_wrapper = True has_side_effects = True out_of_line = True @@ -1493,22 +1549,23 @@ primop StableNameToIntOp "stableNameToInt#" GenPrimOp usage = { mangle StableNameToIntOp [mkP] mkR } ------------------------------------------------------------------------ -section "Parallelism" +section "Unsafe pointer equality" +-- (#1 Bad Guy: Alistair Reid :) ------------------------------------------------------------------------ -primop SeqOp "seq#" GenPrimOp - a -> Int# +primop ReallyUnsafePtrEqualityOp "reallyUnsafePtrEquality#" GenPrimOp + a -> a -> Int# with - usage = { mangle SeqOp [mkO] mkR } - strictness = { \ arity -> StrictnessInfo [wwStrict] False } - -- Seq is strict in its argument; see notes in ConFold.lhs - has_side_effects = True + usage = { mangle ReallyUnsafePtrEqualityOp [mkZ, mkZ] mkR } + +------------------------------------------------------------------------ +section "Parallelism" +------------------------------------------------------------------------ primop ParOp "par#" GenPrimOp a -> Int# with usage = { mangle ParOp [mkO] mkR } - strictness = { \ arity -> StrictnessInfo [wwLazy] False } -- Note that Par is lazy to avoid that the sparked thing -- gets evaluted strictly, which it should *not* be has_side_effects = True @@ -1579,7 +1636,8 @@ section "Tag to enum stuff" primop DataToTagOp "dataToTag#" GenPrimOp a -> Int# with - strictness = { \ arity -> StrictnessInfo [wwLazy] False } + strictness = { \ arity -> mkStrictSig (mkTopDmdType [seqDmd] TopRes) } + -- dataToTag# must have an evaluated argument primop TagToEnumOp "tagToEnum#" GenPrimOp Int# -> a @@ -1595,19 +1653,19 @@ primop AddrToHValueOp "addrToHValue#" GenPrimOp {Convert an Addr\# to a followable type.} primop MkApUpd0_Op "mkApUpd0#" GenPrimOp - a -> (# a #) + BCO# -> (# a #) with out_of_line = True primop NewBCOOp "newBCO#" GenPrimOp - ByteArr# -> ByteArr# -> Array# a -> ByteArr# -> State# s -> (# State# s, BCO# #) + ByteArr# -> ByteArr# -> Array# a -> ByteArr# -> Int# -> ByteArr# -> State# s -> (# State# s, BCO# #) with has_side_effects = True out_of_line = True ------------------------------------------------------------------------ section "Coercion" - {{\tt unsafeCoerce# :: a -> b} is not a primop, but is defined in MkId.lhs.} + {{\tt unsafeCoerce\# :: a -> b} is not a primop, but is defined in MkId.lhs.} ------------------------------------------------------------------------