X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FBytecodes.h;h=e502b8f06eed8ca53a2a1701dc00c71674ef3591;hb=5e95bdca03203ece2f965551dda1d06980771a81;hp=35220722b032dc13ef60fb17b67f4b9b74a310b8;hpb=9da01c710daee2cd5038afb8fad761cdaf343033;p=ghc-hetmet.git diff --git a/ghc/rts/Bytecodes.h b/ghc/rts/Bytecodes.h index 3522072..e502b8f 100644 --- a/ghc/rts/Bytecodes.h +++ b/ghc/rts/Bytecodes.h @@ -1,6 +1,6 @@ /* ----------------------------------------------------------------------------- - * $Id: Bytecodes.h,v 1.5 1999/03/09 14:51:24 sewardj Exp $ + * $Id: Bytecodes.h,v 1.14 2000/03/20 04:26:24 andy Exp $ * * (c) The GHC Team, 1998-1999 * @@ -23,113 +23,89 @@ * overflowing. * ------------------------------------------------------------------------*/ -typedef enum - { i_INTERNAL_ERROR /* Instruction 0 raises an internal error */ - - , i_PANIC /* irrefutable pattern match failed! */ - - , i_STK_CHECK - - , i_ARG_CHECK - - , i_ALLOC_AP - , i_ALLOC_PAP - , i_ALLOC_CONSTR - , i_MKAP - , i_MKAP_big - , i_MKPAP - , i_PACK - - , i_SLIDE - , i_SLIDE_big - - , i_TEST - , i_UNPACK - - , i_VAR - , i_VAR_big - , i_CONST - , i_CONST_big - , i_ENTER - - , i_RETADDR - , i_RETADDR_big - - , i_VOID - , i_RETURN_GENERIC - - , i_VAR_INT - , i_VAR_INT_big - , i_CONST_INT - , i_CONST_INT_big - , i_RETURN_INT - , i_PACK_INT - , i_UNPACK_INT - , i_TEST_INT - -#ifdef PROVIDE_INT64 - , i_VAR_INT64 - , i_CONST_INT64 - , i_RETURN_INT64 - , i_PACK_INT64 - , i_UNPACK_INT64 -#endif -#ifdef PROVIDE_INTEGER - , i_CONST_INTEGER - , i_CONST_INTEGER_big -#endif -#ifdef PROVIDE_WORD - , i_VAR_WORD - , i_CONST_WORD - , i_RETURN_WORD - , i_PACK_WORD - , i_UNPACK_WORD -#endif -#ifdef PROVIDE_ADDR - , i_VAR_ADDR - , i_VAR_ADDR_big - , i_CONST_ADDR - , i_CONST_ADDR_big - , i_RETURN_ADDR - , i_PACK_ADDR - , i_UNPACK_ADDR -#endif - , i_VAR_CHAR - , i_VAR_CHAR_big - , i_CONST_CHAR - , i_CONST_CHAR_big - , i_RETURN_CHAR - , i_PACK_CHAR - , i_UNPACK_CHAR - - , i_VAR_FLOAT - , i_VAR_FLOAT_big - , i_CONST_FLOAT - , i_CONST_FLOAT_big - , i_RETURN_FLOAT - , i_PACK_FLOAT - , i_UNPACK_FLOAT - - , i_VAR_DOUBLE - , i_VAR_DOUBLE_big - , i_CONST_DOUBLE - , i_CONST_DOUBLE_big - , i_RETURN_DOUBLE - , i_PACK_DOUBLE - , i_UNPACK_DOUBLE - -#ifdef PROVIDE_STABLE - , i_VAR_STABLE - , i_RETURN_STABLE - , i_PACK_STABLE - , i_UNPACK_STABLE -#endif +#define INSTRLIST \ + Ins(i_INTERNAL_ERROR), \ + Ins(i_PANIC), \ + Ins(i_STK_CHECK), \ + Ins(i_STK_CHECK_big), \ + Ins(i_ARG_CHECK), \ + Ins(i_ALLOC_AP), \ + Ins(i_ALLOC_PAP), \ + Ins(i_ALLOC_CONSTR), \ + Ins(i_ALLOC_CONSTR_big), \ + Ins(i_MKAP), \ + Ins(i_MKAP_big), \ + Ins(i_MKPAP), \ + Ins(i_PACK), \ + Ins(i_PACK_big), \ + Ins(i_SLIDE), \ + Ins(i_SLIDE_big), \ + Ins(i_TEST), \ + Ins(i_UNPACK), \ + Ins(i_VAR), \ + Ins(i_VAR_big), \ + Ins(i_CONST), \ + Ins(i_CONST_big), \ + Ins(i_ENTER), \ + Ins(i_RETADDR), \ + Ins(i_RETADDR_big), \ + Ins(i_VOID), \ + Ins(i_VAR_INT), \ + Ins(i_VAR_INT_big), \ + Ins(i_CONST_INT), \ + Ins(i_CONST_INT_big), \ + Ins(i_PACK_INT), \ + Ins(i_UNPACK_INT), \ + Ins(i_TEST_INT), \ + Ins(i_CONST_INTEGER), \ + Ins(i_CONST_INTEGER_big), \ + Ins(i_VAR_WORD), \ + Ins(i_VAR_WORD_big), \ + Ins(i_CONST_WORD), \ + Ins(i_PACK_WORD), \ + Ins(i_UNPACK_WORD), \ + Ins(i_VAR_ADDR), \ + Ins(i_VAR_ADDR_big), \ + Ins(i_CONST_ADDR), \ + Ins(i_CONST_ADDR_big), \ + Ins(i_PACK_ADDR), \ + Ins(i_UNPACK_ADDR), \ + Ins(i_VAR_CHAR), \ + Ins(i_VAR_CHAR_big), \ + Ins(i_CONST_CHAR), \ + Ins(i_CONST_CHAR_big), \ + Ins(i_PACK_CHAR), \ + Ins(i_UNPACK_CHAR), \ + Ins(i_VAR_FLOAT), \ + Ins(i_VAR_FLOAT_big), \ + Ins(i_CONST_FLOAT), \ + Ins(i_CONST_FLOAT_big), \ + Ins(i_PACK_FLOAT), \ + Ins(i_UNPACK_FLOAT), \ + Ins(i_VAR_DOUBLE), \ + Ins(i_VAR_DOUBLE_big), \ + Ins(i_CONST_DOUBLE), \ + Ins(i_CONST_DOUBLE_big), \ + Ins(i_PACK_DOUBLE), \ + Ins(i_UNPACK_DOUBLE), \ + Ins(i_VAR_STABLE), \ + Ins(i_VAR_STABLE_big), \ + Ins(i_PACK_STABLE), \ + Ins(i_UNPACK_STABLE), \ + Ins(i_PRIMOP1), \ + Ins(i_PRIMOP2), \ + Ins(i_RV), \ + Ins(i_RVE), \ + Ins(i_SE), \ + Ins(i_VV) + +#define BIGGEST_OPCODE ((int)(i_VV)) + +#define Ins(x) x +typedef enum { INSTRLIST } Instr; +#undef Ins - , i_PRIMOP1 /* Primop: next byte is an Primop1 */ - , i_PRIMOP2 /* Primop: next byte is an Primop2 */ - , MAX_Instr = i_PRIMOP2 -} Instr; typedef enum { i_INTERNAL_ERROR1 /* Instruction 0 raises an internal error */ @@ -171,42 +147,6 @@ typedef enum , i_shiftRAInt , i_shiftRLInt -#ifdef PROVIDE_INT64 - /* Int64# operations */ - , i_gtInt64 - , i_geInt64 - , i_eqInt64 - , i_neInt64 - , i_ltInt64 - , i_leInt64 - , i_minInt64 - , i_maxInt64 - , i_plusInt64 - , i_minusInt64 - , i_timesInt64 - , i_quotInt64 - , i_remInt64 - , i_quotRemInt64 - , i_negateInt64 - , i_andInt64 - , i_orInt64 - , i_xorInt64 - , i_notInt64 - , i_shiftLInt64 - , i_shiftRAInt64 - , i_shiftRLInt64 - , i_int64ToInt - , i_intToInt64 -#ifdef PROVIDE_WORD - , i_int64ToWord - , i_wordToInt64 -#endif - , i_int64ToFloat - , i_floatToInt64 - , i_int64ToDouble - , i_doubleToInt64 -#endif -#ifdef PROVIDE_WORD /* Word# operations */ , i_gtWord , i_geWord @@ -232,8 +172,7 @@ typedef enum , i_shiftRLWord , i_intToWord , i_wordToInt -#endif -#ifdef PROVIDE_ADDR + /* Addr# operations */ , i_gtAddr , i_geAddr @@ -244,61 +183,35 @@ typedef enum , i_intToAddr , i_addrToInt + /* Stable# operations */ + , i_intToStable + , i_stableToInt + /* Stateless Addr operations */ , i_indexCharOffAddr , i_indexIntOffAddr -#ifdef PROVIDE_INT64 - , i_indexInt64OffAddr -#endif -#ifdef PROVIDE_WORD , i_indexWordOffAddr -#endif -#ifdef PROVIDE_ADDR , i_indexAddrOffAddr -#endif , i_indexFloatOffAddr , i_indexDoubleOffAddr -#ifdef PROVIDE_STABLE , i_indexStableOffAddr -#endif , i_readCharOffAddr , i_readIntOffAddr -#ifdef PROVIDE_INT64 - , i_readInt64OffAddr -#endif -#ifdef PROVIDE_WORD , i_readWordOffAddr -#endif -#ifdef PROVIDE_ADDR , i_readAddrOffAddr -#endif , i_readFloatOffAddr , i_readDoubleOffAddr -#ifdef PROVIDE_STABLE , i_readStableOffAddr -#endif , i_writeCharOffAddr , i_writeIntOffAddr -#ifdef PROVIDE_INT64 - , i_writeInt64OffAddr -#endif -#ifdef PROVIDE_WORD , i_writeWordOffAddr -#endif -#ifdef PROVIDE_ADDR , i_writeAddrOffAddr -#endif , i_writeFloatOffAddr , i_writeDoubleOffAddr -#ifdef PROVIDE_STABLE , i_writeStableOffAddr -#endif -#endif /* PROVIDE_ADDR */ - -#ifdef PROVIDE_INTEGER /* Integer operations */ , i_compareInteger , i_negateInteger @@ -309,19 +222,12 @@ typedef enum , i_divModInteger , i_integerToInt , i_intToInteger -#ifdef PROVIDE_INT64 - , i_integerToInt64 - , i_int64ToInteger -#endif -#ifdef PROVIDE_WORD , i_integerToWord , i_wordToInteger -#endif , i_integerToFloat , i_floatToInteger , i_integerToDouble , i_doubleToInteger -#endif /* Float# operations */ , i_gtFloat @@ -356,14 +262,8 @@ typedef enum , i_coshFloat , i_tanhFloat , i_powerFloat -#ifdef PROVIDE_INT64 - , i_decodeFloatz - , i_encodeFloatz -#endif -#ifdef PROVIDE_INTEGER , i_decodeFloatZ , i_encodeFloatZ -#endif , i_isNaNFloat , i_isInfiniteFloat , i_isDenormalizedFloat @@ -405,14 +305,8 @@ typedef enum , i_coshDouble , i_tanhDouble , i_powerDouble -#ifdef PROVIDE_INT64 - , i_decodeDoublez - , i_encodeDoublez -#endif -#ifdef PROVIDE_INTEGER , i_decodeDoubleZ , i_encodeDoubleZ -#endif , i_isNaNDouble , i_isInfiniteDouble , i_isDenormalizedDouble @@ -432,7 +326,6 @@ typedef enum , i_raise -#ifdef PROVIDE_ARRAY /* Ref operations */ , i_newRef , i_writeRef @@ -463,42 +356,31 @@ typedef enum , i_readIntArray , i_indexIntArray -#ifdef PROVIDE_INT64 - , i_writeInt64Array - , i_readInt64Array - , i_indexInt64Array -#endif - /* {write,read,index}IntegerArray not provided */ -#ifdef PROVIDE_WORD , i_writeWordArray , i_readWordArray , i_indexWordArray -#endif -#ifdef PROVIDE_ADDR , i_writeAddrArray , i_readAddrArray , i_indexAddrArray -#endif , i_writeFloatArray , i_readFloatArray , i_indexFloatArray - , i_writeDoubleArray , i_readDoubleArray , i_indexDoubleArray +#if 0 #ifdef PROVIDE_STABLE , i_writeStableArray , i_readStableArray , i_indexStableArray #endif +#endif /* {write,read,index}ForeignObjArray not provided */ -#endif /* PROVIDE_ARRAY */ - #ifdef PROVIDE_PTREQUALITY , i_reallyUnsafePtrEquality #endif @@ -524,35 +406,47 @@ typedef enum , i_makeWeak , i_deRefWeak #endif -#ifdef PROVIDE_STABLE /* StablePtr# operations */ , i_makeStablePtr , i_deRefStablePtr , i_freeStablePtr -#endif + + /* foreign export dynamic support */ + , i_createAdjThunkARCH + + /* misc handy hacks */ + , i_getArgc + , i_getArgv #ifdef PROVIDE_CONCURRENT /* Concurrency operations */ - , i_fork + , i_forkIO , i_killThread - , i_sameMVar - , i_newMVar - , i_takeMVar - , i_putMVar + , i_raiseInThread , i_delay , i_waitRead , i_waitWrite + , i_yield + , i_getThreadId + , i_cmpThreadIds #endif + , i_sameMVar + , i_newMVar + , i_takeMVar + , i_putMVar + /* CCall! */ - , i_ccall_Id - , i_ccall_IO + , i_ccall_ccall_Id + , i_ccall_ccall_IO + , i_ccall_stdcall_Id + , i_ccall_stdcall_IO /* If you add a new primop to this table, check you don't * overflow the 256 limit. That is MAX_Primop2 <= 255. * Current value (30/10/98) = 0x42 */ - , MAX_Primop2 = i_ccall_IO + , MAX_Primop2 = i_ccall_stdcall_IO } Primop2; typedef unsigned int InstrPtr; /* offset of instruction within BCO */