2 /* -----------------------------------------------------------------------------
3 * $Id: Bytecodes.h,v 1.13 1999/12/07 11:49:10 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), \
30 Ins(i_STK_CHECK_big), \
34 Ins(i_ALLOC_CONSTR), \
35 Ins(i_ALLOC_CONSTR_big), \
56 Ins(i_CONST_INT_big), \
60 Ins(i_CONST_INTEGER), \
61 Ins(i_CONST_INTEGER_big), \
63 Ins(i_VAR_WORD_big), \
68 Ins(i_VAR_ADDR_big), \
70 Ins(i_CONST_ADDR_big), \
74 Ins(i_VAR_CHAR_big), \
76 Ins(i_CONST_CHAR_big), \
80 Ins(i_VAR_FLOAT_big), \
82 Ins(i_CONST_FLOAT_big), \
84 Ins(i_UNPACK_FLOAT), \
86 Ins(i_VAR_DOUBLE_big), \
87 Ins(i_CONST_DOUBLE), \
88 Ins(i_CONST_DOUBLE_big), \
90 Ins(i_UNPACK_DOUBLE), \
92 Ins(i_VAR_STABLE_big), \
94 Ins(i_UNPACK_STABLE), \
102 #define BIGGEST_OPCODE ((int)(i_VV))
105 typedef enum { INSTRLIST } Instr;
111 { i_INTERNAL_ERROR1 /* Instruction 0 raises an internal error */
116 /* Char# operations */
126 /* Int# operations */
150 /* Word# operations */
176 /* Addr# operations */
186 /* Stable# operations */
190 /* Stateless Addr operations */
195 , i_indexFloatOffAddr
196 , i_indexDoubleOffAddr
197 , i_indexStableOffAddr
204 , i_readDoubleOffAddr
205 , i_readStableOffAddr
211 , i_writeFloatOffAddr
212 , i_writeDoubleOffAddr
213 , i_writeStableOffAddr
215 /* Integer operations */
232 /* Float# operations */
269 , i_isDenormalizedFloat
270 , i_isNegativeZeroFloat
273 /* Double# operations */
312 , i_isDenormalizedDouble
313 , i_isNegativeZeroDouble
316 /* If you add a new primop to this table, check you don't
317 * overflow the 256 limit. That is MAX_Primop1 <= 255.
318 * Current value (30/10/98) = 0xc8
320 , MAX_Primop1 = i_isIEEEDouble
325 { i_INTERNAL_ERROR2 /* Instruction 0 raises an internal error */
335 /* Prim[Mutable]Array operations */
337 , i_unsafeFreezeArray
346 /* Prim[Mutable]ByteArray operations */
347 , i_sameMutableByteArray
348 , i_unsafeFreezeByteArray
359 /* {write,read,index}IntegerArray not provided */
375 #ifdef PROVIDE_STABLE
382 /* {write,read,index}ForeignObjArray not provided */
384 #ifdef PROVIDE_PTREQUALITY
385 , i_reallyUnsafePtrEquality
387 #ifdef PROVIDE_COERCE
391 #ifdef PROVIDE_FOREIGN
392 /* ForeignObj# operations */
395 , indexCharOffForeignObj
396 , indexIntOffForeignObj
397 , indexInt64OffForeignObj
398 , indexWordOffForeignObj
399 , indexAddrOffForeignObj
400 , indexFloatOffForeignObj
401 , indexDoubleOffForeignObj
402 , indexStablePtrOffForeignObj
405 /* Weak# operations */
409 /* StablePtr# operations */
414 /* foreign export dynamic support */
415 , i_createAdjThunkARCH
417 /* misc handy hacks */
421 #ifdef PROVIDE_CONCURRENT
422 /* Concurrency operations */
443 /* If you add a new primop to this table, check you don't
444 * overflow the 256 limit. That is MAX_Primop2 <= 255.
445 * Current value (30/10/98) = 0x42
447 , MAX_Primop2 = i_ccall_stdcall_IO
450 typedef unsigned int InstrPtr; /* offset of instruction within BCO */
452 /*-------------------------------------------------------------------------*/