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