264fec251199f7be68e656be64c2a7efed82c3c8
[ghc-hetmet.git] / ghc / compiler / prelude / primops.txt
1 -----------------------------------------------------------------------
2 -- $Id: primops.txt,v 1.14 2001/01/15 09:55:41 sewardj Exp $
3 --
4 -- Primitive Operations
5 --
6 -----------------------------------------------------------------------
7
8 -- To add a new primop, you currently need to update the following files:
9 --
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.)
14 --
15 --      - ghc/lib/std/PrelGHC.hi-boot, to declare the primop
16 --
17 --      - if the primop is inline (i.e. a macro), then:
18 --              ghc/includes/PrimOps.h
19 --              ghc/compiler/nativeGen/StixPrim.lhs
20 --
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)
24 --
25 --      - the User's Guide
26 --
27
28 -- The default attribute values which apply if you don't specify
29 -- other ones.  Attribute values can be True, False, or arbitrary
30 -- text between curly brackets.  This is a kludge to enable 
31 -- processors of this file to easily get hold of simple info
32 -- (eg, out_of_line), whilst avoiding parsing complex expressions
33 -- needed for strictness and usage info.
34
35 defaults
36    has_side_effects = False
37    out_of_line      = False
38    commutable       = False
39    needs_wrapper    = False
40    can_fail         = False
41    strictness       = { \ arity -> StrictnessInfo (replicate arity wwPrim) False }
42    usage            = { nomangle other }
43
44
45 ------------------------------------------------------------------------
46 --- Support for the bytecode interpreter and linker                  ---
47 ------------------------------------------------------------------------
48
49 -- Convert an Addr# to a followable type
50 primop   AddrToHValueOp "addrToHValue#" GenPrimOp
51    Addr# -> (# a #)
52
53 primop   MkApUpd0_Op "mkApUpd0#" GenPrimOp
54    a -> (# a #)
55    with
56    out_of_line = True
57
58 primop  NewBCOOp "newBCO#" GenPrimOp
59    ByteArr# -> ByteArr# -> Array# a -> ByteArr# -> State# s -> (# State# s, BCO# #)
60    with
61    has_side_effects = True
62    out_of_line      = True
63
64
65 ------------------------------------------------------------------------
66 --- Addr#                                                            ---
67 ------------------------------------------------------------------------
68
69 primop   AddrGtOp  "gtAddr#"   Compare   Addr# -> Addr# -> Bool
70 primop   AddrGeOp  "geAddr#"   Compare   Addr# -> Addr# -> Bool
71 primop   AddrEqOp  "eqAddr#"   Compare   Addr# -> Addr# -> Bool
72 primop   AddrNeOp  "neAddr#"   Compare   Addr# -> Addr# -> Bool
73 primop   AddrLtOp  "ltAddr#"   Compare   Addr# -> Addr# -> Bool
74 primop   AddrLeOp  "leAddr#"   Compare   Addr# -> Addr# -> Bool
75
76 primop   Addr2IntOp  "addr2Int#"     GenPrimOp   Addr# -> Int#
77
78
79 ------------------------------------------------------------------------
80 --- Char#                                                            ---
81 ------------------------------------------------------------------------
82
83 primop   CharGtOp  "gtChar#"   Compare   Char# -> Char# -> Bool
84 primop   CharGeOp  "geChar#"   Compare   Char# -> Char# -> Bool
85
86 primop   CharEqOp  "eqChar#"   Compare
87    Char# -> Char# -> Bool
88    with commutable = True
89
90 primop   CharNeOp  "neChar#"   Compare
91    Char# -> Char# -> Bool
92    with commutable = True
93
94 primop   CharLtOp  "ltChar#"   Compare   Char# -> Char# -> Bool
95 primop   CharLeOp  "leChar#"   Compare   Char# -> Char# -> Bool
96
97 primop   OrdOp   "ord#"  GenPrimOp   Char# -> Int#
98
99 ------------------------------------------------------------------------
100 --- Double#                                                          ---
101 ------------------------------------------------------------------------
102
103 primop   DoubleGtOp ">##"   Compare   Double# -> Double# -> Bool
104 primop   DoubleGeOp ">=##"   Compare   Double# -> Double# -> Bool
105
106 primop DoubleEqOp "==##"   Compare
107    Double# -> Double# -> Bool
108    with commutable = True
109
110 primop DoubleNeOp "/=##"   Compare
111    Double# -> Double# -> Bool
112    with commutable = True
113
114 primop   DoubleLtOp "<##"   Compare   Double# -> Double# -> Bool
115 primop   DoubleLeOp "<=##"   Compare   Double# -> Double# -> Bool
116
117 primop   DoubleAddOp   "+##"   Dyadic
118    Double# -> Double# -> Double#
119    with commutable = True
120
121 primop   DoubleSubOp   "-##"   Dyadic   Double# -> Double# -> Double#
122
123 primop   DoubleMulOp   "*##"   Dyadic
124    Double# -> Double# -> Double#
125    with commutable = True
126
127 primop   DoubleDivOp   "/##"   Dyadic
128    Double# -> Double# -> Double#
129    with can_fail = True
130
131 primop   DoubleNegOp   "negateDouble#"  Monadic   Double# -> Double#
132
133 primop   Double2IntOp   "double2Int#"          GenPrimOp  Double# -> Int#
134 primop   Double2FloatOp   "double2Float#" GenPrimOp Double# -> Float#
135
136 primop   DoubleExpOp   "expDouble#"      Monadic
137    Double# -> Double#
138    with needs_wrapper = True
139
140 primop   DoubleLogOp   "logDouble#"      Monadic         
141    Double# -> Double#
142    with
143    needs_wrapper = True
144    can_fail = True
145
146 primop   DoubleSqrtOp   "sqrtDouble#"      Monadic  
147    Double# -> Double#
148    with needs_wrapper = True
149
150 primop   DoubleSinOp   "sinDouble#"      Monadic          
151    Double# -> Double#
152    with needs_wrapper = True
153
154 primop   DoubleCosOp   "cosDouble#"      Monadic          
155    Double# -> Double#
156    with needs_wrapper = True
157
158 primop   DoubleTanOp   "tanDouble#"      Monadic          
159    Double# -> Double#
160    with needs_wrapper = True
161
162 primop   DoubleAsinOp   "asinDouble#"      Monadic 
163    Double# -> Double#
164    with
165    needs_wrapper = True
166    can_fail = True
167
168 primop   DoubleAcosOp   "acosDouble#"      Monadic  
169    Double# -> Double#
170    with
171    needs_wrapper = True
172    can_fail = True
173
174 primop   DoubleAtanOp   "atanDouble#"      Monadic  
175    Double# -> Double#
176    with
177    needs_wrapper = True
178
179 primop   DoubleSinhOp   "sinhDouble#"      Monadic  
180    Double# -> Double#
181    with needs_wrapper = True
182
183 primop   DoubleCoshOp   "coshDouble#"      Monadic  
184    Double# -> Double#
185    with needs_wrapper = True
186
187 primop   DoubleTanhOp   "tanhDouble#"      Monadic  
188    Double# -> Double#
189    with needs_wrapper = True
190
191 primop   DoublePowerOp   "**##" Dyadic  
192    Double# -> Double# -> Double#
193    with needs_wrapper = True
194
195 primop   DoubleDecodeOp   "decodeDouble#" GenPrimOp    
196    Double# -> (# Int#, Int#, ByteArr# #)
197    with out_of_line = True
198
199 ------------------------------------------------------------------------
200 --- Float#                                                            ---
201 ------------------------------------------------------------------------
202
203 primop   FloatGtOp  "gtFloat#"   Compare   Float# -> Float# -> Bool
204 primop   FloatGeOp  "geFloat#"   Compare   Float# -> Float# -> Bool
205
206 primop   FloatEqOp  "eqFloat#"   Compare
207    Float# -> Float# -> Bool
208    with commutable = True
209
210 primop   FloatNeOp  "neFloat#"   Compare
211    Float# -> Float# -> Bool
212    with commutable = True
213
214 primop   FloatLtOp  "ltFloat#"   Compare   Float# -> Float# -> Bool
215 primop   FloatLeOp  "leFloat#"   Compare   Float# -> Float# -> Bool
216
217 primop   FloatAddOp   "plusFloat#"      Dyadic            
218    Float# -> Float# -> Float#
219    with commutable = True
220
221 primop   FloatSubOp   "minusFloat#"      Dyadic      Float# -> Float# -> Float#
222
223 primop   FloatMulOp   "timesFloat#"      Dyadic    
224    Float# -> Float# -> Float#
225    with commutable = True
226
227 primop   FloatDivOp   "divideFloat#"      Dyadic  
228    Float# -> Float# -> Float#
229    with can_fail = True
230
231 primop   FloatNegOp   "negateFloat#"      Monadic    Float# -> Float#
232
233 primop   Float2IntOp   "float2Int#"      GenPrimOp  Float# -> Int#
234
235 primop   FloatExpOp   "expFloat#"      Monadic          
236    Float# -> Float#
237    with needs_wrapper = True
238
239 primop   FloatLogOp   "logFloat#"      Monadic          
240    Float# -> Float#
241    with needs_wrapper = True
242         can_fail = True
243
244 primop   FloatSqrtOp   "sqrtFloat#"      Monadic          
245    Float# -> Float#
246    with needs_wrapper = True
247
248 primop   FloatSinOp   "sinFloat#"      Monadic          
249    Float# -> Float#
250    with needs_wrapper = True
251
252 primop   FloatCosOp   "cosFloat#"      Monadic          
253    Float# -> Float#
254    with needs_wrapper = True
255
256 primop   FloatTanOp   "tanFloat#"      Monadic          
257    Float# -> Float#
258    with needs_wrapper = True
259
260 primop   FloatAsinOp   "asinFloat#"      Monadic          
261    Float# -> Float#
262    with needs_wrapper = True
263         can_fail = True
264
265 primop   FloatAcosOp   "acosFloat#"      Monadic          
266    Float# -> Float#
267    with needs_wrapper = True
268         can_fail = True
269
270 primop   FloatAtanOp   "atanFloat#"      Monadic          
271    Float# -> Float#
272    with needs_wrapper = True
273
274 primop   FloatSinhOp   "sinhFloat#"      Monadic          
275    Float# -> Float#
276    with needs_wrapper = True
277
278 primop   FloatCoshOp   "coshFloat#"      Monadic          
279    Float# -> Float#
280    with needs_wrapper = True
281
282 primop   FloatTanhOp   "tanhFloat#"      Monadic          
283    Float# -> Float#
284    with needs_wrapper = True
285
286 primop   FloatPowerOp   "powerFloat#"      Dyadic   
287    Float# -> Float# -> Float#
288    with needs_wrapper = True
289
290 primop   Float2DoubleOp   "float2Double#" GenPrimOp  Float# -> Double#
291
292 primop   FloatDecodeOp   "decodeFloat#" GenPrimOp
293    Float# -> (# Int#, Int#, ByteArr# #)
294    with out_of_line = True
295
296 ------------------------------------------------------------------------
297 --- Int#                                                             ---
298 ------------------------------------------------------------------------
299
300 primop   IntAddOp    "+#"    Dyadic
301    Int# -> Int# -> Int#
302    with commutable = True
303
304 primop   IntSubOp    "-#"    Dyadic   Int# -> Int# -> Int#
305
306 primop   IntMulOp    "*#" 
307    Dyadic   Int# -> Int# -> Int#
308    with commutable = True
309
310 primop   IntQuotOp    "quotInt#"    Dyadic
311    Int# -> Int# -> Int#
312    with can_fail = True
313
314 primop   IntRemOp    "remInt#"    Dyadic
315    Int# -> Int# -> Int#
316    with can_fail = True
317
318 primop   IntGcdOp    "gcdInt#"    Dyadic   Int# -> Int# -> Int#
319 primop   IntNegOp    "negateInt#"    Monadic   Int# -> Int#
320 primop   IntAddCOp   "addIntC#"    GenPrimOp   Int# -> Int# -> (# Int#, Int# #)
321 primop   IntSubCOp   "subIntC#"    GenPrimOp   Int# -> Int# -> (# Int#, Int# #)
322 primop   IntMulCOp   "mulIntC#"    GenPrimOp   Int# -> Int# -> (# Int#, Int# #)
323 primop   IntGtOp  ">#"   Compare   Int# -> Int# -> Bool
324 primop   IntGeOp  ">=#"   Compare   Int# -> Int# -> Bool
325
326 primop   IntEqOp  "==#"   Compare
327    Int# -> Int# -> Bool
328    with commutable = True
329
330 primop   IntNeOp  "/=#"   Compare
331    Int# -> Int# -> Bool
332    with commutable = True
333
334 primop   IntLtOp  "<#"   Compare   Int# -> Int# -> Bool
335 primop   IntLeOp  "<=#"   Compare   Int# -> Int# -> Bool
336
337 primop   ChrOp   "chr#"   GenPrimOp   Int# -> Char#
338
339 primop   Int2WordOp "int2Word#" GenPrimOp Int# -> Word#
340 primop   Int2AddrOp   "int2Addr#"GenPrimOp  Int# -> Addr#
341 primop   Int2FloatOp   "int2Float#"      GenPrimOp  Int# -> Float#
342 primop   Int2DoubleOp   "int2Double#"          GenPrimOp  Int# -> Double#
343
344 primop   Int2IntegerOp    "int2Integer#"
345    GenPrimOp Int# -> (# Int#, ByteArr# #)
346    with out_of_line = True
347
348 primop   ISllOp   "iShiftL#" GenPrimOp  Int# -> Int# -> Int#
349 primop   ISraOp   "iShiftRA#" GenPrimOp Int# -> Int# -> Int#
350 primop   ISrlOp   "iShiftRL#" GenPrimOp Int# -> Int# -> Int#
351
352 ------------------------------------------------------------------------
353 --- Int64#                                                           ---
354 ------------------------------------------------------------------------
355
356 primop   Int64ToIntegerOp   "int64ToInteger#" GenPrimOp 
357    Int64# -> (# Int#, ByteArr# #)
358    with out_of_line = True
359
360
361 ------------------------------------------------------------------------
362 --- Integer#                                                         ---
363 ------------------------------------------------------------------------
364
365 primop   IntegerNegOp   "negateInteger#" GenPrimOp    
366    Int# -> ByteArr# -> (# Int#, ByteArr# #)
367
368 primop   IntegerAddOp   "plusInteger#" GenPrimOp   
369    Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
370    with commutable = True
371         out_of_line = True
372
373 primop   IntegerSubOp   "minusInteger#" GenPrimOp  
374    Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
375    with out_of_line = True
376
377 primop   IntegerMulOp   "timesInteger#" GenPrimOp   
378    Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
379    with commutable = True
380         out_of_line = True
381
382 primop   IntegerGcdOp   "gcdInteger#" GenPrimOp    
383    Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
384    with commutable = True
385         out_of_line = True
386
387 primop   IntegerIntGcdOp   "gcdIntegerInt#" GenPrimOp
388    Int# -> ByteArr# -> Int# -> Int#
389    with commutable = True
390
391 primop   IntegerDivExactOp   "divExactInteger#" GenPrimOp
392    Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
393    with out_of_line = True
394
395 primop   IntegerQuotOp   "quotInteger#" GenPrimOp
396    Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
397    with out_of_line = True
398
399 primop   IntegerRemOp   "remInteger#" GenPrimOp
400    Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
401    with out_of_line = True
402
403 primop   IntegerCmpOp   "cmpInteger#"   GenPrimOp  
404    Int# -> ByteArr# -> Int# -> ByteArr# -> Int#
405    with needs_wrapper = True
406
407 primop   IntegerCmpIntOp   "cmpIntegerInt#" GenPrimOp
408    Int# -> ByteArr# -> Int# -> Int#
409    with needs_wrapper = True
410
411 primop   IntegerQuotRemOp   "quotRemInteger#" GenPrimOp
412    Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr#, Int#, ByteArr# #)
413    with can_fail = True
414         out_of_line = True
415
416 primop   IntegerDivModOp    "divModInteger#"  GenPrimOp
417    Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr#, Int#, ByteArr# #)
418    with can_fail = True
419         out_of_line = True
420
421 primop   Integer2IntOp   "integer2Int#"    GenPrimOp
422    Int# -> ByteArr# -> Int#
423    with needs_wrapper = True
424
425 primop   Integer2WordOp   "integer2Word#"   GenPrimOp
426    Int# -> ByteArr# -> Word#
427    with needs_wrapper = True
428
429 primop   IntegerToInt64Op   "integerToInt64#" GenPrimOp
430    Int# -> ByteArr# -> Int64#
431
432 primop   IntegerToWord64Op   "integerToWord64#" GenPrimOp
433    Int# -> ByteArr# -> Word64#
434
435 primop   IntegerAndOp  "andInteger#" GenPrimOp
436    Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
437    with out_of_line = True
438
439 primop   IntegerOrOp  "orInteger#" GenPrimOp
440    Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
441    with out_of_line = True
442
443 primop   IntegerXorOp  "xorInteger#" GenPrimOp
444    Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
445    with out_of_line = True
446
447 primop   IntegerComplementOp  "complementInteger#" GenPrimOp
448    Int# -> ByteArr# -> (# Int#, ByteArr# #)
449    with out_of_line = True
450
451 ------------------------------------------------------------------------
452 --- Word#                                                            ---
453 ------------------------------------------------------------------------
454
455 primop   WordQuotOp   "quotWord#" Dyadic  Word# -> Word# -> Word#
456 primop   WordRemOp   "remWord#" Dyadic          Word# -> Word# -> Word#
457
458 primop   AndOp   "and#"  Dyadic      
459    Word# -> Word# -> Word#
460    with commutable = True
461
462 primop   OrOp   "or#"          Dyadic      
463    Word# -> Word# -> Word#
464    with commutable = True
465
466 primop   XorOp   "xor#"  Dyadic      
467    Word# -> Word# -> Word#
468    with commutable = True
469
470 primop   NotOp   "not#"  Monadic        Word# -> Word#
471
472 primop   SllOp   "shiftL#" GenPrimOp  Word# -> Int# -> Word#
473 primop   SrlOp   "shiftRL#" GenPrimOp Word# -> Int# -> Word#
474
475
476 primop   Word2IntOp "word2Int#" GenPrimOp Word# -> Int#
477
478 primop   Word2IntegerOp   "word2Integer#" GenPrimOp 
479    Word# -> (# Int#, ByteArr# #)
480    with out_of_line = True
481
482 primop   WordGtOp  "gtWord#"   Compare   Word# -> Word# -> Bool
483 primop   WordGeOp  "geWord#"   Compare   Word# -> Word# -> Bool
484 primop   WordEqOp  "eqWord#"   Compare   Word# -> Word# -> Bool
485 primop   WordNeOp  "neWord#"   Compare   Word# -> Word# -> Bool
486 primop   WordLtOp  "ltWord#"   Compare   Word# -> Word# -> Bool
487 primop   WordLeOp  "leWord#"   Compare   Word# -> Word# -> Bool
488
489 ------------------------------------------------------------------------
490 --- Word64#                                                          ---
491 ------------------------------------------------------------------------
492
493 primop   Word64ToIntegerOp   "word64ToInteger#" GenPrimOp
494    Word64# -> (# Int#, ByteArr# #)
495    with out_of_line = True
496
497
498 ------------------------------------------------------------------------
499 --- Arrays                                                           ---
500 ------------------------------------------------------------------------
501
502 primop  NewByteArrayOp_Char "newByteArray#" GenPrimOp
503    Int# -> State# s -> (# State# s, MutByteArr# s #)
504    with out_of_line = True
505
506
507 primop  ReadByteArrayOp_Char "readCharArray#" GenPrimOp
508    MutByteArr# s -> Int# -> State# s -> (# State# s, Char# #)
509
510 primop  ReadByteArrayOp_Int "readIntArray#" GenPrimOp
511    MutByteArr# s -> Int# -> State# s -> (# State# s, Int# #)
512
513 primop  ReadByteArrayOp_Word "readWordArray#" GenPrimOp
514    MutByteArr# s -> Int# -> State# s -> (# State# s, Word# #)
515
516 primop  ReadByteArrayOp_Addr "readAddrArray#" GenPrimOp
517    MutByteArr# s -> Int# -> State# s -> (# State# s, Addr# #)
518
519 primop  ReadByteArrayOp_Float "readFloatArray#" GenPrimOp
520    MutByteArr# s -> Int# -> State# s -> (# State# s, Float# #)
521
522 primop  ReadByteArrayOp_Double "readDoubleArray#" GenPrimOp
523    MutByteArr# s -> Int# -> State# s -> (# State# s, Double# #)
524
525 primop  ReadByteArrayOp_StablePtr "readStablePtrArray#" GenPrimOp
526    MutByteArr# s -> Int# -> State# s -> (# State# s, StablePtr# a #)
527
528 primop  ReadByteArrayOp_Int8 "readInt8Array#" GenPrimOp
529    MutByteArr# s -> Int# -> State# s -> (# State# s, Int# #)
530
531 primop  ReadByteArrayOp_Int16 "readInt16Array#" GenPrimOp
532    MutByteArr# s -> Int# -> State# s -> (# State# s, Int# #)
533
534 primop  ReadByteArrayOp_Int32 "readInt32Array#" GenPrimOp
535    MutByteArr# s -> Int# -> State# s -> (# State# s, Int# #)
536
537 primop  ReadByteArrayOp_Int64 "readInt64Array#" GenPrimOp
538    MutByteArr# s -> Int# -> State# s -> (# State# s, Int64# #)
539
540 primop  ReadByteArrayOp_Word8 "readWord8Array#" GenPrimOp
541    MutByteArr# s -> Int# -> State# s -> (# State# s, Word# #)
542
543 primop  ReadByteArrayOp_Word16 "readWord16Array#" GenPrimOp
544    MutByteArr# s -> Int# -> State# s -> (# State# s, Word# #)
545
546 primop  ReadByteArrayOp_Word32 "readWord32Array#" GenPrimOp
547    MutByteArr# s -> Int# -> State# s -> (# State# s, Word# #)
548
549 primop  ReadByteArrayOp_Word64 "readWord64Array#" GenPrimOp
550    MutByteArr# s -> Int# -> State# s -> (# State# s, Word64# #)
551
552
553
554 primop  WriteByteArrayOp_Char "writeCharArray#" GenPrimOp
555    MutByteArr# s -> Int# -> Char# -> State# s -> State# s
556    with has_side_effects = True
557
558 primop  WriteByteArrayOp_Int "writeIntArray#" GenPrimOp
559    MutByteArr# s -> Int# -> Int# -> State# s -> State# s
560    with has_side_effects = True
561
562 primop  WriteByteArrayOp_Word "writeWordArray#" GenPrimOp
563    MutByteArr# s -> Int# -> Word# -> State# s -> State# s
564    with has_side_effects = True
565
566 primop  WriteByteArrayOp_Addr "writeAddrArray#" GenPrimOp
567    MutByteArr# s -> Int# -> Addr# -> State# s -> State# s
568    with has_side_effects = True
569
570 primop  WriteByteArrayOp_Float "writeFloatArray#" GenPrimOp
571    MutByteArr# s -> Int# -> Float# -> State# s -> State# s
572    with has_side_effects = True
573
574 primop  WriteByteArrayOp_Double "writeDoubleArray#" GenPrimOp
575    MutByteArr# s -> Int# -> Double# -> State# s -> State# s
576    with has_side_effects = True
577
578 primop  WriteByteArrayOp_StablePtr "writeStablePtrArray#" GenPrimOp
579    MutByteArr# s -> Int# -> StablePtr# a -> State# s -> State# s
580    with has_side_effects = True
581
582 primop  WriteByteArrayOp_Int8 "writeInt8Array#" GenPrimOp
583    MutByteArr# s -> Int# -> Int# -> State# s -> State# s
584    with has_side_effects = True
585
586 primop  WriteByteArrayOp_Word8 "writeWord8Array#" GenPrimOp
587    MutByteArr# s -> Int# -> Word# -> State# s -> State# s
588    with has_side_effects = True
589
590 primop  WriteByteArrayOp_Int16 "writeInt16Array#" GenPrimOp
591    MutByteArr# s -> Int# -> Int# -> State# s -> State# s
592    with has_side_effects = True
593
594 primop  WriteByteArrayOp_Word16 "writeWord16Array#" GenPrimOp
595    MutByteArr# s -> Int# -> Word# -> State# s -> State# s
596    with has_side_effects = True
597
598 primop  WriteByteArrayOp_Int32 "writeInt32Array#" GenPrimOp
599    MutByteArr# s -> Int# -> Int# -> State# s -> State# s
600    with has_side_effects = True
601
602 primop  WriteByteArrayOp_Word32 "writeWord32Array#" GenPrimOp
603    MutByteArr# s -> Int# -> Word# -> State# s -> State# s
604    with has_side_effects = True
605
606 primop  WriteByteArrayOp_Int64 "writeInt64Array#" GenPrimOp
607    MutByteArr# s -> Int# -> Int64# -> State# s -> State# s
608    with has_side_effects = True
609
610 primop  WriteByteArrayOp_Word64 "writeWord64Array#" GenPrimOp
611    MutByteArr# s -> Int# -> Word64# -> State# s -> State# s
612    with has_side_effects = True
613
614
615 primop IndexByteArrayOp_Char "indexCharArray#" GenPrimOp
616    ByteArr# -> Int# -> Char#
617
618 primop IndexByteArrayOp_Int "indexIntArray#" GenPrimOp
619    ByteArr# -> Int# -> Int#
620
621 primop IndexByteArrayOp_Word "indexWordArray#" GenPrimOp
622    ByteArr# -> Int# -> Word#
623
624 primop IndexByteArrayOp_Addr "indexAddrArray#" GenPrimOp
625    ByteArr# -> Int# -> Addr#
626
627 primop IndexByteArrayOp_Float "indexFloatArray#" GenPrimOp
628    ByteArr# -> Int# -> Float#
629
630 primop IndexByteArrayOp_Double "indexDoubleArray#" GenPrimOp
631    ByteArr# -> Int# -> Double#
632
633 primop IndexByteArrayOp_StablePtr "indexStablePtrArray#" GenPrimOp
634    ByteArr# -> Int# -> StablePtr# a
635
636 primop IndexByteArrayOp_Int8 "indexInt8Array#" GenPrimOp
637    ByteArr# -> Int# -> Int#
638
639 primop IndexByteArrayOp_Word8 "indexWord8Array#" GenPrimOp
640    ByteArr# -> Int# -> Word#
641
642 primop IndexByteArrayOp_Int16 "indexInt16Array#" GenPrimOp
643    ByteArr# -> Int# -> Int#
644
645 primop IndexByteArrayOp_Word16 "indexWord16Array#" GenPrimOp
646    ByteArr# -> Int# -> Word#
647
648 primop IndexByteArrayOp_Int32 "indexInt32Array#" GenPrimOp
649    ByteArr# -> Int# -> Int#
650
651 primop IndexByteArrayOp_Word32 "indexWord32Array#" GenPrimOp
652    ByteArr# -> Int# -> Word#
653
654 primop IndexByteArrayOp_Int64 "indexInt64Array#" GenPrimOp
655    ByteArr# -> Int# -> Int64#
656
657 primop IndexByteArrayOp_Word64 "indexWord64Array#" GenPrimOp
658    ByteArr# -> Int# -> Word64#
659
660
661 primop IndexOffAddrOp_Char "indexCharOffAddr#" GenPrimOp
662    Addr# -> Int# -> Char#
663
664 primop IndexOffAddrOp_Int "indexIntOffAddr#" GenPrimOp
665    Addr# -> Int# -> Int#
666
667 primop IndexOffAddrOp_Word "indexWordOffAddr#" GenPrimOp
668    Addr# -> Int# -> Word#
669
670 primop IndexOffAddrOp_Addr "indexAddrOffAddr#" GenPrimOp
671    Addr# -> Int# -> Addr#
672
673 primop IndexOffAddrOp_Float "indexFloatOffAddr#" GenPrimOp
674    Addr# -> Int# -> Float#
675
676 primop IndexOffAddrOp_Double "indexDoubleOffAddr#" GenPrimOp
677    Addr# -> Int# -> Double#
678
679 primop IndexOffAddrOp_StablePtr "indexStablePtrOffAddr#" GenPrimOp
680    Addr# -> Int# -> StablePtr# a
681
682 primop IndexOffAddrOp_Int8 "indexInt8OffAddr#" GenPrimOp
683    Addr# -> Int# -> Int#
684
685 primop IndexOffAddrOp_Word8 "indexWord8OffAddr#" GenPrimOp
686    Addr# -> Int# -> Word#
687
688 primop IndexOffAddrOp_Int16 "indexInt16OffAddr#" GenPrimOp
689    Addr# -> Int# -> Int#
690
691 primop IndexOffAddrOp_Word16 "indexWord16OffAddr#" GenPrimOp
692    Addr# -> Int# -> Word#
693
694 primop IndexOffAddrOp_Int32 "indexInt32OffAddr#" GenPrimOp
695    Addr# -> Int# -> Int#
696
697 primop IndexOffAddrOp_Word32 "indexWord32OffAddr#" GenPrimOp
698    Addr# -> Int# -> Word#
699
700 primop IndexOffAddrOp_Int64 "indexInt64OffAddr#" GenPrimOp
701    Addr# -> Int# -> Int64#
702
703 primop IndexOffAddrOp_Word64 "indexWord64OffAddr#" GenPrimOp
704    Addr# -> Int# -> Word64#
705
706
707 primop IndexOffForeignObjOp_Char "indexCharOffForeignObj#" GenPrimOp
708    ForeignObj# -> Int# -> Char#
709
710 primop IndexOffForeignObjOp_Int "indexIntOffForeignObj#" GenPrimOp
711    ForeignObj# -> Int# -> Int#
712
713 primop IndexOffForeignObjOp_Word "indexWordOffForeignObj#" GenPrimOp
714    ForeignObj# -> Int# -> Word#
715
716 primop IndexOffForeignObjOp_Addr "indexAddrOffForeignObj#" GenPrimOp
717    ForeignObj# -> Int# -> Addr#
718
719 primop IndexOffForeignObjOp_Float "indexFloatOffForeignObj#" GenPrimOp
720    ForeignObj# -> Int# -> Float#
721
722 primop IndexOffForeignObjOp_Double "indexDoubleOffForeignObj#" GenPrimOp
723    ForeignObj# -> Int# -> Double#
724
725 primop IndexOffForeignObjOp_StablePtr "indexStablePtrOffForeignObj#" GenPrimOp
726    ForeignObj# -> Int# -> StablePtr# a
727
728 primop IndexOffForeignObjOp_Int8 "indexInt8OffForeignObj#" GenPrimOp
729    ForeignObj# -> Int# -> Int#
730
731 primop IndexOffForeignObjOp_Word8 "indexWord8OffForeignObj#" GenPrimOp
732    ForeignObj# -> Int# -> Word#
733
734 primop IndexOffForeignObjOp_Int16 "indexInt16OffForeignObj#" GenPrimOp
735    ForeignObj# -> Int# -> Int#
736
737 primop IndexOffForeignObjOp_Word16 "indexWord16OffForeignObj#" GenPrimOp
738    ForeignObj# -> Int# -> Word#
739
740 primop IndexOffForeignObjOp_Int32 "indexInt32OffForeignObj#" GenPrimOp
741    ForeignObj# -> Int# -> Int#
742
743 primop IndexOffForeignObjOp_Word32 "indexWord32OffForeignObj#" GenPrimOp
744    ForeignObj# -> Int# -> Word#
745
746 primop IndexOffForeignObjOp_Int64 "indexInt64OffForeignObj#" GenPrimOp
747    ForeignObj# -> Int# -> Int64#
748
749 primop IndexOffForeignObjOp_Word64 "indexWord64OffForeignObj#" GenPrimOp
750    ForeignObj# -> Int# -> Word64#
751
752
753
754 primop ReadOffAddrOp_Char "readCharOffAddr#" GenPrimOp
755    Addr# -> Int# -> State# s -> (# State# s, Char# #)
756
757 primop ReadOffAddrOp_Int "readIntOffAddr#" GenPrimOp
758    Addr# -> Int# -> State# s -> (# State# s, Int# #)
759
760 primop ReadOffAddrOp_Word "readWordOffAddr#" GenPrimOp
761    Addr# -> Int# -> State# s -> (# State# s, Word# #)
762
763 primop ReadOffAddrOp_Addr "readAddrOffAddr#" GenPrimOp
764    Addr# -> Int# -> State# s -> (# State# s, Addr# #)
765
766 primop ReadOffAddrOp_Float "readFloatOffAddr#" GenPrimOp
767    Addr# -> Int# -> State# s -> (# State# s, Float# #)
768
769 primop ReadOffAddrOp_Double "readDoubleOffAddr#" GenPrimOp
770    Addr# -> Int# -> State# s -> (# State# s, Double# #)
771
772 primop ReadOffAddrOp_StablePtr "readStablePtrOffAddr#" GenPrimOp
773    Addr# -> Int# -> State# s -> (# State# s, StablePtr# a #)
774
775 primop ReadOffAddrOp_ForeignObj "readForeignObjOffAddr#" GenPrimOp
776    Addr# -> Int# -> State# s -> (# State# s, ForeignObj# #)
777
778 primop ReadOffAddrOp_Int8 "readInt8OffAddr#" GenPrimOp
779    Addr# -> Int# -> State# s -> (# State# s, Int# #)
780
781 primop ReadOffAddrOp_Word8 "readWord8OffAddr#" GenPrimOp
782    Addr# -> Int# -> State# s -> (# State# s, Word# #)
783
784 primop ReadOffAddrOp_Int16 "readInt16OffAddr#" GenPrimOp
785    Addr# -> Int# -> State# s -> (# State# s, Int# #)
786
787 primop ReadOffAddrOp_Word16 "readWord16OffAddr#" GenPrimOp
788    Addr# -> Int# -> State# s -> (# State# s, Word# #)
789
790 primop ReadOffAddrOp_Int32 "readInt32OffAddr#" GenPrimOp
791    Addr# -> Int# -> State# s -> (# State# s, Int# #)
792
793 primop ReadOffAddrOp_Word32 "readWord32OffAddr#" GenPrimOp
794    Addr# -> Int# -> State# s -> (# State# s, Word# #)
795
796 primop ReadOffAddrOp_Int64 "readInt64OffAddr#" GenPrimOp
797    Addr# -> Int# -> State# s -> (# State# s, Int64# #)
798
799 primop ReadOffAddrOp_Word64 "readWord64OffAddr#" GenPrimOp
800    Addr# -> Int# -> State# s -> (# State# s, Word64# #)
801
802
803 primop  WriteOffAddrOp_Char "writeCharOffAddr#" GenPrimOp
804    Addr# -> Int# -> Char# -> State# s -> State# s
805    with has_side_effects = True
806
807 primop  WriteOffAddrOp_Int "writeIntOffAddr#" GenPrimOp
808    Addr# -> Int# -> Int# -> State# s -> State# s
809    with has_side_effects = True
810
811 primop  WriteOffAddrOp_Word "writeWordOffAddr#" GenPrimOp
812    Addr# -> Int# -> Word# -> State# s -> State# s
813    with has_side_effects = True
814
815 primop  WriteOffAddrOp_Addr "writeAddrOffAddr#" GenPrimOp
816    Addr# -> Int# -> Addr# -> State# s -> State# s
817    with has_side_effects = True
818
819 primop  WriteOffAddrOp_Float "writeFloatOffAddr#" GenPrimOp
820    Addr# -> Int# -> Float# -> State# s -> State# s
821    with has_side_effects = True
822
823 primop  WriteOffAddrOp_Double "writeDoubleOffAddr#" GenPrimOp
824    Addr# -> Int# -> Double# -> State# s -> State# s
825    with has_side_effects = True
826
827 primop  WriteOffAddrOp_StablePtr "writeStablePtrOffAddr#" GenPrimOp
828    Addr# -> Int# -> StablePtr# a -> State# s -> State# s
829    with has_side_effects = True
830
831 primop  WriteOffAddrOp_ForeignObj "writeForeignObjOffAddr#" GenPrimOp
832    Addr# -> Int# -> ForeignObj# -> State# s -> State# s
833    with has_side_effects = True
834
835 primop  WriteOffAddrOp_Int8 "writeInt8OffAddr#" GenPrimOp
836    Addr# -> Int# -> Int# -> State# s -> State# s
837    with has_side_effects = True
838
839 primop  WriteOffAddrOp_Word8 "writeWord8OffAddr#" GenPrimOp
840    Addr# -> Int# -> Word# -> State# s -> State# s
841    with has_side_effects = True
842
843 primop  WriteOffAddrOp_Int16 "writeInt16OffAddr#" GenPrimOp
844    Addr# -> Int# -> Int# -> State# s -> State# s
845    with has_side_effects = True
846
847 primop  WriteOffAddrOp_Word16 "writeWord16OffAddr#" GenPrimOp
848    Addr# -> Int# -> Word# -> State# s -> State# s
849    with has_side_effects = True
850
851 primop  WriteOffAddrOp_Int32 "writeInt32OffAddr#" GenPrimOp
852    Addr# -> Int# -> Int# -> State# s -> State# s
853    with has_side_effects = True
854
855 primop  WriteOffAddrOp_Word32 "writeWord32OffAddr#" GenPrimOp
856    Addr# -> Int# -> Word# -> State# s -> State# s
857    with has_side_effects = True
858
859 primop  WriteOffAddrOp_Int64 "writeInt64OffAddr#" GenPrimOp
860    Addr# -> Int# -> Int64# -> State# s -> State# s
861    with has_side_effects = True
862
863 primop  WriteOffAddrOp_Word64 "writeWord64OffAddr#" GenPrimOp
864    Addr# -> Int# -> Word64# -> State# s -> State# s
865    with has_side_effects = True
866
867
868
869 primop  NewArrayOp "newArray#" GenPrimOp
870    Int# -> a -> State# s -> (# State# s, MutArr# s a #)
871    with
872    strictness  = { \ arity -> StrictnessInfo [wwPrim, wwLazy, wwPrim] False }
873    usage       = { mangle NewArrayOp [mkP, mkM, mkP] mkM }
874    out_of_line = True
875
876 primop  SameMutableArrayOp "sameMutableArray#" GenPrimOp
877    MutArr# s a -> MutArr# s a -> Bool
878    with
879    usage = { mangle SameMutableArrayOp [mkP, mkP] mkM }
880
881 primop  SameMutableByteArrayOp "sameMutableByteArray#" GenPrimOp
882    MutByteArr# s -> MutByteArr# s -> Bool
883
884 primop  ReadArrayOp "readArray#" GenPrimOp
885    MutArr# s a -> Int# -> State# s -> (# State# s, a #)
886    with
887    usage = { mangle ReadArrayOp [mkM, mkP, mkP] mkM }
888
889 primop  WriteArrayOp "writeArray#" GenPrimOp
890    MutArr# s a -> Int# -> a -> State# s -> State# s
891    with
892    usage            = { mangle WriteArrayOp [mkM, mkP, mkM, mkP] mkR }
893    strictness       = { \ arity -> StrictnessInfo [wwPrim, wwPrim, wwLazy, wwPrim] False }
894    has_side_effects = True
895
896 primop  IndexArrayOp "indexArray#" GenPrimOp
897    Array# a -> Int# -> (# a #)
898    with
899    usage = { mangle  IndexArrayOp [mkM, mkP] mkM }
900
901 primop  UnsafeFreezeArrayOp "unsafeFreezeArray#" GenPrimOp
902    MutArr# s a -> State# s -> (# State# s, Array# a #)
903    with
904    usage            = { mangle UnsafeFreezeArrayOp [mkM, mkP] mkM }
905    has_side_effects = True
906
907 primop  UnsafeFreezeByteArrayOp "unsafeFreezeByteArray#" GenPrimOp
908    MutByteArr# s -> State# s -> (# State# s, ByteArr# #)
909    with
910    has_side_effects = True
911
912 primop  UnsafeThawArrayOp  "unsafeThawArray#" GenPrimOp
913    Array# a -> State# s -> (# State# s, MutArr# s a #)
914    with
915    usage       = { mangle UnsafeThawArrayOp [mkM, mkP] mkM }
916    out_of_line = True
917
918 primop  SizeofByteArrayOp "sizeofByteArray#" GenPrimOp  
919    ByteArr# -> Int#
920
921 primop  SizeofMutableByteArrayOp "sizeofMutableByteArray#" GenPrimOp
922    MutByteArr# s -> Int#
923
924 ------------------------------------------------------------------------
925 --- Mutable variables                                                ---
926 ------------------------------------------------------------------------
927
928 primop  NewMutVarOp "newMutVar#" GenPrimOp
929    a -> State# s -> (# State# s, MutVar# s a #)
930    with
931    usage       = { mangle NewMutVarOp [mkM, mkP] mkM }
932    strictness  = { \ arity -> StrictnessInfo [wwLazy, wwPrim] False }
933    out_of_line = True
934
935 primop  ReadMutVarOp "readMutVar#" GenPrimOp
936    MutVar# s a -> State# s -> (# State# s, a #)
937    with
938    usage = { mangle ReadMutVarOp [mkM, mkP] mkM }
939
940 primop  WriteMutVarOp "writeMutVar#"  GenPrimOp
941    MutVar# s a -> a -> State# s -> State# s
942    with
943    strictness       = { \ arity -> StrictnessInfo [wwPrim, wwLazy, wwPrim] False }
944    usage            = { mangle WriteMutVarOp [mkM, mkM, mkP] mkR }
945    has_side_effects = True
946
947 primop  SameMutVarOp "sameMutVar#" GenPrimOp
948    MutVar# s a -> MutVar# s a -> Bool
949    with
950    usage = { mangle SameMutVarOp [mkP, mkP] mkM }
951
952 ------------------------------------------------------------------------
953 --- Exceptions                                                       ---
954 ------------------------------------------------------------------------
955
956 primop  CatchOp "catch#" GenPrimOp
957           (State# RealWorld -> (# State# RealWorld, a #) )
958        -> (b -> State# RealWorld -> (# State# RealWorld, a #) ) 
959        -> State# RealWorld
960        -> (# State# RealWorld, a #)
961    with
962    strictness = { \ arity -> StrictnessInfo [wwLazy, wwLazy, wwPrim] False }
963         -- Catch is actually strict in its first argument
964         -- but we don't want to tell the strictness
965         -- analyser about that!
966    usage = { mangle CatchOp [mkM, mkM . (inFun CatchOp mkM mkM), mkP] mkM }
967         --     [mkO, mkO . (inFun mkM mkO)] mkO
968         -- might use caught action multiply
969    out_of_line = True
970
971 primop  RaiseOp "raise#" GenPrimOp
972    a -> b
973    with
974    strictness  = { \ arity -> StrictnessInfo [wwLazy] True }
975       -- NB: True => result is bottom
976    usage       = { mangle RaiseOp [mkM] mkM }
977    out_of_line = True
978
979 primop  BlockAsyncExceptionsOp "blockAsyncExceptions#" GenPrimOp
980         (State# RealWorld -> (# State# RealWorld, a #))
981      -> (State# RealWorld -> (# State# RealWorld, a #))
982    with
983    strictness  = { \ arity -> StrictnessInfo [wwLazy] False }
984    out_of_line = True
985
986 primop  UnblockAsyncExceptionsOp "unblockAsyncExceptions#" GenPrimOp
987         (State# RealWorld -> (# State# RealWorld, a #))
988      -> (State# RealWorld -> (# State# RealWorld, a #))
989    with
990    strictness  = { \ arity -> StrictnessInfo [wwLazy] False }
991    out_of_line = True
992
993 ------------------------------------------------------------------------
994 --- MVars (not the same as mutable variables!)                       ---
995 ------------------------------------------------------------------------
996
997 primop  NewMVarOp "newMVar#"  GenPrimOp
998    State# s -> (# State# s, MVar# s a #)
999    with
1000    usage       = { mangle NewMVarOp [mkP] mkR }
1001    out_of_line = True
1002
1003 primop  TakeMVarOp "takeMVar#" GenPrimOp
1004    MVar# s a -> State# s -> (# State# s, a #)
1005    with
1006    usage            = { mangle TakeMVarOp [mkM, mkP] mkM }
1007    has_side_effects = True
1008    out_of_line      = True
1009
1010 primop  PutMVarOp "putMVar#" GenPrimOp
1011    MVar# s a -> a -> State# s -> State# s
1012    with
1013    strictness       = { \ arity -> StrictnessInfo [wwPrim, wwLazy, wwPrim] False }
1014    usage            = { mangle PutMVarOp [mkM, mkM, mkP] mkR }
1015    has_side_effects = True
1016    out_of_line      = True
1017
1018 primop  SameMVarOp "sameMVar#" GenPrimOp
1019    MVar# s a -> MVar# s a -> Bool
1020    with
1021    usage = { mangle SameMVarOp [mkP, mkP] mkM }
1022
1023 primop  TryTakeMVarOp "tryTakeMVar#" GenPrimOp
1024    MVar# s a -> State# s -> (# State# s, Int#, a #)
1025    with
1026    usage            = { mangle TryTakeMVarOp [mkM, mkP] mkM }
1027    has_side_effects = True
1028    out_of_line      = True
1029
1030 primop  IsEmptyMVarOp "isEmptyMVar#" GenPrimOp
1031    MVar# s a -> State# s -> (# State# s, Int# #)
1032    with
1033    usage = { mangle IsEmptyMVarOp [mkP, mkP] mkM }
1034
1035
1036 ------------------------------------------------------------------------
1037 --- delay/wait operations                                            ---
1038 ------------------------------------------------------------------------
1039
1040 primop  DelayOp "delay#" GenPrimOp
1041    Int# -> State# s -> State# s
1042    with
1043    needs_wrapper    = True
1044    has_side_effects = True
1045    out_of_line      = True
1046
1047 primop  WaitReadOp "waitRead#" GenPrimOp
1048    Int# -> State# s -> State# s
1049    with
1050    needs_wrapper    = True
1051    has_side_effects = True
1052    out_of_line      = True
1053
1054 primop  WaitWriteOp "waitWrite#" GenPrimOp
1055    Int# -> State# s -> State# s
1056    with
1057    needs_wrapper    = True
1058    has_side_effects = True
1059    out_of_line      = True
1060
1061 ------------------------------------------------------------------------
1062 --- concurrency primitives                                           ---
1063 ------------------------------------------------------------------------
1064
1065 primop  ForkOp "fork#" GenPrimOp
1066    a -> State# RealWorld -> (# State# RealWorld, ThreadId# #)
1067    with
1068    usage            = { mangle ForkOp [mkO, mkP] mkR }
1069    strictness       = { \ arity -> StrictnessInfo [wwLazy, wwPrim] False }
1070    has_side_effects = True
1071    out_of_line      = True
1072
1073 primop  KillThreadOp "killThread#"  GenPrimOp
1074    ThreadId# -> a -> State# RealWorld -> State# RealWorld
1075    with
1076    usage            = { mangle KillThreadOp [mkP, mkM, mkP] mkR }
1077    has_side_effects = True
1078    out_of_line      = True
1079
1080 primop  YieldOp "yield#" GenPrimOp
1081    State# RealWorld -> State# RealWorld
1082    with
1083    has_side_effects = True
1084    out_of_line      = True
1085
1086 primop  MyThreadIdOp "myThreadId#" GenPrimOp
1087     State# RealWorld -> (# State# RealWorld, ThreadId# #)
1088
1089 ------------------------------------------------------------------------
1090 --- foreign objects                                                  ---
1091 ------------------------------------------------------------------------
1092
1093 primop  MkForeignObjOp "mkForeignObj#" GenPrimOp
1094    Addr# -> State# RealWorld -> (# State# RealWorld, ForeignObj# #)
1095    with
1096    has_side_effects = True
1097    out_of_line      = True
1098
1099 primop  WriteForeignObjOp "writeForeignObj#" GenPrimOp
1100    ForeignObj# -> Addr# -> State# s -> State# s
1101    with
1102    has_side_effects = True
1103
1104 primop ForeignObjToAddrOp "foreignObjToAddr#" GenPrimOp
1105    ForeignObj# -> Addr#
1106
1107 primop TouchOp "touch#" GenPrimOp
1108    o -> State# RealWorld -> State# RealWorld
1109    with
1110    strictness       = { \ arity -> StrictnessInfo [wwLazy, wwPrim] False }
1111
1112
1113 ------------------------------------------------------------------------
1114 --- Weak pointers                                                    ---
1115 ------------------------------------------------------------------------
1116
1117 -- note that tyvar "o" denotes openAlphaTyVar
1118
1119 primop  MkWeakOp "mkWeak#" GenPrimOp
1120    o -> b -> c -> State# RealWorld -> (# State# RealWorld, Weak# b #)
1121    with
1122    strictness       = { \ arity -> StrictnessInfo [wwLazy, wwLazy, wwLazy, wwPrim] False }
1123    usage            = { mangle MkWeakOp [mkZ, mkM, mkM, mkP] mkM }
1124    has_side_effects = True
1125    out_of_line      = True
1126
1127 primop  DeRefWeakOp "deRefWeak#" GenPrimOp
1128    Weak# a -> State# RealWorld -> (# State# RealWorld, Int#, a #)
1129    with
1130    usage            = { mangle DeRefWeakOp [mkM, mkP] mkM }
1131    has_side_effects = True
1132
1133 primop  FinalizeWeakOp "finalizeWeak#" GenPrimOp
1134    Weak# a -> State# RealWorld -> (# State# RealWorld, Int#, 
1135               (State# RealWorld -> (# State# RealWorld, Unit #)) #)
1136    with
1137    usage            = { mangle FinalizeWeakOp [mkM, mkP] 
1138                                (mkR . (inUB FinalizeWeakOp 
1139                                             [id,id,inFun FinalizeWeakOp mkR mkM])) }
1140    has_side_effects = True
1141    out_of_line      = True
1142
1143
1144 ------------------------------------------------------------------------
1145 --- Stable pointers and names                                        ---
1146 ------------------------------------------------------------------------
1147
1148 primop  MakeStablePtrOp "makeStablePtr#" GenPrimOp
1149    a -> State# RealWorld -> (# State# RealWorld, StablePtr# a #)
1150    with
1151    strictness       = { \ arity -> StrictnessInfo [wwLazy, wwPrim] False }
1152    usage            = { mangle MakeStablePtrOp [mkM, mkP] mkM }
1153    has_side_effects = True
1154
1155 primop  DeRefStablePtrOp "deRefStablePtr#" GenPrimOp
1156    StablePtr# a -> State# RealWorld -> (# State# RealWorld, a #)
1157    with
1158    usage            = { mangle DeRefStablePtrOp [mkM, mkP] mkM }
1159    needs_wrapper    = True
1160    has_side_effects = True
1161
1162 primop  EqStablePtrOp "eqStablePtr#" GenPrimOp
1163    StablePtr# a -> StablePtr# a -> Int#
1164    with
1165    usage            = { mangle EqStablePtrOp [mkP, mkP] mkR }
1166    has_side_effects = True
1167
1168 primop  MakeStableNameOp "makeStableName#" GenPrimOp
1169    a -> State# RealWorld -> (# State# RealWorld, StableName# a #)
1170    with
1171    usage            = { mangle MakeStableNameOp [mkZ, mkP] mkR }
1172    strictness       = { \ arity -> StrictnessInfo [wwLazy, wwPrim] False }
1173    needs_wrapper    = True
1174    has_side_effects = True
1175    out_of_line      = True
1176
1177 primop  EqStableNameOp "eqStableName#" GenPrimOp
1178    StableName# a -> StableName# a -> Int#
1179    with
1180    usage = { mangle EqStableNameOp [mkP, mkP] mkR }
1181
1182 primop  StableNameToIntOp "stableNameToInt#" GenPrimOp
1183    StableName# a -> Int#
1184    with
1185    usage = { mangle StableNameToIntOp [mkP] mkR }
1186
1187 ------------------------------------------------------------------------
1188 --- Unsafe pointer equality (#1 Bad Guy: Alistair Reid :)            ---
1189 ------------------------------------------------------------------------
1190
1191 primop  ReallyUnsafePtrEqualityOp "reallyUnsafePtrEquality#" GenPrimOp
1192    a -> a -> Int#
1193    with
1194    usage = { mangle ReallyUnsafePtrEqualityOp [mkZ, mkZ] mkR }
1195
1196 ------------------------------------------------------------------------
1197 --- Parallelism                                                      ---
1198 ------------------------------------------------------------------------
1199
1200 primop  SeqOp "seq#" GenPrimOp
1201    a -> Int#
1202    with
1203    usage            = { mangle  SeqOp [mkO] mkR }
1204    strictness       = { \ arity -> StrictnessInfo [wwStrict] False }
1205       -- Seq is strict in its argument; see notes in ConFold.lhs
1206    has_side_effects = True
1207
1208 primop  ParOp "par#" GenPrimOp
1209    a -> Int#
1210    with
1211    usage            = { mangle ParOp [mkO] mkR }
1212    strictness       = { \ arity -> StrictnessInfo [wwLazy] False }
1213       -- Note that Par is lazy to avoid that the sparked thing
1214       -- gets evaluted strictly, which it should *not* be
1215    has_side_effects = True
1216
1217 -- HWL: The first 4 Int# in all par... annotations denote:
1218 --   name, granularity info, size of result, degree of parallelism
1219 --      Same  structure as _seq_ i.e. returns Int#
1220 -- KSW: v, the second arg in parAt# and parAtForNow#, is used only to determine
1221 --   `the processor containing the expression v'; it is not evaluated
1222
1223 primop  ParGlobalOp  "parGlobal#"  GenPrimOp
1224    a -> Int# -> Int# -> Int# -> Int# -> b -> Int#
1225    with
1226    usage            = { mangle ParGlobalOp [mkO, mkP, mkP, mkP, mkP, mkM] mkM }
1227    has_side_effects = True
1228
1229 primop  ParLocalOp  "parLocal#"  GenPrimOp
1230    a -> Int# -> Int# -> Int# -> Int# -> b -> Int#
1231    with
1232    usage            = { mangle ParLocalOp [mkO, mkP, mkP, mkP, mkP, mkM] mkM }
1233    has_side_effects = True
1234
1235 primop  ParAtOp  "parAt#"  GenPrimOp
1236    b -> a -> Int# -> Int# -> Int# -> Int# -> c -> Int#
1237    with
1238    usage            = { mangle ParAtOp [mkO, mkZ, mkP, mkP, mkP, mkP, mkM] mkM }
1239    has_side_effects = True
1240
1241 primop  ParAtAbsOp  "parAtAbs#"  GenPrimOp
1242    a -> Int# -> Int# -> Int# -> Int# -> Int# -> b -> Int#
1243    with
1244    usage            = { mangle ParAtAbsOp [mkO, mkP, mkP, mkP, mkP, mkM] mkM }
1245    has_side_effects = True
1246
1247 primop  ParAtRelOp  "parAtRel#" GenPrimOp
1248    a -> Int# -> Int# -> Int# -> Int# -> Int# -> b -> Int#
1249    with
1250    usage            = { mangle ParAtRelOp [mkO, mkP, mkP, mkP, mkP, mkM] mkM }
1251    has_side_effects = True
1252
1253 primop  ParAtForNowOp  "parAtForNow#" GenPrimOp
1254    b -> a -> Int# -> Int# -> Int# -> Int# -> c -> Int#
1255    with
1256    usage            = { mangle ParAtForNowOp [mkO, mkZ, mkP, mkP, mkP, mkP, mkM] mkM }
1257    has_side_effects = True
1258
1259 primop  CopyableOp  "copyable#" GenPrimOp
1260    a -> Int#
1261    with
1262    usage            = { mangle CopyableOp [mkZ] mkR }
1263    has_side_effects = True
1264
1265 primop  NoFollowOp "noFollow#" GenPrimOp
1266    a -> Int#
1267    with
1268    usage            = { mangle NoFollowOp [mkZ] mkR }
1269    has_side_effects = True
1270
1271
1272 ------------------------------------------------------------------------
1273 --- tag to enum stuff                                                ---
1274 ------------------------------------------------------------------------
1275
1276 primop  DataToTagOp "dataToTag#" GenPrimOp
1277    a -> Int#
1278    with
1279    strictness = { \ arity -> StrictnessInfo [wwLazy] False }
1280
1281 primop  TagToEnumOp "tagToEnum#" GenPrimOp     
1282    Int# -> a
1283
1284
1285 thats_all_folks
1286
1287 ------------------------------------------------------------------------
1288 ---                                                                  ---
1289 ------------------------------------------------------------------------
1290