1d3d99a0db9c8e11e33f7f539852da8661d9fd1f
[ghc-hetmet.git] / ghc / compiler / prelude / primops.txt
1 -----------------------------------------------------------------------
2 -- $Id: primops.txt,v 1.16 2001/02/14 12:59:35 simonmar 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   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_Int8 "readInt8OffAddr#" GenPrimOp
773    Addr# -> Int# -> State# s -> (# State# s, Int# #)
774
775 primop ReadOffAddrOp_Word8 "readWord8OffAddr#" GenPrimOp
776    Addr# -> Int# -> State# s -> (# State# s, Word# #)
777
778 primop ReadOffAddrOp_Int16 "readInt16OffAddr#" GenPrimOp
779    Addr# -> Int# -> State# s -> (# State# s, Int# #)
780
781 primop ReadOffAddrOp_Word16 "readWord16OffAddr#" GenPrimOp
782    Addr# -> Int# -> State# s -> (# State# s, Word# #)
783
784 primop ReadOffAddrOp_Int32 "readInt32OffAddr#" GenPrimOp
785    Addr# -> Int# -> State# s -> (# State# s, Int# #)
786
787 primop ReadOffAddrOp_Word32 "readWord32OffAddr#" GenPrimOp
788    Addr# -> Int# -> State# s -> (# State# s, Word# #)
789
790 primop ReadOffAddrOp_Int64 "readInt64OffAddr#" GenPrimOp
791    Addr# -> Int# -> State# s -> (# State# s, Int64# #)
792
793 primop ReadOffAddrOp_Word64 "readWord64OffAddr#" GenPrimOp
794    Addr# -> Int# -> State# s -> (# State# s, Word64# #)
795
796
797 primop  WriteOffAddrOp_Char "writeCharOffAddr#" GenPrimOp
798    Addr# -> Int# -> Char# -> State# s -> State# s
799    with has_side_effects = True
800
801 primop  WriteOffAddrOp_Int "writeIntOffAddr#" GenPrimOp
802    Addr# -> Int# -> Int# -> State# s -> State# s
803    with has_side_effects = True
804
805 primop  WriteOffAddrOp_Word "writeWordOffAddr#" GenPrimOp
806    Addr# -> Int# -> Word# -> State# s -> State# s
807    with has_side_effects = True
808
809 primop  WriteOffAddrOp_Addr "writeAddrOffAddr#" GenPrimOp
810    Addr# -> Int# -> Addr# -> State# s -> State# s
811    with has_side_effects = True
812
813 primop  WriteOffAddrOp_Float "writeFloatOffAddr#" GenPrimOp
814    Addr# -> Int# -> Float# -> State# s -> State# s
815    with has_side_effects = True
816
817 primop  WriteOffAddrOp_Double "writeDoubleOffAddr#" GenPrimOp
818    Addr# -> Int# -> Double# -> State# s -> State# s
819    with has_side_effects = True
820
821 primop  WriteOffAddrOp_StablePtr "writeStablePtrOffAddr#" GenPrimOp
822    Addr# -> Int# -> StablePtr# a -> State# s -> State# s
823    with has_side_effects = True
824
825 primop  WriteOffAddrOp_ForeignObj "writeForeignObjOffAddr#" GenPrimOp
826    Addr# -> Int# -> ForeignObj# -> State# s -> State# s
827    with has_side_effects = True
828
829 primop  WriteOffAddrOp_Int8 "writeInt8OffAddr#" GenPrimOp
830    Addr# -> Int# -> Int# -> State# s -> State# s
831    with has_side_effects = True
832
833 primop  WriteOffAddrOp_Word8 "writeWord8OffAddr#" GenPrimOp
834    Addr# -> Int# -> Word# -> State# s -> State# s
835    with has_side_effects = True
836
837 primop  WriteOffAddrOp_Int16 "writeInt16OffAddr#" GenPrimOp
838    Addr# -> Int# -> Int# -> State# s -> State# s
839    with has_side_effects = True
840
841 primop  WriteOffAddrOp_Word16 "writeWord16OffAddr#" GenPrimOp
842    Addr# -> Int# -> Word# -> State# s -> State# s
843    with has_side_effects = True
844
845 primop  WriteOffAddrOp_Int32 "writeInt32OffAddr#" GenPrimOp
846    Addr# -> Int# -> Int# -> State# s -> State# s
847    with has_side_effects = True
848
849 primop  WriteOffAddrOp_Word32 "writeWord32OffAddr#" GenPrimOp
850    Addr# -> Int# -> Word# -> State# s -> State# s
851    with has_side_effects = True
852
853 primop  WriteOffAddrOp_Int64 "writeInt64OffAddr#" GenPrimOp
854    Addr# -> Int# -> Int64# -> State# s -> State# s
855    with has_side_effects = True
856
857 primop  WriteOffAddrOp_Word64 "writeWord64OffAddr#" GenPrimOp
858    Addr# -> Int# -> Word64# -> State# s -> State# s
859    with has_side_effects = True
860
861
862
863 primop  NewArrayOp "newArray#" GenPrimOp
864    Int# -> a -> State# s -> (# State# s, MutArr# s a #)
865    with
866    strictness  = { \ arity -> StrictnessInfo [wwPrim, wwLazy, wwPrim] False }
867    usage       = { mangle NewArrayOp [mkP, mkM, mkP] mkM }
868    out_of_line = True
869
870 primop  SameMutableArrayOp "sameMutableArray#" GenPrimOp
871    MutArr# s a -> MutArr# s a -> Bool
872    with
873    usage = { mangle SameMutableArrayOp [mkP, mkP] mkM }
874
875 primop  SameMutableByteArrayOp "sameMutableByteArray#" GenPrimOp
876    MutByteArr# s -> MutByteArr# s -> Bool
877
878 primop  ReadArrayOp "readArray#" GenPrimOp
879    MutArr# s a -> Int# -> State# s -> (# State# s, a #)
880    with
881    usage = { mangle ReadArrayOp [mkM, mkP, mkP] mkM }
882
883 primop  WriteArrayOp "writeArray#" GenPrimOp
884    MutArr# s a -> Int# -> a -> State# s -> State# s
885    with
886    usage            = { mangle WriteArrayOp [mkM, mkP, mkM, mkP] mkR }
887    strictness       = { \ arity -> StrictnessInfo [wwPrim, wwPrim, wwLazy, wwPrim] False }
888    has_side_effects = True
889
890 primop  IndexArrayOp "indexArray#" GenPrimOp
891    Array# a -> Int# -> (# a #)
892    with
893    usage = { mangle  IndexArrayOp [mkM, mkP] mkM }
894
895 primop  UnsafeFreezeArrayOp "unsafeFreezeArray#" GenPrimOp
896    MutArr# s a -> State# s -> (# State# s, Array# a #)
897    with
898    usage            = { mangle UnsafeFreezeArrayOp [mkM, mkP] mkM }
899    has_side_effects = True
900
901 primop  UnsafeFreezeByteArrayOp "unsafeFreezeByteArray#" GenPrimOp
902    MutByteArr# s -> State# s -> (# State# s, ByteArr# #)
903    with
904    has_side_effects = True
905
906 primop  UnsafeThawArrayOp  "unsafeThawArray#" GenPrimOp
907    Array# a -> State# s -> (# State# s, MutArr# s a #)
908    with
909    usage       = { mangle UnsafeThawArrayOp [mkM, mkP] mkM }
910    out_of_line = True
911
912 primop  SizeofByteArrayOp "sizeofByteArray#" GenPrimOp  
913    ByteArr# -> Int#
914
915 primop  SizeofMutableByteArrayOp "sizeofMutableByteArray#" GenPrimOp
916    MutByteArr# s -> Int#
917
918 ------------------------------------------------------------------------
919 --- Mutable variables                                                ---
920 ------------------------------------------------------------------------
921
922 primop  NewMutVarOp "newMutVar#" GenPrimOp
923    a -> State# s -> (# State# s, MutVar# s a #)
924    with
925    usage       = { mangle NewMutVarOp [mkM, mkP] mkM }
926    strictness  = { \ arity -> StrictnessInfo [wwLazy, wwPrim] False }
927    out_of_line = True
928
929 primop  ReadMutVarOp "readMutVar#" GenPrimOp
930    MutVar# s a -> State# s -> (# State# s, a #)
931    with
932    usage = { mangle ReadMutVarOp [mkM, mkP] mkM }
933
934 primop  WriteMutVarOp "writeMutVar#"  GenPrimOp
935    MutVar# s a -> a -> State# s -> State# s
936    with
937    strictness       = { \ arity -> StrictnessInfo [wwPrim, wwLazy, wwPrim] False }
938    usage            = { mangle WriteMutVarOp [mkM, mkM, mkP] mkR }
939    has_side_effects = True
940
941 primop  SameMutVarOp "sameMutVar#" GenPrimOp
942    MutVar# s a -> MutVar# s a -> Bool
943    with
944    usage = { mangle SameMutVarOp [mkP, mkP] mkM }
945
946 ------------------------------------------------------------------------
947 --- Exceptions                                                       ---
948 ------------------------------------------------------------------------
949
950 primop  CatchOp "catch#" GenPrimOp
951           (State# RealWorld -> (# State# RealWorld, a #) )
952        -> (b -> State# RealWorld -> (# State# RealWorld, a #) ) 
953        -> State# RealWorld
954        -> (# State# RealWorld, a #)
955    with
956    strictness = { \ arity -> StrictnessInfo [wwLazy, wwLazy, wwPrim] False }
957         -- Catch is actually strict in its first argument
958         -- but we don't want to tell the strictness
959         -- analyser about that!
960    usage = { mangle CatchOp [mkM, mkM . (inFun CatchOp mkM mkM), mkP] mkM }
961         --     [mkO, mkO . (inFun mkM mkO)] mkO
962         -- might use caught action multiply
963    out_of_line = True
964
965 primop  RaiseOp "raise#" GenPrimOp
966    a -> b
967    with
968    strictness  = { \ arity -> StrictnessInfo [wwLazy] True }
969       -- NB: True => result is bottom
970    usage       = { mangle RaiseOp [mkM] mkM }
971    out_of_line = True
972
973 primop  BlockAsyncExceptionsOp "blockAsyncExceptions#" GenPrimOp
974         (State# RealWorld -> (# State# RealWorld, a #))
975      -> (State# RealWorld -> (# State# RealWorld, a #))
976    with
977    strictness  = { \ arity -> StrictnessInfo [wwLazy] False }
978    out_of_line = True
979
980 primop  UnblockAsyncExceptionsOp "unblockAsyncExceptions#" GenPrimOp
981         (State# RealWorld -> (# State# RealWorld, a #))
982      -> (State# RealWorld -> (# State# RealWorld, a #))
983    with
984    strictness  = { \ arity -> StrictnessInfo [wwLazy] False }
985    out_of_line = True
986
987 ------------------------------------------------------------------------
988 --- MVars (not the same as mutable variables!)                       ---
989 ------------------------------------------------------------------------
990
991 primop  NewMVarOp "newMVar#"  GenPrimOp
992    State# s -> (# State# s, MVar# s a #)
993    with
994    usage       = { mangle NewMVarOp [mkP] mkR }
995    out_of_line = True
996
997 primop  TakeMVarOp "takeMVar#" GenPrimOp
998    MVar# s a -> State# s -> (# State# s, a #)
999    with
1000    usage            = { mangle TakeMVarOp [mkM, mkP] mkM }
1001    has_side_effects = True
1002    out_of_line      = True
1003
1004 primop  TryTakeMVarOp "tryTakeMVar#" GenPrimOp
1005    MVar# s a -> State# s -> (# State# s, Int#, a #)
1006    with
1007    usage            = { mangle TryTakeMVarOp [mkM, mkP] mkM }
1008    has_side_effects = True
1009    out_of_line      = True
1010
1011 primop  PutMVarOp "putMVar#" GenPrimOp
1012    MVar# s a -> a -> State# s -> State# s
1013    with
1014    strictness       = { \ arity -> StrictnessInfo [wwPrim, wwLazy, wwPrim] False }
1015    usage            = { mangle PutMVarOp [mkM, mkM, mkP] mkR }
1016    has_side_effects = True
1017    out_of_line      = True
1018
1019 primop  TryPutMVarOp "tryPutMVar#" GenPrimOp
1020    MVar# s a -> a -> State# s -> (# State# s, Int# #)
1021    with
1022    strictness       = { \ arity -> StrictnessInfo [wwPrim, wwLazy, wwPrim] False }
1023    usage            = { mangle PutMVarOp [mkM, mkM, mkP] mkR }
1024    has_side_effects = True
1025    out_of_line      = True
1026
1027 primop  SameMVarOp "sameMVar#" GenPrimOp
1028    MVar# s a -> MVar# s a -> Bool
1029    with
1030    usage = { mangle SameMVarOp [mkP, mkP] mkM }
1031
1032 primop  IsEmptyMVarOp "isEmptyMVar#" GenPrimOp
1033    MVar# s a -> State# s -> (# State# s, Int# #)
1034    with
1035    usage = { mangle IsEmptyMVarOp [mkP, mkP] mkM }
1036
1037
1038 ------------------------------------------------------------------------
1039 --- delay/wait operations                                            ---
1040 ------------------------------------------------------------------------
1041
1042 primop  DelayOp "delay#" GenPrimOp
1043    Int# -> State# s -> State# s
1044    with
1045    needs_wrapper    = True
1046    has_side_effects = True
1047    out_of_line      = True
1048
1049 primop  WaitReadOp "waitRead#" GenPrimOp
1050    Int# -> State# s -> State# s
1051    with
1052    needs_wrapper    = True
1053    has_side_effects = True
1054    out_of_line      = True
1055
1056 primop  WaitWriteOp "waitWrite#" GenPrimOp
1057    Int# -> State# s -> State# s
1058    with
1059    needs_wrapper    = True
1060    has_side_effects = True
1061    out_of_line      = True
1062
1063 ------------------------------------------------------------------------
1064 --- concurrency primitives                                           ---
1065 ------------------------------------------------------------------------
1066
1067 primop  ForkOp "fork#" GenPrimOp
1068    a -> State# RealWorld -> (# State# RealWorld, ThreadId# #)
1069    with
1070    usage            = { mangle ForkOp [mkO, mkP] mkR }
1071    strictness       = { \ arity -> StrictnessInfo [wwLazy, wwPrim] False }
1072    has_side_effects = True
1073    out_of_line      = True
1074
1075 primop  KillThreadOp "killThread#"  GenPrimOp
1076    ThreadId# -> a -> State# RealWorld -> State# RealWorld
1077    with
1078    usage            = { mangle KillThreadOp [mkP, mkM, mkP] mkR }
1079    has_side_effects = True
1080    out_of_line      = True
1081
1082 primop  YieldOp "yield#" GenPrimOp
1083    State# RealWorld -> State# RealWorld
1084    with
1085    has_side_effects = True
1086    out_of_line      = True
1087
1088 primop  MyThreadIdOp "myThreadId#" GenPrimOp
1089     State# RealWorld -> (# State# RealWorld, ThreadId# #)
1090
1091 ------------------------------------------------------------------------
1092 --- foreign objects                                                  ---
1093 ------------------------------------------------------------------------
1094
1095 primop  MkForeignObjOp "mkForeignObj#" GenPrimOp
1096    Addr# -> State# RealWorld -> (# State# RealWorld, ForeignObj# #)
1097    with
1098    has_side_effects = True
1099    out_of_line      = True
1100
1101 primop  WriteForeignObjOp "writeForeignObj#" GenPrimOp
1102    ForeignObj# -> Addr# -> State# s -> State# s
1103    with
1104    has_side_effects = True
1105
1106 primop ForeignObjToAddrOp "foreignObjToAddr#" GenPrimOp
1107    ForeignObj# -> Addr#
1108
1109 primop TouchOp "touch#" GenPrimOp
1110    o -> State# RealWorld -> State# RealWorld
1111    with
1112    strictness       = { \ arity -> StrictnessInfo [wwLazy, wwPrim] False }
1113
1114
1115 ------------------------------------------------------------------------
1116 --- Weak pointers                                                    ---
1117 ------------------------------------------------------------------------
1118
1119 -- note that tyvar "o" denotes openAlphaTyVar
1120
1121 primop  MkWeakOp "mkWeak#" GenPrimOp
1122    o -> b -> c -> State# RealWorld -> (# State# RealWorld, Weak# b #)
1123    with
1124    strictness       = { \ arity -> StrictnessInfo [wwLazy, wwLazy, wwLazy, wwPrim] False }
1125    usage            = { mangle MkWeakOp [mkZ, mkM, mkM, mkP] mkM }
1126    has_side_effects = True
1127    out_of_line      = True
1128
1129 primop  DeRefWeakOp "deRefWeak#" GenPrimOp
1130    Weak# a -> State# RealWorld -> (# State# RealWorld, Int#, a #)
1131    with
1132    usage            = { mangle DeRefWeakOp [mkM, mkP] mkM }
1133    has_side_effects = True
1134
1135 primop  FinalizeWeakOp "finalizeWeak#" GenPrimOp
1136    Weak# a -> State# RealWorld -> (# State# RealWorld, Int#, 
1137               (State# RealWorld -> (# State# RealWorld, Unit #)) #)
1138    with
1139    usage            = { mangle FinalizeWeakOp [mkM, mkP] 
1140                                (mkR . (inUB FinalizeWeakOp 
1141                                             [id,id,inFun FinalizeWeakOp mkR mkM])) }
1142    has_side_effects = True
1143    out_of_line      = True
1144
1145
1146 ------------------------------------------------------------------------
1147 --- Stable pointers and names                                        ---
1148 ------------------------------------------------------------------------
1149
1150 primop  MakeStablePtrOp "makeStablePtr#" GenPrimOp
1151    a -> State# RealWorld -> (# State# RealWorld, StablePtr# a #)
1152    with
1153    strictness       = { \ arity -> StrictnessInfo [wwLazy, wwPrim] False }
1154    usage            = { mangle MakeStablePtrOp [mkM, mkP] mkM }
1155    has_side_effects = True
1156
1157 primop  DeRefStablePtrOp "deRefStablePtr#" GenPrimOp
1158    StablePtr# a -> State# RealWorld -> (# State# RealWorld, a #)
1159    with
1160    usage            = { mangle DeRefStablePtrOp [mkM, mkP] mkM }
1161    needs_wrapper    = True
1162    has_side_effects = True
1163
1164 primop  EqStablePtrOp "eqStablePtr#" GenPrimOp
1165    StablePtr# a -> StablePtr# a -> Int#
1166    with
1167    usage            = { mangle EqStablePtrOp [mkP, mkP] mkR }
1168    has_side_effects = True
1169
1170 primop  MakeStableNameOp "makeStableName#" GenPrimOp
1171    a -> State# RealWorld -> (# State# RealWorld, StableName# a #)
1172    with
1173    usage            = { mangle MakeStableNameOp [mkZ, mkP] mkR }
1174    strictness       = { \ arity -> StrictnessInfo [wwLazy, wwPrim] False }
1175    needs_wrapper    = True
1176    has_side_effects = True
1177    out_of_line      = True
1178
1179 primop  EqStableNameOp "eqStableName#" GenPrimOp
1180    StableName# a -> StableName# a -> Int#
1181    with
1182    usage = { mangle EqStableNameOp [mkP, mkP] mkR }
1183
1184 primop  StableNameToIntOp "stableNameToInt#" GenPrimOp
1185    StableName# a -> Int#
1186    with
1187    usage = { mangle StableNameToIntOp [mkP] mkR }
1188
1189 ------------------------------------------------------------------------
1190 --- Unsafe pointer equality (#1 Bad Guy: Alistair Reid :)            ---
1191 ------------------------------------------------------------------------
1192
1193 primop  ReallyUnsafePtrEqualityOp "reallyUnsafePtrEquality#" GenPrimOp
1194    a -> a -> Int#
1195    with
1196    usage = { mangle ReallyUnsafePtrEqualityOp [mkZ, mkZ] mkR }
1197
1198 ------------------------------------------------------------------------
1199 --- Parallelism                                                      ---
1200 ------------------------------------------------------------------------
1201
1202 primop  SeqOp "seq#" GenPrimOp
1203    a -> Int#
1204    with
1205    usage            = { mangle  SeqOp [mkO] mkR }
1206    strictness       = { \ arity -> StrictnessInfo [wwStrict] False }
1207       -- Seq is strict in its argument; see notes in ConFold.lhs
1208    has_side_effects = True
1209
1210 primop  ParOp "par#" GenPrimOp
1211    a -> Int#
1212    with
1213    usage            = { mangle ParOp [mkO] mkR }
1214    strictness       = { \ arity -> StrictnessInfo [wwLazy] False }
1215       -- Note that Par is lazy to avoid that the sparked thing
1216       -- gets evaluted strictly, which it should *not* be
1217    has_side_effects = True
1218
1219 -- HWL: The first 4 Int# in all par... annotations denote:
1220 --   name, granularity info, size of result, degree of parallelism
1221 --      Same  structure as _seq_ i.e. returns Int#
1222 -- KSW: v, the second arg in parAt# and parAtForNow#, is used only to determine
1223 --   `the processor containing the expression v'; it is not evaluated
1224
1225 primop  ParGlobalOp  "parGlobal#"  GenPrimOp
1226    a -> Int# -> Int# -> Int# -> Int# -> b -> Int#
1227    with
1228    usage            = { mangle ParGlobalOp [mkO, mkP, mkP, mkP, mkP, mkM] mkM }
1229    has_side_effects = True
1230
1231 primop  ParLocalOp  "parLocal#"  GenPrimOp
1232    a -> Int# -> Int# -> Int# -> Int# -> b -> Int#
1233    with
1234    usage            = { mangle ParLocalOp [mkO, mkP, mkP, mkP, mkP, mkM] mkM }
1235    has_side_effects = True
1236
1237 primop  ParAtOp  "parAt#"  GenPrimOp
1238    b -> a -> Int# -> Int# -> Int# -> Int# -> c -> Int#
1239    with
1240    usage            = { mangle ParAtOp [mkO, mkZ, mkP, mkP, mkP, mkP, mkM] mkM }
1241    has_side_effects = True
1242
1243 primop  ParAtAbsOp  "parAtAbs#"  GenPrimOp
1244    a -> Int# -> Int# -> Int# -> Int# -> Int# -> b -> Int#
1245    with
1246    usage            = { mangle ParAtAbsOp [mkO, mkP, mkP, mkP, mkP, mkM] mkM }
1247    has_side_effects = True
1248
1249 primop  ParAtRelOp  "parAtRel#" GenPrimOp
1250    a -> Int# -> Int# -> Int# -> Int# -> Int# -> b -> Int#
1251    with
1252    usage            = { mangle ParAtRelOp [mkO, mkP, mkP, mkP, mkP, mkM] mkM }
1253    has_side_effects = True
1254
1255 primop  ParAtForNowOp  "parAtForNow#" GenPrimOp
1256    b -> a -> Int# -> Int# -> Int# -> Int# -> c -> Int#
1257    with
1258    usage            = { mangle ParAtForNowOp [mkO, mkZ, mkP, mkP, mkP, mkP, mkM] mkM }
1259    has_side_effects = True
1260
1261 -- copyable# and noFollow# have no corresponding entry in
1262 -- PrelGHC.hi-boot, so I don't know whether they should still
1263 -- be here or not.  JRS, 15 Jan 01
1264 --
1265 --primop  CopyableOp  "copyable#" GenPrimOp
1266 --   a -> Int#
1267 --   with
1268 --   usage            = { mangle CopyableOp [mkZ] mkR }
1269 --   has_side_effects = True
1270 --
1271 --primop  NoFollowOp "noFollow#" GenPrimOp
1272 --   a -> Int#
1273 --   with
1274 --   usage            = { mangle NoFollowOp [mkZ] mkR }
1275 --   has_side_effects = True
1276
1277
1278 ------------------------------------------------------------------------
1279 --- tag to enum stuff                                                ---
1280 ------------------------------------------------------------------------
1281
1282 primop  DataToTagOp "dataToTag#" GenPrimOp
1283    a -> Int#
1284    with
1285    strictness = { \ arity -> StrictnessInfo [wwLazy] False }
1286
1287 primop  TagToEnumOp "tagToEnum#" GenPrimOp     
1288    Int# -> a
1289
1290
1291 thats_all_folks
1292
1293 ------------------------------------------------------------------------
1294 ---                                                                  ---
1295 ------------------------------------------------------------------------
1296