am 8ca802ff: am 7b4c1d52: Pop call frame before boxing result
Merge commit '8ca802ff96060b730119b58379c2e6366afdbd3e'
* commit '8ca802ff96060b730119b58379c2e6366afdbd3e':
Pop call frame before boxing result
diff --git a/vm/Thread.c b/vm/Thread.c
index 635fe56..32d4bcd 100644
--- a/vm/Thread.c
+++ b/vm/Thread.c
@@ -4068,6 +4068,9 @@
/* this is very bad */
LOGE("PGC: invalid ref in reg %d: 0x%08x\n",
method->registersSize-1 - i, rval);
+ LOGE("PGC: %s.%s addr 0x%04x\n",
+ method->clazz->descriptor, method->name,
+ saveArea->xtra.currentPc - method->insns);
} else
#endif
{
diff --git a/vm/interp/Stack.c b/vm/interp/Stack.c
index 0456e50..695aa44 100644
--- a/vm/interp/Stack.c
+++ b/vm/interp/Stack.c
@@ -658,6 +658,7 @@
s4* ins;
int verifyCount, argListLength;
JValue retval;
+ bool needPop = false;
/* verify arg count */
if (argList != NULL)
@@ -675,6 +676,7 @@
clazz = callPrep(self, method, obj, !noAccessCheck);
if (clazz == NULL)
return NULL;
+ needPop = true;
/* "ins" for new frame start at frame pointer plus locals */
ins = ((s4*)self->curFrame) + (method->registersSize - method->insSize);
@@ -710,9 +712,10 @@
(*(types-1))->descriptor);
}
dvmPopFrame(self); // throw wants to pull PC out of stack
+ needPop = false;
dvmThrowException("Ljava/lang/IllegalArgumentException;",
"argument type mismatch");
- goto bail_popped;
+ goto bail;
}
ins += width;
@@ -740,6 +743,13 @@
}
/*
+ * Pop the frame immediately. The "wrap" calls below can cause
+ * allocations, and we don't want the GC to walk the now-dead frame.
+ */
+ dvmPopFrame(self);
+ needPop = false;
+
+ /*
* If an exception is raised, wrap and replace. This is necessary
* because the invoked method could have thrown a checked exception
* that the caller wasn't prepared for.
@@ -764,8 +774,9 @@
}
bail:
- dvmPopFrame(self);
-bail_popped:
+ if (needPop) {
+ dvmPopFrame(self);
+ }
return retObj;
}