* terminates "with a thrown exception".
*/
u2 opcode = GET_OPCODE(*pc);
- if (opcode == OP_RETURN_VOID || opcode == OP_RETURN ||
- opcode == OP_RETURN_WIDE ||opcode == OP_RETURN_OBJECT)
+ if (opcode == OP_RETURN_VOID || opcode == OP_RETURN || opcode == OP_RETURN_VOID_BARRIER ||
+ opcode == OP_RETURN_OBJECT || opcode == OP_RETURN_WIDE)
{
eventFlags |= DBG_METHOD_EXIT;
}
*/
/*
- * Construct an s4 from two consecutive half-words of switch data.
- * This needs to check endianness because the DEX optimizer only swaps
- * half-words in instruction stream.
- *
- * "switchData" must be 32-bit aligned.
- */
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-static inline s4 s4FromSwitchData(const void* switchData) {
- return *(s4*) switchData;
-}
-#else
-static inline s4 s4FromSwitchData(const void* switchData) {
- u2* data = switchData;
- return data[0] | (((s4) data[1]) << 16);
-}
-#endif
-
-/*
* Find the matching case. Returns the offset to the handler instructions.
*
* Returns 3 if we don't find a match (it's the size of the packed-switch
s4 dvmInterpHandlePackedSwitch(const u2* switchData, s4 testVal)
{
const int kInstrLen = 3;
- u2 size;
- s4 firstKey;
- const s4* entries;
/*
* Packed switch data format:
return kInstrLen;
}
- size = *switchData++;
+ u2 size = *switchData++;
assert(size > 0);
- firstKey = *switchData++;
+ s4 firstKey = *switchData++;
firstKey |= (*switchData++) << 16;
- if (testVal < firstKey || testVal >= firstKey + size) {
+ int index = testVal - firstKey;
+ if (index < 0 || index >= size) {
LOGVV("Value %d not found in switch (%d-%d)",
testVal, firstKey, firstKey+size-1);
return kInstrLen;
/* The entries are guaranteed to be aligned on a 32-bit boundary;
* we can treat them as a native int array.
*/
- entries = (const s4*) switchData;
+ const s4* entries = (const s4*) switchData;
assert(((u4)entries & 0x3) == 0);
- assert(testVal - firstKey >= 0 && testVal - firstKey < size);
+ assert(index >= 0 && index < size);
LOGVV("Value %d found in slot %d (goto 0x%02x)",
- testVal, testVal - firstKey,
- s4FromSwitchData(&entries[testVal - firstKey]));
- return s4FromSwitchData(&entries[testVal - firstKey]);
+ testVal, index,
+ s4FromSwitchData(&entries[index]));
+ return s4FromSwitchData(&entries[index]);
}
/*
case VERIFY_ERROR_NONE:
/* should never happen; use default exception */
assert(false);
- msg = strdup("weird - no error specified");
+ msg = "weird - no error specified";
break;
/* no default clause -- want warning if enum updated */
if (gDvm.instructionCountEnableCount > 0) {
dvmEnableSubMode(thread, kSubModeInstCounting);
}
- if (dvmIsMethodTraceActive()) {
- dvmEnableSubMode(thread, kSubModeMethodTrace);
+ TracingMode mode = dvmGetMethodTracingMode();
+ if (mode != TRACING_INACTIVE) {
+ if (mode == SAMPLE_PROFILING_ACTIVE) {
+ dvmEnableSubMode(thread, kSubModeSampleTrace);
+ } else {
+ dvmEnableSubMode(thread, kSubModeMethodTrace);
+ }
}
if (gDvm.emulatorTraceEnableCount > 0) {
dvmEnableSubMode(thread, kSubModeEmulatorTrace);
if (gDvm.debuggerActive) {
dvmEnableSubMode(thread, kSubModeDebuggerActive);
}
+#if defined(WITH_JIT)
+ dvmJitUpdateThreadStateSingle(thread);
+#endif
#if 0
// Debugging stress mode - force checkBefore
dvmEnableSubMode(thread, kSubModeCheckAlways);
#endif
self->debugIsMethodEntry = true;
#if defined(WITH_JIT)
- dvmJitCalleeSave(calleeSave);
/* Initialize the state to kJitNot */
self->jitState = kJitNot;
#endif
if (gDvm.executionMode == kExecutionModeInterpFast)
stdInterp = dvmMterpStd;
#if defined(WITH_JIT)
- else if (gDvm.executionMode == kExecutionModeJit)
+ else if (gDvm.executionMode == kExecutionModeJit ||
+ gDvm.executionMode == kExecutionModeNcgO0 ||
+ gDvm.executionMode == kExecutionModeNcgO1)
stdInterp = dvmMterpStd;
#endif
else