src/share/vm/interpreter/bytecodeInterpreter.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6791168 Sdiff src/share/vm/interpreter

src/share/vm/interpreter/bytecodeInterpreter.cpp

Print this page




 146           CACHE_STATE();                                                         \
 147           if (THREAD->pop_frame_pending() &&                                     \
 148               !THREAD->pop_frame_in_process()) {                                 \
 149             goto handle_Pop_Frame;                                               \
 150           }                                                                      \
 151           opcode = *pc;                                                          \
 152         }                                                                        \
 153       }                                                                          \
 154 }
 155 #else
 156 #define DEBUGGER_SINGLE_STEP_NOTIFY()
 157 #endif
 158 
 159 /*
 160  * CONTINUE - Macro for executing the next opcode.
 161  */
 162 #undef CONTINUE
 163 #ifdef USELABELS
 164 // Have to do this dispatch this way in C++ because otherwise gcc complains about crossing an
 165 // initialization (which is is the initialization of the table pointer...)
 166 #define DISPATCH(opcode) goto *dispatch_table[opcode]
 167 #define CONTINUE {                              \
 168         opcode = *pc;                           \
 169         DO_UPDATE_INSTRUCTION_COUNT(opcode);    \
 170         DEBUGGER_SINGLE_STEP_NOTIFY();          \
 171         DISPATCH(opcode);                       \
 172     }
 173 #else
 174 #ifdef PREFETCH_OPCCODE
 175 #define CONTINUE {                              \
 176         opcode = *pc;                           \
 177         DO_UPDATE_INSTRUCTION_COUNT(opcode);    \
 178         DEBUGGER_SINGLE_STEP_NOTIFY();          \
 179         continue;                               \
 180     }
 181 #else
 182 #define CONTINUE {                              \
 183         DO_UPDATE_INSTRUCTION_COUNT(opcode);    \
 184         DEBUGGER_SINGLE_STEP_NOTIFY();          \
 185         continue;                               \
 186     }


 324 #define DECACHE_TOS()    istate->set_stack(topOfStack);
 325 
 326 #define CACHE_TOS()      topOfStack = (intptr_t *)istate->stack();
 327 
 328 #undef DECACHE_PC
 329 #undef CACHE_PC
 330 #define DECACHE_PC()    istate->set_bcp(pc);
 331 #define CACHE_PC()      pc = istate->bcp();
 332 #define CACHE_CP()      cp = istate->constants();
 333 #define CACHE_LOCALS()  locals = istate->locals();
 334 #undef CACHE_FRAME
 335 #define CACHE_FRAME()
 336 
 337 /*
 338  * CHECK_NULL - Macro for throwing a NullPointerException if the object
 339  * passed is a null ref.
 340  * On some architectures/platforms it should be possible to do this implicitly
 341  */
 342 #undef CHECK_NULL
 343 #define CHECK_NULL(obj_)                                                 \
 344     if ((obj_) == 0) {                                                   \
 345         VM_JAVA_ERROR(vmSymbols::java_lang_NullPointerException(), "");  \
 346     }
 347 
 348 #define VMdoubleConstZero() 0.0
 349 #define VMdoubleConstOne() 1.0
 350 #define VMlongConstZero() (max_jlong-max_jlong)
 351 #define VMlongConstOne() ((max_jlong-max_jlong)+1)
 352 
 353 /*
 354  * Alignment
 355  */
 356 #define VMalignWordUp(val)          (((uintptr_t)(val) + 3) & ~3)
 357 
 358 // Decache the interpreter state that interpreter modifies directly (i.e. GC is indirect mod)
 359 #define DECACHE_STATE() DECACHE_PC(); DECACHE_TOS();
 360 
 361 // Reload interpreter state after calling the VM or a possible GC
 362 #define CACHE_STATE()   \
 363         CACHE_TOS();    \
 364         CACHE_PC();     \


