------------------------------------------------------------------------
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,
+ rounded up to the nearest multiple of a word). 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.}
------------------------------------------------------------------------
primop SizeofByteArrayOp "sizeofByteArray#" GenPrimOp
ByteArray# -> Int#
+ {Return the size of the array in bytes, rounded up to the nearest multiple
+ of a word.}
primop SizeofMutableByteArrayOp "sizeofMutableByteArray#" GenPrimOp
MutableByteArray# s -> Int#
-
+ {Return the size of the array in bytes, rounded up to the nearest multiple
+ of a word.}
primop IndexByteArrayOp_Char "indexCharArray#" GenPrimOp
ByteArray# -> Int# -> Char#
-- 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
+
------------------------------------------------------------------------
--- ---
------------------------------------------------------------------------