#if defined(__ARM_EABI__)
# define NO_UNALIGN_64__UNION
#endif
+/*
+ * MIPS ABI requires 64-bit alignment for access to 64-bit data types.
+ *
+ * Use memcpy() to do the transfer
+ */
+#if defined(__mips__)
+/* # define NO_UNALIGN_64__UNION */
+#endif
//#define LOG_INSTR /* verbose debugging */
{ \
char* desc; \
desc = dexProtoCopyMethodDescriptor(&curMethod->prototype); \
- LOGE("Invalid branch %d at 0x%04x in %s.%s %s\n", \
+ LOGE("Invalid branch %d at 0x%04x in %s.%s %s", \
myoff, (int) (pc - curMethod->insns), \
curMethod->clazz->descriptor, curMethod->name, desc); \
free(desc); \
# define ILOG(_level, ...) do { \
char debugStrBuf[128]; \
snprintf(debugStrBuf, sizeof(debugStrBuf), __VA_ARGS__); \
- if (curMethod != NULL) \
- LOG(_level, LOG_TAG"i", "%-2d|%04x%s\n", \
+ if (curMethod != NULL) \
+ LOG(_level, LOG_TAG"i", "%-2d|%04x%s", \
self->threadId, (int)(pc - curMethod->insns), debugStrBuf); \
else \
- LOG(_level, LOG_TAG"i", "%-2d|####%s\n", \
+ LOG(_level, LOG_TAG"i", "%-2d|####%s", \
self->threadId, debugStrBuf); \
} while(false)
void dvmDumpRegs(const Method* method, const u4* framePtr, bool inOnly);
return false;
}
#ifdef WITH_EXTRA_OBJECT_VALIDATION
- if (!dvmIsValidObject(obj)) {
- LOGE("Invalid object %p\n", obj);
+ if (!dvmIsHeapAddressObject(obj)) {
+ LOGE("Invalid object %p", obj);
dvmAbort();
}
#endif
#ifndef NDEBUG
if (obj->clazz == NULL || ((u4) obj->clazz) <= 65536) {
/* probable heap corruption */
- LOGE("Invalid object class %p (in %p)\n", obj->clazz, obj);
+ LOGE("Invalid object class %p (in %p)", obj->clazz, obj);
dvmAbort();
}
#endif
return false;
}
#ifdef WITH_EXTRA_OBJECT_VALIDATION
- if (!dvmIsValidObject(obj)) {
- LOGE("Invalid object %p\n", obj);
+ if (!dvmIsHeapAddress(obj)) {
+ LOGE("Invalid object %p", obj);
dvmAbort();
}
#endif
#ifndef NDEBUG
if (obj->clazz == NULL || ((u4) obj->clazz) <= 65536) {
/* probable heap corruption */
- LOGE("Invalid object class %p (in %p)\n", obj->clazz, obj);
+ LOGE("Invalid object class %p (in %p)", obj->clazz, obj);
dvmAbort();
}
#endif
* Redefine what used to be local variable accesses into Thread struct
* references. (These are undefined down in "footer.cpp".)
*/
-#define retval self->retval
+#define retval self->interpSave.retval
#define pc self->interpSave.pc
#define fp self->interpSave.curFrame
#define curMethod self->interpSave.method
}
#endif
+#define FINISH_BKPT(_opcode) /* FIXME? */
+#define DISPATCH_EXTENDED(_opcode) /* FIXME? */
/*
* The "goto label" statements turn into function calls followed by
* As a special case, "goto bail" turns into a longjmp.
*/
#define GOTO_bail() \
- dvmMterpStdBail(self, false);
+ dvmMterpStdBail(self)
/*
* Periodically check for thread suspension.
result = 1; \
else \
result = (_nanVal); \
- ILOGV("+ result=%d\n", result); \
+ ILOGV("+ result=%d", result); \
SET_REGISTER(vdst, result); \
} \
FINISH(2);
} \
SET_REGISTER##_regsize(vdst, \
((_type*)(void*)arrayObj->contents)[GET_REGISTER(vsrc2)]); \
- ILOGV("+ AGET[%d]=0x%x", GET_REGISTER(vsrc2), GET_REGISTER(vdst)); \
+ ILOGV("+ AGET[%d]=%#x", GET_REGISTER(vsrc2), GET_REGISTER(vdst)); \
} \
FINISH(2);
} \
SET_REGISTER##_regsize(vdst, \
dvmGetField##_ftype(obj, ifield->byteOffset)); \
- ILOGV("+ IGET '%s'=0x%08llx", ifield->field.name, \
+ ILOGV("+ IGET '%s'=0x%08llx", ifield->name, \
(u8) GET_REGISTER##_regsize(vdst)); \
} \
FINISH(2);
} \
SET_REGISTER##_regsize(vdst, \
dvmGetField##_ftype(obj, ifield->byteOffset)); \
- ILOGV("+ IGET '%s'=0x%08llx", ifield->field.name, \
+ ILOGV("+ IGET '%s'=0x%08llx", ifield->name, \
(u8) GET_REGISTER##_regsize(vdst)); \
} \
FINISH(5);
} \
dvmSetField##_ftype(obj, ifield->byteOffset, \
GET_REGISTER##_regsize(vdst)); \
- ILOGV("+ IPUT '%s'=0x%08llx", ifield->field.name, \
+ ILOGV("+ IPUT '%s'=0x%08llx", ifield->name, \
(u8) GET_REGISTER##_regsize(vdst)); \
} \
FINISH(2);
} \
dvmSetField##_ftype(obj, ifield->byteOffset, \
GET_REGISTER##_regsize(vdst)); \
- ILOGV("+ IPUT '%s'=0x%08llx", ifield->field.name, \
+ ILOGV("+ IPUT '%s'=0x%08llx", ifield->name, \
(u8) GET_REGISTER##_regsize(vdst)); \
} \
FINISH(5);
if (sfield == NULL) \
GOTO_exceptionThrown(); \
if (dvmDexGetResolvedField(methodClassDex, ref) == NULL) { \
- JIT_STUB_HACK(dvmJitEndTraceSelect(self,pc)); \
+ JIT_STUB_HACK(dvmJitEndTraceSelect(self,pc)); \
} \
} \
SET_REGISTER##_regsize(vdst, dvmGetStaticField##_ftype(sfield)); \
ILOGV("+ SGET '%s'=0x%08llx", \
- sfield->field.name, (u8)GET_REGISTER##_regsize(vdst)); \
+ sfield->name, (u8)GET_REGISTER##_regsize(vdst)); \
} \
FINISH(2);
if (sfield == NULL) \
GOTO_exceptionThrown(); \
if (dvmDexGetResolvedField(methodClassDex, ref) == NULL) { \
- JIT_STUB_HACK(dvmJitEndTraceSelect(self,pc)); \
+ JIT_STUB_HACK(dvmJitEndTraceSelect(self,pc)); \
} \
} \
SET_REGISTER##_regsize(vdst, dvmGetStaticField##_ftype(sfield)); \
ILOGV("+ SGET '%s'=0x%08llx", \
- sfield->field.name, (u8)GET_REGISTER##_regsize(vdst)); \
+ sfield->name, (u8)GET_REGISTER##_regsize(vdst)); \
} \
FINISH(4);
if (sfield == NULL) \
GOTO_exceptionThrown(); \
if (dvmDexGetResolvedField(methodClassDex, ref) == NULL) { \
- JIT_STUB_HACK(dvmJitEndTraceSelect(self,pc)); \
+ JIT_STUB_HACK(dvmJitEndTraceSelect(self,pc)); \
} \
} \
dvmSetStaticField##_ftype(sfield, GET_REGISTER##_regsize(vdst)); \
ILOGV("+ SPUT '%s'=0x%08llx", \
- sfield->field.name, (u8)GET_REGISTER##_regsize(vdst)); \
+ sfield->name, (u8)GET_REGISTER##_regsize(vdst)); \
} \
FINISH(2);
if (sfield == NULL) \
GOTO_exceptionThrown(); \
if (dvmDexGetResolvedField(methodClassDex, ref) == NULL) { \
- JIT_STUB_HACK(dvmJitEndTraceSelect(self,pc)); \
+ JIT_STUB_HACK(dvmJitEndTraceSelect(self,pc)); \
} \
} \
dvmSetStaticField##_ftype(sfield, GET_REGISTER##_regsize(vdst)); \
ILOGV("+ SPUT '%s'=0x%08llx", \
- sfield->field.name, (u8)GET_REGISTER##_regsize(vdst)); \
+ sfield->name, (u8)GET_REGISTER##_regsize(vdst)); \
} \
FINISH(4);
* the thread resumed.
*/
u1 originalOpcode = dvmGetOriginalOpcode(pc);
- LOGV("+++ break 0x%02x (0x%04x -> 0x%04x)\n", originalOpcode, inst,
+ LOGV("+++ break 0x%02x (0x%04x -> 0x%04x)", originalOpcode, inst,
INST_REPLACE_OP(inst, originalOpcode));
inst = INST_REPLACE_OP(inst, originalOpcode);
FINISH_BKPT(originalOpcode);
/*
* Create an array of the specified type.
*/
- LOGVV("+++ filled-new-array type is '%s'\n", arrayClass->descriptor);
+ LOGVV("+++ filled-new-array type is '%s'", arrayClass->descriptor);
typeCh = arrayClass->descriptor[1];
if (typeCh == 'D' || typeCh == 'J') {
/* category 2 primitives not allowed */
GOTO_exceptionThrown();
} else if (typeCh != 'L' && typeCh != '[' && typeCh != 'I') {
/* TODO: requires multiple "fill in" loops with different widths */
- LOGE("non-int primitives not implemented\n");
+ LOGE("non-int primitives not implemented");
dvmThrowInternalError(
"filled-new-array not implemented for anything but 'int'");
GOTO_exceptionThrown();
if (baseMethod == NULL) {
baseMethod = dvmResolveMethod(curMethod->clazz, ref,METHOD_VIRTUAL);
if (baseMethod == NULL) {
- ILOGV("+ unknown method or access denied\n");
+ ILOGV("+ unknown method or access denied");
GOTO_exceptionThrown();
}
}
methodToCall->nativeFunc != NULL);
#endif
- LOGVV("+++ base=%s.%s virtual[%d]=%s.%s\n",
+ LOGVV("+++ base=%s.%s virtual[%d]=%s.%s",
baseMethod->clazz->descriptor, baseMethod->name,
(u4) baseMethod->methodIndex,
methodToCall->clazz->descriptor, methodToCall->name);
#if 0
if (vsrc1 != methodToCall->insSize) {
- LOGW("WRONG METHOD: base=%s.%s virtual[%d]=%s.%s\n",
+ LOGW("WRONG METHOD: base=%s.%s virtual[%d]=%s.%s",
baseMethod->clazz->descriptor, baseMethod->name,
(u4) baseMethod->methodIndex,
methodToCall->clazz->descriptor, methodToCall->name);
if (baseMethod == NULL) {
baseMethod = dvmResolveMethod(curMethod->clazz, ref,METHOD_VIRTUAL);
if (baseMethod == NULL) {
- ILOGV("+ unknown method or access denied\n");
+ ILOGV("+ unknown method or access denied");
GOTO_exceptionThrown();
}
}
assert(!dvmIsAbstractMethod(methodToCall) ||
methodToCall->nativeFunc != NULL);
#endif
- LOGVV("+++ base=%s.%s super-virtual=%s.%s\n",
+ LOGVV("+++ base=%s.%s super-virtual=%s.%s",
baseMethod->clazz->descriptor, baseMethod->name,
methodToCall->clazz->descriptor, methodToCall->name);
assert(methodToCall != NULL);
methodToCall = dvmResolveMethod(curMethod->clazz, ref,
METHOD_DIRECT);
if (methodToCall == NULL) {
- ILOGV("+ unknown direct method\n"); // should be impossible
+ ILOGV("+ unknown direct method"); // should be impossible
GOTO_exceptionThrown();
}
}
if (methodToCall == NULL) {
methodToCall = dvmResolveMethod(curMethod->clazz, ref, METHOD_STATIC);
if (methodToCall == NULL) {
- ILOGV("+ unknown method\n");
+ ILOGV("+ unknown method");
GOTO_exceptionThrown();
}
methodToCall->nativeFunc != NULL);
#endif
- LOGVV("+++ virtual[%d]=%s.%s\n",
+ LOGVV("+++ virtual[%d]=%s.%s",
ref, methodToCall->clazz->descriptor, methodToCall->name);
assert(methodToCall != NULL);
assert(!dvmIsAbstractMethod(methodToCall) ||
methodToCall->nativeFunc != NULL);
#endif
- LOGVV("+++ super-virtual[%d]=%s.%s\n",
+ LOGVV("+++ super-virtual[%d]=%s.%s",
ref, methodToCall->clazz->descriptor, methodToCall->name);
assert(methodToCall != NULL);
GOTO_invokeMethod(methodCallRange, methodToCall, vsrc1, vdst);
if (dvmIsBreakFrame(fp)) {
/* bail without popping the method frame from stack */
- LOGVV("+++ returned into break frame\n");
+ LOGVV("+++ returned into break frame");
GOTO_bail();
}
{
FINISH(3);
} else {
- //LOGE("Unknown invoke instr %02x at %d\n",
+ //LOGE("Unknown invoke instr %02x at %d",
// invokeInstr, (int) (pc - curMethod->insns));
assert(false);
}
dvmAddTrackedAlloc(exception, self);
dvmClearException(self);
- LOGV("Handling exception %s at %s:%d\n",
+ LOGV("Handling exception %s at %s:%d",
exception->clazz->descriptor, curMethod->name,
dvmLineNumFromPC(curMethod, pc - curMethod->insns));
if (catchRelPc < 0) {
/* falling through to JNI code or off the bottom of the stack */
#if DVM_SHOW_EXCEPTION >= 2
- LOGD("Exception %s from %s:%d not caught locally\n",
+ LOGD("Exception %s from %s:%d not caught locally",
exception->clazz->descriptor, dvmGetMethodSourceFile(curMethod),
dvmLineNumFromPC(curMethod, pc - curMethod->insns));
#endif
#if DVM_SHOW_EXCEPTION >= 3
{
const Method* catchMethod = SAVEAREA_FROM_FP(fp)->method;
- LOGD("Exception %s thrown from %s:%d to %s:%d\n",
+ LOGD("Exception %s thrown from %s:%d to %s:%d",
exception->clazz->descriptor, dvmGetMethodSourceFile(curMethod),
dvmLineNumFromPC(curMethod, pc - curMethod->insns),
dvmGetMethodSourceFile(catchMethod),
bottom = (u1*) newSaveArea - methodToCall->outsSize * sizeof(u4);
if (bottom < self->interpStackEnd) {
/* stack overflow */
- LOGV("Stack overflow on method call (start=%p end=%p newBot=%p(%d) size=%d '%s')\n",
+ LOGV("Stack overflow on method call (start=%p end=%p newBot=%p(%d) size=%d '%s')",
self->interpStackStart, self->interpStackEnd, bottom,
(u1*) fp - bottom, self->interpStackSize,
methodToCall->name);
assert(dvmCheckException(self));
GOTO_exceptionThrown();
}
- //LOGD("+++ fp=%p newFp=%p newSave=%p bottom=%p\n",
+ //LOGD("+++ fp=%p newFp=%p newSave=%p bottom=%p",
// fp, newFp, newSaveArea, bottom);
}
self->interpSave.method = curMethod;
methodClassDex = curMethod->clazz->pDvmDex;
pc = methodToCall->insns;
- self->interpSave.curFrame = fp = newFp;
+ self->interpSave.curFrame = newFp;
+ fp = newFp;
#ifdef EASY_GDB
debugSaveArea = SAVEAREA_FROM_FP(newFp);
#endif
DUMP_REGS(methodToCall, newFp, true); // show input args
if (self->interpBreak.ctl.subMode != 0) {
- dvmReportPreNativeInvoke(methodToCall, self, fp);
+ dvmReportPreNativeInvoke(methodToCall, self, newSaveArea->prevFrame);
}
ILOGD("> native <-- %s.%s %s", methodToCall->clazz->descriptor,
(*methodToCall->nativeFunc)(newFp, &retval, methodToCall, self);
if (self->interpBreak.ctl.subMode != 0) {
- dvmReportPostNativeInvoke(methodToCall, self, fp);
+ dvmReportPostNativeInvoke(methodToCall, self, newSaveArea->prevFrame);
}
/* pop frame off */
dvmPopJniLocals(self, newSaveArea);
- self->interpSave.curFrame = fp;
+ self->interpSave.curFrame = newSaveArea->prevFrame;
+ fp = newSaveArea->prevFrame;
/*
* If the native code threw an exception, or interpreted code
* it, jump to our local exception handling.
*/
if (dvmCheckException(self)) {
- LOGV("Exception thrown by/below native code\n");
+ LOGV("Exception thrown by/below native code");
GOTO_exceptionThrown();
}
{
FINISH(3);
} else {
- //LOGE("Unknown invoke instr %02x at %d\n",
+ //LOGE("Unknown invoke instr %02x at %d",
// invokeInstr, (int) (pc - curMethod->insns));
assert(false);
}