1 /* -*- mode: hugs-c; -*- */
2 /* -----------------------------------------------------------------------------
3 * $Id: Bytecodes.h,v 1.3 1999/02/05 16:02:36 simonm 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 as 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 */
73 #ifdef PROVIDE_INTEGER
108 #ifdef PROVIDE_STABLE
115 , i_PRIMOP1 /* Primop: next byte is an Primop1 */
116 , i_PRIMOP2 /* Primop: next byte is an Primop2 */
118 , MAX_Instr = i_PRIMOP2
122 { i_INTERNAL_ERROR1 /* Instruction 0 raises an internal error */
124 /* Char# operations */
134 /* Int# operations */
159 /* Int64# operations */
194 /* Word# operations */
221 /* Addr# operations */
231 /* Stateless Addr operations */
235 , i_indexInt64OffAddr
243 , i_indexFloatOffAddr
244 , i_indexDoubleOffAddr
245 #ifdef PROVIDE_STABLE
246 , i_indexStableOffAddr
261 , i_readDoubleOffAddr
262 #ifdef PROVIDE_STABLE
263 , i_readStableOffAddr
269 , i_writeInt64OffAddr
277 , i_writeFloatOffAddr
278 , i_writeDoubleOffAddr
279 #ifdef PROVIDE_STABLE
280 , i_writeStableOffAddr
283 #endif /* PROVIDE_ADDR */
285 #ifdef PROVIDE_INTEGER
286 /* Integer operations */
310 /* Float# operations */
347 #ifdef PROVIDE_INTEGER
353 , i_isDenormalizedFloat
354 , i_isNegativeZeroFloat
357 /* Double# operations */
396 #ifdef PROVIDE_INTEGER
402 , i_isDenormalizedDouble
403 , i_isNegativeZeroDouble
406 /* If you add a new primop to this table, check you don't
407 * overflow the 256 limit. That is MAX_Primop1 <= 255.
408 * Current value (30/10/98) = 0xc8
410 , MAX_Primop1 = i_isIEEEDouble
415 { 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 /*-------------------------------------------------------------------------*/