2 /* -----------------------------------------------------------------------------
3 * $Id: Bytecodes.h,v 1.6 1999/04/27 10:07:20 sewardj Exp $
5 * (c) The GHC Team, 1998-1999
7 * Bytecode definitions.
9 * ---------------------------------------------------------------------------*/
11 /* --------------------------------------------------------------------------
15 * o INTERNAL_ERROR is never generated by the compiler and usually
16 * indicates an error in the heap.
17 * PANIC is generated by the compiler whenever it tests an "irrefutable"
18 * pattern which fails. If we don't see too many of these, we could
19 * optimise out the redundant test.
21 * o If you add any new instructions, you have to check that each enumeration
22 * has at most 256 entries in it --- some of the lists are very close to
24 * ------------------------------------------------------------------------*/
27 Ins(i_INTERNAL_ERROR), \
33 Ins(i_ALLOC_CONSTR), \
54 Ins(i_CONST_INT_big), \
58 Ins(i_CONST_INTEGER), \
59 Ins(i_CONST_INTEGER_big), \
61 Ins(i_VAR_WORD_big), \
66 Ins(i_VAR_ADDR_big), \
68 Ins(i_CONST_ADDR_big), \
72 Ins(i_VAR_CHAR_big), \
74 Ins(i_CONST_CHAR_big), \
78 Ins(i_VAR_FLOAT_big), \
80 Ins(i_CONST_FLOAT_big), \
82 Ins(i_UNPACK_FLOAT), \
84 Ins(i_VAR_DOUBLE_big), \
85 Ins(i_CONST_DOUBLE), \
86 Ins(i_CONST_DOUBLE_big), \
88 Ins(i_UNPACK_DOUBLE), \
91 Ins(i_UNPACK_STABLE), \
99 #define BIGGEST_OPCODE ((int)(i_VV))
102 typedef enum { INSTRLIST } Instr;
108 { i_INTERNAL_ERROR1 /* Instruction 0 raises an internal error */
113 /* Char# operations */
123 /* Int# operations */
147 /* Word# operations */
173 /* Addr# operations */
183 /* Stateless Addr operations */
188 , i_indexFloatOffAddr
189 , i_indexDoubleOffAddr
190 #ifdef PROVIDE_STABLE
191 , i_indexStableOffAddr
199 , i_readDoubleOffAddr
200 #ifdef PROVIDE_STABLE
201 , i_readStableOffAddr
208 , i_writeFloatOffAddr
209 , i_writeDoubleOffAddr
210 #ifdef PROVIDE_STABLE
211 , i_writeStableOffAddr
214 /* Integer operations */
231 /* Float# operations */
268 , i_isDenormalizedFloat
269 , i_isNegativeZeroFloat
272 /* Double# operations */
311 , i_isDenormalizedDouble
312 , i_isNegativeZeroDouble
315 /* If you add a new primop to this table, check you don't
316 * overflow the 256 limit. That is MAX_Primop1 <= 255.
317 * Current value (30/10/98) = 0xc8
319 , MAX_Primop1 = i_isIEEEDouble
324 { i_INTERNAL_ERROR2 /* Instruction 0 raises an internal error */
334 /* Prim[Mutable]Array operations */
336 , i_unsafeFreezeArray
345 /* Prim[Mutable]ByteArray operations */
346 , i_sameMutableByteArray
347 , i_unsafeFreezeByteArray
358 /* {write,read,index}IntegerArray not provided */
373 #ifdef PROVIDE_STABLE
379 /* {write,read,index}ForeignObjArray not provided */
381 #ifdef PROVIDE_PTREQUALITY
382 , i_reallyUnsafePtrEquality
384 #ifdef PROVIDE_COERCE
388 #ifdef PROVIDE_FOREIGN
389 /* ForeignObj# operations */
392 , indexCharOffForeignObj
393 , indexIntOffForeignObj
394 , indexInt64OffForeignObj
395 , indexWordOffForeignObj
396 , indexAddrOffForeignObj
397 , indexFloatOffForeignObj
398 , indexDoubleOffForeignObj
399 , indexStablePtrOffForeignObj
402 /* Weak# operations */
406 #ifdef PROVIDE_STABLE
407 /* StablePtr# operations */
413 #ifdef PROVIDE_CONCURRENT
414 /* Concurrency operations */
430 /* If you add a new primop to this table, check you don't
431 * overflow the 256 limit. That is MAX_Primop2 <= 255.
432 * Current value (30/10/98) = 0x42
434 , MAX_Primop2 = i_ccall_IO
437 typedef unsigned int InstrPtr; /* offset of instruction within BCO */
439 /*-------------------------------------------------------------------------*/