1345                       ? (int16_t)Bytes::get_Java_u2(pc + 1) : 3;             \
1346           address branch_pc = pc;                                            \
1347           UPDATE_PC_AND_TOS(skip, -1);                                       \
1348           DO_BACKEDGE_CHECKS(skip, branch_pc);                               \
1349           CONTINUE;                                                          \
1350       }
1351 
1352 #define COMPARISON_OP2(name, comparison)                                     \
1353       COMPARISON_OP(name, comparison)                                        \
1354       CASE(_if_acmp##name): {                                                \
1355           int skip = (STACK_OBJECT(-2) comparison STACK_OBJECT(-1))          \
1356                        ? (int16_t)Bytes::get_Java_u2(pc + 1) : 3;            \
1357           address branch_pc = pc;                                            \
1358           UPDATE_PC_AND_TOS(skip, -2);                                       \
1359           DO_BACKEDGE_CHECKS(skip, branch_pc);                               \
1360           CONTINUE;                                                          \
1361       }
1362 
1363 #define NULL_COMPARISON_NOT_OP(name)                                         \
1364       CASE(_if##name): {                                                     \
1365           int skip = (!(STACK_OBJECT(-1) == 0))                              \
1366                       ? (int16_t)Bytes::get_Java_u2(pc + 1) : 3;             \
1367           address branch_pc = pc;                                            \
1368           UPDATE_PC_AND_TOS(skip, -1);                                       \
1369           DO_BACKEDGE_CHECKS(skip, branch_pc);                               \
1370           CONTINUE;                                                          \
1371       }
1372 
1373 #define NULL_COMPARISON_OP(name)                                             \
1374       CASE(_if##name): {                                                     \
1375           int skip = ((STACK_OBJECT(-1) == 0))                               \
1376                       ? (int16_t)Bytes::get_Java_u2(pc + 1) : 3;             \
1377           address branch_pc = pc;                                            \
1378           UPDATE_PC_AND_TOS(skip, -1);                                       \
1379           DO_BACKEDGE_CHECKS(skip, branch_pc);                               \
1380           CONTINUE;                                                          \
1381       }
1382       COMPARISON_OP(lt, <);
1383       COMPARISON_OP(gt, >);
1384       COMPARISON_OP(le, <=);
1385       COMPARISON_OP(ge, >=);
1386       COMPARISON_OP2(eq, ==);  /* include ref comparison */
1387       COMPARISON_OP2(ne, !=);  /* include ref comparison */
1388       NULL_COMPARISON_OP(null);
1389       NULL_COMPARISON_NOT_OP(nonnull);
1390 
1391       /* Goto pc at specified offset in switch table. */
1392 
1393       CASE(_tableswitch): {
1394           jint* lpc  = (jint*)VMalignWordUp(pc+1);
1395           int32_t  key  = STACK_INT(-1);




 146           CACHE_STATE();                                                         \
 147           if (THREAD->pop_frame_pending() &&                                     \
 148               !THREAD->pop_frame_in_process()) {                                 \
 149             goto handle_Pop_Frame;                                               \
 150           }                                                                      \
 151           opcode = *pc;                                                          \
 152         }                                                                        \
 153       }                                                                          \
 154 }
 155 #else
 156 #define DEBUGGER_SINGLE_STEP_NOTIFY()
 157 #endif
 158 
 159 /*
 160  * CONTINUE - Macro for executing the next opcode.
 161  */
 162 #undef CONTINUE
 163 #ifdef USELABELS
 164 // Have to do this dispatch this way in C++ because otherwise gcc complains about crossing an
 165 // initialization (which is is the initialization of the table pointer...)
 166 #define DISPATCH(opcode) goto *(void*)dispatch_table[opcode]
 167 #define CONTINUE {                              \
 168         opcode = *pc;                           \
 169         DO_UPDATE_INSTRUCTION_COUNT(opcode);    \
 170         DEBUGGER_SINGLE_STEP_NOTIFY();          \
 171         DISPATCH(opcode);                       \
 172     }
 173 #else
 174 #ifdef PREFETCH_OPCCODE
 175 #define CONTINUE {                              \
 176         opcode = *pc;                           \
 177         DO_UPDATE_INSTRUCTION_COUNT(opcode);    \
 178         DEBUGGER_SINGLE_STEP_NOTIFY();          \
 179         continue;                               \
 180     }
 181 #else
 182 #define CONTINUE {                              \
 183         DO_UPDATE_INSTRUCTION_COUNT(opcode);    \
 184         DEBUGGER_SINGLE_STEP_NOTIFY();          \
 185         continue;                               \
 186     }


 324 #define DECACHE_TOS()    istate->set_stack(topOfStack);
 325 
 326 #define CACHE_TOS()      topOfStack = (intptr_t *)istate->stack();
 327 
 328 #undef DECACHE_PC
 329 #undef CACHE_PC
 330 #define DECACHE_PC()    istate->set_bcp(pc);
 331 #define CACHE_PC()      pc = istate->bcp();
 332 #define CACHE_CP()      cp = istate->constants();
 333 #define CACHE_LOCALS()  locals = istate->locals();
 334 #undef CACHE_FRAME
 335 #define CACHE_FRAME()
 336 
 337 /*
 338  * CHECK_NULL - Macro for throwing a NullPointerException if the object
 339  * passed is a null ref.
 340  * On some architectures/platforms it should be possible to do this implicitly
 341  */
 342 #undef CHECK_NULL
 343 #define CHECK_NULL(obj_)                                                 \
 344     if ((obj_) == NULL) {                                                \
 345         VM_JAVA_ERROR(vmSymbols::java_lang_NullPointerException(), "");  \
 346     }
 347 
 348 #define VMdoubleConstZero() 0.0
 349 #define VMdoubleConstOne() 1.0
 350 #define VMlongConstZero() (max_jlong-max_jlong)
 351 #define VMlongConstOne() ((max_jlong-max_jlong)+1)
 352 
 353 /*
 354  * Alignment
 355  */
 356 #define VMalignWordUp(val)          (((uintptr_t)(val) + 3) & ~3)
 357 
 358 // Decache the interpreter state that interpreter modifies directly (i.e. GC is indirect mod)
 359 #define DECACHE_STATE() DECACHE_PC(); DECACHE_TOS();
 360 
 361 // Reload interpreter state after calling the VM or a possible GC
 362 #define CACHE_STATE()   \
 363         CACHE_TOS();    \
 364         CACHE_PC();     \


