Consolidate curFrame fields in thread storage
We ended up with two locations in the Thread structure for saved
Dalvik frame pointer. This change consolidates them.
Change-Id: I78f288e4e57e232f29663be930101e775bfe370f
diff --git a/vm/interp/Interp.cpp b/vm/interp/Interp.cpp
index 6684c4a..bc2b4ec 100644
--- a/vm/interp/Interp.cpp
+++ b/vm/interp/Interp.cpp
@@ -537,10 +537,11 @@
* on by PushLocalFrame, we want to use the topmost native method.
*/
const StackSaveArea* saveArea;
- void* fp;
- void* prevFp = NULL;
+ u4* fp;
+ u4* prevFp = NULL;
- for (fp = thread->curFrame; fp != NULL; fp = saveArea->prevFrame) {
+ for (fp = thread->interpSave.curFrame; fp != NULL;
+ fp = saveArea->prevFrame) {
const Method* method;
saveArea = SAVEAREA_FROM_FP(fp);
@@ -587,7 +588,8 @@
pCtrl->pAddressSet
= dvmAddressSetForLine(saveArea->method, pCtrl->line);
}
- pCtrl->frameDepth = dvmComputeVagueFrameDepth(thread, thread->curFrame);
+ pCtrl->frameDepth =
+ dvmComputeVagueFrameDepth(thread, thread->interpSave.curFrame);
pCtrl->active = true;
LOGV("##### step init: thread=%p meth=%p '%s' line=%d frameDepth=%d depth=%s size=%s\n",
@@ -630,7 +632,7 @@
int offset = self->interpSave.pc - curMethod->insns;
int catchRelPc = dvmFindCatchBlock(self, offset, exception,
true, &catchFrame);
- dvmDbgPostException(self->interpSave.fp, offset, catchFrame,
+ dvmDbgPostException(self->interpSave.curFrame, offset, catchFrame,
catchRelPc, exception);
}
}
@@ -649,10 +651,10 @@
* The interpreter is preparing to do a native invoke. Handle any
* special subMode requirements. NOTE: for a native invoke,
* dvmReportInvoke() and dvmReportPreNativeInvoke() will both
- * be called prior to the invoke. All interpSave state must
- * be valid on entry.
+ * be called prior to the invoke. fp is the Dalvik FP of the calling
+ * method.
*/
-void dvmReportPreNativeInvoke(const Method* methodToCall, Thread* self)
+void dvmReportPreNativeInvoke(const Method* methodToCall, Thread* self, u4* fp)
{
#if defined(WITH_JIT)
/*
@@ -664,8 +666,7 @@
}
#endif
if (self->interpBreak.ctl.subMode & kSubModeDebuggerActive) {
- Object* thisPtr = dvmGetThisPtr(self->interpSave.method,
- self->interpSave.fp);
+ Object* thisPtr = dvmGetThisPtr(self->interpSave.method, fp);
assert(thisPtr == NULL || dvmIsValidObject(thisPtr));
dvmDbgPostLocationEvent(methodToCall, -1, thisPtr, DBG_METHOD_ENTRY);
}
@@ -673,14 +674,13 @@
/*
* The interpreter has returned from a native invoke. Handle any
- * special subMode requirements. All interpSave state must be
- * valid on entry.
+ * special subMode requirements. fp is the Dalvik FP of the calling
+ * method.
*/
-void dvmReportPostNativeInvoke(const Method* methodToCall, Thread* self)
+void dvmReportPostNativeInvoke(const Method* methodToCall, Thread* self, u4* fp)
{
if (self->interpBreak.ctl.subMode & kSubModeDebuggerActive) {
- Object* thisPtr = dvmGetThisPtr(self->interpSave.method,
- self->interpSave.fp);
+ Object* thisPtr = dvmGetThisPtr(self->interpSave.method, fp);
assert(thisPtr == NULL || dvmIsValidObject(thisPtr));
dvmDbgPostLocationEvent(methodToCall, -1, thisPtr, DBG_METHOD_EXIT);
}
@@ -697,7 +697,7 @@
{
TRACE_METHOD_EXIT(self, self->interpSave.method);
#if defined(WITH_JIT)
- if (dvmIsBreakFrame(self->interpSave.fp) &&
+ if (dvmIsBreakFrame(self->interpSave.curFrame) &&
(self->interpBreak.ctl.subMode & kSubModeJitTraceBuild)) {
dvmCheckJit(self->interpSave.pc, self);
}
@@ -1766,7 +1766,7 @@
dvmUnlockMutex(&self->callbackMutex);
// Update Thread structure
self->interpSave.pc = pc;
- self->interpSave.fp = fp;
+ self->interpSave.curFrame = fp;
if (callback != NULL) {
// Do the callback
if (!callback(self,arg)) {
@@ -1948,7 +1948,7 @@
* No need to initialize "retval".
*/
self->interpSave.method = method;
- self->interpSave.fp = (u4*) self->curFrame;
+ self->interpSave.curFrame = (u4*) self->interpSave.curFrame;
self->interpSave.pc = method->insns;
assert(!dvmIsNativeMethod(method));