Fix stack overflow edge case.

When a stack overflows, Dalvik allows the stack to expand into a
"reserved" area, so that it has enough room to create and initialize the
StackOverflowError object.  While the stack is expanded we also do the
search for an appropriate "catch" block, which may require resolving
some exception classes.

As it happens, things go badly when the "catch" resolution throws an
exception.  The VM tries to shrink the stack back down after the second
exception is finished, rather than waiting for the initial SOE to
finish.  Since we still have some additional frames on the stack, we're
still occupying the "reserved" area, and the VM aborts when it detects
the situation.

This changes the stack cleanup to wait until the SOE is being dealt
with.

For bug 2398031.
14 files changed