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