2 /* -----------------------------------------------------------------------------
3 * $Id: Bytecodes.h,v 1.4 1999/03/01 14:47:07 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 { i_INTERNAL_ERROR /* Instruction 0 raises an internal error */
29 , i_PANIC /* irrefutable pattern match failed! */
50 , i_CONST2 /* 16 bit offsets - ad-hoc fix for general problem */
72 #ifdef PROVIDE_INTEGER
107 #ifdef PROVIDE_STABLE
114 , i_PRIMOP1 /* Primop: next byte is an Primop1 */
115 , i_PRIMOP2 /* Primop: next byte is an Primop2 */
117 , MAX_Instr = i_PRIMOP2
121 { i_INTERNAL_ERROR1 /* Instruction 0 raises an internal error */
126 /* Char# operations */
136 /* Int# operations */
161 /* Int64# operations */
196 /* Word# operations */
223 /* Addr# operations */
233 /* Stateless Addr operations */
237 , i_indexInt64OffAddr
245 , i_indexFloatOffAddr
246 , i_indexDoubleOffAddr
247 #ifdef PROVIDE_STABLE
248 , i_indexStableOffAddr
263 , i_readDoubleOffAddr
264 #ifdef PROVIDE_STABLE
265 , i_readStableOffAddr
271 , i_writeInt64OffAddr
279 , i_writeFloatOffAddr
280 , i_writeDoubleOffAddr
281 #ifdef PROVIDE_STABLE
282 , i_writeStableOffAddr
285 #endif /* PROVIDE_ADDR */
287 #ifdef PROVIDE_INTEGER
288 /* Integer operations */
312 /* Float# operations */
349 #ifdef PROVIDE_INTEGER
355 , i_isDenormalizedFloat
356 , i_isNegativeZeroFloat
359 /* Double# operations */
398 #ifdef PROVIDE_INTEGER
404 , i_isDenormalizedDouble
405 , i_isNegativeZeroDouble
408 /* If you add a new primop to this table, check you don't
409 * overflow the 256 limit. That is MAX_Primop1 <= 255.
410 * Current value (30/10/98) = 0xc8
412 , MAX_Primop1 = i_isIEEEDouble
417 { i_INTERNAL_ERROR2 /* Instruction 0 raises an internal error */
428 /* Prim[Mutable]Array operations */
430 , i_unsafeFreezeArray
439 /* Prim[Mutable]ByteArray operations */
440 , i_sameMutableByteArray
441 , i_unsafeFreezeByteArray
458 /* {write,read,index}IntegerArray not provided */
478 #ifdef PROVIDE_STABLE
484 /* {write,read,index}ForeignObjArray not provided */
486 #endif /* PROVIDE_ARRAY */
488 #ifdef PROVIDE_PTREQUALITY
489 , i_reallyUnsafePtrEquality
491 #ifdef PROVIDE_COERCE
495 #ifdef PROVIDE_FOREIGN
496 /* ForeignObj# operations */
499 , indexCharOffForeignObj
500 , indexIntOffForeignObj
501 , indexInt64OffForeignObj
502 , indexWordOffForeignObj
503 , indexAddrOffForeignObj
504 , indexFloatOffForeignObj
505 , indexDoubleOffForeignObj
506 , indexStablePtrOffForeignObj
509 /* Weak# operations */
513 #ifdef PROVIDE_STABLE
514 /* StablePtr# operations */
520 #ifdef PROVIDE_CONCURRENT
521 /* Concurrency operations */
537 /* If you add a new primop to this table, check you don't
538 * overflow the 256 limit. That is MAX_Primop2 <= 255.
539 * Current value (30/10/98) = 0x42
541 , MAX_Primop2 = i_ccall_IO
544 typedef unsigned int InstrPtr; /* offset of instruction within BCO */
546 /*-------------------------------------------------------------------------*/