📄 execute.h
字号:
*=======================================================================*/
#define CALL_STATIC_METHOD { \
goto callMethod_static; \
}
/*=========================================================================
* CALL_SPECIAL_METHOD - Branch to common code for Invokespecial
*=======================================================================*/
#define CALL_SPECIAL_METHOD { \
goto callMethod_special; \
}
/*=========================================================================
* CALL_INTERFACE_METHOD - Branch to common code for Invokeinterface
*=======================================================================*/
#define CALL_INTERFACE_METHOD { \
goto callMethod_interface; \
}
/*=========================================================================
* CHECK_NOT_NULL - Throw an exception of an object is null
*
* Use the following macro to place null checks where a NullPointerException
* should be thrown (e.g. invoking a virtual method on a null object).
* As this macro executes a continue statement, it must only be used where
* the continue will effect a jump to the start of the interpreter loop.
*=======================================================================*/
#define CHECK_NOT_NULL(object) \
if (object == NIL) { \
goto handleNullPointerException; \
}
/*=========================================================================
* TRACE_METHOD_ENTRY - Macro for tracing
*=======================================================================*/
#if INCLUDEDEBUGCODE
#define TRACE_METHOD_ENTRY(method, what) { \
ASSERTING_NO_ALLOCATION \
if (tracemethodcallsverbose) Log->enterMethod(method, what); \
END_ASSERTING_NO_ALLOCATION \
}
#else
#define TRACE_METHOD_ENTRY(method, what) /**/
#endif
/*=========================================================================
* TRACE_METHOD_EXIT - Macro for tracing
*=======================================================================*/
#if INCLUDEDEBUGCODE
#define TRACE_METHOD_EXIT(method) { \
ASSERTING_NO_ALLOCATION \
if (tracemethodcallsverbose) Log->exitMethod(method); \
END_ASSERTING_NO_ALLOCATION \
}
#else
#define TRACE_METHOD_EXIT(method) /**/
#endif
/*=========================================================================
* POP_FRAME - Macro to pop a stack frame
*=======================================================================*/
#if INCLUDEDEBUGCODE
#define POP_FRAME { \
VMSAVE \
popFrame(); \
VMRESTORE \
}
#else
#define POP_FRAME POPFRAMEMACRO
#endif
/*=========================================================================
* ASMROUTINE - Entry to execute the in-assembly interpreter
*=======================================================================*/
#if ASMBYTECODE
#define ASMROUTINE(x) case x: { \
VMSAVE \
ASMInterpret(); \
VMRESTORE \
goto next0;}
#endif /* end of #if ASMBYTECODE */
/*=========================================================================
* INFREQUENTROUTINE - Have bytecode executed by the infrequent routine
*=======================================================================*/
#if SPLITINFREQUENTBYTECODES
#define INFREQUENTROUTINE(x) case x: { goto callSlowInterpret; }
#else
#define INFREQUENTROUTINE(x) /**/
#endif
/*=========================================================================
* INSTRUCTIONPROFILE - Instruction profiling
*=======================================================================*/
#if ENABLEPROFILING
#define INSTRUCTIONPROFILE { \
VMSAVE \
InstructionProfile(); \
VMRESTORE \
}
#else
#define INSTRUCTIONPROFILE /**/
#endif
/*=========================================================================
* INSTRUCTIONTRACE - Instruction tracing
*=======================================================================*/
#if INCLUDEDEBUGCODE
#define INSTRUCTIONTRACE { \
VMSAVE \
if (tracebytecodes) InstructionTrace(ip_global);\
VMRESTORE \
}
#else
#define INSTRUCTIONTRACE /**/
#endif
/*=========================================================================
* RESCHEDULE - Thread rescheduling
*=======================================================================*/
#if ENABLE_JAVA_DEBUGGER
#define __getNextToken() \
if (CurrentThread->isAtBreakpoint) { \
CurrentThread->isAtBreakpoint = FALSE; \
token = CurrentThread->nextOpcode; \
} else \
token = *ip;
#define __doSingleStep() \
if (CurrentThread && CurrentThread->isStepping) { \
THREAD __thread__ = CurrentThread; \
THREAD __tp__; \
VMSAVE \
if (handleSingleStep(__thread__, &__tp__)) { \
__tp__->isAtBreakpoint = TRUE; \
__tp__->nextOpcode = token; \
VMRESTORE \
goto reschedulePoint; \
} \
VMRESTORE \
}
#define __checkDebugEvent() \
if (vmDebugReady && CurrentThread && CurrentThread->needEvent) { \
checkDebugEvent(CurrentThread); \
}
/* This routine/macro is called from inside the interpreter */
/* to check if it is time to perform thread switching and */
/* possibly to check for external events. This routine is */
/* very performance critical! Most of the function calls */
/* inside this macro definition turn into null statements */
/* in production builds when debugger support is turned off */
extern void GPIO_WriteIO(char data, char port);
#define RESCHEDULE { \
INC_RESHED \
checkRescheduleValid(); \
if (isTimeToReschedule()) { \
VMSAVE \
__checkDebugEvent() \
reschedule(); \
VMRESTORE \
} \
if (vmDebugReady && CurrentThread) { \
__getNextToken() \
__doSingleStep() \
} else \
token = *ip; \
}
#else
/* This routine/macro is called from inside the interpreter */
/* to check if it is time to perform thread switching and */
/* possibly to check for external events. This routine is */
/* very performance critical! Most of the function calls */
/* inside this macro definition turn into null statements */
/* in production builds when debugger support is turned off */
#define RESCHEDULE { \
INC_RESHED \
checkRescheduleValid(); \
if (isTimeToReschedule()) { \
VMSAVE \
reschedule(); \
VMRESTORE \
} \
}
#endif /* ENABLE_JAVA_DEBUGGER */
/*=========================================================================
* BRANCHIF - Macro to cause a branch if a condition is true
*=======================================================================*/
#if COMMONBRANCHING
#define BRANCHIF(cond) { if(cond) { goto branchPoint; } else { goto next3; } }
#else
#define BRANCHIF(cond) { ip += (cond) ? getShort(ip + 1) : 3; goto reschedulePoint; }
#endif
/*=========================================================================
* NOTIMPLEMENTED - Macro to pad out the jump table as an option
*=======================================================================*/
#if PADTABLE
#define NOTIMPLEMENTED(x) case x: { goto notImplemented; }
#else
#define NOTIMPLEMENTED(x) /**/
#endif
/*=========================================================================
* CLEAR - Zero a variable for safety only
*=======================================================================*/
#if INCLUDEDEBUGCODE
#define CLEAR(x) { (x) = 0; }
#else
#define CLEAR(x) /**/
#endif
/*=========================================================================
* SAVEIP/RESTOREIP - Macros to spill and load the ip machine register
*=======================================================================*/
#if IPISLOCAL
#define SAVEIP ip_global = ip; CLEAR(ip);
#define RESTOREIP ip = ip_global; CLEAR(ip_global);
#else
#define SAVEIP /**/
#define RESTOREIP /**/
#endif
/*=========================================================================
* SAVEFP/RESTOREFP - Macros to spill and load the fp machine register
*=======================================================================*/
#if FPISLOCAL
#define SAVEFP fp_global = fp; CLEAR(fp);
#define RESTOREFP fp = fp_global; CLEAR(fp_global);
#else
#define SAVEFP /**/
#define RESTOREFP /**/
#endif
/*=========================================================================
* SAVESP/RESTORESP - Macros to spill and load the sp machine register
*=======================================================================*/
#if SPISLOCAL
#define SAVESP sp_global = sp; CLEAR(sp);
#define RESTORESP sp = sp_global; CLEAR(sp_global);
#else
#define SAVESP /**/
#define RESTORESP /**/
#endif
/*=========================================================================
* SAVELP/RESTORELP - Macros to spill and load the lp machine register
*=======================================================================*/
#if LPISLOCAL
#define SAVELP lp_global = lp; CLEAR(lp);
#define RESTORELP lp = lp_global; CLEAR(lp_global);
#else
#define SAVELP /**/
#define RESTORELP /**/
#endif
/*=========================================================================
* SAVECP/RESTORECP - Macros to spill and load the cp machine register
*=======================================================================*/
#if CPISLOCAL
#define SAVECP cp_global = cp; CLEAR(cp);
#define RESTORECP cp = cp_global; CLEAR(cp_global);
#else
#define SAVECP /**/
#define RESTORECP /**/
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -