2 /* -----------------------------------------------------------------------------
3 * $Id: Bytecodes.h,v 1.8 1999/10/26 17:27:30 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), \
90 Ins(i_VAR_STABLE_big), \
92 Ins(i_UNPACK_STABLE), \
100 #define BIGGEST_OPCODE ((int)(i_VV))
103 typedef enum { INSTRLIST } Instr;
109 { i_INTERNAL_ERROR1 /* Instruction 0 raises an internal error */
114 /* Char# operations */
124 /* Int# operations */
148 /* Word# operations */
174 /* Addr# operations */
184 /* Stable# operations */
188 /* Stateless Addr operations */
193 , i_indexFloatOffAddr
194 , i_indexDoubleOffAddr
195 , i_indexStableOffAddr
202 , i_readDoubleOffAddr
203 , i_readStableOffAddr
209 , i_writeFloatOffAddr
210 , i_writeDoubleOffAddr
211 , i_writeStableOffAddr
213 /* Integer operations */
230 /* Float# operations */
267 , i_isDenormalizedFloat
268 , i_isNegativeZeroFloat
271 /* Double# operations */
310 , i_isDenormalizedDouble
311 , i_isNegativeZeroDouble
314 /* If you add a new primop to this table, check you don't
315 * overflow the 256 limit. That is MAX_Primop1 <= 255.
316 * Current value (30/10/98) = 0xc8
318 , MAX_Primop1 = i_isIEEEDouble
323 { i_INTERNAL_ERROR2 /* Instruction 0 raises an internal error */
333 /* Prim[Mutable]Array operations */
335 , i_unsafeFreezeArray
344 /* Prim[Mutable]ByteArray operations */
345 , i_sameMutableByteArray
346 , i_unsafeFreezeByteArray
357 /* {write,read,index}IntegerArray not provided */
373 #ifdef PROVIDE_STABLE
380 /* {write,read,index}ForeignObjArray not provided */
382 #ifdef PROVIDE_PTREQUALITY
383 , i_reallyUnsafePtrEquality
385 #ifdef PROVIDE_COERCE
389 #ifdef PROVIDE_FOREIGN
390 /* ForeignObj# operations */
393 , indexCharOffForeignObj
394 , indexIntOffForeignObj
395 , indexInt64OffForeignObj
396 , indexWordOffForeignObj
397 , indexAddrOffForeignObj
398 , indexFloatOffForeignObj
399 , indexDoubleOffForeignObj
400 , indexStablePtrOffForeignObj
403 /* Weak# operations */
407 /* StablePtr# operations */
412 /* foreign export dynamic support */
413 , i_createAdjThunkARCH
415 #ifdef PROVIDE_CONCURRENT
416 /* Concurrency operations */
434 /* If you add a new primop to this table, check you don't
435 * overflow the 256 limit. That is MAX_Primop2 <= 255.
436 * Current value (30/10/98) = 0x42
438 , MAX_Primop2 = i_ccall_stdcall_IO
441 typedef unsigned int InstrPtr; /* offset of instruction within BCO */
443 /*-------------------------------------------------------------------------*/