📄 interpret.h
字号:
"IXOR", /* 0x82 */ \
"LXOR", /* 0x83 */ \
"IINC", /* 0x84 */ \
"I2L", /* 0x85 */ \
"I2F", /* 0x86 */ \
"I2D", /* 0x87 */ \
"L2I", /* 0x88 */ \
"L2F", /* 0x89 */ \
"L2D", /* 0x8A */ \
"F2I", /* 0x8B */ \
"F2L", /* 0x8C */ \
"F2D", /* 0x8D */ \
"D2I", /* 0x8E */ \
"D2L", /* 0x8F */ \
"D2F", /* 0x90 */ \
"I2B", /* 0x91 */ \
"I2C", /* 0x92 */ \
"I2S", /* 0x93 */ \
"LCMP", /* 0x94 */ \
"FCMPL", /* 0x95 */ \
"FCMPG", /* 0x96 */ \
"DCMPL", /* 0x97 */ \
"DCMPG", /* 0x98 */ \
"IFEQ", /* 0x99 */ \
"IFNE", /* 0x9A */ \
"IFLT", /* 0x9B */ \
"IFGE", /* 0x9C */ \
"IFGT", /* 0x9D */ \
"IFLE", /* 0x9E */ \
"IF_ICMPEQ", /* 0x9F */ \
"IF_ICMPNE", /* 0xA0 */ \
"IF_ICMPLT", /* 0xA1 */ \
"IF_ICMPGE", /* 0xA2 */ \
"IF_ICMPGT", /* 0xA3 */ \
"IF_ICMPLE", /* 0xA4 */ \
"IF_ACMPEQ", /* 0xA5 */ \
"IF_ACMPNE", /* 0xA6 */ \
"GOTO", /* 0xA7 */ \
"JSR", /* 0xA8 */ \
"RET", /* 0xA9 */ \
"TABLESWITCH", /* 0xAA */ \
"LOOKUPSWITCH", /* 0xAB */ \
"IRETURN", /* 0xAC */ \
"LRETURN", /* 0xAD */ \
"FRETURN", /* 0xAE */ \
"DRETURN", /* 0xAF */ \
"ARETURN", /* 0xB0 */ \
"RETURN", /* 0xB1 */ \
"GETSTATIC", /* 0xB2 */ \
"PUTSTATIC", /* 0xB3 */ \
"GETFIELD", /* 0xB4 */ \
"PUTFIELD", /* 0xB5 */ \
"INVOKEVIRTUAL", /* 0xB6 */ \
"INVOKESPECIAL", /* 0xB7 */ \
"INVOKESTATIC", /* 0xB8 */ \
"INVOKEINTERFACE", /* 0xB9 */ \
"UNUSED_BA", /* 0xBA */ \
"NEW", /* 0xBB */ \
"NEWARRAY", /* 0xBC */ \
"ANEWARRAY", /* 0xBD */ \
"ARRAYLENGTH", /* 0xBE */ \
"ATHROW", /* 0xBF */ \
"CHECKCAST", /* 0xC0 */ \
"INSTANCEOF", /* 0xC1 */ \
"MONITORENTER", /* 0xC2 */ \
"MONITOREXIT", /* 0xC3 */ \
"WIDE", /* 0xC4 */ \
"MULTIANEWARRAY", /* 0xC5 */ \
"IFNULL", /* 0xC6 */ \
"IFNONNULL", /* 0xC7 */ \
"GOTO_W", /* 0xC8 */ \
"JSR_W", /* 0xC9 */ \
"BREAKPOINT", /* 0xCA */ \
/* Fast bytecodes: */ \
"GETFIELD_FAST", /* 0xCB */ \
"GETFIELDP_FAST", /* 0xCC */ \
"GETFIELD2_FAST", /* 0xCD */ \
"PUTFIELD_FAST", /* 0xCE */ \
"PUTFIELD2_FAST", /* 0xCF */ \
"GETSTATIC_FAST", /* 0xD0 */ \
"GETSTATICP_FAST", /* 0xD1 */ \
"GETSTATIC2_FAST", /* 0xD2 */ \
"PUTSTATIC_FAST", /* 0xD3 */ \
"PUTSTATIC2_FAST", /* 0xD4 */ \
"UNUSED_D5", /* 0xD5 */ \
"INVOKEVIRTUAL_FAST", /* 0xD6 */ \
"INVOKESPECIAL_FAST", /* 0xD7 */ \
"INVOKESTATIC_FAST", /* 0xD8 */ \
"INVOKEINTERFACE_FAST", /* 0xD9 */ \
"NEW_FAST", /* 0xDA */ \
"ANEWARRAY_FAST", /* 0xDB */ \
"MULTIANEWARRAY_FAST", /* 0xDC */ \
"CHECKCAST_FAST", /* 0xDD */ \
"INSTANCEOF_FAST", /* 0xDE */ \
"CUSTOMCODE" /* 0xDF */ }
/*=========================================================================
* Definitions and declarations
*=======================================================================*/
#ifdef CLDC11
#ifndef DOUBLE_REMAINDER
#define DOUBLE_REMAINDER(a,b) fmod(a,b)
#endif
#endif /* CLDC11 */
/*=========================================================================
* Callback function for CUSTOMCODE bytecode
*=======================================================================*/
typedef void (*CustomCodeCallbackFunction)(FRAME_HANDLE exceptionFrame);
/*=========================================================================
* Bytecode interpreter debugging operations
*=======================================================================*/
#if INCLUDEDEBUGCODE
void printRegisterStatus(void);
void printVMstatus(void);
#else
#define printRegisterStatus()
#define printVMstatus()
#endif
#if ENABLEPROFILING
void InstructionProfile(void);
#endif
#ifdef __GNUC__
void fatalSlotError(CONSTANTPOOL, int cpIndex) __attribute__ ((noreturn));
void fatalIcacheMethodError(ICACHE icacheEntry) __attribute__ ((noreturn));
#else
void fatalSlotError(CONSTANTPOOL constantPool, int cpIndex);
void fatalIcacheMethodError(ICACHE icacheEntry);
#endif
#if INCLUDEDEBUGCODE
void TraceMethodEntry(METHOD method, const char *what);
void TraceMethodExit(METHOD method);
#else
#define TraceMethodEntry(method, what) /**/
#define TraceMethodExit(method) /**/
#endif
#if INCLUDEDEBUGCODE
void InstructionTrace(BYTE *traceip);
#endif
#if ENABLEPROFILING && ENABLEFASTBYTECODES
#define IncrInlineCacheHitCounter() { InlineCacheHitCounter++; }
#define IncrInlineCacheMissCounter() { InlineCacheMissCounter++; }
#else
#define IncrInlineCacheHitCounter() /**/
#define IncrInlineCacheMissCounter() /**/
#endif
/*=========================================================================
* Macros for data alignment
*=======================================================================*/
#if NEED_LONG_ALIGNMENT
/* Don't consider stack up to down issue */
#define GET_LONG(_addr) ( ((tdub).x[0] = ((long*)(_addr))[0]), \
((tdub).x[1] = ((long*)(_addr))[1]), \
(tdub).l )
#define GET_ULONG(_addr) ( ((tdub).x[0] = ((long*)(_addr))[0]), \
((tdub).x[1] = ((long*)(_addr))[1]), \
(tdub).ul )
#define SET_LONG( _addr, _v) ( (tdub).l = (_v), \
((long*)(_addr))[0] = (tdub).x[0], \
((long*)(_addr))[1] = (tdub).x[1] )
#define SET_ULONG( _addr, _v) ( (tdub).ul = (_v), \
((long*)(_addr))[0] = (tdub).x[0], \
((long*)(_addr))[1] = (tdub).x[1] )
#define COPY_LONG(_new, _old) ( ((long*)(_new))[0] = ((long*)(_old))[0], \
((long*)(_new))[1] = ((long*)(_old))[1] )
#else
#define GET_LONG(_addr) (*(long64*)(_addr))
#define GET_ULONG(_addr) (*(ulong64*)(_addr))
#define SET_LONG(_addr, _v) (*(long64*)(_addr) = (_v))
#define SET_ULONG(_addr, _v) (*(ulong64*)(_addr) = (_v))
#define COPY_LONG(_new, _old) (*(long64*)(_new) = *(long64*)(_old))
#endif /* NEED_LONG_ALIGNMENT */
/* If double's must be aligned on doubleword boundaries then define this */
#if NEED_DOUBLE_ALIGNMENT
#define GET_DOUBLE(_addr) ( ((tdub).x[0] = ((long*)(_addr))[0]), \
((tdub).x[1] = ((long*)(_addr))[1]), \
(tdub).d )
#define SET_DOUBLE( _addr, _v) ( (tdub).d = (_v), \
((long*)(_addr))[0] = (tdub).x[0], \
((long*)(_addr))[1] = (tdub).x[1] )
#define COPY_DOUBLE(_new, _old) ( ((long*)(_new))[0] = ((long*)(_old))[0], \
((long*)(_new))[1] = ((long*)(_old))[1] )
#else
#define GET_DOUBLE(_addr) (*(double*)(_addr))
#define SET_DOUBLE(_addr, _v) (*(double*)(_addr) = (_v))
#define COPY_DOUBLE(_new, _old) (*(double*)(_new) = *(double*)(_old))
#endif /* NEED_DOUBLE_ALIGNMENT */
/* Macros for handling endianness of the hardware architecture properly */
#if LITTLE_ENDIAN
# define SET_LONG_FROM_HALVES(_addr, _hi, _lo) \
(((long *)_addr)[0] = (_lo), ((long *)_addr)[1] = (_hi))
#elif BIG_ENDIAN
# define SET_LONG_FROM_HALVES(_addr, _hi, _lo) \
(((long *)_addr)[0] = (_hi), ((long *)_addr)[1] = (_lo))
#elif COMPILER_SUPPORTS_LONG
# if NEED_LONG_ALIGNMENT
# define SET_LONG_FROM_HALVES(_addr, _hi, _lo) \
do { long64 _tmp = ((((long64)_hi)<<32) | ((unsigned long)_lo)); \
COPY_LONG(_addr, &_tmp); } while(0)
# else
# define SET_LONG_FROM_HALVES(_addr, _hi, _lo) \
(*(long64 *)(_addr) = ((((long64)_hi)<<32) | ((unsigned long)_lo)))
# endif
#else
# error "You must define LITTLE_ENDIAN or BIG_ENDIAN"
#endif
/* Macros for popping and pushing 64-bit numbers from/to operand stack */
#if UPTODOWNSTACK
#define popDouble(_lval) (COPY_DOUBLE(&_lval, getSP()), lessStack(2))
#define popLong(_lval) (COPY_LONG(&_lval, getSP()), lessStack(2))
#define popLongAddr(_lval) (COPY_LONG(_lval, getSP()), lessStack(2))
#define popLongVal(_lval) (GET_LONG(_val, getSP()), lessStack(2))
#define pushDouble(_lval) (moreStack(2), COPY_DOUBLE(getSP(), &_lval))
#define pushLong(_lval) (moreStack(2), COPY_LONG(getSP(), &_lval))
#define pushLongAddr(_lval) (moreStack(2), COPY_LONG(getSP(), _lval))
#define pushLongVal(_lval) (moreStack(2), SET_LONG(getSP(), _lval))
/*=========================================================================
* The equivalent macros to the above for use when the stack being
* manipulated is not for the currently executing thread. In all cases
* the additional parameter is the THREAD pointer.
*=======================================================================*/
#define popDoubleForThread( t, _lval) (COPY_DOUBLE(&_lval, spForThread(t)), lessStackForThread(t, 2))
#define popLongForThread( t, _lval) (COPY_LONG( &_lval, spForThread(t)), lessStackForThread(t, 2))
#define pushDoubleForThread(t, _lval) (moreStackForThread(t, 2), COPY_DOUBLE(spForThread(t), &_lval))
#define pushLongForThread( t, _lval) (moreStackForThread(t, 2), COPY_LONG( spForThread(t), &_lval))
#else
#define popDouble(_lval) (oneLess, COPY_DOUBLE(&_lval, getSP()), oneLess)
#define popLong(_lval) (oneLess, COPY_LONG(&_lval, getSP()), oneLess)
#define popLongAddr(_lval) (oneLess, COPY_LONG(_lval, getSP()), oneLess)
#define popLongVal(_lval) (oneLess, GET_LONG(_val, getSP()), oneLess)
#define pushDouble(_lval) (oneMore, COPY_DOUBLE(getSP(), &_lval), oneMore)
#define pushLong(_lval) (oneMore, COPY_LONG(getSP(), &_lval), oneMore)
#define pushLongAddr(_lval) (oneMore, COPY_LONG(getSP(), _lval), oneMore)
#define pushLongVal(_lval) (oneMore, SET_LONG(getSP(), _lval), oneMore)
/*=========================================================================
* The equivalent macros to the above for use when the stack being
* manipulated is not for the currently executing thread. In all cases
* the additional parameter is the THREAD pointer.
*=======================================================================*/
#define popDoubleForThread( t, _lval) (oneLessForThread(t), COPY_DOUBLE(&_lval, spForThread(t)), oneLessForThread(t))
#define popLongForThread( t, _lval) (oneLessForThread(t), COPY_LONG( &_lval, spForThread(t)), oneLessForThread(t))
#define pushDoubleForThread(t, _lval) (oneMoreForThread(t), COPY_DOUBLE(spForThread(t), &_lval), oneMoreForThread(t))
#define pushLongForThread( t, _lval) (oneMoreForThread(t), COPY_LONG( spForThread(t), &_lval), oneMoreForThread(t))
#endif /* end of #if UPTODOWNSTACK */
/*=========================================================================
* Bytecode interpreter operations
*=======================================================================*/
void SlowInterpret(ByteCode token);
void FastInterpret(void);
void Interpret(void);
#endif /* _INTERPRET_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -