-----------------------------------------------------------------------
--- $Id: primops.txt.pp,v 1.37 2005/11/25 09:46:19 simonmar Exp $
+--
+-- (c) 2010 The University of Glasgow
--
-- Primitive Operations and Types
--
+-- For more information on PrimOps, see
+-- http://hackage.haskell.org/trac/ghc/wiki/Commentary/PrimOps
+--
-----------------------------------------------------------------------
-- This file is processed by the utility program genprimopcode to produce
--
-- It should first be preprocessed.
--
--- To add a new primop, you currently need to update the following files:
---
--- - this file (ghc/compiler/prelude/primops.txt.pp), which includes
--- the type of the primop, and various other properties (its
--- strictness attributes, whether it is defined as a macro
--- or as out-of-line code, etc.)
---
--- - if the primop is inline (i.e. a macro), then:
--- 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/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
+-- Information on how PrimOps are implemented and the steps necessary to
+-- add a new one can be found in the Commentary:
--
+-- http://hackage.haskell.org/trac/ghc/wiki/Commentary/PrimOps
-- This file is divided into named sections, each containing or more
-- primop entries. Section headers have the format:
{Satisfies \texttt{(quotInt\# x y) *\# y +\# (remInt\# x y) == x}.}
with can_fail = True
-primop IntGcdOp "gcdInt#" Dyadic Int# -> Int# -> Int#
- with out_of_line = True
-
primop IntNegOp "negateInt#" Monadic Int# -> Int#
primop IntAddCOp "addIntC#" GenPrimOp Int# -> Int# -> (# Int#, Int# #)
{Add with carry. First member of result is (wrapped) sum;
primop Int2FloatOp "int2Float#" GenPrimOp Int# -> Float#
primop Int2DoubleOp "int2Double#" GenPrimOp Int# -> Double#
-primop Int2IntegerOp "int2Integer#"
- GenPrimOp Int# -> (# Int#, ByteArray# #)
- with out_of_line = True
-
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 Word2IntOp "word2Int#" GenPrimOp Word# -> Int#
-primop Word2IntegerOp "word2Integer#" GenPrimOp
- Word# -> (# Int#, ByteArray# #)
- 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
primtype Int32#
-primop Int32ToIntegerOp "int32ToInteger#" GenPrimOp
- Int32# -> (# Int#, ByteArray# #)
- with out_of_line = True
-
-
------------------------------------------------------------------------
section "Word32#"
{Operations on 32-bit unsigned words. This type is only used
primtype Word32#
-primop Word32ToIntegerOp "word32ToInteger#" GenPrimOp
- Word32# -> (# Int#, ByteArray# #)
- with out_of_line = True
-
-
#endif
primtype Int64#
-primop Int64ToIntegerOp "int64ToInteger#" GenPrimOp
- Int64# -> (# Int#, ByteArray# #)
- with out_of_line = True
-
------------------------------------------------------------------------
section "Word64#"
{Operations on 64-bit unsigned words. This type is only used
primtype Word64#
-primop Word64ToIntegerOp "word64ToInteger#" GenPrimOp
- Word64# -> (# Int#, ByteArray# #)
- with out_of_line = True
-
-#endif
-
-------------------------------------------------------------------------
-section "Integer#"
- {Operations on arbitrary-precision integers. These operations are
-implemented via the GMP package. An integer is represented as a pair
-consisting of an {\tt Int\#} representing the number of 'limbs' in use and
-the sign, and a {\tt ByteArray\#} containing the 'limbs' themselves. Such pairs
-are returned as unboxed pairs, but must be passed as separate
-components.
-
-For .NET these operations are implemented by foreign imports, so the
-primops are omitted.}
-------------------------------------------------------------------------
-
-#ifndef ILX
-
-primop IntegerAddOp "plusInteger#" GenPrimOp
- Int# -> ByteArray# -> Int# -> ByteArray# -> (# Int#, ByteArray# #)
- with commutable = True
- out_of_line = True
-
-primop IntegerSubOp "minusInteger#" GenPrimOp
- Int# -> ByteArray# -> Int# -> ByteArray# -> (# Int#, ByteArray# #)
- with out_of_line = True
-
-primop IntegerMulOp "timesInteger#" GenPrimOp
- Int# -> ByteArray# -> Int# -> ByteArray# -> (# Int#, ByteArray# #)
- with commutable = True
- out_of_line = True
-
-primop IntegerGcdOp "gcdInteger#" GenPrimOp
- Int# -> ByteArray# -> Int# -> ByteArray# -> (# Int#, ByteArray# #)
- {Greatest common divisor.}
- with commutable = True
- out_of_line = True
-
-primop IntegerIntGcdOp "gcdIntegerInt#" GenPrimOp
- Int# -> ByteArray# -> Int# -> Int#
- {Greatest common divisor, where second argument is an ordinary {\tt Int\#}.}
- with out_of_line = True
-
-primop IntegerDivExactOp "divExactInteger#" GenPrimOp
- Int# -> ByteArray# -> Int# -> ByteArray# -> (# Int#, ByteArray# #)
- {Divisor is guaranteed to be a factor of dividend.}
- with out_of_line = True
-
-primop IntegerQuotOp "quotInteger#" GenPrimOp
- Int# -> ByteArray# -> Int# -> ByteArray# -> (# Int#, ByteArray# #)
- {Rounds towards zero.}
- with out_of_line = True
-
-primop IntegerRemOp "remInteger#" GenPrimOp
- Int# -> ByteArray# -> Int# -> ByteArray# -> (# Int#, ByteArray# #)
- {Satisfies \texttt{plusInteger\# (timesInteger\# (quotInteger\# x y) y) (remInteger\# x y) == x}.}
- with out_of_line = True
-
-primop IntegerCmpOp "cmpInteger#" GenPrimOp
- Int# -> ByteArray# -> Int# -> ByteArray# -> Int#
- {Returns -1,0,1 according as first argument is less than, equal to, or greater than second argument.}
- with needs_wrapper = True
- out_of_line = True
-
-primop IntegerCmpIntOp "cmpIntegerInt#" GenPrimOp
- Int# -> ByteArray# -> Int# -> Int#
- {Returns -1,0,1 according as first argument is less than, equal to, or greater than second argument, which
- is an ordinary Int\#.}
- with needs_wrapper = True
- out_of_line = True
-
-primop IntegerQuotRemOp "quotRemInteger#" GenPrimOp
- Int# -> ByteArray# -> Int# -> ByteArray# -> (# Int#, ByteArray#, Int#, ByteArray# #)
- {Compute quot and rem simulaneously.}
- with can_fail = True
- out_of_line = True
-
-primop IntegerDivModOp "divModInteger#" GenPrimOp
- Int# -> ByteArray# -> Int# -> ByteArray# -> (# Int#, ByteArray#, Int#, ByteArray# #)
- {Compute div and mod simultaneously, where div rounds towards negative infinity
- and\texttt{(q,r) = divModInteger\#(x,y)} implies \texttt{plusInteger\# (timesInteger\# q y) r = x}.}
- with can_fail = True
- out_of_line = True
-
-primop Integer2IntOp "integer2Int#" GenPrimOp
- Int# -> ByteArray# -> Int#
- with needs_wrapper = True
- out_of_line = True
-
-primop Integer2WordOp "integer2Word#" GenPrimOp
- Int# -> ByteArray# -> Word#
- with needs_wrapper = True
- out_of_line = True
-
-#if WORD_SIZE_IN_BITS < 32
-primop IntegerToInt32Op "integerToInt32#" GenPrimOp
- Int# -> ByteArray# -> Int32#
-
-primop IntegerToWord32Op "integerToWord32#" GenPrimOp
- Int# -> ByteArray# -> Word32#
#endif
-primop IntegerAndOp "andInteger#" GenPrimOp
- Int# -> ByteArray# -> Int# -> ByteArray# -> (# Int#, ByteArray# #)
- with out_of_line = True
-
-primop IntegerOrOp "orInteger#" GenPrimOp
- Int# -> ByteArray# -> Int# -> ByteArray# -> (# Int#, ByteArray# #)
- with out_of_line = True
-
-primop IntegerXorOp "xorInteger#" GenPrimOp
- Int# -> ByteArray# -> Int# -> ByteArray# -> (# Int#, ByteArray# #)
- with out_of_line = True
-
-primop IntegerComplementOp "complementInteger#" GenPrimOp
- Int# -> ByteArray# -> (# Int#, ByteArray# #)
- with out_of_line = True
-
-#endif /* ndef ILX */
-
------------------------------------------------------------------------
section "Double#"
{Operations on double-precision (64 bit) floating-point numbers.}
{Exponentiation.}
with needs_wrapper = True
-primop DoubleDecodeOp "decodeDouble#" GenPrimOp
- Double# -> (# Int#, Int#, ByteArray# #)
- {Convert to arbitrary-precision integer.
- First {\tt Int\#} in result is the exponent; second {\tt Int\#} and {\tt ByteArray\#}
- represent an {\tt Integer\#} holding the mantissa.}
- with out_of_line = True
-
primop DoubleDecode_2IntOp "decodeDouble_2Int#" GenPrimOp
Double# -> (# Int#, Word#, Word#, Int# #)
- {Convert to arbitrary-precision integer.
+ {Convert to integer.
First component of the result is -1 or 1, indicating the sign of the
mantissa. The next two are the high and low 32 bits of the mantissa
respectively, and the last is the exponent.}
primop Float2DoubleOp "float2Double#" GenPrimOp Float# -> Double#
-primop FloatDecodeOp "decodeFloat#" GenPrimOp
- Float# -> (# Int#, Int#, ByteArray# #)
- {Convert to arbitrary-precision integer.
- First {\tt Int\#} in result is the exponent; second {\tt Int\#} and {\tt ByteArray\#}
- represent an {\tt Integer\#} holding the mantissa.}
- with out_of_line = True
-
primop FloatDecode_IntOp "decodeFloat_Int#" GenPrimOp
Float# -> (# Int#, Int# #)
- {Convert to arbitrary-precision integer.
+ {Convert to integers.
First {\tt Int\#} in result is the mantissa; second is the exponent.}
with out_of_line = True
with each element containing the specified initial value.}
with
out_of_line = True
+ has_side_effects = True
primop SameMutableArrayOp "sameMutableArray#" GenPrimOp
MutableArray# s a -> MutableArray# s a -> Bool
primop ReadArrayOp "readArray#" GenPrimOp
MutableArray# s a -> Int# -> State# s -> (# State# s, a #)
{Read from specified index of mutable array. Result is not yet evaluated.}
+ with
+ has_side_effects = True
primop WriteArrayOp "writeArray#" GenPrimOp
MutableArray# s a -> Int# -> a -> State# s -> State# s
{Make an immutable array mutable, without copying.}
with
out_of_line = True
+ has_side_effects = True
------------------------------------------------------------------------
section "Byte Arrays"
{Operations on {\tt ByteArray\#}. A {\tt ByteArray\#} is a just a region of
- raw memory in the garbage-collected heap, which is not scanned
- for pointers. It carries its own size (in bytes). There are
- three sets of operations for accessing byte array contents:
- index for reading from immutable byte arrays, and read/write
- for mutable byte arrays. Each set contains operations for
- a range of useful primitive data types. Each operation takes
- an offset measured in terms of the size fo the primitive type
- being read or written.}
+ raw memory in the garbage-collected heap, which is not
+ scanned for pointers. It carries its own size (in bytes).
+ There are
+ three sets of operations for accessing byte array contents:
+ index for reading from immutable byte arrays, and read/write
+ for mutable byte arrays. Each set contains operations for a
+ range of useful primitive data types. Each operation takes
+ an offset measured in terms of the size fo the primitive type
+ being read or written.}
------------------------------------------------------------------------
{Create a new mutable byte array of specified size (in bytes), in
the specified state thread.}
with out_of_line = True
+ has_side_effects = True
primop NewPinnedByteArrayOp_Char "newPinnedByteArray#" GenPrimOp
Int# -> State# s -> (# State# s, MutableByteArray# s #)
{Create a mutable byte array that the GC guarantees not to move.}
with out_of_line = True
+ has_side_effects = True
primop NewAlignedPinnedByteArrayOp_Char "newAlignedPinnedByteArray#" GenPrimOp
Int# -> Int# -> State# s -> (# State# s, MutableByteArray# s #)
{Create a mutable byte array, aligned by the specified amount, that the GC guarantees not to move.}
with out_of_line = True
+ has_side_effects = True
primop ByteArrayContents_Char "byteArrayContents#" GenPrimOp
ByteArray# -> Addr#
primop SizeofByteArrayOp "sizeofByteArray#" GenPrimOp
ByteArray# -> Int#
+ {Return the size of the array in bytes.}
primop SizeofMutableByteArrayOp "sizeofMutableByteArray#" GenPrimOp
MutableByteArray# s -> Int#
-
+ {Return the size of the array in bytes.}
primop IndexByteArrayOp_Char "indexCharArray#" GenPrimOp
ByteArray# -> Int# -> Char#
primop ReadByteArrayOp_Char "readCharArray#" GenPrimOp
MutableByteArray# s -> Int# -> State# s -> (# State# s, Char# #)
{Read 8-bit character; offset in bytes.}
+ with has_side_effects = True
primop ReadByteArrayOp_WideChar "readWideCharArray#" GenPrimOp
MutableByteArray# s -> Int# -> State# s -> (# State# s, Char# #)
{Read 31-bit character; offset in 4-byte words.}
+ with has_side_effects = True
primop ReadByteArrayOp_Int "readIntArray#" GenPrimOp
MutableByteArray# s -> Int# -> State# s -> (# State# s, Int# #)
+ with has_side_effects = True
primop ReadByteArrayOp_Word "readWordArray#" GenPrimOp
MutableByteArray# s -> Int# -> State# s -> (# State# s, Word# #)
+ with has_side_effects = True
primop ReadByteArrayOp_Addr "readAddrArray#" GenPrimOp
MutableByteArray# s -> Int# -> State# s -> (# State# s, Addr# #)
+ with has_side_effects = True
primop ReadByteArrayOp_Float "readFloatArray#" GenPrimOp
MutableByteArray# s -> Int# -> State# s -> (# State# s, Float# #)
+ with has_side_effects = True
primop ReadByteArrayOp_Double "readDoubleArray#" GenPrimOp
MutableByteArray# s -> Int# -> State# s -> (# State# s, Double# #)
+ with has_side_effects = True
primop ReadByteArrayOp_StablePtr "readStablePtrArray#" GenPrimOp
MutableByteArray# s -> Int# -> State# s -> (# State# s, StablePtr# a #)
+ with has_side_effects = True
primop ReadByteArrayOp_Int8 "readInt8Array#" GenPrimOp
MutableByteArray# s -> Int# -> State# s -> (# State# s, Int# #)
+ with has_side_effects = True
primop ReadByteArrayOp_Int16 "readInt16Array#" GenPrimOp
MutableByteArray# s -> Int# -> State# s -> (# State# s, Int# #)
+ with has_side_effects = True
primop ReadByteArrayOp_Int32 "readInt32Array#" GenPrimOp
MutableByteArray# s -> Int# -> State# s -> (# State# s, INT32 #)
+ with has_side_effects = True
primop ReadByteArrayOp_Int64 "readInt64Array#" GenPrimOp
MutableByteArray# s -> Int# -> State# s -> (# State# s, INT64 #)
+ with has_side_effects = True
primop ReadByteArrayOp_Word8 "readWord8Array#" GenPrimOp
MutableByteArray# s -> Int# -> State# s -> (# State# s, Word# #)
+ with has_side_effects = True
primop ReadByteArrayOp_Word16 "readWord16Array#" GenPrimOp
MutableByteArray# s -> Int# -> State# s -> (# State# s, Word# #)
+ with has_side_effects = True
primop ReadByteArrayOp_Word32 "readWord32Array#" GenPrimOp
MutableByteArray# s -> Int# -> State# s -> (# State# s, WORD32 #)
+ with has_side_effects = True
primop ReadByteArrayOp_Word64 "readWord64Array#" GenPrimOp
MutableByteArray# s -> Int# -> State# s -> (# State# s, WORD64 #)
+ with has_side_effects = True
primop WriteByteArrayOp_Char "writeCharArray#" GenPrimOp
MutableByteArray# s -> Int# -> Char# -> State# s -> State# s
primop ReadOffAddrOp_Char "readCharOffAddr#" GenPrimOp
Addr# -> Int# -> State# s -> (# State# s, Char# #)
{Reads 8-bit character; offset in bytes.}
+ with has_side_effects = True
primop ReadOffAddrOp_WideChar "readWideCharOffAddr#" GenPrimOp
Addr# -> Int# -> State# s -> (# State# s, Char# #)
{Reads 31-bit character; offset in 4-byte words.}
+ with has_side_effects = True
primop ReadOffAddrOp_Int "readIntOffAddr#" GenPrimOp
Addr# -> Int# -> State# s -> (# State# s, Int# #)
+ with has_side_effects = True
primop ReadOffAddrOp_Word "readWordOffAddr#" GenPrimOp
Addr# -> Int# -> State# s -> (# State# s, Word# #)
+ with has_side_effects = True
primop ReadOffAddrOp_Addr "readAddrOffAddr#" GenPrimOp
Addr# -> Int# -> State# s -> (# State# s, Addr# #)
+ with has_side_effects = True
primop ReadOffAddrOp_Float "readFloatOffAddr#" GenPrimOp
Addr# -> Int# -> State# s -> (# State# s, Float# #)
+ with has_side_effects = True
primop ReadOffAddrOp_Double "readDoubleOffAddr#" GenPrimOp
Addr# -> Int# -> State# s -> (# State# s, Double# #)
+ with has_side_effects = True
primop ReadOffAddrOp_StablePtr "readStablePtrOffAddr#" GenPrimOp
Addr# -> Int# -> State# s -> (# State# s, StablePtr# a #)
+ with has_side_effects = True
primop ReadOffAddrOp_Int8 "readInt8OffAddr#" GenPrimOp
Addr# -> Int# -> State# s -> (# State# s, Int# #)
+ with has_side_effects = True
primop ReadOffAddrOp_Int16 "readInt16OffAddr#" GenPrimOp
Addr# -> Int# -> State# s -> (# State# s, Int# #)
+ with has_side_effects = True
primop ReadOffAddrOp_Int32 "readInt32OffAddr#" GenPrimOp
Addr# -> Int# -> State# s -> (# State# s, INT32 #)
+ with has_side_effects = True
primop ReadOffAddrOp_Int64 "readInt64OffAddr#" GenPrimOp
Addr# -> Int# -> State# s -> (# State# s, INT64 #)
+ with has_side_effects = True
primop ReadOffAddrOp_Word8 "readWord8OffAddr#" GenPrimOp
Addr# -> Int# -> State# s -> (# State# s, Word# #)
+ with has_side_effects = True
primop ReadOffAddrOp_Word16 "readWord16OffAddr#" GenPrimOp
Addr# -> Int# -> State# s -> (# State# s, Word# #)
+ with has_side_effects = True
primop ReadOffAddrOp_Word32 "readWord32OffAddr#" GenPrimOp
Addr# -> Int# -> State# s -> (# State# s, WORD32 #)
+ with has_side_effects = True
primop ReadOffAddrOp_Word64 "readWord64OffAddr#" GenPrimOp
Addr# -> Int# -> State# s -> (# State# s, WORD64 #)
+ with has_side_effects = True
primop WriteOffAddrOp_Char "writeCharOffAddr#" GenPrimOp
{Create {\tt MutVar\#} with specified initial value in specified state thread.}
with
out_of_line = True
+ has_side_effects = True
primop ReadMutVarOp "readMutVar#" GenPrimOp
MutVar# s a -> State# s -> (# State# s, a #)
{Read contents of {\tt MutVar\#}. Result is not yet evaluated.}
+ with
+ has_side_effects = True
primop WriteMutVarOp "writeMutVar#" GenPrimOp
MutVar# s a -> a -> State# s -> State# s
primop AtomicModifyMutVarOp "atomicModifyMutVar#" GenPrimOp
MutVar# s a -> (a -> b) -> State# s -> (# State# s, c #)
with
- has_side_effects = True
out_of_line = True
+ has_side_effects = True
------------------------------------------------------------------------
section "Exceptions"
-- analyser about that!
-- might use caught action multiply
out_of_line = True
+ has_side_effects = True
primop RaiseOp "raise#" GenPrimOp
a -> b
a -> State# RealWorld -> (# State# RealWorld, b #)
with
out_of_line = True
+ has_side_effects = True
-primop BlockAsyncExceptionsOp "blockAsyncExceptions#" GenPrimOp
+primop MaskAsyncExceptionsOp "maskAsyncExceptions#" GenPrimOp
(State# RealWorld -> (# State# RealWorld, a #))
-> (State# RealWorld -> (# State# RealWorld, a #))
with
out_of_line = True
+ has_side_effects = True
-primop UnblockAsyncExceptionsOp "unblockAsyncExceptions#" GenPrimOp
+primop MaskUninterruptibleOp "maskUninterruptible#" GenPrimOp
(State# RealWorld -> (# State# RealWorld, a #))
-> (State# RealWorld -> (# State# RealWorld, a #))
with
out_of_line = True
+ has_side_effects = True
-primop AsyncExceptionsBlockedOp "asyncExceptionsBlocked#" GenPrimOp
+primop UnmaskAsyncExceptionsOp "unmaskAsyncExceptions#" GenPrimOp
+ (State# RealWorld -> (# State# RealWorld, a #))
+ -> (State# RealWorld -> (# State# RealWorld, a #))
+ with
+ out_of_line = True
+ has_side_effects = True
+
+primop MaskStatus "getMaskingState#" GenPrimOp
State# RealWorld -> (# State# RealWorld, Int# #)
with
out_of_line = True
+ has_side_effects = True
------------------------------------------------------------------------
section "STM-accessible Mutable Variables"
{Create a new {\tt TVar\#} holding a specified initial value.}
with
out_of_line = True
+ has_side_effects = True
primop ReadTVarOp "readTVar#" GenPrimOp
TVar# s a
{Read contents of {\tt TVar\#}. Result is not yet evaluated.}
with
out_of_line = True
+ has_side_effects = True
primop ReadTVarIOOp "readTVarIO#" GenPrimOp
TVar# s a
{Read contents of {\tt TVar\#} outside an STM transaction}
with
out_of_line = True
+ has_side_effects = True
primop WriteTVarOp "writeTVar#" GenPrimOp
TVar# s a
{Create new {\tt MVar\#}; initially empty.}
with
out_of_line = True
+ has_side_effects = True
primop TakeMVarOp "takeMVar#" GenPrimOp
MVar# s a -> State# s -> (# State# s, a #)
{If {\tt MVar\#} is empty, block until it becomes full.
Then remove and return its contents, and set it empty.}
with
- has_side_effects = True
out_of_line = True
+ has_side_effects = True
primop TryTakeMVarOp "tryTakeMVar#" GenPrimOp
MVar# s a -> State# s -> (# State# s, Int#, a #)
{If {\tt MVar\#} is empty, immediately return with integer 0 and value undefined.
Otherwise, return with integer 1 and contents of {\tt MVar\#}, and set {\tt MVar\#} empty.}
with
- has_side_effects = True
out_of_line = True
+ has_side_effects = True
primop PutMVarOp "putMVar#" GenPrimOp
MVar# s a -> a -> State# s -> State# s
{If {\tt MVar\#} is full, block until it becomes empty.
Then store value arg as its new contents.}
with
- has_side_effects = True
out_of_line = True
+ has_side_effects = True
primop TryPutMVarOp "tryPutMVar#" GenPrimOp
MVar# s a -> a -> State# s -> (# State# s, Int# #)
{If {\tt MVar\#} is full, immediately return with integer 0.
Otherwise, store value arg as {\tt MVar\#}'s new contents, and return with integer 1.}
with
- has_side_effects = True
out_of_line = True
+ has_side_effects = True
primop SameMVarOp "sameMVar#" GenPrimOp
MVar# s a -> MVar# s a -> Bool
{Return 1 if {\tt MVar\#} is empty; 0 otherwise.}
with
out_of_line = True
+ has_side_effects = True
------------------------------------------------------------------------
section "Delay/wait operations"
State# RealWorld -> (# State# RealWorld, ThreadId# #)
with
out_of_line = True
+ has_side_effects = True
primop LabelThreadOp "labelThread#" GenPrimOp
ThreadId# -> Addr# -> State# RealWorld -> State# RealWorld
State# RealWorld -> (# State# RealWorld, Int# #)
with
out_of_line = True
+ has_side_effects = True
primop NoDuplicateOp "noDuplicate#" GenPrimOp
State# RealWorld -> State# RealWorld
with
out_of_line = True
+ has_side_effects = True
primop ThreadStatusOp "threadStatus#" GenPrimOp
ThreadId# -> State# RealWorld -> (# State# RealWorld, Int# #)
with
out_of_line = True
+ has_side_effects = True
------------------------------------------------------------------------
section "Weak pointers"
has_side_effects = True
out_of_line = True
+primop NumSparks "numSparks#" GenPrimOp
+ State# s -> (# State# s, Int# #)
+ { Returns the number of sparks in the local spark pool. }
+ with
+ has_side_effects = True
+ out_of_line = True
+
-- HWL: The first 4 Int# in all par... annotations denote:
-- name, granularity info, size of result, degree of parallelism
-- Same structure as _seq_ i.e. returns Int#
-- the wrapper had type () -> (), and hence the wrapper de-constructed the (), the worker re-constructed
-- a new (), with the result that the code ended up with "case () of (a,b) -> ...".
+primop TraceEventOp "traceEvent#" GenPrimOp
+ Addr# -> State# s -> State# s
+ { Emits an event via the RTS tracing framework. The contents
+ of the event is the zero-terminated byte string passed as the first
+ argument. The event will be emitted either to the .eventlog file,
+ or to stderr, depending on the runtime RTS flags. }
+ with
+ has_side_effects = True
+ out_of_line = True
+
------------------------------------------------------------------------
--- ---
------------------------------------------------------------------------