⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 executejava_split2.c

📁 This is a resource based on j2me embedded,if you dont understand,you can connection with me .
💻 C
📖 第 1 页 / 共 5 页
字号:
#else#define JVMTI_SINGLE_STEPPING(opc)#define JVMTI_WATCHING_FIELD_ACCESS(location)#define JVMTI_WATCHING_FIELD_MODIFICATION(location, isDoubleWord, isRef)#endif#ifdef CVM_JVMPI#define JVMPI_CHECK_FOR_DATA_DUMP_REQUEST(ee) \    if (CVMjvmpiDataDumpWasRequested()) {     \        DECACHE_PC(frame);                    \        DECACHE_TOS(frame);                   \        CVMD_gcSafeExec(ee, {                 \            CVMjvmpiPostDataDumpRequest();    \        });                                   \    }#else#define JVMPI_CHECK_FOR_DATA_DUMP_REQUEST(ee)#endif/* NOTE: About JVMPI bytecode tracing:    JVMPI bytecode tracing is only supported if CVM is built with    CVM_JVMPI_TRACE_INSTRUCTION=true.  Otherwise, the JVMPI trace macros will    be #defined out.    JVMPI Trace Macros:    ==================    Some JVMPI bytecode trace events require additional information.  These    special cases are handled by posting the event using special macros as    follows:        1. JVMPI_TRACE_IF() for condition "if" bytecodes.        2. JVMPI_TRACE_TABLESWITCH() fot the tableswitch bytecode.        3. JVMPI_TRACE_LOOKUPSWITCH() for the lookupswitch bytecode.    For everything else, the generic JVMPI_TRACE_INSTRUCTION macro is used to    post the JVMPI bytecode trace event.    Embedding calls to the trace macros:    ===================================    In most cases, a call to JVMPI_TRACE_INSTRUCTION() is embedded in the CASE()    macro.  This ensures that the JVMPI event is posted before the bytecode is    executed.  This gets around complications with dealing with exceptions that    may be thrown before the bytecode executes completely.    However, allowance is made for some special cases for which posting the    generic trace event from within the CASE() macro is inadequate.  For these    cases, the CASE_NT() macro (NT stands for "No Trace") is introduced.  The    CASE_NT() macro behaves exactly like the CASE() macro with the exception of    not calling JVMPI_TRACE_INSTRUCTION().  The special cases where the    CASE_NT() macro is used are as follows:        1. The bytecodes which require additional information in their JVMPI           trace events as outlined above.  The opcode's handler will be           responsible for calling the appropriate macro (JVMPI_TRACE_IF(),           JVMPI_TRACE_TABLESWITCH(), or JVMPI_TRACE_LOOKUPSWITCH()) to post           the event with the appropriate information.        2. Bytecodes which are interpreted by the same handler.  For           example,                CASE_NT(opc_1)                CASE_NT(opc_2)                CASE_NT(opc_3)                CASE(opc_4)                    ... // Execute bytecode.            Note opc1, opc2, and opc3 did not need to call            JVMPI_TRACE_INSTRUCTION() because opc4 will call it on their behalf.        3. Bytecode handlers which fall through to another bytecode handler.           For example,                CASE_NT(opc5)                    ... // Execute part of bytecode functionality.                    // Fall through to opc6 below.                CASE(opc6)                    ... // Execute some more functionality.            Note opc5 did not need to call JVMPI_TRACE_INSTRUCTION() because            opc6 will call it on its behalf.  This is only used where opc5            will always fall through to opc6.  If opc5 could end up branching            elsewhere (perhaps due to an exception being thrown), then other            special treatment should be applied.        4. Bytecodes which will be quickened.  These don't need to call           JVMPI_TRACE_INSTRUCTION() because their quicken formed will be           executed after the bytecode is quickened.  The quickened bytecode           will call JVMPI_TRACE_INSTRUCTION().        5. Bytecodes which need to check if a static initializer has run.           The call to JVMPI_TRACE_INSTRUCTION() should happen after the check           to see if the static initializer has already been called.  This is           because if static initialization is needed, the first attempt to           execute the bytecode will fail, and the bytecode will be executed           a second time after the static initializer has been called.  We only           want to post the JVMPI trace event once.  Hence the call to           JVMPI_TRACE_INSTRUCTION() is done in the INIT_CLASS_IF_NEEDED()           macro only after the static initializer has been executed.*/#ifdef CVM_JVMPI_TRACE_INSTRUCTION/* The following macros are for posting the JVMPI_EVENT_INSTRUCTION_START * event for JVMPI support of tracing bytecode execution: */#define JVMPI_TRACE_INSTRUCTION() {                     \    if (CVMjvmpiEventInstructionStartIsEnabled()) {     \        DECACHE_PC(frame);                              \        DECACHE_TOS(frame);                             \        CVMjvmpiPostInstructionStartEvent(ee, pc);      \    }                                                   \}#define JVMPI_TRACE_IF(isTrue) {                                \    if (CVMjvmpiEventInstructionStartIsEnabled()) {             \        DECACHE_PC(frame);                                      \        DECACHE_TOS(frame);                                     \        CVMjvmpiPostInstructionStartEvent4If(ee, pc, isTrue);   \    }                                                           \}#define JVMPI_TRACE_TABLESWITCH(key, low, hi) {                      \    if (CVMjvmpiEventInstructionStartIsEnabled()) {                  \        DECACHE_PC(frame);                                           \        DECACHE_TOS(frame);                                          \        CVMjvmpiPostInstructionStartEvent4Tableswitch(ee, pc, key,   \                                                      low, hi);      \    }                                                                \}#define JVMPI_TRACE_LOOKUPSWITCH(chosenPairIndex, pairsTotal) { \    if (CVMjvmpiEventInstructionStartIsEnabled()) {             \        DECACHE_PC(frame);                                      \        DECACHE_TOS(frame);                                     \        CVMjvmpiPostInstructionStartEvent4Lookupswitch(ee, pc,  \                                chosenPairIndex, pairsTotal);   \    }                                                           \}#else /* !CVM_JVMPI_TRACE_INSTRUCTION */#define JVMPI_TRACE_INSTRUCTION()#define JVMPI_TRACE_IF(isTrue)#define JVMPI_TRACE_TABLESWITCH(key, low, hi)#define JVMPI_TRACE_LOOKUPSWITCH(chosenPairIndex, pairsTotal)#endif /* CVM_JVMPI_TRACE_INSTRUCTION *//* * GCC macro for adding an assembler label so the .s file is easier to read. */#undef ASMLABEL#if defined(__GNUC__) && defined(CVM_GENERATE_ASM_LABELS)#define ASMLABEL(name) \    __asm__ __volatile__ (".LL_" #name ":");#else#define ASMLABEL(name)#endif/* * Macro for setting up an opcode case or goto label. */#undef PRIVATE_CASE#ifdef CVM_USELABELS#define PRIVATE_CASE(opcode_, jvmpiAction_)     \    opcode_:                                    \    ASMLABEL(opcode_);                          \    jvmpiAction_;#define DEFAULT					\    opc_DEFAULT:				\    ASMLABEL(opc_DEFAULT);#else#define PRIVATE_CASE(opcode_, jvmpiAction_)     \    case opcode_:                               \    ASMLABEL(opcode_);                          \    jvmpiAction_;#define DEFAULT					\    default:					\    ASMLABEL(opc_DEFAULT);#endif#undef CASE#define CASE(opcname)                           \    PRIVATE_CASE(opcname, {                     \        JVMPI_TRACE_INSTRUCTION();              \    })/* CASE_NT (no trace), in contrast with the CASE() macro, does not post a * JVMPI_EVENT_INSTRUCTION_START event.  This is used where special handling * is needed to post the JVMPI event, or when the case falls through to * another case immediately below it which will post the event. */#undef CASE_NT#define CASE_NT(opcname)                         \    PRIVATE_CASE(opcname, {})/* * CONTINUE - Macro for executing the next opcode. */#undef CONTINUE#ifdef CVM_USELABELS#define CONTINUE_NEXT(opc)			\	UPDATE_INSTRUCTION_COUNT(opc);		\        JVMTI_SINGLE_STEPPING(opc);		\	goto *nextLabel;#define CONTINUE {					\        CVMUint32 opcode = *pc;				\        const void* nextLabel = opclabels[opcode];	\        CONTINUE_NEXT(opcode);				\    }#else#ifdef CVM_PREFETCH_OPCODE#define CONTINUE_NEXT(opc)			\	UPDATE_INSTRUCTION_COUNT(opc);		\        JVMTI_SINGLE_STEPPING(opc);		\	continue;#define CONTINUE {				\        opcode = *pc; 				\        CONTINUE_NEXT(opcode);			\    }#else#define CONTINUE_NEXT(opc)			\	UPDATE_INSTRUCTION_COUNT(opc);		\        JVMTI_SINGLE_STEPPING(opc);		\	continue;#define CONTINUE {				\        CONTINUE_NEXT(opcode);			\    }#endif#endif/* * REEXECUTE_CURRENT_BYTECODE - Macro for reexecuting the opcode. */#undef REEXECUTE_BYTECODE#ifdef CVM_USELABELS#define REEXECUTE_BYTECODE(opc) {		\	goto *opclabels[(opc)];			\    }#else#ifdef CVM_PREFETCH_OPCODE#define REEXECUTE_BYTECODE(opc) {		\        opcode = (opc); 			\	goto skip_prefetch;			\    }#else#define REEXECUTE_BYTECODE(opc) {		\        opcode = (opc);				\	goto skip_prefetch;			\    }#endif#endif#ifdef CVM_USELABELS#define OPCODE_INTRO_DECL					\    CVMUint32 opcode;						\    const void* nextLabel;#define OPCODE_UPDATE_NEXT(opc)					\    nextLabel = opclabels[(opc)]#else#define OPCODE_INTRO_DECL#define OPCODE_UPDATE_NEXT(opc)#endif/* * This is for prefetching the next opcode */#ifdef CVM_PREFETCH_OPCODE#define OPCODE_UPDATE_NEW(opc)     opcode = (opc)#else#define OPCODE_UPDATE_NEW(opc)#endif/* * UPDATE_PC_AND_TOS - Macro for updating the pc and topOfStack. */#undef UPDATE_PC_AND_TOS#define UPDATE_PC_AND_TOS(opsize, stack) \    {pc += opsize; topOfStack += stack;}/* * CHECK_PENDING_REQUESTS - Macro for checking pending requests which need * to be checked periodically in the interpreter loop. */#undef CHECK_PENDING_REQUESTS#ifdef CVM_REMOTE_EXCEPTIONS_SUPPORTED/* %comment h001 */#define CHECK_PENDING_REQUESTS(ee) \	(CVMD_gcSafeCheckRequest(ee) || CVMremoteExceptionOccurred(ee))#else#define CHECK_PENDING_REQUESTS(ee) \	(CVMD_gcSafeCheckRequest(ee))#endif/* * UPDATE_PC_AND_TOS_AND_CONTINUE - Macro for updating the pc and topOfStack, * and executing the next opcode. It's somewhat similar to the combination * of UPDATE_PC_AND_TOS and CONTINUE, but with some minor optimizations. */#undef UPDATE_PC_AND_TOS_AND_CONTINUE_WORK#define UPDATE_PC_AND_TOS_AND_CONTINUE_WORK(opsize, stack, doPendingCheck) {\        OPCODE_INTRO_DECL					\        /* 							\         * Offer a GC-safe point. The current frame is always up\         * to date, so don't worry about de-caching frame.  	\         */							\	if ((doPendingCheck) && CHECK_PENDING_REQUESTS(ee)) {	\            goto handle_pending_request;			\        }							\        JVMPI_CHECK_FOR_DATA_DUMP_REQUEST(ee);                  \        OPCODE_UPDATE_NEW(pc[opsize]);			        \        OPCODE_UPDATE_NEXT(opcode);				\        UPDATE_PC_AND_TOS(opsize, stack);			\        CONTINUE_NEXT(opcode);					\    }#undef UPDATE_PC_AND_TOS_AND_CONTINUE#define UPDATE_PC_AND_TOS_AND_CONTINUE(opsize, stack) \    UPDATE_PC_AND_TOS_AND_CONTINUE_WORK((opsize), (stack), CVM_FALSE)/* * For those opcodes that need to have a GC point */#undef UPDATE_PC_AND_TOS_AND_CONTINUE_WITH_GC_CHECK#define UPDATE_PC_AND_TOS_AND_CONTINUE_WITH_GC_CHECK(skip, stack) \    UPDATE_PC_AND_TOS_AND_CONTINUE_WORK((skip), (stack), CVM_TRUE)#undef UPDATE_PC_AND_TOS_AND_CONTINUE_WITH_BACKWARDS_CHECK#define UPDATE_PC_AND_TOS_AND_CONTINUE_WITH_BACKWARDS_CHECK(skip, stack) \    UPDATE_PC_AND_TOS_AND_CONTINUE_WORK((skip), (stack), ((skip) <= 0))/* * Macros for accessing the stack. */#undef STACK_INFO#undef STACK_INT#undef STACK_FLOAT#undef STACK_ICELL#undef STACK_ADDR#undef STACK_OBJECT#undef STACK_DOUBLE#undef STACK_LONG#define STACK_SLOT(offset)    (topOfStack[offset].s)#define STACK_INFO(offset)    (STACK_SLOT(offset).j)#define STACK_ADDR(offset)    (STACK_SLOT(offset).a)#define STACK_INT(offset)     (STACK_INFO(offset).i)#define STACK_FLOAT(offset)   (STACK_INFO(offset).f)#define STACK_ICELL(offset)   (STACK_INFO(offset).r)#define STACK_OBJECT(offset)  (CVMID_icellDirect(ee, &STACK_ICELL(offset)))#define STACK_DOUBLE(offset) \        CVMjvm2Double(&STACK_INFO(offset).raw)#define STACK_LONG(offset)   \        CVMjvm2Long(&STACK_INFO(offset).raw)#ifdef CVM_TRACE#undef GET_LONGCSTRING#define GET_LONGCSTRING(number) \        (CVMlong2String(number, trBuf, trBuf+sizeof(trBuf)), trBuf)#endif/* * Macros for caching and flushing the interpreter state. Some local * variables need to be flushed out to the frame before we do certain * things (like pushing frames or becomming gc safe) and some need to  * be recached later (like after popping a frame). We could use one * macro to cache or decache everything, but this would be less then * optimal because we don't always need to cache or decache everything * because some things we know are already cached or decached. */#undef DECACHE_TOS#undef CACHE_TOS#undef CACHE_PREV_TOS#define DECACHE_TOS(frame)    {					\    (frame)->topOfStack = topOfStack;				\}#define CACHE_TOS(frame)    {					\    topOfStack = (frame)->topOfStack;				\}#define CACHE_PREV_TOS(frame) topOfStack = CVMframePrev(frame)->topOfStack;#undef DECACHE_PC#undef CACHE_PC#define DECACHE_PC(frame)	{				\    CVMframePc((frame)) = pc;					\}#define CACHE_PC(frame)	{					\    pc = CVMframePc((frame));					\}/* * CHECK_NULL - Macro for throwing a NullPointerException if the object * passed is a null ref. */#undef CHECK_NULL#define CHECK_NULL(obj_) 				\    if ((obj_) == NULL) {   				\        goto throwNullPointerException;			\    }/* * CVMgcUnsafeExecuteJavaMethod * * The real deal. This is where byte codes actually get interpreted. * Basically it's a big while loop that iterates until we return from * the method passed in.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -