[project @ 2001-10-16 13:31:56 by simonmar]
[ghc-hetmet.git] / ghc / compiler / prelude / primops.txt.pp
1 -----------------------------------------------------------------------
2 -- $Id: primops.txt.pp,v 1.7 2001/10/16 13:31:56 simonmar Exp $
3 --
4 -- Primitive Operations
5 --
6 -----------------------------------------------------------------------
7
8 -- This file is processed by the utility program genprimopcode to produce
9 -- a number of include files within the compiler and optionally to produce
10 -- human-readable documentation.
11 --
12 -- It should first be preprocessed.
13 --
14 -- To add a new primop, you currently need to update the following files:
15 --
16 --      - this file (ghc/compiler/prelude/primops.txt), which includes
17 --        the type of the primop, and various other properties (its
18 --        strictness attributes, whether it is defined as a macro
19 --        or as out-of-line code, etc.)
20 --
21 --      - ghc/lib/std/PrelGHC.hi-boot, to declare the primop
22 --
23 --      - if the primop is inline (i.e. a macro), then:
24 --              ghc/includes/PrimOps.h
25 --              ghc/compiler/nativeGen/StixPrim.lhs 
26 --              ghc/compiler/nativeGen/MachCode.lhs (if implementation is machine-dependent)
27 --              
28 --      - or, for an out-of-line primop:
29 --              ghc/includes/PrimOps.h (just add the declaration)
30 --              ghc/rts/PrimOps.hc     (define it here)
31 --
32 --      - the User's Guide 
33 --
34
35 -- This file is divided into named sections, each containing or more
36 -- primop entries. Section headers have the format:
37 --
38 --      section "section-name" {description}
39 --
40 -- This information is used solely when producing documentation; it is
41 -- otherwise ignored.  The description is optional.
42 --
43 -- The format of each primop entry is as follows:
44 --
45 --      primop internal-name "name-in-program-text" type category {description} attributes
46
47 -- The default attribute values which apply if you don't specify
48 -- other ones.  Attribute values can be True, False, or arbitrary
49 -- text between curly brackets.  This is a kludge to enable 
50 -- processors of this file to easily get hold of simple info
51 -- (eg, out_of_line), whilst avoiding parsing complex expressions
52 -- needed for strictness and usage info.
53
54 defaults
55    has_side_effects = False
56    out_of_line      = False
57    commutable       = False
58    needs_wrapper    = False
59    can_fail         = False
60    strictness       = { \ arity -> StrictnessInfo (replicate arity wwPrim) False }
61    usage            = { nomangle other }
62
63 -- Currently, documentation is produced using latex, so contents of
64 -- description fields should be legal latex. Descriptions can contain
65 -- matched pairs of embedded curly brackets.
66
67 #include "MachDeps.h"
68
69 section "The word size story."
70         {Haskell98 specifies that signed integers (type {\tt Int})
71          must contain at least 30 bits. GHC always implements {\tt
72          Int} using the primitive type {\tt Int\#}, whose size equals
73          the {\tt MachDeps.h} constant {\tt WORD\_SIZE\_IN\_BITS}.
74          This is normally set based on the {\tt config.h} parameter
75          {\tt SIZEOF\_HSWORD}, i.e., 32 bits on 32-bit machines, 64
76          bits on 64-bit machines.  However, it can also be explicitly
77          set to a smaller number, e.g., 31 bits, to allow the
78          possibility of using tag bits. Currently GHC itself has only
79          32-bit and 64-bit variants, but 30 or 31-bit code can be
80          exported as an external core file for use in other back ends.
81
82          GHC also implements a primitive unsigned integer type {\tt
83          Word\#} which always has the same number of bits as {\tt
84          Int\#}.
85         
86          In addition, GHC supports families of explicit-sized integers
87          and words at 8, 16, 32, and 64 bits, with the usual
88          arithmetic operations, comparisons, and a range of
89          conversions.  The 8-bit and 16-bit sizes are always
90          represented as {\tt Int\#} and {\tt Word\#}, and the
91          operations implemented in terms of the the primops on these
92          types, with suitable range restrictions on the results (using
93          the {\tt narrow$n$Int\#} and {\tt narrow$n$Word\#} families
94          of primops.  The 32-bit sizes are represented using {\tt
95          Int\#} and {\tt Word\#} when {\tt WORD\_SIZE\_IN\_BITS}
96          $\geq$ 32; otherwise, these are represented using distinct
97          primitive types {\tt Int32\#} and {\tt Word32\#}. These (when
98          needed) have a complete set of corresponding operations;
99          however, nearly all of these are implemented as external C
100          functions rather than as primops.  Exactly the same story
101          applies to the 64-bit sizes.  All of these details are hidden
102          under the {\tt PrelInt} and {\tt PrelWord} modules, which use
103          {\tt \#if}-defs to invoke the appropriate types and
104          operators.
105
106          Word size also matters for the families of primops for
107          indexing/reading/writing fixed-size quantities at offsets
108          from an array base, address, or foreign pointer.  Here, a
109          slightly different approach is taken.  The names of these
110          primops are fixed, but their {\it types} vary according to
111          the value of {\tt WORD\_SIZE\_IN\_BITS}. For example, if word
112          size is at least 32 bits then an operator like
113          \texttt{indexInt32Array\#} has type {\tt ByteArr\# -> Int\#
114          -> Int\#}; otherwise it has type {\tt ByteArr\# -> Int\# ->
115          Int32\#}.  This approach confines the necessary {\tt
116          \#if}-defs to this file; no conditional compilation is needed
117          in the files that expose these primops, namely
118          \texttt{lib/std/PrelStorable.lhs},
119          \texttt{hslibs/lang/ArrayBase.hs}, and (in deprecated
120          fashion) in \texttt{hslibs/lang/ForeignObj.lhs} and
121          \texttt{hslibs/lang/Addr.lhs}.
122
123          Finally, there are strongly deprecated primops for coercing
124          between {\tt Addr\#}, the primitive type of machine
125          addresses, and {\tt Int\#}.  These are pretty bogus anyway,
126          but will work on existing 32-bit and 64-bit GHC targets; they
127          are completely bogus when tag bits are used in {\tt Int\#},
128          so are not available in this case.  }
129         
130 -- Define synonyms for indexing ops. 
131
132 #if WORD_SIZE_IN_BITS < 32 
133 #define INT32 Int32#
134 #define WORD32 Word32#
135 #else
136 #define INT32 Int#
137 #define WORD32 Word#
138 #endif
139
140 #if WORD_SIZE_IN_BITS < 64
141 #define INT64 Int64#
142 #define WORD64 Word64#
143 #else
144 #define INT64 Int#
145 #define WORD64 Word#
146 #endif
147
148 ------------------------------------------------------------------------
149 section "Char#" 
150         {Operations on 31-bit characters.}
151 ------------------------------------------------------------------------
152
153
154 primop   CharGtOp  "gtChar#"   Compare   Char# -> Char# -> Bool
155 primop   CharGeOp  "geChar#"   Compare   Char# -> Char# -> Bool
156
157 primop   CharEqOp  "eqChar#"   Compare
158    Char# -> Char# -> Bool
159    with commutable = True
160
161 primop   CharNeOp  "neChar#"   Compare
162    Char# -> Char# -> Bool
163    with commutable = True
164
165 primop   CharLtOp  "ltChar#"   Compare   Char# -> Char# -> Bool
166 primop   CharLeOp  "leChar#"   Compare   Char# -> Char# -> Bool
167
168 primop   OrdOp   "ord#"  GenPrimOp   Char# -> Int#
169
170 ------------------------------------------------------------------------
171 section "Int#"
172         {Operations on native-size integers (30+ bits).}
173 ------------------------------------------------------------------------
174
175 primop   IntAddOp    "+#"    Dyadic
176    Int# -> Int# -> Int#
177    with commutable = True
178
179 primop   IntSubOp    "-#"    Dyadic   Int# -> Int# -> Int#
180
181 primop   IntMulOp    "*#" 
182    Dyadic   Int# -> Int# -> Int#
183    with commutable = True
184
185 primop   IntQuotOp    "quotInt#"    Dyadic
186    Int# -> Int# -> Int#
187    {Rounds towards zero.}
188    with can_fail = True
189
190 primop   IntRemOp    "remInt#"    Dyadic
191    Int# -> Int# -> Int#
192    {Satisfies \texttt{(quotInt\# x y) *\# y +\# (remInt\# x y) == x}.}
193    with can_fail = True
194
195 primop   IntGcdOp    "gcdInt#"    Dyadic   Int# -> Int# -> Int#
196 primop   IntNegOp    "negateInt#"    Monadic   Int# -> Int#
197 primop   IntAddCOp   "addIntC#"    GenPrimOp   Int# -> Int# -> (# Int#, Int# #)
198          {Add with carry.  First member of result is (wrapped) sum; second member is 0 iff no overflow occured.}
199 primop   IntSubCOp   "subIntC#"    GenPrimOp   Int# -> Int# -> (# Int#, Int# #)
200          {Subtract with carry.  First member of result is (wrapped) difference; second member is 0 iff no overflow occured.}
201 primop   IntMulCOp   "mulIntC#"    GenPrimOp   Int# -> Int# -> (# Int#, Int# #)
202          {Multiply with carry.  First member of result is (wrapped) product; second member is 0 iff no overflow occured.}
203 primop   IntGtOp  ">#"   Compare   Int# -> Int# -> Bool
204 primop   IntGeOp  ">=#"   Compare   Int# -> Int# -> Bool
205
206 primop   IntEqOp  "==#"   Compare
207    Int# -> Int# -> Bool
208    with commutable = True
209
210 primop   IntNeOp  "/=#"   Compare
211    Int# -> Int# -> Bool
212    with commutable = True
213
214 primop   IntLtOp  "<#"   Compare   Int# -> Int# -> Bool
215 primop   IntLeOp  "<=#"   Compare   Int# -> Int# -> Bool
216
217 primop   ChrOp   "chr#"   GenPrimOp   Int# -> Char#
218
219 primop   Int2WordOp "int2Word#" GenPrimOp Int# -> Word#
220 primop   Int2FloatOp   "int2Float#"      GenPrimOp  Int# -> Float#
221 primop   Int2DoubleOp   "int2Double#"          GenPrimOp  Int# -> Double#
222
223 primop   Int2IntegerOp    "int2Integer#"
224    GenPrimOp Int# -> (# Int#, ByteArr# #)
225    with out_of_line = True
226
227 primop   ISllOp   "iShiftL#" GenPrimOp  Int# -> Int# -> Int#
228          {Shift left. Return 0 if shifted by more than size of an Int\#.} 
229 primop   ISraOp   "iShiftRA#" GenPrimOp Int# -> Int# -> Int#
230          {Shift right arithemetic. Return 0 if shifted by more than size of an Int\#.}
231 primop   ISrlOp   "iShiftRL#" GenPrimOp Int# -> Int# -> Int#
232          {Shift right logical. Return 0 if shifted by more than size of an Int\#.}
233
234 ------------------------------------------------------------------------
235 section "Word#"
236         {Operations on native-sized unsigned words (30+ bits).}
237 ------------------------------------------------------------------------
238
239 primop   WordAddOp   "plusWord#"   Dyadic   Word# -> Word# -> Word#
240    with commutable = True
241
242 primop   WordSubOp   "minusWord#"   Dyadic   Word# -> Word# -> Word#
243
244 primop   WordMulOp   "timesWord#"   Dyadic   Word# -> Word# -> Word#
245    with commutable = True
246
247 primop   WordQuotOp   "quotWord#"   Dyadic   Word# -> Word# -> Word#
248    with can_fail = True
249
250 primop   WordRemOp   "remWord#"   Dyadic   Word# -> Word# -> Word#
251    with can_fail = True
252
253 primop   AndOp   "and#"   Dyadic   Word# -> Word# -> Word#
254    with commutable = True
255
256 primop   OrOp   "or#"   Dyadic   Word# -> Word# -> Word#
257    with commutable = True
258
259 primop   XorOp   "xor#"   Dyadic   Word# -> Word# -> Word#
260    with commutable = True
261
262 primop   NotOp   "not#"   Monadic   Word# -> Word#
263
264 primop   SllOp   "shiftL#"   GenPrimOp   Word# -> Int# -> Word#
265          {Shift left logical. Return 0 if shifted by more than number of bits in a Word\#.}
266 primop   SrlOp   "shiftRL#"   GenPrimOp   Word# -> Int# -> Word#
267          {Shift right logical. Return 0 if shifted by more than number of bits in a Word\#.}
268
269 primop   Word2IntOp   "word2Int#"   GenPrimOp   Word# -> Int#
270
271 primop   Word2IntegerOp   "word2Integer#"   GenPrimOp 
272    Word# -> (# Int#, ByteArr# #)
273    with out_of_line = True
274
275 primop   WordGtOp   "gtWord#"   Compare   Word# -> Word# -> Bool
276 primop   WordGeOp   "geWord#"   Compare   Word# -> Word# -> Bool
277 primop   WordEqOp   "eqWord#"   Compare   Word# -> Word# -> Bool
278 primop   WordNeOp   "neWord#"   Compare   Word# -> Word# -> Bool
279 primop   WordLtOp   "ltWord#"   Compare   Word# -> Word# -> Bool
280 primop   WordLeOp   "leWord#"   Compare   Word# -> Word# -> Bool
281
282 ------------------------------------------------------------------------
283 section "Narrowings" 
284         {Explicit narrowing of native-sized ints or words.}
285 ------------------------------------------------------------------------
286
287 primop   Narrow8IntOp      "narrow8Int#"      Monadic   Int# -> Int#
288 primop   Narrow16IntOp     "narrow16Int#"     Monadic   Int# -> Int#
289 primop   Narrow32IntOp     "narrow32Int#"     Monadic   Int# -> Int#
290 primop   Narrow8WordOp     "narrow8Word#"     Monadic   Word# -> Word#
291 primop   Narrow16WordOp    "narrow16Word#"    Monadic   Word# -> Word#
292 primop   Narrow32WordOp    "narrow32Word#"    Monadic   Word# -> Word#
293
294
295 #if WORD_SIZE_IN_BITS < 32
296 ------------------------------------------------------------------------
297 section "Int32#"
298         {Operations on 32-bit integers (Int32\#).  This type is only used
299          if plain Int\# has less than 32 bits.  In any case, the operations
300          are not primops; they are implemented (if needed) as ccalls instead.}
301 ------------------------------------------------------------------------
302
303 primop   Int32ToIntegerOp   "int32ToInteger#" GenPrimOp 
304    Int32# -> (# Int#, ByteArr# #)
305    with out_of_line = True
306
307
308 ------------------------------------------------------------------------
309 section "Word32#"
310         {Operations on 32-bit unsigned words. This type is only used 
311          if plain Word\# has less than 32 bits. In any case, the operations
312          are not primops; they are implemented (if needed) as ccalls instead.}
313 ------------------------------------------------------------------------
314
315 primop   Word32ToIntegerOp   "word32ToInteger#" GenPrimOp
316    Word32# -> (# Int#, ByteArr# #)
317    with out_of_line = True
318
319
320 #endif 
321
322
323 #if WORD_SIZE_IN_BITS < 64
324 ------------------------------------------------------------------------
325 section "Int64#"
326         {Operations on 64-bit unsigned words. This type is only used 
327          if plain Int\# has less than 64 bits. In any case, the operations
328          are not primops; they are implemented (if needed) as ccalls instead.}
329 ------------------------------------------------------------------------
330
331 primop   Int64ToIntegerOp   "int64ToInteger#" GenPrimOp 
332    Int64# -> (# Int#, ByteArr# #)
333    with out_of_line = True
334
335 ------------------------------------------------------------------------
336 section "Word64#"
337         {Operations on 64-bit unsigned words. This type is only used 
338          if plain Word\# has less than 64 bits. In any case, the operations
339          are not primops; they are implemented (if needed) as ccalls instead.}
340 ------------------------------------------------------------------------
341
342 primop   Word64ToIntegerOp   "word64ToInteger#" GenPrimOp
343    Word64# -> (# Int#, ByteArr# #)
344    with out_of_line = True
345
346 #endif
347
348 ------------------------------------------------------------------------
349 section "Integer#"
350         {Operations on arbitrary-precision integers. These operations are 
351 implemented via the GMP package. An integer is represented as a pair
352 consisting of an Int\# representing the number of 'limbs' in use and
353 the sign, and a ByteArr\# containing the 'limbs' themselves.  Such pairs
354 are returned as unboxed pairs, but must be passed as separate components.}
355 ------------------------------------------------------------------------
356
357 primop   IntegerAddOp   "plusInteger#" GenPrimOp   
358    Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
359    with commutable = True
360         out_of_line = True
361
362 primop   IntegerSubOp   "minusInteger#" GenPrimOp  
363    Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
364    with out_of_line = True
365
366 primop   IntegerMulOp   "timesInteger#" GenPrimOp   
367    Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
368    with commutable = True
369         out_of_line = True
370
371 primop   IntegerGcdOp   "gcdInteger#" GenPrimOp    
372    Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
373    {Greatest common divisor.}
374    with commutable = True
375         out_of_line = True
376
377 primop   IntegerIntGcdOp   "gcdIntegerInt#" GenPrimOp
378    Int# -> ByteArr# -> Int# -> Int#
379    {Greatest common divisor, where second argument is an ordinary Int\#.}
380    -- with commutable = True  (surely not? APT 8/01)
381
382 primop   IntegerDivExactOp   "divExactInteger#" GenPrimOp
383    Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
384    {Divisor is guaranteed to be a factor of dividend.}
385    with out_of_line = True
386
387 primop   IntegerQuotOp   "quotInteger#" GenPrimOp
388    Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
389    {Rounds towards zero.}
390    with out_of_line = True
391
392 primop   IntegerRemOp   "remInteger#" GenPrimOp
393    Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
394    {Satisfies \texttt{plusInteger\# (timesInteger\# (quotInteger\# x y) y) (remInteger\# x y) == x}.}
395    with out_of_line = True
396
397 primop   IntegerCmpOp   "cmpInteger#"   GenPrimOp  
398    Int# -> ByteArr# -> Int# -> ByteArr# -> Int#
399    {Returns -1,0,1 according as first argument is less than, equal to, or greater than second argument.}
400    with needs_wrapper = True
401
402 primop   IntegerCmpIntOp   "cmpIntegerInt#" GenPrimOp
403    Int# -> ByteArr# -> Int# -> Int#
404    {Returns -1,0,1 according as first argument is less than, equal to, or greater than second argument, which
405    is an ordinary Int\#.}
406    with needs_wrapper = True
407
408 primop   IntegerQuotRemOp   "quotRemInteger#" GenPrimOp
409    Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr#, Int#, ByteArr# #)
410    {Compute quot and rem simulaneously.}
411    with can_fail = True
412         out_of_line = True
413
414 primop   IntegerDivModOp    "divModInteger#"  GenPrimOp
415    Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr#, Int#, ByteArr# #)
416    {Compute div and mod simultaneously, where div rounds towards negative infinity
417     and\texttt{(q,r) = divModInteger\#(x,y)} implies \texttt{plusInteger\# (timesInteger\# q y) r = x}.}
418    with can_fail = True
419         out_of_line = True
420
421 primop   Integer2IntOp   "integer2Int#"    GenPrimOp
422    Int# -> ByteArr# -> Int#
423    with needs_wrapper = True
424
425 primop   Integer2WordOp   "integer2Word#"   GenPrimOp
426    Int# -> ByteArr# -> Word#
427    with needs_wrapper = True
428
429 #if WORD_SIZE_IN_BITS < 32
430 primop   IntegerToInt32Op   "integerToInt32#" GenPrimOp
431    Int# -> ByteArr# -> Int32#
432
433 primop   IntegerToWord32Op   "integerToWord32#" GenPrimOp
434    Int# -> ByteArr# -> Word32#
435 #endif
436
437 #if WORD_SIZE_IN_BITS < 64
438 primop   IntegerToInt64Op   "integerToInt64#" GenPrimOp
439    Int# -> ByteArr# -> Int64#
440
441 primop   IntegerToWord64Op   "integerToWord64#" GenPrimOp
442    Int# -> ByteArr# -> Word64#
443 #endif
444
445 primop   IntegerAndOp  "andInteger#" GenPrimOp
446    Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
447    with out_of_line = True
448
449 primop   IntegerOrOp  "orInteger#" GenPrimOp
450    Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
451    with out_of_line = True
452
453 primop   IntegerXorOp  "xorInteger#" GenPrimOp
454    Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
455    with out_of_line = True
456
457 primop   IntegerComplementOp  "complementInteger#" GenPrimOp
458    Int# -> ByteArr# -> (# Int#, ByteArr# #)
459    with out_of_line = True
460
461
462 ------------------------------------------------------------------------
463 section "Double#"
464         {Operations on double-precision (64 bit) floating-point numbers.}
465 ------------------------------------------------------------------------
466
467 primop   DoubleGtOp ">##"   Compare   Double# -> Double# -> Bool
468 primop   DoubleGeOp ">=##"   Compare   Double# -> Double# -> Bool
469
470 primop DoubleEqOp "==##"   Compare
471    Double# -> Double# -> Bool
472    with commutable = True
473
474 primop DoubleNeOp "/=##"   Compare
475    Double# -> Double# -> Bool
476    with commutable = True
477
478 primop   DoubleLtOp "<##"   Compare   Double# -> Double# -> Bool
479 primop   DoubleLeOp "<=##"   Compare   Double# -> Double# -> Bool
480
481 primop   DoubleAddOp   "+##"   Dyadic
482    Double# -> Double# -> Double#
483    with commutable = True
484
485 primop   DoubleSubOp   "-##"   Dyadic   Double# -> Double# -> Double#
486
487 primop   DoubleMulOp   "*##"   Dyadic
488    Double# -> Double# -> Double#
489    with commutable = True
490
491 primop   DoubleDivOp   "/##"   Dyadic
492    Double# -> Double# -> Double#
493    with can_fail = True
494
495 primop   DoubleNegOp   "negateDouble#"  Monadic   Double# -> Double#
496
497 primop   Double2IntOp   "double2Int#"          GenPrimOp  Double# -> Int#
498 primop   Double2FloatOp   "double2Float#" GenPrimOp Double# -> Float#
499
500 primop   DoubleExpOp   "expDouble#"      Monadic
501    Double# -> Double#
502    with needs_wrapper = True
503
504 primop   DoubleLogOp   "logDouble#"      Monadic         
505    Double# -> Double#
506    with
507    needs_wrapper = True
508    can_fail = True
509
510 primop   DoubleSqrtOp   "sqrtDouble#"      Monadic  
511    Double# -> Double#
512    with needs_wrapper = True
513
514 primop   DoubleSinOp   "sinDouble#"      Monadic          
515    Double# -> Double#
516    with needs_wrapper = True
517
518 primop   DoubleCosOp   "cosDouble#"      Monadic          
519    Double# -> Double#
520    with needs_wrapper = True
521
522 primop   DoubleTanOp   "tanDouble#"      Monadic          
523    Double# -> Double#
524    with needs_wrapper = True
525
526 primop   DoubleAsinOp   "asinDouble#"      Monadic 
527    Double# -> Double#
528    with
529    needs_wrapper = True
530    can_fail = True
531
532 primop   DoubleAcosOp   "acosDouble#"      Monadic  
533    Double# -> Double#
534    with
535    needs_wrapper = True
536    can_fail = True
537
538 primop   DoubleAtanOp   "atanDouble#"      Monadic  
539    Double# -> Double#
540    with
541    needs_wrapper = True
542
543 primop   DoubleSinhOp   "sinhDouble#"      Monadic  
544    Double# -> Double#
545    with needs_wrapper = True
546
547 primop   DoubleCoshOp   "coshDouble#"      Monadic  
548    Double# -> Double#
549    with needs_wrapper = True
550
551 primop   DoubleTanhOp   "tanhDouble#"      Monadic  
552    Double# -> Double#
553    with needs_wrapper = True
554
555 primop   DoublePowerOp   "**##" Dyadic  
556    Double# -> Double# -> Double#
557    {Exponentiation.}
558    with needs_wrapper = True
559
560 primop   DoubleDecodeOp   "decodeDouble#" GenPrimOp    
561    Double# -> (# Int#, Int#, ByteArr# #)
562    {Convert to arbitrary-precision integer.
563     First Int\# in result is the exponent; second Int\# and ByteArr\# represent an Integer\# 
564     holding the mantissa.}
565    with out_of_line = True
566
567 ------------------------------------------------------------------------
568 section "Float#" 
569         {Operations on single-precision (32-bit) floating-point numbers.}
570 ------------------------------------------------------------------------
571
572 primop   FloatGtOp  "gtFloat#"   Compare   Float# -> Float# -> Bool
573 primop   FloatGeOp  "geFloat#"   Compare   Float# -> Float# -> Bool
574
575 primop   FloatEqOp  "eqFloat#"   Compare
576    Float# -> Float# -> Bool
577    with commutable = True
578
579 primop   FloatNeOp  "neFloat#"   Compare
580    Float# -> Float# -> Bool
581    with commutable = True
582
583 primop   FloatLtOp  "ltFloat#"   Compare   Float# -> Float# -> Bool
584 primop   FloatLeOp  "leFloat#"   Compare   Float# -> Float# -> Bool
585
586 primop   FloatAddOp   "plusFloat#"      Dyadic            
587    Float# -> Float# -> Float#
588    with commutable = True
589
590 primop   FloatSubOp   "minusFloat#"      Dyadic      Float# -> Float# -> Float#
591
592 primop   FloatMulOp   "timesFloat#"      Dyadic    
593    Float# -> Float# -> Float#
594    with commutable = True
595
596 primop   FloatDivOp   "divideFloat#"      Dyadic  
597    Float# -> Float# -> Float#
598    with can_fail = True
599
600 primop   FloatNegOp   "negateFloat#"      Monadic    Float# -> Float#
601
602 primop   Float2IntOp   "float2Int#"      GenPrimOp  Float# -> Int#
603
604 primop   FloatExpOp   "expFloat#"      Monadic          
605    Float# -> Float#
606    with needs_wrapper = True
607
608 primop   FloatLogOp   "logFloat#"      Monadic          
609    Float# -> Float#
610    with needs_wrapper = True
611         can_fail = True
612
613 primop   FloatSqrtOp   "sqrtFloat#"      Monadic          
614    Float# -> Float#
615    with needs_wrapper = True
616
617 primop   FloatSinOp   "sinFloat#"      Monadic          
618    Float# -> Float#
619    with needs_wrapper = True
620
621 primop   FloatCosOp   "cosFloat#"      Monadic          
622    Float# -> Float#
623    with needs_wrapper = True
624
625 primop   FloatTanOp   "tanFloat#"      Monadic          
626    Float# -> Float#
627    with needs_wrapper = True
628
629 primop   FloatAsinOp   "asinFloat#"      Monadic          
630    Float# -> Float#
631    with needs_wrapper = True
632         can_fail = True
633
634 primop   FloatAcosOp   "acosFloat#"      Monadic          
635    Float# -> Float#
636    with needs_wrapper = True
637         can_fail = True
638
639 primop   FloatAtanOp   "atanFloat#"      Monadic          
640    Float# -> Float#
641    with needs_wrapper = True
642
643 primop   FloatSinhOp   "sinhFloat#"      Monadic          
644    Float# -> Float#
645    with needs_wrapper = True
646
647 primop   FloatCoshOp   "coshFloat#"      Monadic          
648    Float# -> Float#
649    with needs_wrapper = True
650
651 primop   FloatTanhOp   "tanhFloat#"      Monadic          
652    Float# -> Float#
653    with needs_wrapper = True
654
655 primop   FloatPowerOp   "powerFloat#"      Dyadic   
656    Float# -> Float# -> Float#
657    with needs_wrapper = True
658
659 primop   Float2DoubleOp   "float2Double#" GenPrimOp  Float# -> Double#
660
661 primop   FloatDecodeOp   "decodeFloat#" GenPrimOp
662    Float# -> (# Int#, Int#, ByteArr# #)
663    {Convert to arbitrary-precision integer.
664     First Int\# in result is the exponent; second Int\# and ByteArr\# represent an Integer\# 
665     holding the mantissa.}
666    with out_of_line = True
667
668 ------------------------------------------------------------------------
669 section "Arrays"
670         {Operations on Array\#.}
671 ------------------------------------------------------------------------
672
673 primop  NewArrayOp "newArray#" GenPrimOp
674    Int# -> a -> State# s -> (# State# s, MutArr# s a #)
675    {Create a new mutable array of specified size (in bytes),
676     in the specified state thread,
677     with each element containing the specified initial value.}
678    with
679    strictness  = { \ arity -> StrictnessInfo [wwPrim, wwLazy, wwPrim] False }
680    usage       = { mangle NewArrayOp [mkP, mkM, mkP] mkM }
681    out_of_line = True
682
683 primop  SameMutableArrayOp "sameMutableArray#" GenPrimOp
684    MutArr# s a -> MutArr# s a -> Bool
685    with
686    usage = { mangle SameMutableArrayOp [mkP, mkP] mkM }
687
688 primop  ReadArrayOp "readArray#" GenPrimOp
689    MutArr# s a -> Int# -> State# s -> (# State# s, a #)
690    {Read from specified index of mutable array. Result is not yet evaluated.}
691    with
692    usage = { mangle ReadArrayOp [mkM, mkP, mkP] mkM }
693
694 primop  WriteArrayOp "writeArray#" GenPrimOp
695    MutArr# s a -> Int# -> a -> State# s -> State# s
696    {Write to specified index of mutable array.}
697    with
698    usage            = { mangle WriteArrayOp [mkM, mkP, mkM, mkP] mkR }
699    strictness       = { \ arity -> StrictnessInfo [wwPrim, wwPrim, wwLazy, wwPrim] False }
700    has_side_effects = True
701
702 primop  IndexArrayOp "indexArray#" GenPrimOp
703    Array# a -> Int# -> (# a #)
704    {Read from specified index of immutable array. Result is packaged into
705     an unboxed singleton; the result itself is not yet evaluated.}
706    with
707    usage = { mangle  IndexArrayOp [mkM, mkP] mkM }
708
709 primop  UnsafeFreezeArrayOp "unsafeFreezeArray#" GenPrimOp
710    MutArr# s a -> State# s -> (# State# s, Array# a #)
711    {Make a mutable array immutable, without copying.}
712    with
713    usage            = { mangle UnsafeFreezeArrayOp [mkM, mkP] mkM }
714    has_side_effects = True
715
716 primop  UnsafeThawArrayOp  "unsafeThawArray#" GenPrimOp
717    Array# a -> State# s -> (# State# s, MutArr# s a #)
718    {Make an immutable array mutable, without copying.}
719    with
720    usage       = { mangle UnsafeThawArrayOp [mkM, mkP] mkM }
721    out_of_line = True
722
723 ------------------------------------------------------------------------
724 section "Byte Arrays"
725         {Operations on ByteArray\#. A ByteArray\# is a just a region of
726          raw memory in the garbage-collected heap, which is not scanned
727          for pointers. It carries its own size (in bytes). There are
728          three sets of operations for accessing byte array contents:
729          index for reading from immutable byte arrays, and read/write
730          for mutable byte arrays.  Each set contains operations for 
731          a range of useful primitive data types.  Each operation takes  
732          an offset measured in terms of the size fo the primitive type
733          being read or written.}
734
735 ------------------------------------------------------------------------
736
737 primop  NewByteArrayOp_Char "newByteArray#" GenPrimOp
738    Int# -> State# s -> (# State# s, MutByteArr# s #)
739    {Create a new mutable byte array of specified size (in bytes), in
740     the specified state thread.}
741    with out_of_line = True
742
743 primop  NewPinnedByteArrayOp_Char "newPinnedByteArray#" GenPrimOp
744    Int# -> State# s -> (# State# s, MutByteArr# s #)
745    {Create a mutable byte array that the GC guarantees not to move.}
746    with out_of_line = True
747
748 primop  ByteArrayContents_Char "byteArrayContents#" GenPrimOp
749    ByteArr# -> Addr#
750    {Intended for use with pinned arrays; otherwise very unsafe!}
751
752 primop  SameMutableByteArrayOp "sameMutableByteArray#" GenPrimOp
753    MutByteArr# s -> MutByteArr# s -> Bool
754
755 primop  UnsafeFreezeByteArrayOp "unsafeFreezeByteArray#" GenPrimOp
756    MutByteArr# s -> State# s -> (# State# s, ByteArr# #)
757    {Make a mutable byte array immutable, without copying.}
758    with
759    has_side_effects = True
760
761 primop  SizeofByteArrayOp "sizeofByteArray#" GenPrimOp  
762    ByteArr# -> Int#
763
764 primop  SizeofMutableByteArrayOp "sizeofMutableByteArray#" GenPrimOp
765    MutByteArr# s -> Int#
766
767
768 primop IndexByteArrayOp_Char "indexCharArray#" GenPrimOp
769    ByteArr# -> Int# -> Char#
770    {Read 8-bit character; offset in bytes.}
771
772 primop IndexByteArrayOp_WideChar "indexWideCharArray#" GenPrimOp
773    ByteArr# -> Int# -> Char#
774    {Read 31-bit character; offset in 4-byte words.}
775
776 primop IndexByteArrayOp_Int "indexIntArray#" GenPrimOp
777    ByteArr# -> Int# -> Int#
778
779 primop IndexByteArrayOp_Word "indexWordArray#" GenPrimOp
780    ByteArr# -> Int# -> Word#
781
782 primop IndexByteArrayOp_Addr "indexAddrArray#" GenPrimOp
783    ByteArr# -> Int# -> Addr#
784
785 primop IndexByteArrayOp_Float "indexFloatArray#" GenPrimOp
786    ByteArr# -> Int# -> Float#
787
788 primop IndexByteArrayOp_Double "indexDoubleArray#" GenPrimOp
789    ByteArr# -> Int# -> Double#
790
791 primop IndexByteArrayOp_StablePtr "indexStablePtrArray#" GenPrimOp
792    ByteArr# -> Int# -> StablePtr# a
793
794 primop IndexByteArrayOp_Int8 "indexInt8Array#" GenPrimOp
795    ByteArr# -> Int# -> Int#
796
797 primop IndexByteArrayOp_Int16 "indexInt16Array#" GenPrimOp
798    ByteArr# -> Int# -> Int#
799
800 primop IndexByteArrayOp_Int32 "indexInt32Array#" GenPrimOp
801    ByteArr# -> Int# -> INT32
802
803 primop IndexByteArrayOp_Int64 "indexInt64Array#" GenPrimOp
804    ByteArr# -> Int# -> INT64
805
806 primop IndexByteArrayOp_Word8 "indexWord8Array#" GenPrimOp
807    ByteArr# -> Int# -> Word#
808
809 primop IndexByteArrayOp_Word16 "indexWord16Array#" GenPrimOp
810    ByteArr# -> Int# -> Word#
811
812 primop IndexByteArrayOp_Word32 "indexWord32Array#" GenPrimOp
813    ByteArr# -> Int# -> WORD32
814
815 primop IndexByteArrayOp_Word64 "indexWord64Array#" GenPrimOp
816    ByteArr# -> Int# -> WORD64
817
818 primop  ReadByteArrayOp_Char "readCharArray#" GenPrimOp
819    MutByteArr# s -> Int# -> State# s -> (# State# s, Char# #)
820    {Read 8-bit character; offset in bytes.}
821
822 primop  ReadByteArrayOp_WideChar "readWideCharArray#" GenPrimOp
823    MutByteArr# s -> Int# -> State# s -> (# State# s, Char# #)
824    {Read 31-bit character; offset in 4-byte words.}
825
826 primop  ReadByteArrayOp_Int "readIntArray#" GenPrimOp
827    MutByteArr# s -> Int# -> State# s -> (# State# s, Int# #)
828
829 primop  ReadByteArrayOp_Word "readWordArray#" GenPrimOp
830    MutByteArr# s -> Int# -> State# s -> (# State# s, Word# #)
831
832 primop  ReadByteArrayOp_Addr "readAddrArray#" GenPrimOp
833    MutByteArr# s -> Int# -> State# s -> (# State# s, Addr# #)
834
835 primop  ReadByteArrayOp_Float "readFloatArray#" GenPrimOp
836    MutByteArr# s -> Int# -> State# s -> (# State# s, Float# #)
837
838 primop  ReadByteArrayOp_Double "readDoubleArray#" GenPrimOp
839    MutByteArr# s -> Int# -> State# s -> (# State# s, Double# #)
840
841 primop  ReadByteArrayOp_StablePtr "readStablePtrArray#" GenPrimOp
842    MutByteArr# s -> Int# -> State# s -> (# State# s, StablePtr# a #)
843
844 primop  ReadByteArrayOp_Int8 "readInt8Array#" GenPrimOp
845    MutByteArr# s -> Int# -> State# s -> (# State# s, Int# #)
846
847 primop  ReadByteArrayOp_Int16 "readInt16Array#" GenPrimOp
848    MutByteArr# s -> Int# -> State# s -> (# State# s, Int# #)
849
850 primop  ReadByteArrayOp_Int32 "readInt32Array#" GenPrimOp
851    MutByteArr# s -> Int# -> State# s -> (# State# s, INT32 #)
852
853 primop  ReadByteArrayOp_Int64 "readInt64Array#" GenPrimOp
854    MutByteArr# s -> Int# -> State# s -> (# State# s, INT64 #)
855
856 primop  ReadByteArrayOp_Word8 "readWord8Array#" GenPrimOp
857    MutByteArr# s -> Int# -> State# s -> (# State# s, Word# #)
858
859 primop  ReadByteArrayOp_Word16 "readWord16Array#" GenPrimOp
860    MutByteArr# s -> Int# -> State# s -> (# State# s, Word# #)
861
862 primop  ReadByteArrayOp_Word32 "readWord32Array#" GenPrimOp
863    MutByteArr# s -> Int# -> State# s -> (# State# s, WORD32 #)
864
865 primop  ReadByteArrayOp_Word64 "readWord64Array#" GenPrimOp
866    MutByteArr# s -> Int# -> State# s -> (# State# s, WORD64 #)
867
868 primop  WriteByteArrayOp_Char "writeCharArray#" GenPrimOp
869    MutByteArr# s -> Int# -> Char# -> State# s -> State# s
870    {Write 8-bit character; offset in bytes.}
871    with has_side_effects = True
872
873 primop  WriteByteArrayOp_WideChar "writeWideCharArray#" GenPrimOp
874    MutByteArr# s -> Int# -> Char# -> State# s -> State# s
875    {Write 31-bit character; offset in 4-byte words.}
876    with has_side_effects = True
877
878 primop  WriteByteArrayOp_Int "writeIntArray#" GenPrimOp
879    MutByteArr# s -> Int# -> Int# -> State# s -> State# s
880    with has_side_effects = True
881
882 primop  WriteByteArrayOp_Word "writeWordArray#" GenPrimOp
883    MutByteArr# s -> Int# -> Word# -> State# s -> State# s
884    with has_side_effects = True
885
886 primop  WriteByteArrayOp_Addr "writeAddrArray#" GenPrimOp
887    MutByteArr# s -> Int# -> Addr# -> State# s -> State# s
888    with has_side_effects = True
889
890 primop  WriteByteArrayOp_Float "writeFloatArray#" GenPrimOp
891    MutByteArr# s -> Int# -> Float# -> State# s -> State# s
892    with has_side_effects = True
893
894 primop  WriteByteArrayOp_Double "writeDoubleArray#" GenPrimOp
895    MutByteArr# s -> Int# -> Double# -> State# s -> State# s
896    with has_side_effects = True
897
898 primop  WriteByteArrayOp_StablePtr "writeStablePtrArray#" GenPrimOp
899    MutByteArr# s -> Int# -> StablePtr# a -> State# s -> State# s
900    with has_side_effects = True
901
902 primop  WriteByteArrayOp_Int8 "writeInt8Array#" GenPrimOp
903    MutByteArr# s -> Int# -> Int# -> State# s -> State# s
904    with has_side_effects = True
905
906 primop  WriteByteArrayOp_Int16 "writeInt16Array#" GenPrimOp
907    MutByteArr# s -> Int# -> Int# -> State# s -> State# s
908    with has_side_effects = True
909
910 primop  WriteByteArrayOp_Int32 "writeInt32Array#" GenPrimOp
911    MutByteArr# s -> Int# -> INT32 -> State# s -> State# s
912    with has_side_effects = True
913
914 primop  WriteByteArrayOp_Int64 "writeInt64Array#" GenPrimOp
915    MutByteArr# s -> Int# -> INT64 -> State# s -> State# s
916    with has_side_effects = True
917
918 primop  WriteByteArrayOp_Word8 "writeWord8Array#" GenPrimOp
919    MutByteArr# s -> Int# -> Word# -> State# s -> State# s
920    with has_side_effects = True
921
922 primop  WriteByteArrayOp_Word16 "writeWord16Array#" GenPrimOp
923    MutByteArr# s -> Int# -> Word# -> State# s -> State# s
924    with has_side_effects = True
925
926 primop  WriteByteArrayOp_Word32 "writeWord32Array#" GenPrimOp
927    MutByteArr# s -> Int# -> WORD32 -> State# s -> State# s
928    with has_side_effects = True
929
930 primop  WriteByteArrayOp_Word64 "writeWord64Array#" GenPrimOp
931    MutByteArr# s -> Int# -> WORD64 -> State# s -> State# s
932    with has_side_effects = True
933
934 ------------------------------------------------------------------------
935 section "Addr#"
936         {Addr\# is an arbitrary machine address assumed to point outside
937          the garbage-collected heap.}
938 ------------------------------------------------------------------------
939
940 primop   AddrNullOp "nullAddr#" GenPrimOp  Int# -> Addr#
941          {Returns null address. Argument is ignored (nullary primops 
942           don't quite work!)}
943 primop   AddrAddOp "plusAddr#" GenPrimOp Addr# -> Int# -> Addr#
944 primop   AddrSubOp "minusAddr#" GenPrimOp Addr# -> Addr# -> Int#
945          {Result is meaningless if two Addr\#s are so far apart that their
946          difference doesn't fit in an Int\#.}
947 primop   AddrRemOp "remAddr#" GenPrimOp Addr# -> Int# -> Int#
948          {Return the remainder when the Addr\# arg, treated like an Int\#,
949           is divided by the Int\# arg.}
950 #if (WORD_SIZE_IN_BITS == 32 || WORD_SIZE_IN_BITS == 64)
951 primop   Addr2IntOp  "addr2Int#"     GenPrimOp   Addr# -> Int#
952         {Coerce directly from address to int. Strongly deprecated.}
953 primop   Int2AddrOp   "int2Addr#"    GenPrimOp  Int# -> Addr#
954         {Coerce directly from int to address. Strongly deprecated.}
955 #endif
956
957 primop   AddrGtOp  "gtAddr#"   Compare   Addr# -> Addr# -> Bool
958 primop   AddrGeOp  "geAddr#"   Compare   Addr# -> Addr# -> Bool
959 primop   AddrEqOp  "eqAddr#"   Compare   Addr# -> Addr# -> Bool
960 primop   AddrNeOp  "neAddr#"   Compare   Addr# -> Addr# -> Bool
961 primop   AddrLtOp  "ltAddr#"   Compare   Addr# -> Addr# -> Bool
962 primop   AddrLeOp  "leAddr#"   Compare   Addr# -> Addr# -> Bool
963
964 primop IndexOffAddrOp_Char "indexCharOffAddr#" GenPrimOp
965    Addr# -> Int# -> Char#
966    {Reads 8-bit character; offset in bytes.}
967
968 primop IndexOffAddrOp_WideChar "indexWideCharOffAddr#" GenPrimOp
969    Addr# -> Int# -> Char#
970    {Reads 31-bit character; offset in 4-byte words.}
971
972 primop IndexOffAddrOp_Int "indexIntOffAddr#" GenPrimOp
973    Addr# -> Int# -> Int#
974
975 primop IndexOffAddrOp_Word "indexWordOffAddr#" GenPrimOp
976    Addr# -> Int# -> Word#
977
978 primop IndexOffAddrOp_Addr "indexAddrOffAddr#" GenPrimOp
979    Addr# -> Int# -> Addr#
980
981 primop IndexOffAddrOp_Float "indexFloatOffAddr#" GenPrimOp
982    Addr# -> Int# -> Float#
983
984 primop IndexOffAddrOp_Double "indexDoubleOffAddr#" GenPrimOp
985    Addr# -> Int# -> Double#
986
987 primop IndexOffAddrOp_StablePtr "indexStablePtrOffAddr#" GenPrimOp
988    Addr# -> Int# -> StablePtr# a
989
990 primop IndexOffAddrOp_Int8 "indexInt8OffAddr#" GenPrimOp
991    Addr# -> Int# -> Int#
992
993 primop IndexOffAddrOp_Int16 "indexInt16OffAddr#" GenPrimOp
994    Addr# -> Int# -> Int#
995
996 primop IndexOffAddrOp_Int32 "indexInt32OffAddr#" GenPrimOp
997    Addr# -> Int# -> INT32
998
999 primop IndexOffAddrOp_Int64 "indexInt64OffAddr#" GenPrimOp
1000    Addr# -> Int# -> INT64
1001
1002 primop IndexOffAddrOp_Word8 "indexWord8OffAddr#" GenPrimOp
1003    Addr# -> Int# -> Word#
1004
1005 primop IndexOffAddrOp_Word16 "indexWord16OffAddr#" GenPrimOp
1006    Addr# -> Int# -> Word#
1007
1008 primop IndexOffAddrOp_Word32 "indexWord32OffAddr#" GenPrimOp
1009    Addr# -> Int# -> WORD32
1010
1011 primop IndexOffAddrOp_Word64 "indexWord64OffAddr#" GenPrimOp
1012    Addr# -> Int# -> WORD64
1013
1014 primop ReadOffAddrOp_Char "readCharOffAddr#" GenPrimOp
1015    Addr# -> Int# -> State# s -> (# State# s, Char# #)
1016    {Reads 8-bit character; offset in bytes.}
1017
1018 primop ReadOffAddrOp_WideChar "readWideCharOffAddr#" GenPrimOp
1019    Addr# -> Int# -> State# s -> (# State# s, Char# #)
1020    {Reads 31-bit character; offset in 4-byte words.}
1021
1022 primop ReadOffAddrOp_Int "readIntOffAddr#" GenPrimOp
1023    Addr# -> Int# -> State# s -> (# State# s, Int# #)
1024
1025 primop ReadOffAddrOp_Word "readWordOffAddr#" GenPrimOp
1026    Addr# -> Int# -> State# s -> (# State# s, Word# #)
1027
1028 primop ReadOffAddrOp_Addr "readAddrOffAddr#" GenPrimOp
1029    Addr# -> Int# -> State# s -> (# State# s, Addr# #)
1030
1031 primop ReadOffAddrOp_Float "readFloatOffAddr#" GenPrimOp
1032    Addr# -> Int# -> State# s -> (# State# s, Float# #)
1033
1034 primop ReadOffAddrOp_Double "readDoubleOffAddr#" GenPrimOp
1035    Addr# -> Int# -> State# s -> (# State# s, Double# #)
1036
1037 primop ReadOffAddrOp_StablePtr "readStablePtrOffAddr#" GenPrimOp
1038    Addr# -> Int# -> State# s -> (# State# s, StablePtr# a #)
1039
1040 primop ReadOffAddrOp_Int8 "readInt8OffAddr#" GenPrimOp
1041    Addr# -> Int# -> State# s -> (# State# s, Int# #)
1042
1043 primop ReadOffAddrOp_Int16 "readInt16OffAddr#" GenPrimOp
1044    Addr# -> Int# -> State# s -> (# State# s, Int# #)
1045
1046 primop ReadOffAddrOp_Int32 "readInt32OffAddr#" GenPrimOp
1047    Addr# -> Int# -> State# s -> (# State# s, INT32 #)
1048
1049 primop ReadOffAddrOp_Int64 "readInt64OffAddr#" GenPrimOp
1050    Addr# -> Int# -> State# s -> (# State# s, INT64 #)
1051
1052 primop ReadOffAddrOp_Word8 "readWord8OffAddr#" GenPrimOp
1053    Addr# -> Int# -> State# s -> (# State# s, Word# #)
1054
1055 primop ReadOffAddrOp_Word16 "readWord16OffAddr#" GenPrimOp
1056    Addr# -> Int# -> State# s -> (# State# s, Word# #)
1057
1058 primop ReadOffAddrOp_Word32 "readWord32OffAddr#" GenPrimOp
1059    Addr# -> Int# -> State# s -> (# State# s, WORD32 #)
1060
1061 primop ReadOffAddrOp_Word64 "readWord64OffAddr#" GenPrimOp
1062    Addr# -> Int# -> State# s -> (# State# s, WORD64 #)
1063
1064
1065 primop  WriteOffAddrOp_Char "writeCharOffAddr#" GenPrimOp
1066    Addr# -> Int# -> Char# -> State# s -> State# s
1067    with has_side_effects = True
1068
1069 primop  WriteOffAddrOp_WideChar "writeWideCharOffAddr#" GenPrimOp
1070    Addr# -> Int# -> Char# -> State# s -> State# s
1071    with has_side_effects = True
1072
1073 primop  WriteOffAddrOp_Int "writeIntOffAddr#" GenPrimOp
1074    Addr# -> Int# -> Int# -> State# s -> State# s
1075    with has_side_effects = True
1076
1077 primop  WriteOffAddrOp_Word "writeWordOffAddr#" GenPrimOp
1078    Addr# -> Int# -> Word# -> State# s -> State# s
1079    with has_side_effects = True
1080
1081 primop  WriteOffAddrOp_Addr "writeAddrOffAddr#" GenPrimOp
1082    Addr# -> Int# -> Addr# -> State# s -> State# s
1083    with has_side_effects = True
1084
1085 primop  WriteOffAddrOp_ForeignObj "writeForeignObjOffAddr#" GenPrimOp
1086    Addr# -> Int# -> ForeignObj# -> State# s -> State# s
1087    with has_side_effects = True
1088
1089 primop  WriteOffAddrOp_Float "writeFloatOffAddr#" GenPrimOp
1090    Addr# -> Int# -> Float# -> State# s -> State# s
1091    with has_side_effects = True
1092
1093 primop  WriteOffAddrOp_Double "writeDoubleOffAddr#" GenPrimOp
1094    Addr# -> Int# -> Double# -> State# s -> State# s
1095    with has_side_effects = True
1096
1097 primop  WriteOffAddrOp_StablePtr "writeStablePtrOffAddr#" GenPrimOp
1098    Addr# -> Int# -> StablePtr# a -> State# s -> State# s
1099    with has_side_effects = True
1100
1101 primop  WriteOffAddrOp_Int8 "writeInt8OffAddr#" GenPrimOp
1102    Addr# -> Int# -> Int# -> State# s -> State# s
1103    with has_side_effects = True
1104
1105 primop  WriteOffAddrOp_Int16 "writeInt16OffAddr#" GenPrimOp
1106    Addr# -> Int# -> Int# -> State# s -> State# s
1107    with has_side_effects = True
1108
1109 primop  WriteOffAddrOp_Int32 "writeInt32OffAddr#" GenPrimOp
1110    Addr# -> Int# -> INT32 -> State# s -> State# s
1111    with has_side_effects = True
1112
1113 primop  WriteOffAddrOp_Int64 "writeInt64OffAddr#" GenPrimOp
1114    Addr# -> Int# -> INT64 -> State# s -> State# s
1115    with has_side_effects = True
1116
1117 primop  WriteOffAddrOp_Word8 "writeWord8OffAddr#" GenPrimOp
1118    Addr# -> Int# -> Word# -> State# s -> State# s
1119    with has_side_effects = True
1120
1121 primop  WriteOffAddrOp_Word16 "writeWord16OffAddr#" GenPrimOp
1122    Addr# -> Int# -> Word# -> State# s -> State# s
1123    with has_side_effects = True
1124
1125 primop  WriteOffAddrOp_Word32 "writeWord32OffAddr#" GenPrimOp
1126    Addr# -> Int# -> WORD32 -> State# s -> State# s
1127    with has_side_effects = True
1128
1129 primop  WriteOffAddrOp_Word64 "writeWord64OffAddr#" GenPrimOp
1130    Addr# -> Int# -> WORD64 -> State# s -> State# s
1131    with has_side_effects = True
1132
1133 ------------------------------------------------------------------------
1134 section "ForeignObj#"
1135         {Operations on ForeignObj\#.  The indexing operations are
1136         all deprecated.}
1137 ------------------------------------------------------------------------
1138
1139 primop  MkForeignObjOp "mkForeignObj#" GenPrimOp
1140    Addr# -> State# RealWorld -> (# State# RealWorld, ForeignObj# #)
1141    with
1142    has_side_effects = True
1143    out_of_line      = True
1144
1145 primop  WriteForeignObjOp "writeForeignObj#" GenPrimOp
1146    ForeignObj# -> Addr# -> State# s -> State# s
1147    with
1148    has_side_effects = True
1149
1150 primop ForeignObjToAddrOp "foreignObjToAddr#" GenPrimOp
1151    ForeignObj# -> Addr#
1152
1153 primop TouchOp "touch#" GenPrimOp
1154    o -> State# RealWorld -> State# RealWorld
1155    with
1156    has_side_effects = True
1157    strictness       = { \ arity -> StrictnessInfo [wwLazy, wwPrim] False }
1158
1159 primop EqForeignObj "eqForeignObj#" GenPrimOp
1160    ForeignObj# -> ForeignObj# -> Bool
1161    with commutable = True
1162
1163 primop IndexOffForeignObjOp_Char "indexCharOffForeignObj#" GenPrimOp
1164    ForeignObj# -> Int# -> Char#
1165    {Read 8-bit character; offset in bytes.}
1166
1167 primop IndexOffForeignObjOp_WideChar "indexWideCharOffForeignObj#" GenPrimOp
1168    ForeignObj# -> Int# -> Char#
1169    {Read 31-bit character; offset in 4-byte words.}
1170
1171 primop IndexOffForeignObjOp_Int "indexIntOffForeignObj#" GenPrimOp
1172    ForeignObj# -> Int# -> Int#
1173
1174 primop IndexOffForeignObjOp_Word "indexWordOffForeignObj#" GenPrimOp
1175    ForeignObj# -> Int# -> Word#
1176
1177 primop IndexOffForeignObjOp_Addr "indexAddrOffForeignObj#" GenPrimOp
1178    ForeignObj# -> Int# -> Addr#
1179
1180 primop IndexOffForeignObjOp_Float "indexFloatOffForeignObj#" GenPrimOp
1181    ForeignObj# -> Int# -> Float#
1182
1183 primop IndexOffForeignObjOp_Double "indexDoubleOffForeignObj#" GenPrimOp
1184    ForeignObj# -> Int# -> Double#
1185
1186 primop IndexOffForeignObjOp_StablePtr "indexStablePtrOffForeignObj#" GenPrimOp
1187    ForeignObj# -> Int# -> StablePtr# a
1188
1189 primop IndexOffForeignObjOp_Int8 "indexInt8OffForeignObj#" GenPrimOp
1190    ForeignObj# -> Int# -> Int#
1191
1192 primop IndexOffForeignObjOp_Int16 "indexInt16OffForeignObj#" GenPrimOp
1193    ForeignObj# -> Int# -> Int#
1194
1195 primop IndexOffForeignObjOp_Int32 "indexInt32OffForeignObj#" GenPrimOp
1196    ForeignObj# -> Int# -> INT32
1197
1198 primop IndexOffForeignObjOp_Int64 "indexInt64OffForeignObj#" GenPrimOp
1199    ForeignObj# -> Int# -> INT64
1200
1201 primop IndexOffForeignObjOp_Word8 "indexWord8OffForeignObj#" GenPrimOp
1202    ForeignObj# -> Int# -> Word#
1203
1204 primop IndexOffForeignObjOp_Word16 "indexWord16OffForeignObj#" GenPrimOp
1205    ForeignObj# -> Int# -> Word#
1206
1207 primop IndexOffForeignObjOp_Word32 "indexWord32OffForeignObj#" GenPrimOp
1208    ForeignObj# -> Int# -> WORD32
1209
1210 primop IndexOffForeignObjOp_Word64 "indexWord64OffForeignObj#" GenPrimOp
1211    ForeignObj# -> Int# -> WORD64
1212
1213
1214
1215 ------------------------------------------------------------------------
1216 section "Mutable variables"
1217         {Operations on MutVar\#s, which behave like single-element mutable arrays.}
1218 ------------------------------------------------------------------------
1219
1220 primop  NewMutVarOp "newMutVar#" GenPrimOp
1221    a -> State# s -> (# State# s, MutVar# s a #)
1222    {Create MutVar\# with specified initial value in specified state thread.}
1223    with
1224    usage       = { mangle NewMutVarOp [mkM, mkP] mkM }
1225    strictness  = { \ arity -> StrictnessInfo [wwLazy, wwPrim] False }
1226    out_of_line = True
1227
1228 primop  ReadMutVarOp "readMutVar#" GenPrimOp
1229    MutVar# s a -> State# s -> (# State# s, a #)
1230    {Read contents of MutVar\#. Result is not yet evaluated.}
1231    with
1232    usage = { mangle ReadMutVarOp [mkM, mkP] mkM }
1233
1234 primop  WriteMutVarOp "writeMutVar#"  GenPrimOp
1235    MutVar# s a -> a -> State# s -> State# s
1236    {Write contents of MutVar\#.}
1237    with
1238    strictness       = { \ arity -> StrictnessInfo [wwPrim, wwLazy, wwPrim] False }
1239    usage            = { mangle WriteMutVarOp [mkM, mkM, mkP] mkR }
1240    has_side_effects = True
1241
1242 primop  SameMutVarOp "sameMutVar#" GenPrimOp
1243    MutVar# s a -> MutVar# s a -> Bool
1244    with
1245    usage = { mangle SameMutVarOp [mkP, mkP] mkM }
1246
1247 ------------------------------------------------------------------------
1248 section "Exceptions"
1249 ------------------------------------------------------------------------
1250
1251 primop  CatchOp "catch#" GenPrimOp
1252           (State# RealWorld -> (# State# RealWorld, a #) )
1253        -> (b -> State# RealWorld -> (# State# RealWorld, a #) ) 
1254        -> State# RealWorld
1255        -> (# State# RealWorld, a #)
1256    with
1257    strictness = { \ arity -> StrictnessInfo [wwLazy, wwLazy, wwPrim] False }
1258         -- Catch is actually strict in its first argument
1259         -- but we don't want to tell the strictness
1260         -- analyser about that!
1261    usage = { mangle CatchOp [mkM, mkM . (inFun CatchOp mkM mkM), mkP] mkM }
1262         --     [mkO, mkO . (inFun mkM mkO)] mkO
1263         -- might use caught action multiply
1264    out_of_line = True
1265
1266 primop  RaiseOp "raise#" GenPrimOp
1267    a -> b
1268    with
1269    strictness  = { \ arity -> StrictnessInfo [wwLazy] True }
1270       -- NB: True => result is bottom
1271    usage       = { mangle RaiseOp [mkM] mkM }
1272    out_of_line = True
1273
1274 primop  BlockAsyncExceptionsOp "blockAsyncExceptions#" GenPrimOp
1275         (State# RealWorld -> (# State# RealWorld, a #))
1276      -> (State# RealWorld -> (# State# RealWorld, a #))
1277    with
1278    strictness  = { \ arity -> StrictnessInfo [wwLazy, wwPrim] False }
1279    out_of_line = True
1280
1281 primop  UnblockAsyncExceptionsOp "unblockAsyncExceptions#" GenPrimOp
1282         (State# RealWorld -> (# State# RealWorld, a #))
1283      -> (State# RealWorld -> (# State# RealWorld, a #))
1284    with
1285    strictness  = { \ arity -> StrictnessInfo [wwLazy, wwPrim] False }
1286    out_of_line = True
1287
1288 ------------------------------------------------------------------------
1289 section "Synchronized Mutable Variables"
1290         {Operations on MVar\#s, which are shared mutable variables
1291         ({\it not} the same as MutVar\#s!). (Note: in a non-concurrent implementation,
1292         (MVar\# a) can be represented by (MutVar\# (Maybe a)).)}
1293 ------------------------------------------------------------------------
1294
1295
1296 primop  NewMVarOp "newMVar#"  GenPrimOp
1297    State# s -> (# State# s, MVar# s a #)
1298    {Create new mvar; initially empty.}
1299    with
1300    usage       = { mangle NewMVarOp [mkP] mkR }
1301    out_of_line = True
1302
1303 primop  TakeMVarOp "takeMVar#" GenPrimOp
1304    MVar# s a -> State# s -> (# State# s, a #)
1305    {If mvar is empty, block until it becomes full.
1306    Then remove and return its contents, and set it empty.}
1307    with
1308    usage            = { mangle TakeMVarOp [mkM, mkP] mkM }
1309    has_side_effects = True
1310    out_of_line      = True
1311
1312 primop  TryTakeMVarOp "tryTakeMVar#" GenPrimOp
1313    MVar# s a -> State# s -> (# State# s, Int#, a #)
1314    {If mvar is empty, immediately return with integer 0 and value undefined.
1315    Otherwise, return with integer 1 and contents of mvar, and set mvar empty.}
1316    with
1317    usage            = { mangle TryTakeMVarOp [mkM, mkP] mkM }
1318    has_side_effects = True
1319    out_of_line      = True
1320
1321 primop  PutMVarOp "putMVar#" GenPrimOp
1322    MVar# s a -> a -> State# s -> State# s
1323    {If mvar is full, block until it becomes empty.
1324    Then store value arg as its new contents.}
1325    with
1326    strictness       = { \ arity -> StrictnessInfo [wwPrim, wwLazy, wwPrim] False }
1327    usage            = { mangle PutMVarOp [mkM, mkM, mkP] mkR }
1328    has_side_effects = True
1329    out_of_line      = True
1330
1331 primop  TryPutMVarOp "tryPutMVar#" GenPrimOp
1332    MVar# s a -> a -> State# s -> (# State# s, Int# #)
1333    {If mvar is full, immediately return with integer 0.
1334     Otherwise, store value arg as mvar's new contents, and return with integer 1.}
1335    with
1336    strictness       = { \ arity -> StrictnessInfo [wwPrim, wwLazy, wwPrim] False }
1337    usage            = { mangle TryPutMVarOp [mkM, mkM, mkP] mkR }
1338    has_side_effects = True
1339    out_of_line      = True
1340
1341 primop  SameMVarOp "sameMVar#" GenPrimOp
1342    MVar# s a -> MVar# s a -> Bool
1343    with
1344    usage = { mangle SameMVarOp [mkP, mkP] mkM }
1345
1346 primop  IsEmptyMVarOp "isEmptyMVar#" GenPrimOp
1347    MVar# s a -> State# s -> (# State# s, Int# #)
1348    {Return 1 if mvar is empty; 0 otherwise.}
1349    with
1350    usage = { mangle IsEmptyMVarOp [mkP, mkP] mkM }
1351
1352
1353 ------------------------------------------------------------------------
1354 section "Delay/wait operations"
1355 ------------------------------------------------------------------------
1356
1357 primop  DelayOp "delay#" GenPrimOp
1358    Int# -> State# s -> State# s
1359    {Sleep specified number of microseconds.}
1360    with
1361    needs_wrapper    = True
1362    has_side_effects = True
1363    out_of_line      = True
1364
1365 primop  WaitReadOp "waitRead#" GenPrimOp
1366    Int# -> State# s -> State# s
1367    {Block until input is available on specified file descriptor.}
1368    with
1369    needs_wrapper    = True
1370    has_side_effects = True
1371    out_of_line      = True
1372
1373 primop  WaitWriteOp "waitWrite#" GenPrimOp
1374    Int# -> State# s -> State# s
1375    {Block until output is possible on specified file descriptor.}
1376    with
1377    needs_wrapper    = True
1378    has_side_effects = True
1379    out_of_line      = True
1380
1381 ------------------------------------------------------------------------
1382 section "Concurrency primitives"
1383         {(In a non-concurrent implementation, ThreadId\# can be as singleton
1384         type, whose (unique) value is returned by myThreadId\#.  The 
1385         other operations can be omitted.)}
1386 ------------------------------------------------------------------------
1387
1388 primop  ForkOp "fork#" GenPrimOp
1389    a -> State# RealWorld -> (# State# RealWorld, ThreadId# #)
1390    with
1391    usage            = { mangle ForkOp [mkO, mkP] mkR }
1392    strictness       = { \ arity -> StrictnessInfo [wwLazy, wwPrim] False }
1393    has_side_effects = True
1394    out_of_line      = True
1395
1396 primop  KillThreadOp "killThread#"  GenPrimOp
1397    ThreadId# -> a -> State# RealWorld -> State# RealWorld
1398    with
1399    usage            = { mangle KillThreadOp [mkP, mkM, mkP] mkR }
1400    has_side_effects = True
1401    out_of_line      = True
1402
1403 primop  YieldOp "yield#" GenPrimOp
1404    State# RealWorld -> State# RealWorld
1405    with
1406    has_side_effects = True
1407    out_of_line      = True
1408
1409 primop  MyThreadIdOp "myThreadId#" GenPrimOp
1410     State# RealWorld -> (# State# RealWorld, ThreadId# #)
1411
1412 ------------------------------------------------------------------------
1413 section "Weak pointers"
1414 ------------------------------------------------------------------------
1415
1416 -- note that tyvar "o" denotes openAlphaTyVar
1417
1418 primop  MkWeakOp "mkWeak#" GenPrimOp
1419    o -> b -> c -> State# RealWorld -> (# State# RealWorld, Weak# b #)
1420    with
1421    strictness       = { \ arity -> StrictnessInfo [wwLazy, wwLazy, wwLazy, wwPrim] False }
1422    usage            = { mangle MkWeakOp [mkZ, mkM, mkM, mkP] mkM }
1423    has_side_effects = True
1424    out_of_line      = True
1425
1426 primop  DeRefWeakOp "deRefWeak#" GenPrimOp
1427    Weak# a -> State# RealWorld -> (# State# RealWorld, Int#, a #)
1428    with
1429    usage            = { mangle DeRefWeakOp [mkM, mkP] mkM }
1430    has_side_effects = True
1431
1432 primop  FinalizeWeakOp "finalizeWeak#" GenPrimOp
1433    Weak# a -> State# RealWorld -> (# State# RealWorld, Int#, 
1434               (State# RealWorld -> (# State# RealWorld, Unit #)) #)
1435    with
1436    usage            = { mangle FinalizeWeakOp [mkM, mkP] 
1437                                (mkR . (inUB FinalizeWeakOp 
1438                                             [id,id,inFun FinalizeWeakOp mkR mkM])) }
1439    has_side_effects = True
1440    out_of_line      = True
1441
1442 ------------------------------------------------------------------------
1443 section "Stable pointers and names"
1444 ------------------------------------------------------------------------
1445
1446 primop  MakeStablePtrOp "makeStablePtr#" GenPrimOp
1447    a -> State# RealWorld -> (# State# RealWorld, StablePtr# a #)
1448    with
1449    strictness       = { \ arity -> StrictnessInfo [wwLazy, wwPrim] False }
1450    usage            = { mangle MakeStablePtrOp [mkM, mkP] mkM }
1451    has_side_effects = True
1452
1453 primop  DeRefStablePtrOp "deRefStablePtr#" GenPrimOp
1454    StablePtr# a -> State# RealWorld -> (# State# RealWorld, a #)
1455    with
1456    usage            = { mangle DeRefStablePtrOp [mkM, mkP] mkM }
1457    needs_wrapper    = True
1458    has_side_effects = True
1459
1460 primop  EqStablePtrOp "eqStablePtr#" GenPrimOp
1461    StablePtr# a -> StablePtr# a -> Int#
1462    with
1463    usage            = { mangle EqStablePtrOp [mkP, mkP] mkR }
1464    has_side_effects = True
1465
1466 primop  MakeStableNameOp "makeStableName#" GenPrimOp
1467    a -> State# RealWorld -> (# State# RealWorld, StableName# a #)
1468    with
1469    usage            = { mangle MakeStableNameOp [mkZ, mkP] mkR }
1470    strictness       = { \ arity -> StrictnessInfo [wwLazy, wwPrim] False }
1471    needs_wrapper    = True
1472    has_side_effects = True
1473    out_of_line      = True
1474
1475 primop  EqStableNameOp "eqStableName#" GenPrimOp
1476    StableName# a -> StableName# a -> Int#
1477    with
1478    usage = { mangle EqStableNameOp [mkP, mkP] mkR }
1479
1480 primop  StableNameToIntOp "stableNameToInt#" GenPrimOp
1481    StableName# a -> Int#
1482    with
1483    usage = { mangle StableNameToIntOp [mkP] mkR }
1484
1485 ------------------------------------------------------------------------
1486 section "Unsafe pointer equality"
1487 --  (#1 Bad Guy: Alistair Reid :)   
1488 ------------------------------------------------------------------------
1489
1490 primop  ReallyUnsafePtrEqualityOp "reallyUnsafePtrEquality#" GenPrimOp
1491    a -> a -> Int#
1492    with
1493    usage = { mangle ReallyUnsafePtrEqualityOp [mkZ, mkZ] mkR }
1494
1495 ------------------------------------------------------------------------
1496 section "Parallelism"
1497 ------------------------------------------------------------------------
1498
1499 primop  SeqOp "seq#" GenPrimOp
1500    a -> Int#
1501    with
1502    usage            = { mangle  SeqOp [mkO] mkR }
1503    strictness       = { \ arity -> StrictnessInfo [wwStrict] False }
1504       -- Seq is strict in its argument; see notes in ConFold.lhs
1505    has_side_effects = True
1506
1507 primop  ParOp "par#" GenPrimOp
1508    a -> Int#
1509    with
1510    usage            = { mangle ParOp [mkO] mkR }
1511    strictness       = { \ arity -> StrictnessInfo [wwLazy] False }
1512       -- Note that Par is lazy to avoid that the sparked thing
1513       -- gets evaluted strictly, which it should *not* be
1514    has_side_effects = True
1515
1516 -- HWL: The first 4 Int# in all par... annotations denote:
1517 --   name, granularity info, size of result, degree of parallelism
1518 --      Same  structure as _seq_ i.e. returns Int#
1519 -- KSW: v, the second arg in parAt# and parAtForNow#, is used only to determine
1520 --   `the processor containing the expression v'; it is not evaluated
1521
1522 primop  ParGlobalOp  "parGlobal#"  GenPrimOp
1523    a -> Int# -> Int# -> Int# -> Int# -> b -> Int#
1524    with
1525    usage            = { mangle ParGlobalOp [mkO, mkP, mkP, mkP, mkP, mkM] mkM }
1526    has_side_effects = True
1527
1528 primop  ParLocalOp  "parLocal#"  GenPrimOp
1529    a -> Int# -> Int# -> Int# -> Int# -> b -> Int#
1530    with
1531    usage            = { mangle ParLocalOp [mkO, mkP, mkP, mkP, mkP, mkM] mkM }
1532    has_side_effects = True
1533
1534 primop  ParAtOp  "parAt#"  GenPrimOp
1535    b -> a -> Int# -> Int# -> Int# -> Int# -> c -> Int#
1536    with
1537    usage            = { mangle ParAtOp [mkO, mkZ, mkP, mkP, mkP, mkP, mkM] mkM }
1538    has_side_effects = True
1539
1540 primop  ParAtAbsOp  "parAtAbs#"  GenPrimOp
1541    a -> Int# -> Int# -> Int# -> Int# -> Int# -> b -> Int#
1542    with
1543    usage            = { mangle ParAtAbsOp [mkO, mkP, mkP, mkP, mkP, mkM] mkM }
1544    has_side_effects = True
1545
1546 primop  ParAtRelOp  "parAtRel#" GenPrimOp
1547    a -> Int# -> Int# -> Int# -> Int# -> Int# -> b -> Int#
1548    with
1549    usage            = { mangle ParAtRelOp [mkO, mkP, mkP, mkP, mkP, mkM] mkM }
1550    has_side_effects = True
1551
1552 primop  ParAtForNowOp  "parAtForNow#" GenPrimOp
1553    b -> a -> Int# -> Int# -> Int# -> Int# -> c -> Int#
1554    with
1555    usage            = { mangle ParAtForNowOp [mkO, mkZ, mkP, mkP, mkP, mkP, mkM] mkM }
1556    has_side_effects = True
1557
1558 -- copyable# and noFollow# are yet to be implemented (for GpH)
1559 --
1560 --primop  CopyableOp  "copyable#" GenPrimOp
1561 --   a -> Int#
1562 --   with
1563 --   usage            = { mangle CopyableOp [mkZ] mkR }
1564 --   has_side_effects = True
1565 --
1566 --primop  NoFollowOp "noFollow#" GenPrimOp
1567 --   a -> Int#
1568 --   with
1569 --   usage            = { mangle NoFollowOp [mkZ] mkR }
1570 --   has_side_effects = True
1571
1572
1573 ------------------------------------------------------------------------
1574 section "Tag to enum stuff"
1575         {Convert back and forth between values of enumerated types
1576         and small integers.}
1577 ------------------------------------------------------------------------
1578
1579 primop  DataToTagOp "dataToTag#" GenPrimOp
1580    a -> Int#
1581    with
1582    strictness = { \ arity -> StrictnessInfo [wwLazy] False }
1583
1584 primop  TagToEnumOp "tagToEnum#" GenPrimOp     
1585    Int# -> a
1586
1587 ------------------------------------------------------------------------
1588 section "Bytecode operations" 
1589         {Support for the bytecode interpreter and linker.}
1590 ------------------------------------------------------------------------
1591
1592
1593 primop   AddrToHValueOp "addrToHValue#" GenPrimOp
1594    Addr# -> (# a #)
1595    {Convert an Addr\# to a followable type.}
1596
1597 primop   MkApUpd0_Op "mkApUpd0#" GenPrimOp
1598    a -> (# a #)
1599    with
1600    out_of_line = True
1601
1602 primop  NewBCOOp "newBCO#" GenPrimOp
1603    ByteArr# -> ByteArr# -> Array# a -> ByteArr# -> State# s -> (# State# s, BCO# #)
1604    with
1605    has_side_effects = True
1606    out_of_line      = True
1607
1608 ------------------------------------------------------------------------
1609 ---                                                                  ---
1610 ------------------------------------------------------------------------
1611
1612 thats_all_folks
1613
1614
1615