2 /* -----------------------------------------------------------------------------
3 * $Id: Bytecodes.h,v 1.12 1999/11/18 12:10:25 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), \
55 Ins(i_CONST_INT_big), \
59 Ins(i_CONST_INTEGER), \
60 Ins(i_CONST_INTEGER_big), \
62 Ins(i_VAR_WORD_big), \
67 Ins(i_VAR_ADDR_big), \
69 Ins(i_CONST_ADDR_big), \
73 Ins(i_VAR_CHAR_big), \
75 Ins(i_CONST_CHAR_big), \
79 Ins(i_VAR_FLOAT_big), \
81 Ins(i_CONST_FLOAT_big), \
83 Ins(i_UNPACK_FLOAT), \
85 Ins(i_VAR_DOUBLE_big), \
86 Ins(i_CONST_DOUBLE), \
87 Ins(i_CONST_DOUBLE_big), \
89 Ins(i_UNPACK_DOUBLE), \
91 Ins(i_VAR_STABLE_big), \
93 Ins(i_UNPACK_STABLE), \
101 #define BIGGEST_OPCODE ((int)(i_VV))
104 typedef enum { INSTRLIST } Instr;
110 { i_INTERNAL_ERROR1 /* Instruction 0 raises an internal error */
115 /* Char# operations */
125 /* Int# operations */
149 /* Word# operations */
175 /* Addr# operations */
185 /* Stable# operations */
189 /* Stateless Addr operations */
194 , i_indexFloatOffAddr
195 , i_indexDoubleOffAddr
196 , i_indexStableOffAddr
203 , i_readDoubleOffAddr
204 , i_readStableOffAddr
210 , i_writeFloatOffAddr
211 , i_writeDoubleOffAddr
212 , 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 */
374 #ifdef PROVIDE_STABLE
381 /* {write,read,index}ForeignObjArray not provided */
383 #ifdef PROVIDE_PTREQUALITY
384 , i_reallyUnsafePtrEquality
386 #ifdef PROVIDE_COERCE
390 #ifdef PROVIDE_FOREIGN
391 /* ForeignObj# operations */
394 , indexCharOffForeignObj
395 , indexIntOffForeignObj
396 , indexInt64OffForeignObj
397 , indexWordOffForeignObj
398 , indexAddrOffForeignObj
399 , indexFloatOffForeignObj
400 , indexDoubleOffForeignObj
401 , indexStablePtrOffForeignObj
404 /* Weak# operations */
408 /* StablePtr# operations */
413 /* foreign export dynamic support */
414 , i_createAdjThunkARCH
416 /* misc handy hacks */
420 #ifdef PROVIDE_CONCURRENT
421 /* Concurrency operations */
442 /* If you add a new primop to this table, check you don't
443 * overflow the 256 limit. That is MAX_Primop2 <= 255.
444 * Current value (30/10/98) = 0x42
446 , MAX_Primop2 = i_ccall_stdcall_IO
449 typedef unsigned int InstrPtr; /* offset of instruction within BCO */
451 /*-------------------------------------------------------------------------*/