1 -----------------------------------------------------------------------
2 -- $Id: primops.txt,v 1.23 2001/07/26 03:08:38 ken Exp $
4 -- Primitive Operations
6 -----------------------------------------------------------------------
8 -- To add a new primop, you currently need to update the following files:
10 -- - this file (ghc/compiler/prelude/primops.txt), which includes
11 -- the type of the primop, and various other properties (its
12 -- strictness attributes, whether it is defined as a macro
13 -- or as out-of-line code, etc.)
15 -- - ghc/lib/std/PrelGHC.hi-boot, to declare the primop
17 -- - if the primop is inline (i.e. a macro), then:
18 -- ghc/includes/PrimOps.h
19 -- ghc/compiler/nativeGen/StixPrim.lhs
21 -- - or, for an out-of-line primop:
22 -- ghc/includes/PrimOps.h (just add the declaration)
23 -- ghc/rts/PrimOps.hc (define it here)
31 -- The default attribute values which apply if you don't specify
32 -- other ones. Attribute values can be True, False, or arbitrary
33 -- text between curly brackets. This is a kludge to enable
34 -- processors of this file to easily get hold of simple info
35 -- (eg, out_of_line), whilst avoiding parsing complex expressions
36 -- needed for strictness and usage info.
39 has_side_effects = False
44 strictness = { \ arity -> StrictnessInfo (replicate arity wwPrim) False }
45 usage = { nomangle other }
48 ------------------------------------------------------------------------
49 --- Support for the bytecode interpreter and linker ---
50 ------------------------------------------------------------------------
52 -- Convert an Addr# to a followable type
53 primop AddrToHValueOp "addrToHValue#" GenPrimOp
56 primop MkApUpd0_Op "mkApUpd0#" GenPrimOp
61 primop NewBCOOp "newBCO#" GenPrimOp
62 ByteArr# -> ByteArr# -> Array# a -> ByteArr# -> State# s -> (# State# s, BCO# #)
64 has_side_effects = True
68 ------------------------------------------------------------------------
70 ------------------------------------------------------------------------
72 primop AddrGtOp "gtAddr#" Compare Addr# -> Addr# -> Bool
73 primop AddrGeOp "geAddr#" Compare Addr# -> Addr# -> Bool
74 primop AddrEqOp "eqAddr#" Compare Addr# -> Addr# -> Bool
75 primop AddrNeOp "neAddr#" Compare Addr# -> Addr# -> Bool
76 primop AddrLtOp "ltAddr#" Compare Addr# -> Addr# -> Bool
77 primop AddrLeOp "leAddr#" Compare Addr# -> Addr# -> Bool
79 primop Addr2IntOp "addr2Int#" GenPrimOp Addr# -> Int#
82 ------------------------------------------------------------------------
84 ------------------------------------------------------------------------
86 primop CharGtOp "gtChar#" Compare Char# -> Char# -> Bool
87 primop CharGeOp "geChar#" Compare Char# -> Char# -> Bool
89 primop CharEqOp "eqChar#" Compare
90 Char# -> Char# -> Bool
91 with commutable = True
93 primop CharNeOp "neChar#" Compare
94 Char# -> Char# -> Bool
95 with commutable = True
97 primop CharLtOp "ltChar#" Compare Char# -> Char# -> Bool
98 primop CharLeOp "leChar#" Compare Char# -> Char# -> Bool
100 primop OrdOp "ord#" GenPrimOp Char# -> Int#
102 ------------------------------------------------------------------------
104 ------------------------------------------------------------------------
106 primop DoubleGtOp ">##" Compare Double# -> Double# -> Bool
107 primop DoubleGeOp ">=##" Compare Double# -> Double# -> Bool
109 primop DoubleEqOp "==##" Compare
110 Double# -> Double# -> Bool
111 with commutable = True
113 primop DoubleNeOp "/=##" Compare
114 Double# -> Double# -> Bool
115 with commutable = True
117 primop DoubleLtOp "<##" Compare Double# -> Double# -> Bool
118 primop DoubleLeOp "<=##" Compare Double# -> Double# -> Bool
120 primop DoubleAddOp "+##" Dyadic
121 Double# -> Double# -> Double#
122 with commutable = True
124 primop DoubleSubOp "-##" Dyadic Double# -> Double# -> Double#
126 primop DoubleMulOp "*##" Dyadic
127 Double# -> Double# -> Double#
128 with commutable = True
130 primop DoubleDivOp "/##" Dyadic
131 Double# -> Double# -> Double#
134 primop DoubleNegOp "negateDouble#" Monadic Double# -> Double#
136 primop Double2IntOp "double2Int#" GenPrimOp Double# -> Int#
137 primop Double2FloatOp "double2Float#" GenPrimOp Double# -> Float#
139 primop DoubleExpOp "expDouble#" Monadic
141 with needs_wrapper = True
143 primop DoubleLogOp "logDouble#" Monadic
149 primop DoubleSqrtOp "sqrtDouble#" Monadic
151 with needs_wrapper = True
153 primop DoubleSinOp "sinDouble#" Monadic
155 with needs_wrapper = True
157 primop DoubleCosOp "cosDouble#" Monadic
159 with needs_wrapper = True
161 primop DoubleTanOp "tanDouble#" Monadic
163 with needs_wrapper = True
165 primop DoubleAsinOp "asinDouble#" Monadic
171 primop DoubleAcosOp "acosDouble#" Monadic
177 primop DoubleAtanOp "atanDouble#" Monadic
182 primop DoubleSinhOp "sinhDouble#" Monadic
184 with needs_wrapper = True
186 primop DoubleCoshOp "coshDouble#" Monadic
188 with needs_wrapper = True
190 primop DoubleTanhOp "tanhDouble#" Monadic
192 with needs_wrapper = True
194 primop DoublePowerOp "**##" Dyadic
195 Double# -> Double# -> Double#
196 with needs_wrapper = True
198 primop DoubleDecodeOp "decodeDouble#" GenPrimOp
199 Double# -> (# Int#, Int#, ByteArr# #)
200 with out_of_line = True
202 ------------------------------------------------------------------------
204 ------------------------------------------------------------------------
206 primop FloatGtOp "gtFloat#" Compare Float# -> Float# -> Bool
207 primop FloatGeOp "geFloat#" Compare Float# -> Float# -> Bool
209 primop FloatEqOp "eqFloat#" Compare
210 Float# -> Float# -> Bool
211 with commutable = True
213 primop FloatNeOp "neFloat#" Compare
214 Float# -> Float# -> Bool
215 with commutable = True
217 primop FloatLtOp "ltFloat#" Compare Float# -> Float# -> Bool
218 primop FloatLeOp "leFloat#" Compare Float# -> Float# -> Bool
220 primop FloatAddOp "plusFloat#" Dyadic
221 Float# -> Float# -> Float#
222 with commutable = True
224 primop FloatSubOp "minusFloat#" Dyadic Float# -> Float# -> Float#
226 primop FloatMulOp "timesFloat#" Dyadic
227 Float# -> Float# -> Float#
228 with commutable = True
230 primop FloatDivOp "divideFloat#" Dyadic
231 Float# -> Float# -> Float#
234 primop FloatNegOp "negateFloat#" Monadic Float# -> Float#
236 primop Float2IntOp "float2Int#" GenPrimOp Float# -> Int#
238 primop FloatExpOp "expFloat#" Monadic
240 with needs_wrapper = True
242 primop FloatLogOp "logFloat#" Monadic
244 with needs_wrapper = True
247 primop FloatSqrtOp "sqrtFloat#" Monadic
249 with needs_wrapper = True
251 primop FloatSinOp "sinFloat#" Monadic
253 with needs_wrapper = True
255 primop FloatCosOp "cosFloat#" Monadic
257 with needs_wrapper = True
259 primop FloatTanOp "tanFloat#" Monadic
261 with needs_wrapper = True
263 primop FloatAsinOp "asinFloat#" Monadic
265 with needs_wrapper = True
268 primop FloatAcosOp "acosFloat#" Monadic
270 with needs_wrapper = True
273 primop FloatAtanOp "atanFloat#" Monadic
275 with needs_wrapper = True
277 primop FloatSinhOp "sinhFloat#" Monadic
279 with needs_wrapper = True
281 primop FloatCoshOp "coshFloat#" Monadic
283 with needs_wrapper = True
285 primop FloatTanhOp "tanhFloat#" Monadic
287 with needs_wrapper = True
289 primop FloatPowerOp "powerFloat#" Dyadic
290 Float# -> Float# -> Float#
291 with needs_wrapper = True
293 primop Float2DoubleOp "float2Double#" GenPrimOp Float# -> Double#
295 primop FloatDecodeOp "decodeFloat#" GenPrimOp
296 Float# -> (# Int#, Int#, ByteArr# #)
297 with out_of_line = True
299 ------------------------------------------------------------------------
301 ------------------------------------------------------------------------
303 primop IntAddOp "+#" Dyadic
305 with commutable = True
307 primop IntSubOp "-#" Dyadic Int# -> Int# -> Int#
310 Dyadic Int# -> Int# -> Int#
311 with commutable = True
313 primop IntQuotOp "quotInt#" Dyadic
317 primop IntRemOp "remInt#" Dyadic
321 primop IntGcdOp "gcdInt#" Dyadic Int# -> Int# -> Int#
322 primop IntNegOp "negateInt#" Monadic Int# -> Int#
323 primop IntAddCOp "addIntC#" GenPrimOp Int# -> Int# -> (# Int#, Int# #)
324 primop IntSubCOp "subIntC#" GenPrimOp Int# -> Int# -> (# Int#, Int# #)
325 primop IntMulCOp "mulIntC#" GenPrimOp Int# -> Int# -> (# Int#, Int# #)
326 primop IntGtOp ">#" Compare Int# -> Int# -> Bool
327 primop IntGeOp ">=#" Compare Int# -> Int# -> Bool
329 primop IntEqOp "==#" Compare
331 with commutable = True
333 primop IntNeOp "/=#" Compare
335 with commutable = True
337 primop IntLtOp "<#" Compare Int# -> Int# -> Bool
338 primop IntLeOp "<=#" Compare Int# -> Int# -> Bool
340 primop ChrOp "chr#" GenPrimOp Int# -> Char#
342 primop Int2WordOp "int2Word#" GenPrimOp Int# -> Word#
343 primop Int2AddrOp "int2Addr#"GenPrimOp Int# -> Addr#
344 primop Int2FloatOp "int2Float#" GenPrimOp Int# -> Float#
345 primop Int2DoubleOp "int2Double#" GenPrimOp Int# -> Double#
347 primop Int2IntegerOp "int2Integer#"
348 GenPrimOp Int# -> (# Int#, ByteArr# #)
349 with out_of_line = True
351 primop ISllOp "iShiftL#" GenPrimOp Int# -> Int# -> Int#
352 primop ISraOp "iShiftRA#" GenPrimOp Int# -> Int# -> Int#
353 primop ISrlOp "iShiftRL#" GenPrimOp Int# -> Int# -> Int#
355 ------------------------------------------------------------------------
357 ------------------------------------------------------------------------
359 #ifdef SUPPORT_LONG_LONGS
360 primop Int64ToIntegerOp "int64ToInteger#" GenPrimOp
361 Int64# -> (# Int#, ByteArr# #)
362 with out_of_line = True
366 ------------------------------------------------------------------------
368 ------------------------------------------------------------------------
370 primop IntegerAddOp "plusInteger#" GenPrimOp
371 Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
372 with commutable = True
375 primop IntegerSubOp "minusInteger#" GenPrimOp
376 Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
377 with out_of_line = True
379 primop IntegerMulOp "timesInteger#" GenPrimOp
380 Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
381 with commutable = True
384 primop IntegerGcdOp "gcdInteger#" GenPrimOp
385 Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
386 with commutable = True
389 primop IntegerIntGcdOp "gcdIntegerInt#" GenPrimOp
390 Int# -> ByteArr# -> Int# -> Int#
391 with commutable = True
393 primop IntegerDivExactOp "divExactInteger#" GenPrimOp
394 Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
395 with out_of_line = True
397 primop IntegerQuotOp "quotInteger#" GenPrimOp
398 Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
399 with out_of_line = True
401 primop IntegerRemOp "remInteger#" GenPrimOp
402 Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
403 with out_of_line = True
405 primop IntegerCmpOp "cmpInteger#" GenPrimOp
406 Int# -> ByteArr# -> Int# -> ByteArr# -> Int#
407 with needs_wrapper = True
409 primop IntegerCmpIntOp "cmpIntegerInt#" GenPrimOp
410 Int# -> ByteArr# -> Int# -> Int#
411 with needs_wrapper = True
413 primop IntegerQuotRemOp "quotRemInteger#" GenPrimOp
414 Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr#, Int#, ByteArr# #)
418 primop IntegerDivModOp "divModInteger#" GenPrimOp
419 Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr#, Int#, ByteArr# #)
423 primop Integer2IntOp "integer2Int#" GenPrimOp
424 Int# -> ByteArr# -> Int#
425 with needs_wrapper = True
427 primop Integer2WordOp "integer2Word#" GenPrimOp
428 Int# -> ByteArr# -> Word#
429 with needs_wrapper = True
431 #ifdef SUPPORT_LONG_LONGS
432 primop IntegerToInt64Op "integerToInt64#" GenPrimOp
433 Int# -> ByteArr# -> Int64#
435 primop IntegerToWord64Op "integerToWord64#" GenPrimOp
436 Int# -> ByteArr# -> Word64#
439 primop IntegerAndOp "andInteger#" GenPrimOp
440 Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
441 with out_of_line = True
443 primop IntegerOrOp "orInteger#" GenPrimOp
444 Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
445 with out_of_line = True
447 primop IntegerXorOp "xorInteger#" GenPrimOp
448 Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
449 with out_of_line = True
451 primop IntegerComplementOp "complementInteger#" GenPrimOp
452 Int# -> ByteArr# -> (# Int#, ByteArr# #)
453 with out_of_line = True
455 ------------------------------------------------------------------------
457 ------------------------------------------------------------------------
459 primop WordAddOp "plusWord#" Dyadic Word# -> Word# -> Word#
460 with commutable = True
462 primop WordSubOp "minusWord#" Dyadic Word# -> Word# -> Word#
464 primop WordMulOp "timesWord#" Dyadic Word# -> Word# -> Word#
465 with commutable = True
467 primop WordQuotOp "quotWord#" Dyadic Word# -> Word# -> Word#
470 primop WordRemOp "remWord#" Dyadic Word# -> Word# -> Word#
473 primop AndOp "and#" Dyadic Word# -> Word# -> Word#
474 with commutable = True
476 primop OrOp "or#" Dyadic Word# -> Word# -> Word#
477 with commutable = True
479 primop XorOp "xor#" Dyadic Word# -> Word# -> Word#
480 with commutable = True
482 primop NotOp "not#" Monadic Word# -> Word#
484 primop SllOp "shiftL#" GenPrimOp Word# -> Int# -> Word#
486 primop SrlOp "shiftRL#" GenPrimOp Word# -> Int# -> Word#
488 primop Word2IntOp "word2Int#" GenPrimOp Word# -> Int#
490 primop Word2IntegerOp "word2Integer#" GenPrimOp
491 Word# -> (# Int#, ByteArr# #)
492 with out_of_line = True
494 primop WordGtOp "gtWord#" Compare Word# -> Word# -> Bool
495 primop WordGeOp "geWord#" Compare Word# -> Word# -> Bool
496 primop WordEqOp "eqWord#" Compare Word# -> Word# -> Bool
497 primop WordNeOp "neWord#" Compare Word# -> Word# -> Bool
498 primop WordLtOp "ltWord#" Compare Word# -> Word# -> Bool
499 primop WordLeOp "leWord#" Compare Word# -> Word# -> Bool
501 ------------------------------------------------------------------------
503 ------------------------------------------------------------------------
505 #ifdef SUPPORT_LONG_LONGS
506 primop Word64ToIntegerOp "word64ToInteger#" GenPrimOp
507 Word64# -> (# Int#, ByteArr# #)
508 with out_of_line = True
511 ------------------------------------------------------------------------
512 --- Explicitly sized Int# and Word# ---
513 ------------------------------------------------------------------------
515 primop IntToInt8Op "intToInt8#" Monadic Int# -> Int#
516 primop IntToInt16Op "intToInt16#" Monadic Int# -> Int#
517 primop IntToInt32Op "intToInt32#" Monadic Int# -> Int#
518 primop WordToWord8Op "wordToWord8#" Monadic Word# -> Word#
519 primop WordToWord16Op "wordToWord16#" Monadic Word# -> Word#
520 primop WordToWord32Op "wordToWord32#" Monadic Word# -> Word#
522 ------------------------------------------------------------------------
524 ------------------------------------------------------------------------
526 primop NewArrayOp "newArray#" GenPrimOp
527 Int# -> a -> State# s -> (# State# s, MutArr# s a #)
529 strictness = { \ arity -> StrictnessInfo [wwPrim, wwLazy, wwPrim] False }
530 usage = { mangle NewArrayOp [mkP, mkM, mkP] mkM }
533 primop NewByteArrayOp_Char "newByteArray#" GenPrimOp
534 Int# -> State# s -> (# State# s, MutByteArr# s #)
535 with out_of_line = True
538 primop IndexByteArrayOp_Char "indexCharArray#" GenPrimOp
539 ByteArr# -> Int# -> Char#
541 primop IndexByteArrayOp_WideChar "indexWideCharArray#" GenPrimOp
542 ByteArr# -> Int# -> Char#
544 primop IndexByteArrayOp_Int "indexIntArray#" GenPrimOp
545 ByteArr# -> Int# -> Int#
547 primop IndexByteArrayOp_Word "indexWordArray#" GenPrimOp
548 ByteArr# -> Int# -> Word#
550 primop IndexByteArrayOp_Addr "indexAddrArray#" GenPrimOp
551 ByteArr# -> Int# -> Addr#
553 primop IndexByteArrayOp_Float "indexFloatArray#" GenPrimOp
554 ByteArr# -> Int# -> Float#
556 primop IndexByteArrayOp_Double "indexDoubleArray#" GenPrimOp
557 ByteArr# -> Int# -> Double#
559 primop IndexByteArrayOp_StablePtr "indexStablePtrArray#" GenPrimOp
560 ByteArr# -> Int# -> StablePtr# a
562 primop IndexByteArrayOp_Int8 "indexInt8Array#" GenPrimOp
563 ByteArr# -> Int# -> Int#
565 primop IndexByteArrayOp_Int16 "indexInt16Array#" GenPrimOp
566 ByteArr# -> Int# -> Int#
568 primop IndexByteArrayOp_Int32 "indexInt32Array#" GenPrimOp
569 ByteArr# -> Int# -> Int#
571 #ifdef SUPPORT_LONG_LONGS
572 primop IndexByteArrayOp_Int64 "indexInt64Array#" GenPrimOp
573 ByteArr# -> Int# -> Int64#
576 primop IndexByteArrayOp_Word8 "indexWord8Array#" GenPrimOp
577 ByteArr# -> Int# -> Word#
579 primop IndexByteArrayOp_Word16 "indexWord16Array#" GenPrimOp
580 ByteArr# -> Int# -> Word#
582 primop IndexByteArrayOp_Word32 "indexWord32Array#" GenPrimOp
583 ByteArr# -> Int# -> Word#
585 #ifdef SUPPORT_LONG_LONGS
586 primop IndexByteArrayOp_Word64 "indexWord64Array#" GenPrimOp
587 ByteArr# -> Int# -> Word64#
591 primop ReadByteArrayOp_Char "readCharArray#" GenPrimOp
592 MutByteArr# s -> Int# -> State# s -> (# State# s, Char# #)
594 primop ReadByteArrayOp_WideChar "readWideCharArray#" GenPrimOp
595 MutByteArr# s -> Int# -> State# s -> (# State# s, Char# #)
597 primop ReadByteArrayOp_Int "readIntArray#" GenPrimOp
598 MutByteArr# s -> Int# -> State# s -> (# State# s, Int# #)
600 primop ReadByteArrayOp_Word "readWordArray#" GenPrimOp
601 MutByteArr# s -> Int# -> State# s -> (# State# s, Word# #)
603 primop ReadByteArrayOp_Addr "readAddrArray#" GenPrimOp
604 MutByteArr# s -> Int# -> State# s -> (# State# s, Addr# #)
606 primop ReadByteArrayOp_Float "readFloatArray#" GenPrimOp
607 MutByteArr# s -> Int# -> State# s -> (# State# s, Float# #)
609 primop ReadByteArrayOp_Double "readDoubleArray#" GenPrimOp
610 MutByteArr# s -> Int# -> State# s -> (# State# s, Double# #)
612 primop ReadByteArrayOp_StablePtr "readStablePtrArray#" GenPrimOp
613 MutByteArr# s -> Int# -> State# s -> (# State# s, StablePtr# a #)
615 primop ReadByteArrayOp_Int8 "readInt8Array#" GenPrimOp
616 MutByteArr# s -> Int# -> State# s -> (# State# s, Int# #)
618 primop ReadByteArrayOp_Int16 "readInt16Array#" GenPrimOp
619 MutByteArr# s -> Int# -> State# s -> (# State# s, Int# #)
621 primop ReadByteArrayOp_Int32 "readInt32Array#" GenPrimOp
622 MutByteArr# s -> Int# -> State# s -> (# State# s, Int# #)
624 #ifdef SUPPORT_LONG_LONGS
625 primop ReadByteArrayOp_Int64 "readInt64Array#" GenPrimOp
626 MutByteArr# s -> Int# -> State# s -> (# State# s, Int64# #)
629 primop ReadByteArrayOp_Word8 "readWord8Array#" GenPrimOp
630 MutByteArr# s -> Int# -> State# s -> (# State# s, Word# #)
632 primop ReadByteArrayOp_Word16 "readWord16Array#" GenPrimOp
633 MutByteArr# s -> Int# -> State# s -> (# State# s, Word# #)
635 primop ReadByteArrayOp_Word32 "readWord32Array#" GenPrimOp
636 MutByteArr# s -> Int# -> State# s -> (# State# s, Word# #)
638 #ifdef SUPPORT_LONG_LONGS
639 primop ReadByteArrayOp_Word64 "readWord64Array#" GenPrimOp
640 MutByteArr# s -> Int# -> State# s -> (# State# s, Word64# #)
645 primop WriteByteArrayOp_Char "writeCharArray#" GenPrimOp
646 MutByteArr# s -> Int# -> Char# -> State# s -> State# s
647 with has_side_effects = True
649 primop WriteByteArrayOp_WideChar "writeWideCharArray#" GenPrimOp
650 MutByteArr# s -> Int# -> Char# -> State# s -> State# s
651 with has_side_effects = True
653 primop WriteByteArrayOp_Int "writeIntArray#" GenPrimOp
654 MutByteArr# s -> Int# -> Int# -> State# s -> State# s
655 with has_side_effects = True
657 primop WriteByteArrayOp_Word "writeWordArray#" GenPrimOp
658 MutByteArr# s -> Int# -> Word# -> State# s -> State# s
659 with has_side_effects = True
661 primop WriteByteArrayOp_Addr "writeAddrArray#" GenPrimOp
662 MutByteArr# s -> Int# -> Addr# -> State# s -> State# s
663 with has_side_effects = True
665 primop WriteByteArrayOp_Float "writeFloatArray#" GenPrimOp
666 MutByteArr# s -> Int# -> Float# -> State# s -> State# s
667 with has_side_effects = True
669 primop WriteByteArrayOp_Double "writeDoubleArray#" GenPrimOp
670 MutByteArr# s -> Int# -> Double# -> State# s -> State# s
671 with has_side_effects = True
673 primop WriteByteArrayOp_StablePtr "writeStablePtrArray#" GenPrimOp
674 MutByteArr# s -> Int# -> StablePtr# a -> State# s -> State# s
675 with has_side_effects = True
677 primop WriteByteArrayOp_Int8 "writeInt8Array#" GenPrimOp
678 MutByteArr# s -> Int# -> Int# -> State# s -> State# s
679 with has_side_effects = True
681 primop WriteByteArrayOp_Int16 "writeInt16Array#" GenPrimOp
682 MutByteArr# s -> Int# -> Int# -> State# s -> State# s
683 with has_side_effects = True
685 primop WriteByteArrayOp_Int32 "writeInt32Array#" GenPrimOp
686 MutByteArr# s -> Int# -> Int# -> State# s -> State# s
687 with has_side_effects = True
689 #ifdef SUPPORT_LONG_LONGS
690 primop WriteByteArrayOp_Int64 "writeInt64Array#" GenPrimOp
691 MutByteArr# s -> Int# -> Int64# -> State# s -> State# s
692 with has_side_effects = True
695 primop WriteByteArrayOp_Word8 "writeWord8Array#" GenPrimOp
696 MutByteArr# s -> Int# -> Word# -> State# s -> State# s
697 with has_side_effects = True
699 primop WriteByteArrayOp_Word16 "writeWord16Array#" GenPrimOp
700 MutByteArr# s -> Int# -> Word# -> State# s -> State# s
701 with has_side_effects = True
703 primop WriteByteArrayOp_Word32 "writeWord32Array#" GenPrimOp
704 MutByteArr# s -> Int# -> Word# -> State# s -> State# s
705 with has_side_effects = True
707 #ifdef SUPPORT_LONG_LONGS
708 primop WriteByteArrayOp_Word64 "writeWord64Array#" GenPrimOp
709 MutByteArr# s -> Int# -> Word64# -> State# s -> State# s
710 with has_side_effects = True
714 primop IndexOffAddrOp_Char "indexCharOffAddr#" GenPrimOp
715 Addr# -> Int# -> Char#
717 primop IndexOffAddrOp_WideChar "indexWideCharOffAddr#" GenPrimOp
718 Addr# -> Int# -> Char#
720 primop IndexOffAddrOp_Int "indexIntOffAddr#" GenPrimOp
721 Addr# -> Int# -> Int#
723 primop IndexOffAddrOp_Word "indexWordOffAddr#" GenPrimOp
724 Addr# -> Int# -> Word#
726 primop IndexOffAddrOp_Addr "indexAddrOffAddr#" GenPrimOp
727 Addr# -> Int# -> Addr#
729 primop IndexOffAddrOp_Float "indexFloatOffAddr#" GenPrimOp
730 Addr# -> Int# -> Float#
732 primop IndexOffAddrOp_Double "indexDoubleOffAddr#" GenPrimOp
733 Addr# -> Int# -> Double#
735 primop IndexOffAddrOp_StablePtr "indexStablePtrOffAddr#" GenPrimOp
736 Addr# -> Int# -> StablePtr# a
738 primop IndexOffAddrOp_Int8 "indexInt8OffAddr#" GenPrimOp
739 Addr# -> Int# -> Int#
741 primop IndexOffAddrOp_Int16 "indexInt16OffAddr#" GenPrimOp
742 Addr# -> Int# -> Int#
744 primop IndexOffAddrOp_Int32 "indexInt32OffAddr#" GenPrimOp
745 Addr# -> Int# -> Int#
747 #ifdef SUPPORT_LONG_LONGS
748 primop IndexOffAddrOp_Int64 "indexInt64OffAddr#" GenPrimOp
749 Addr# -> Int# -> Int64#
752 primop IndexOffAddrOp_Word8 "indexWord8OffAddr#" GenPrimOp
753 Addr# -> Int# -> Word#
755 primop IndexOffAddrOp_Word16 "indexWord16OffAddr#" GenPrimOp
756 Addr# -> Int# -> Word#
758 primop IndexOffAddrOp_Word32 "indexWord32OffAddr#" GenPrimOp
759 Addr# -> Int# -> Word#
761 #ifdef SUPPORT_LONG_LONGS
762 primop IndexOffAddrOp_Word64 "indexWord64OffAddr#" GenPrimOp
763 Addr# -> Int# -> Word64#
767 primop EqForeignObj "eqForeignObj#" GenPrimOp
768 ForeignObj# -> ForeignObj# -> Bool
769 with commutable = True
771 primop IndexOffForeignObjOp_Char "indexCharOffForeignObj#" GenPrimOp
772 ForeignObj# -> Int# -> Char#
774 primop IndexOffForeignObjOp_WideChar "indexWideCharOffForeignObj#" GenPrimOp
775 ForeignObj# -> Int# -> Char#
777 primop IndexOffForeignObjOp_Int "indexIntOffForeignObj#" GenPrimOp
778 ForeignObj# -> Int# -> Int#
780 primop IndexOffForeignObjOp_Word "indexWordOffForeignObj#" GenPrimOp
781 ForeignObj# -> Int# -> Word#
783 primop IndexOffForeignObjOp_Addr "indexAddrOffForeignObj#" GenPrimOp
784 ForeignObj# -> Int# -> Addr#
786 primop IndexOffForeignObjOp_Float "indexFloatOffForeignObj#" GenPrimOp
787 ForeignObj# -> Int# -> Float#
789 primop IndexOffForeignObjOp_Double "indexDoubleOffForeignObj#" GenPrimOp
790 ForeignObj# -> Int# -> Double#
792 primop IndexOffForeignObjOp_StablePtr "indexStablePtrOffForeignObj#" GenPrimOp
793 ForeignObj# -> Int# -> StablePtr# a
795 primop IndexOffForeignObjOp_Int8 "indexInt8OffForeignObj#" GenPrimOp
796 ForeignObj# -> Int# -> Int#
798 primop IndexOffForeignObjOp_Int16 "indexInt16OffForeignObj#" GenPrimOp
799 ForeignObj# -> Int# -> Int#
801 primop IndexOffForeignObjOp_Int32 "indexInt32OffForeignObj#" GenPrimOp
802 ForeignObj# -> Int# -> Int#
804 #ifdef SUPPORT_LONG_LONGS
805 primop IndexOffForeignObjOp_Int64 "indexInt64OffForeignObj#" GenPrimOp
806 ForeignObj# -> Int# -> Int64#
809 primop IndexOffForeignObjOp_Word8 "indexWord8OffForeignObj#" GenPrimOp
810 ForeignObj# -> Int# -> Word#
812 primop IndexOffForeignObjOp_Word16 "indexWord16OffForeignObj#" GenPrimOp
813 ForeignObj# -> Int# -> Word#
815 primop IndexOffForeignObjOp_Word32 "indexWord32OffForeignObj#" GenPrimOp
816 ForeignObj# -> Int# -> Word#
818 #ifdef SUPPORT_LONG_LONGS
819 primop IndexOffForeignObjOp_Word64 "indexWord64OffForeignObj#" GenPrimOp
820 ForeignObj# -> Int# -> Word64#
823 primop ReadOffAddrOp_Char "readCharOffAddr#" GenPrimOp
824 Addr# -> Int# -> State# s -> (# State# s, Char# #)
826 primop ReadOffAddrOp_WideChar "readWideCharOffAddr#" GenPrimOp
827 Addr# -> Int# -> State# s -> (# State# s, Char# #)
829 primop ReadOffAddrOp_Int "readIntOffAddr#" GenPrimOp
830 Addr# -> Int# -> State# s -> (# State# s, Int# #)
832 primop ReadOffAddrOp_Word "readWordOffAddr#" GenPrimOp
833 Addr# -> Int# -> State# s -> (# State# s, Word# #)
835 primop ReadOffAddrOp_Addr "readAddrOffAddr#" GenPrimOp
836 Addr# -> Int# -> State# s -> (# State# s, Addr# #)
838 primop ReadOffAddrOp_Float "readFloatOffAddr#" GenPrimOp
839 Addr# -> Int# -> State# s -> (# State# s, Float# #)
841 primop ReadOffAddrOp_Double "readDoubleOffAddr#" GenPrimOp
842 Addr# -> Int# -> State# s -> (# State# s, Double# #)
844 primop ReadOffAddrOp_StablePtr "readStablePtrOffAddr#" GenPrimOp
845 Addr# -> Int# -> State# s -> (# State# s, StablePtr# a #)
847 primop ReadOffAddrOp_Int8 "readInt8OffAddr#" GenPrimOp
848 Addr# -> Int# -> State# s -> (# State# s, Int# #)
850 primop ReadOffAddrOp_Int16 "readInt16OffAddr#" GenPrimOp
851 Addr# -> Int# -> State# s -> (# State# s, Int# #)
853 primop ReadOffAddrOp_Int32 "readInt32OffAddr#" GenPrimOp
854 Addr# -> Int# -> State# s -> (# State# s, Int# #)
856 #ifdef SUPPORT_LONG_LONGS
857 primop ReadOffAddrOp_Int64 "readInt64OffAddr#" GenPrimOp
858 Addr# -> Int# -> State# s -> (# State# s, Int64# #)
861 primop ReadOffAddrOp_Word8 "readWord8OffAddr#" GenPrimOp
862 Addr# -> Int# -> State# s -> (# State# s, Word# #)
864 primop ReadOffAddrOp_Word16 "readWord16OffAddr#" GenPrimOp
865 Addr# -> Int# -> State# s -> (# State# s, Word# #)
867 primop ReadOffAddrOp_Word32 "readWord32OffAddr#" GenPrimOp
868 Addr# -> Int# -> State# s -> (# State# s, Word# #)
870 #ifdef SUPPORT_LONG_LONGS
871 primop ReadOffAddrOp_Word64 "readWord64OffAddr#" GenPrimOp
872 Addr# -> Int# -> State# s -> (# State# s, Word64# #)
876 primop WriteOffAddrOp_Char "writeCharOffAddr#" GenPrimOp
877 Addr# -> Int# -> Char# -> State# s -> State# s
878 with has_side_effects = True
880 primop WriteOffAddrOp_WideChar "writeWideCharOffAddr#" GenPrimOp
881 Addr# -> Int# -> Char# -> State# s -> State# s
882 with has_side_effects = True
884 primop WriteOffAddrOp_Int "writeIntOffAddr#" GenPrimOp
885 Addr# -> Int# -> Int# -> State# s -> State# s
886 with has_side_effects = True
888 primop WriteOffAddrOp_Word "writeWordOffAddr#" GenPrimOp
889 Addr# -> Int# -> Word# -> State# s -> State# s
890 with has_side_effects = True
892 primop WriteOffAddrOp_Addr "writeAddrOffAddr#" GenPrimOp
893 Addr# -> Int# -> Addr# -> State# s -> State# s
894 with has_side_effects = True
896 primop WriteOffAddrOp_ForeignObj "writeForeignObjOffAddr#" GenPrimOp
897 Addr# -> Int# -> ForeignObj# -> State# s -> State# s
898 with has_side_effects = True
900 primop WriteOffAddrOp_Float "writeFloatOffAddr#" GenPrimOp
901 Addr# -> Int# -> Float# -> State# s -> State# s
902 with has_side_effects = True
904 primop WriteOffAddrOp_Double "writeDoubleOffAddr#" GenPrimOp
905 Addr# -> Int# -> Double# -> State# s -> State# s
906 with has_side_effects = True
908 primop WriteOffAddrOp_StablePtr "writeStablePtrOffAddr#" GenPrimOp
909 Addr# -> Int# -> StablePtr# a -> State# s -> State# s
910 with has_side_effects = True
912 primop WriteOffAddrOp_Int8 "writeInt8OffAddr#" GenPrimOp
913 Addr# -> Int# -> Int# -> State# s -> State# s
914 with has_side_effects = True
916 primop WriteOffAddrOp_Int16 "writeInt16OffAddr#" GenPrimOp
917 Addr# -> Int# -> Int# -> State# s -> State# s
918 with has_side_effects = True
920 primop WriteOffAddrOp_Int32 "writeInt32OffAddr#" GenPrimOp
921 Addr# -> Int# -> Int# -> State# s -> State# s
922 with has_side_effects = True
924 #ifdef SUPPORT_LONG_LONGS
925 primop WriteOffAddrOp_Int64 "writeInt64OffAddr#" GenPrimOp
926 Addr# -> Int# -> Int64# -> State# s -> State# s
927 with has_side_effects = True
930 primop WriteOffAddrOp_Word8 "writeWord8OffAddr#" GenPrimOp
931 Addr# -> Int# -> Word# -> State# s -> State# s
932 with has_side_effects = True
934 primop WriteOffAddrOp_Word16 "writeWord16OffAddr#" GenPrimOp
935 Addr# -> Int# -> Word# -> State# s -> State# s
936 with has_side_effects = True
938 primop WriteOffAddrOp_Word32 "writeWord32OffAddr#" GenPrimOp
939 Addr# -> Int# -> Word# -> State# s -> State# s
940 with has_side_effects = True
942 #ifdef SUPPORT_LONG_LONGS
943 primop WriteOffAddrOp_Word64 "writeWord64OffAddr#" GenPrimOp
944 Addr# -> Int# -> Word64# -> State# s -> State# s
945 with has_side_effects = True
950 primop SameMutableArrayOp "sameMutableArray#" GenPrimOp
951 MutArr# s a -> MutArr# s a -> Bool
953 usage = { mangle SameMutableArrayOp [mkP, mkP] mkM }
955 primop SameMutableByteArrayOp "sameMutableByteArray#" GenPrimOp
956 MutByteArr# s -> MutByteArr# s -> Bool
958 primop ReadArrayOp "readArray#" GenPrimOp
959 MutArr# s a -> Int# -> State# s -> (# State# s, a #)
961 usage = { mangle ReadArrayOp [mkM, mkP, mkP] mkM }
963 primop WriteArrayOp "writeArray#" GenPrimOp
964 MutArr# s a -> Int# -> a -> State# s -> State# s
966 usage = { mangle WriteArrayOp [mkM, mkP, mkM, mkP] mkR }
967 strictness = { \ arity -> StrictnessInfo [wwPrim, wwPrim, wwLazy, wwPrim] False }
968 has_side_effects = True
970 primop IndexArrayOp "indexArray#" GenPrimOp
971 Array# a -> Int# -> (# a #)
973 usage = { mangle IndexArrayOp [mkM, mkP] mkM }
975 primop UnsafeFreezeArrayOp "unsafeFreezeArray#" GenPrimOp
976 MutArr# s a -> State# s -> (# State# s, Array# a #)
978 usage = { mangle UnsafeFreezeArrayOp [mkM, mkP] mkM }
979 has_side_effects = True
981 primop UnsafeFreezeByteArrayOp "unsafeFreezeByteArray#" GenPrimOp
982 MutByteArr# s -> State# s -> (# State# s, ByteArr# #)
984 has_side_effects = True
986 primop UnsafeThawArrayOp "unsafeThawArray#" GenPrimOp
987 Array# a -> State# s -> (# State# s, MutArr# s a #)
989 usage = { mangle UnsafeThawArrayOp [mkM, mkP] mkM }
992 primop SizeofByteArrayOp "sizeofByteArray#" GenPrimOp
995 primop SizeofMutableByteArrayOp "sizeofMutableByteArray#" GenPrimOp
996 MutByteArr# s -> Int#
998 ------------------------------------------------------------------------
999 --- Mutable variables ---
1000 ------------------------------------------------------------------------
1002 primop NewMutVarOp "newMutVar#" GenPrimOp
1003 a -> State# s -> (# State# s, MutVar# s a #)
1005 usage = { mangle NewMutVarOp [mkM, mkP] mkM }
1006 strictness = { \ arity -> StrictnessInfo [wwLazy, wwPrim] False }
1009 primop ReadMutVarOp "readMutVar#" GenPrimOp
1010 MutVar# s a -> State# s -> (# State# s, a #)
1012 usage = { mangle ReadMutVarOp [mkM, mkP] mkM }
1014 primop WriteMutVarOp "writeMutVar#" GenPrimOp
1015 MutVar# s a -> a -> State# s -> State# s
1017 strictness = { \ arity -> StrictnessInfo [wwPrim, wwLazy, wwPrim] False }
1018 usage = { mangle WriteMutVarOp [mkM, mkM, mkP] mkR }
1019 has_side_effects = True
1021 primop SameMutVarOp "sameMutVar#" GenPrimOp
1022 MutVar# s a -> MutVar# s a -> Bool
1024 usage = { mangle SameMutVarOp [mkP, mkP] mkM }
1026 ------------------------------------------------------------------------
1028 ------------------------------------------------------------------------
1030 primop CatchOp "catch#" GenPrimOp
1031 (State# RealWorld -> (# State# RealWorld, a #) )
1032 -> (b -> State# RealWorld -> (# State# RealWorld, a #) )
1034 -> (# State# RealWorld, a #)
1036 strictness = { \ arity -> StrictnessInfo [wwLazy, wwLazy, wwPrim] False }
1037 -- Catch is actually strict in its first argument
1038 -- but we don't want to tell the strictness
1039 -- analyser about that!
1040 usage = { mangle CatchOp [mkM, mkM . (inFun CatchOp mkM mkM), mkP] mkM }
1041 -- [mkO, mkO . (inFun mkM mkO)] mkO
1042 -- might use caught action multiply
1045 primop RaiseOp "raise#" GenPrimOp
1048 strictness = { \ arity -> StrictnessInfo [wwLazy] True }
1049 -- NB: True => result is bottom
1050 usage = { mangle RaiseOp [mkM] mkM }
1053 primop BlockAsyncExceptionsOp "blockAsyncExceptions#" GenPrimOp
1054 (State# RealWorld -> (# State# RealWorld, a #))
1055 -> (State# RealWorld -> (# State# RealWorld, a #))
1057 strictness = { \ arity -> StrictnessInfo [wwLazy,wwPrim] False }
1060 primop UnblockAsyncExceptionsOp "unblockAsyncExceptions#" GenPrimOp
1061 (State# RealWorld -> (# State# RealWorld, a #))
1062 -> (State# RealWorld -> (# State# RealWorld, a #))
1064 strictness = { \ arity -> StrictnessInfo [wwLazy,wwPrim] False }
1067 ------------------------------------------------------------------------
1068 --- MVars (not the same as mutable variables!) ---
1069 ------------------------------------------------------------------------
1071 primop NewMVarOp "newMVar#" GenPrimOp
1072 State# s -> (# State# s, MVar# s a #)
1074 usage = { mangle NewMVarOp [mkP] mkR }
1077 primop TakeMVarOp "takeMVar#" GenPrimOp
1078 MVar# s a -> State# s -> (# State# s, a #)
1080 usage = { mangle TakeMVarOp [mkM, mkP] mkM }
1081 has_side_effects = True
1084 primop TryTakeMVarOp "tryTakeMVar#" GenPrimOp
1085 MVar# s a -> State# s -> (# State# s, Int#, a #)
1087 usage = { mangle TryTakeMVarOp [mkM, mkP] mkM }
1088 has_side_effects = True
1091 primop PutMVarOp "putMVar#" GenPrimOp
1092 MVar# s a -> a -> State# s -> State# s
1094 strictness = { \ arity -> StrictnessInfo [wwPrim, wwLazy, wwPrim] False }
1095 usage = { mangle PutMVarOp [mkM, mkM, mkP] mkR }
1096 has_side_effects = True
1099 primop TryPutMVarOp "tryPutMVar#" GenPrimOp
1100 MVar# s a -> a -> State# s -> (# State# s, Int# #)
1102 strictness = { \ arity -> StrictnessInfo [wwPrim, wwLazy, wwPrim] False }
1103 usage = { mangle TryPutMVarOp [mkM, mkM, mkP] mkR }
1104 has_side_effects = True
1107 primop SameMVarOp "sameMVar#" GenPrimOp
1108 MVar# s a -> MVar# s a -> Bool
1110 usage = { mangle SameMVarOp [mkP, mkP] mkM }
1112 primop IsEmptyMVarOp "isEmptyMVar#" GenPrimOp
1113 MVar# s a -> State# s -> (# State# s, Int# #)
1115 usage = { mangle IsEmptyMVarOp [mkP, mkP] mkM }
1118 ------------------------------------------------------------------------
1119 --- delay/wait operations ---
1120 ------------------------------------------------------------------------
1122 primop DelayOp "delay#" GenPrimOp
1123 Int# -> State# s -> State# s
1125 needs_wrapper = True
1126 has_side_effects = True
1129 primop WaitReadOp "waitRead#" GenPrimOp
1130 Int# -> State# s -> State# s
1132 needs_wrapper = True
1133 has_side_effects = True
1136 primop WaitWriteOp "waitWrite#" GenPrimOp
1137 Int# -> State# s -> State# s
1139 needs_wrapper = True
1140 has_side_effects = True
1143 ------------------------------------------------------------------------
1144 --- concurrency primitives ---
1145 ------------------------------------------------------------------------
1147 primop ForkOp "fork#" GenPrimOp
1148 a -> State# RealWorld -> (# State# RealWorld, ThreadId# #)
1150 usage = { mangle ForkOp [mkO, mkP] mkR }
1151 strictness = { \ arity -> StrictnessInfo [wwLazy, wwPrim] False }
1152 has_side_effects = True
1155 primop KillThreadOp "killThread#" GenPrimOp
1156 ThreadId# -> a -> State# RealWorld -> State# RealWorld
1158 usage = { mangle KillThreadOp [mkP, mkM, mkP] mkR }
1159 has_side_effects = True
1162 primop YieldOp "yield#" GenPrimOp
1163 State# RealWorld -> State# RealWorld
1165 has_side_effects = True
1168 primop MyThreadIdOp "myThreadId#" GenPrimOp
1169 State# RealWorld -> (# State# RealWorld, ThreadId# #)
1171 ------------------------------------------------------------------------
1172 --- foreign objects ---
1173 ------------------------------------------------------------------------
1175 primop MkForeignObjOp "mkForeignObj#" GenPrimOp
1176 Addr# -> State# RealWorld -> (# State# RealWorld, ForeignObj# #)
1178 has_side_effects = True
1181 primop WriteForeignObjOp "writeForeignObj#" GenPrimOp
1182 ForeignObj# -> Addr# -> State# s -> State# s
1184 has_side_effects = True
1186 primop ForeignObjToAddrOp "foreignObjToAddr#" GenPrimOp
1187 ForeignObj# -> Addr#
1189 primop TouchOp "touch#" GenPrimOp
1190 o -> State# RealWorld -> State# RealWorld
1192 has_side_effects = True
1193 strictness = { \ arity -> StrictnessInfo [wwLazy, wwPrim] False }
1195 ------------------------------------------------------------------------
1196 --- Weak pointers ---
1197 ------------------------------------------------------------------------
1199 -- note that tyvar "o" denotes openAlphaTyVar
1201 primop MkWeakOp "mkWeak#" GenPrimOp
1202 o -> b -> c -> State# RealWorld -> (# State# RealWorld, Weak# b #)
1204 strictness = { \ arity -> StrictnessInfo [wwLazy, wwLazy, wwLazy, wwPrim] False }
1205 usage = { mangle MkWeakOp [mkZ, mkM, mkM, mkP] mkM }
1206 has_side_effects = True
1209 primop DeRefWeakOp "deRefWeak#" GenPrimOp
1210 Weak# a -> State# RealWorld -> (# State# RealWorld, Int#, a #)
1212 usage = { mangle DeRefWeakOp [mkM, mkP] mkM }
1213 has_side_effects = True
1215 primop FinalizeWeakOp "finalizeWeak#" GenPrimOp
1216 Weak# a -> State# RealWorld -> (# State# RealWorld, Int#,
1217 (State# RealWorld -> (# State# RealWorld, Unit #)) #)
1219 usage = { mangle FinalizeWeakOp [mkM, mkP]
1220 (mkR . (inUB FinalizeWeakOp
1221 [id,id,inFun FinalizeWeakOp mkR mkM])) }
1222 has_side_effects = True
1225 ------------------------------------------------------------------------
1226 --- Stable pointers and names ---
1227 ------------------------------------------------------------------------
1229 primop MakeStablePtrOp "makeStablePtr#" GenPrimOp
1230 a -> State# RealWorld -> (# State# RealWorld, StablePtr# a #)
1232 strictness = { \ arity -> StrictnessInfo [wwLazy, wwPrim] False }
1233 usage = { mangle MakeStablePtrOp [mkM, mkP] mkM }
1234 has_side_effects = True
1236 primop DeRefStablePtrOp "deRefStablePtr#" GenPrimOp
1237 StablePtr# a -> State# RealWorld -> (# State# RealWorld, a #)
1239 usage = { mangle DeRefStablePtrOp [mkM, mkP] mkM }
1240 needs_wrapper = True
1241 has_side_effects = True
1243 primop EqStablePtrOp "eqStablePtr#" GenPrimOp
1244 StablePtr# a -> StablePtr# a -> Int#
1246 usage = { mangle EqStablePtrOp [mkP, mkP] mkR }
1247 has_side_effects = True
1249 primop MakeStableNameOp "makeStableName#" GenPrimOp
1250 a -> State# RealWorld -> (# State# RealWorld, StableName# a #)
1252 usage = { mangle MakeStableNameOp [mkZ, mkP] mkR }
1253 strictness = { \ arity -> StrictnessInfo [wwLazy, wwPrim] False }
1254 needs_wrapper = True
1255 has_side_effects = True
1258 primop EqStableNameOp "eqStableName#" GenPrimOp
1259 StableName# a -> StableName# a -> Int#
1261 usage = { mangle EqStableNameOp [mkP, mkP] mkR }
1263 primop StableNameToIntOp "stableNameToInt#" GenPrimOp
1264 StableName# a -> Int#
1266 usage = { mangle StableNameToIntOp [mkP] mkR }
1268 ------------------------------------------------------------------------
1269 --- Unsafe pointer equality (#1 Bad Guy: Alistair Reid :) ---
1270 ------------------------------------------------------------------------
1272 primop ReallyUnsafePtrEqualityOp "reallyUnsafePtrEquality#" GenPrimOp
1275 usage = { mangle ReallyUnsafePtrEqualityOp [mkZ, mkZ] mkR }
1277 ------------------------------------------------------------------------
1279 ------------------------------------------------------------------------
1281 primop SeqOp "seq#" GenPrimOp
1284 usage = { mangle SeqOp [mkO] mkR }
1285 strictness = { \ arity -> StrictnessInfo [wwStrict] False }
1286 -- Seq is strict in its argument; see notes in ConFold.lhs
1287 has_side_effects = True
1289 primop ParOp "par#" GenPrimOp
1292 usage = { mangle ParOp [mkO] mkR }
1293 strictness = { \ arity -> StrictnessInfo [wwLazy] False }
1294 -- Note that Par is lazy to avoid that the sparked thing
1295 -- gets evaluted strictly, which it should *not* be
1296 has_side_effects = True
1298 -- HWL: The first 4 Int# in all par... annotations denote:
1299 -- name, granularity info, size of result, degree of parallelism
1300 -- Same structure as _seq_ i.e. returns Int#
1301 -- KSW: v, the second arg in parAt# and parAtForNow#, is used only to determine
1302 -- `the processor containing the expression v'; it is not evaluated
1304 primop ParGlobalOp "parGlobal#" GenPrimOp
1305 a -> Int# -> Int# -> Int# -> Int# -> b -> Int#
1307 usage = { mangle ParGlobalOp [mkO, mkP, mkP, mkP, mkP, mkM] mkM }
1308 has_side_effects = True
1310 primop ParLocalOp "parLocal#" GenPrimOp
1311 a -> Int# -> Int# -> Int# -> Int# -> b -> Int#
1313 usage = { mangle ParLocalOp [mkO, mkP, mkP, mkP, mkP, mkM] mkM }
1314 has_side_effects = True
1316 primop ParAtOp "parAt#" GenPrimOp
1317 b -> a -> Int# -> Int# -> Int# -> Int# -> c -> Int#
1319 usage = { mangle ParAtOp [mkO, mkZ, mkP, mkP, mkP, mkP, mkM] mkM }
1320 has_side_effects = True
1322 primop ParAtAbsOp "parAtAbs#" GenPrimOp
1323 a -> Int# -> Int# -> Int# -> Int# -> Int# -> b -> Int#
1325 usage = { mangle ParAtAbsOp [mkO, mkP, mkP, mkP, mkP, mkM] mkM }
1326 has_side_effects = True
1328 primop ParAtRelOp "parAtRel#" GenPrimOp
1329 a -> Int# -> Int# -> Int# -> Int# -> Int# -> b -> Int#
1331 usage = { mangle ParAtRelOp [mkO, mkP, mkP, mkP, mkP, mkM] mkM }
1332 has_side_effects = True
1334 primop ParAtForNowOp "parAtForNow#" GenPrimOp
1335 b -> a -> Int# -> Int# -> Int# -> Int# -> c -> Int#
1337 usage = { mangle ParAtForNowOp [mkO, mkZ, mkP, mkP, mkP, mkP, mkM] mkM }
1338 has_side_effects = True
1340 -- copyable# and noFollow# are yet to be implemented (for GpH)
1342 --primop CopyableOp "copyable#" GenPrimOp
1345 -- usage = { mangle CopyableOp [mkZ] mkR }
1346 -- has_side_effects = True
1348 --primop NoFollowOp "noFollow#" GenPrimOp
1351 -- usage = { mangle NoFollowOp [mkZ] mkR }
1352 -- has_side_effects = True
1355 ------------------------------------------------------------------------
1356 --- tag to enum stuff ---
1357 ------------------------------------------------------------------------
1359 primop DataToTagOp "dataToTag#" GenPrimOp
1362 strictness = { \ arity -> StrictnessInfo [wwLazy] False }
1364 primop TagToEnumOp "tagToEnum#" GenPrimOp
1370 ------------------------------------------------------------------------
1372 ------------------------------------------------------------------------