Avoid sign extension in packed-switch.

This code (at least in the ARM version) is trying to assign to r0 and r1
from C by returning a 64-bit result. The mistaken use of signed integers
for pointers can lead to sign extension if the JIT code cache is at a
sufficiently high address.

Bug: 6799823
Bug: 6703991

(cherry picked from commit 2d0c1c2dbe44458ebb199c47ce1047f266db5349)

Conflicts:

	vm/compiler/codegen/mips/CalloutHelper.h
	vm/compiler/codegen/mips/CodegenDriver.cpp

Change-Id: Id4699fdd0b3d61abe9c92874832b8561df4fa797
merge in jb-mr0-release history after reset to jb-dev
Missing zero-checks in JIT compiler

Zero-checks were not generated by the JIT compiler for
some instructions. This caused crashes instead of
the expected ArithmeticException.

Change-Id: Ic8041741a7cccc1bd6b8c3c0723ba55a55af856b
Don't log "WAIT_FOR_CONCURRENT_GC blocked 0ms".

Stupid to spend more time logging than we spent waiting. (Highly visible
in the zygote's preloading phase.)

Change-Id: If2d6b6093b3bebae0887aa385745b7ed9225216b
Fix a small and unlikely memory leak.

Change-Id: I131b9f2f8ae4a4b2bb3bb00bc2cd1e607d979bb5
Change dalvik script to use exec

Change-Id: I0a82ced8ce31ae0e6916509a1c79b738c475ae18
Switched code to blx <reg>

ldr ip,<addr> blx ip is preferred over mov lr,pc ldr pc,<addr> from armv5te,
and will typically perform better on later ARM processors.

Change-Id: I8f2e5e794c644faafd767037ad56579f2934de47
Merge "Don't log "WAIT_FOR_CONCURRENT_GC blocked 0ms"." into jb
Merge "Fix a small and unlikely memory leak." into jb
Merge "Change dalvik script to use exec" into jb
Merge "Switched code to blx <reg>" into jb
Avoid sign extension in packed-switch.

This code (at least in the ARM version) is trying to assign to r0 and r1
from C by returning a 64-bit result. The mistaken use of signed integers
for pointers can lead to sign extension if the JIT code cache is at a
sufficiently high address.

Bug: 6799823
Bug: 6703991

(cherry picked from commit 2d0c1c2dbe44458ebb199c47ce1047f266db5349)

Conflicts:

	vm/compiler/codegen/mips/CalloutHelper.h
	vm/compiler/codegen/mips/CodegenDriver.cpp

Change-Id: Id4699fdd0b3d61abe9c92874832b8561df4fa797
Support debug info in dexmerge and fix max blowup of annotations

Support debug info in dexmerge.

Bug: 4090053

(cherry-pick of bc23c4f3ebaefebb3f1be7732767631f91e165ea.)

Change-Id: I1108933fc03330ff91be3a2edef8b4966977dcd7
Signed-off-by: Jesse Wilson <jesse@swank.ca>

Fix a bug where debugInfos' size wasn't being computed.

Previously debugInfos' size of 0 caused a malformed dex file
because debug data was present but not mentioned in the table
of contents.

Change-Id: I07171aaee12fef9f303fc505909f44ef1a714114

Fix a bug where the max blowup of annotations was incorrect.

I'm not sure where the 1.34 number comes from but it's incorrect.
From the spec, the encoded_annotation is made up of a single byte
plus an unlimited number of uleb128 values. Each of these values
can double in width in the worst case. I received (personal) email
from one user who'd run into a case worse than the incorrect 1.34
limit.

Change-Id: I3b676e6d2b274aaa538ca61ce23945b3d49aff04
Merge tag 'android-4.1.2_r1' into HEAD

Android 4.1.2 release 1
[PATCH] Basic KSM Support

Be sure to add '#define MADV_MERGEABLE 12' to
bionic/libc/include/sys/mman.h so we can have a central place for this

parse the process memory map and inform madvise common HEAP/Stack
regions on fork from zygote

These then can be used by the kernel KSM module to re-join (copy on write)
pages between the various dalvik processes.

As is on a fully loaded system you can expect ~12MB to be indicated to be
scanned by KSM.. of this 10-15% will be saved; as such a recommend a very
slow scan until as any logic to stop scanning while sleeping will require
another process and remove all memory savings provided by this logic.

To activate on a KSM kernel (2min for full scan of ~16m and 1%CPU):

echo 4000 > /sys/kernel/mm/ksm/sleep_millisecs
echo 128 > /sys/kernel/mm/ksm/pages_to_scan
echo 1 > /sys/kernel/mm/ksm/run

Newer kernels only require the last line.

In future additional memory regions and kernel logic may improve this.

Change-Id: I271cbee74a1f02a89c34c6ee9006a4ea81360154
Fix an ugly bug where try/catch offsets weren't being mapped properly.

In dex files, there are several places where one object refers
to another object by its position in the file. The dex merger
is generally very careful to adjust these mappings when combining
dex files.

Unfortunately one of these cases was broken. Each try_item refers
to a corresponding encoded_catch_handler by its byte offset in a
list. Most of the time this byte offset is the same in the input
dex file and the output dex file. But encoded_catch_handlers are
variable-length because they use a variable-length uleb128 encoding
to address the type_idx being caught. When dex files are merged,
some exception types may go from having a small index to having
a large index, increasing the number of bytes required to encode
that index. This breaks our ability to directly copy over offsets
as we were doing previously.

Bug: http://code.google.com/p/android/issues/detail?id=36490
Change-Id: I3bdadf20899fdb5d4d074e69103b33c0404a31f8