Fix the double-OOME case again.

The key ingredient to this change is that the NULL check on the NewStringUTF
call in ClassLinker::FindClass was accidentally checking the input to the
function (which we know isn't null) rather than the output (which will be
if allocation fails).

I've also fixed a bunch of places where we were missing null checks on
allocation, but there's a lot more to do.

I've stopped -Xcheck:jni from trying to dump pending OutOfMemoryError stacks
because that's highly likely to go horribly wrong and just gets in the way
of debugging the actual problem. (We could perhaps do better, so I've added
a TODO.)

In DexFile, we were always allocating java.lang.Strings for the names of
each local variable, even if we were only parsing the debug info for the
purposes of translating a line number. This was less of a problem in Dalvik
where the names were just const char*s, but since we go straight to Strings,
this was causing yet more OOME carnage (and is a lot of wasted effort).

This fixes the regression we were seeing in 061.

Change-Id: I6241602756db3070b214ccb35e3760b37e1e3d10
7 files changed
tree: 5713b45d0e42e4ec319d8aea75b6d2a6bdb079c3
  1. Android.mk
  2. build/
  3. oat_process/
  4. oat_runtime/
  5. src/
  6. test/
  7. tools/