1345                       ? (int16_t)Bytes::get_Java_u2(pc + 1) : 3;             \
1346           address branch_pc = pc;                                            \
1347           UPDATE_PC_AND_TOS(skip, -1);                                       \
1348           DO_BACKEDGE_CHECKS(skip, branch_pc);                               \
1349           CONTINUE;                                                          \
1350       }
1351 
1352 #define COMPARISON_OP2(name, comparison)                                     \
1353       COMPARISON_OP(name, comparison)                                        \
1354       CASE(_if_acmp##name): {                                                \
1355           int skip = (STACK_OBJECT(-2) comparison STACK_OBJECT(-1))          \
1356                        ? (int16_t)Bytes::get_Java_u2(pc + 1) : 3;            \
1357           address branch_pc = pc;                                            \
1358           UPDATE_PC_AND_TOS(skip, -2);                                       \
1359           DO_BACKEDGE_CHECKS(skip, branch_pc);                               \
1360           CONTINUE;                                                          \
1361       }
1362 
1363 #define NULL_COMPARISON_NOT_OP(name)                                         \
1364       CASE(_if##name): {                                                     \
1365           int skip = (!(STACK_OBJECT(-1) == NULL))                           \
1366                       ? (int16_t)Bytes::get_Java_u2(pc + 1) : 3;             \
1367           address branch_pc = pc;                                            \
1368           UPDATE_PC_AND_TOS(skip, -1);                                       \
1369           DO_BACKEDGE_CHECKS(skip, branch_pc);                               \
1370           CONTINUE;                                                          \
1371       }
1372 
1373 #define NULL_COMPARISON_OP(name)                                             \
1374       CASE(_if##name): {                                                     \
1375           int skip = ((STACK_OBJECT(-1) == NULL))                            \
1376                       ? (int16_t)Bytes::get_Java_u2(pc + 1) : 3;             \
1377           address branch_pc = pc;                                            \
1378           UPDATE_PC_AND_TOS(skip, -1);                                       \
1379           DO_BACKEDGE_CHECKS(skip, branch_pc);                               \
1380           CONTINUE;                                                          \
1381       }
1382       COMPARISON_OP(lt, <);
1383       COMPARISON_OP(gt, >);
1384       COMPARISON_OP(le, <=);
1385       COMPARISON_OP(ge, >=);
1386       COMPARISON_OP2(eq, ==);  /* include ref comparison */
1387       COMPARISON_OP2(ne, !=);  /* include ref comparison */
1388       NULL_COMPARISON_OP(null);
1389       NULL_COMPARISON_NOT_OP(nonnull);
1390 
1391       /* Goto pc at specified offset in switch table. */
1392 
1393       CASE(_tableswitch): {
1394           jint* lpc  = (jint*)VMalignWordUp(pc+1);
1395           int32_t  key  = STACK_INT(-1);


src/share/vm/interpreter/bytecodeInterpreter.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File