2 /* -----------------------------------------------------------------------------
3 * $Id: Bytecodes.h,v 1.16 2000/06/15 13:23:51 daan 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), \
30 Ins(i_STK_CHECK_big), \
34 Ins(i_ALLOC_CONSTR), \
35 Ins(i_ALLOC_CONSTR_big), \
37 Ins(i_ALLOC_ROW_big), \
44 Ins(i_PACK_ROW_big), \
46 Ins(i_PACK_INJ_big), \
47 Ins(i_PACK_INJ_CONST), \
52 Ins(i_TEST_INJ_big), \
53 Ins(i_TEST_INJ_CONST), \
68 Ins(i_CONST_INT_big), \
72 Ins(i_CONST_INTEGER), \
73 Ins(i_CONST_INTEGER_big), \
75 Ins(i_VAR_WORD_big), \
80 Ins(i_VAR_ADDR_big), \
82 Ins(i_CONST_ADDR_big), \
86 Ins(i_VAR_CHAR_big), \
88 Ins(i_CONST_CHAR_big), \
92 Ins(i_VAR_FLOAT_big), \
94 Ins(i_CONST_FLOAT_big), \
96 Ins(i_UNPACK_FLOAT), \
98 Ins(i_VAR_DOUBLE_big), \
99 Ins(i_CONST_DOUBLE), \
100 Ins(i_CONST_DOUBLE_big), \
101 Ins(i_PACK_DOUBLE), \
102 Ins(i_UNPACK_DOUBLE), \
104 Ins(i_VAR_STABLE_big), \
105 Ins(i_PACK_STABLE), \
106 Ins(i_UNPACK_STABLE), \
114 #define BIGGEST_OPCODE ((int)(i_VV))
117 typedef enum { INSTRLIST } Instr;
123 { i_INTERNAL_ERROR1 /* Instruction 0 raises an internal error */
128 /* Char# operations */
138 /* Int# operations */
162 /* Word# operations */
188 /* Addr# operations */
198 /* Stable# operations */
202 /* Stateless Addr operations */
207 , i_indexFloatOffAddr
208 , i_indexDoubleOffAddr
209 , i_indexStableOffAddr
216 , i_readDoubleOffAddr
217 , i_readStableOffAddr
223 , i_writeFloatOffAddr
224 , i_writeDoubleOffAddr
225 , i_writeStableOffAddr
227 /* Integer operations */
244 /* Float# operations */
281 , i_isDenormalizedFloat
282 , i_isNegativeZeroFloat
285 /* Double# operations */
324 , i_isDenormalizedDouble
325 , i_isNegativeZeroDouble
328 /* If you add a new primop to this table, check you don't
329 * overflow the 256 limit. That is MAX_Primop1 <= 255.
330 * Current value (30/10/98) = 0xc8
332 , MAX_Primop1 = i_isIEEEDouble
337 { i_INTERNAL_ERROR2 /* Instruction 0 raises an internal error */
342 /* row primitives. */
353 /* Prim[Mutable]Array operations */
355 , i_unsafeFreezeArray
364 /* Prim[Mutable]ByteArray operations */
365 , i_sameMutableByteArray
366 , i_unsafeFreezeByteArray
377 /* {write,read,index}IntegerArray not provided */
393 #ifdef PROVIDE_STABLE
400 /* {write,read,index}ForeignObjArray not provided */
402 #ifdef PROVIDE_PTREQUALITY
403 , i_reallyUnsafePtrEquality
405 #ifdef PROVIDE_COERCE
409 #ifdef PROVIDE_FOREIGN
410 /* ForeignObj# operations */
413 , indexCharOffForeignObj
414 , indexIntOffForeignObj
415 , indexInt64OffForeignObj
416 , indexWordOffForeignObj
417 , indexAddrOffForeignObj
418 , indexFloatOffForeignObj
419 , indexDoubleOffForeignObj
420 , indexStablePtrOffForeignObj
423 /* Weak# operations */
427 /* StablePtr# operations */
432 /* foreign export dynamic support */
433 , i_createAdjThunkARCH
435 /* misc handy hacks */
439 #ifdef PROVIDE_CONCURRENT
440 /* Concurrency operations */
463 /* If you add a new primop to this table, check you don't
464 * overflow the 256 limit. That is MAX_Primop2 <= 255.
465 * Current value (6/10/2000) = 0x44
467 , MAX_Primop2 = i_ccall_stdcall_IO
470 typedef unsigned int InstrPtr; /* offset of instruction within BCO */
472 /*-------------------------------------------------------------------------*/