2 /* -----------------------------------------------------------------------------
3 * $Id: Bytecodes.h,v 1.5 1999/03/09 14:51:24 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! */
77 #ifdef PROVIDE_INTEGER
121 #ifdef PROVIDE_STABLE
128 , i_PRIMOP1 /* Primop: next byte is an Primop1 */
129 , i_PRIMOP2 /* Primop: next byte is an Primop2 */
131 , MAX_Instr = i_PRIMOP2
135 { i_INTERNAL_ERROR1 /* Instruction 0 raises an internal error */
140 /* Char# operations */
150 /* Int# operations */
175 /* Int64# operations */
210 /* Word# operations */
237 /* Addr# operations */
247 /* Stateless Addr operations */
251 , i_indexInt64OffAddr
259 , i_indexFloatOffAddr
260 , i_indexDoubleOffAddr
261 #ifdef PROVIDE_STABLE
262 , i_indexStableOffAddr
277 , i_readDoubleOffAddr
278 #ifdef PROVIDE_STABLE
279 , i_readStableOffAddr
285 , i_writeInt64OffAddr
293 , i_writeFloatOffAddr
294 , i_writeDoubleOffAddr
295 #ifdef PROVIDE_STABLE
296 , i_writeStableOffAddr
299 #endif /* PROVIDE_ADDR */
301 #ifdef PROVIDE_INTEGER
302 /* Integer operations */
326 /* Float# operations */
363 #ifdef PROVIDE_INTEGER
369 , i_isDenormalizedFloat
370 , i_isNegativeZeroFloat
373 /* Double# operations */
412 #ifdef PROVIDE_INTEGER
418 , i_isDenormalizedDouble
419 , i_isNegativeZeroDouble
422 /* If you add a new primop to this table, check you don't
423 * overflow the 256 limit. That is MAX_Primop1 <= 255.
424 * Current value (30/10/98) = 0xc8
426 , MAX_Primop1 = i_isIEEEDouble
431 { i_INTERNAL_ERROR2 /* Instruction 0 raises an internal error */
442 /* Prim[Mutable]Array operations */
444 , i_unsafeFreezeArray
453 /* Prim[Mutable]ByteArray operations */
454 , i_sameMutableByteArray
455 , i_unsafeFreezeByteArray
472 /* {write,read,index}IntegerArray not provided */
492 #ifdef PROVIDE_STABLE
498 /* {write,read,index}ForeignObjArray not provided */
500 #endif /* PROVIDE_ARRAY */
502 #ifdef PROVIDE_PTREQUALITY
503 , i_reallyUnsafePtrEquality
505 #ifdef PROVIDE_COERCE
509 #ifdef PROVIDE_FOREIGN
510 /* ForeignObj# operations */
513 , indexCharOffForeignObj
514 , indexIntOffForeignObj
515 , indexInt64OffForeignObj
516 , indexWordOffForeignObj
517 , indexAddrOffForeignObj
518 , indexFloatOffForeignObj
519 , indexDoubleOffForeignObj
520 , indexStablePtrOffForeignObj
523 /* Weak# operations */
527 #ifdef PROVIDE_STABLE
528 /* StablePtr# operations */
534 #ifdef PROVIDE_CONCURRENT
535 /* Concurrency operations */
551 /* If you add a new primop to this table, check you don't
552 * overflow the 256 limit. That is MAX_Primop2 <= 255.
553 * Current value (30/10/98) = 0x42
555 , MAX_Primop2 = i_ccall_IO
558 typedef unsigned int InstrPtr; /* offset of instruction within BCO */
560 /*-------------------------------------------------------------------------*/