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
JIT: Use rsb and shift in easy multiply.

For easy multiplication using reverse subtract (when
lit is 2^n-1) use the barrel shifter for rsb.

This improves arithmetic performance for code executing
in Dalvik. E.g String.hashCode.

Change-Id: Ifb086dcec344b30fd3e392ac21d508b43e820cdc
Signed-off-by: Patrik Ryd <patrik.ryd@stericsson.com>

Conflicts:
	vm/compiler/codegen/arm/Thumb/Gen.cpp
	vm/compiler/codegen/arm/Thumb2/Gen.cpp
JIT: Combine add with shift and offset for array load & store.

Optimize long and double array load / store for ARM JIT.
Array load / store performs a logical shift left and add,
replace it with add capable of performing shift in the
same instruction.
Array load / store performs an add instead of using offset
for vldr/vstr. Replace the add and vldr/vstr with a vldr/vstr
that is capable of handling offset.

This improves performance for usecases involving long and double
array code execution in Dalvik. E.g WindowOrientation.

Change-Id: I90220c349ab936cdba1987139ccdf4dc31d7bbb0
Signed-off-by: Patrik Ryd <patrik.ryd@stericsson.com>

Conflicts:
	vm/compiler/codegen/arm/Thumb2/Gen.cpp
Revert "Support debug info in dexmerge."

This reverts commit 89b53f727b579850a777a99b822aab1d31093db0.

Applied in duplicate

Conflicts:
	dx/src/com/android/dx/merge/DexMerger.java

Change-Id: Ib43ae391be9e48b308d3d55516cd183936891c63
GC triggering performance optimizations

Copy the correct starting heap size at process init.
Interfaces to set GC/managed heap parameters.

Change-Id: I454b1985a3225d7dbdea9c5d4e6f0c9f5e24352e

Conflicts:
	vm/alloc/HeapSource.cpp
dalvik/libdex: Change to -O2 if we're building with -O3

This is a workaround for an apparent gcc bug.
https://bugs.launchpad.net/linaro-android/+bug/948255

Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
dalvik/libdex: Don't reduce optimization level to -O2

Don't reduce optimization level to -O2: It's sufficient to disable
function inlining

Change-Id: Ie6d9978cf0bf0e49cfa296c09c4eba913f22c303
Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
dalvik: Fix for broswer-crashing bug

This applies the fix proposed by Olivier Cozette in
https://code.google.com/p/android/issues/detail?id=37561
and fixes our bug:
https://bugs.launchpad.net/linaro-android/+bug/978060

An alternative fix has been applied since, leaving this one in
as a comment for reference

Change-Id: I54336c83650c1628fd1bb689148bc1dd8843d7c6
Signed-off-by: Jon Medhurst <tixy@linaro.org>
dalvik/vm: Dalvik startup with a low memory footprint

Initialize concurrentStartBytes and createMspace using HEAP_MIN_FREE.
This helps save Android framework memory after boot.

This is for low memory targets only(~512MB RAM & hdpi resolution)
Also, set TARGET_ARCH_LOWMEM in the BoardConfig.mk file of a device
for this patch to take effect.

Change-Id: Ib164c5eaf3236fe2de2697e84de4ee85f8997e94

Conflicts:
	vm/alloc/HeapSource.cpp
Minor code cleanup to address warnings found by Clang.

cherry-picked from internal Android branch
55617c82a73d84ff3695bdd5526159448262d009

Change-Id: I0f78ca6b8293c13d7dbb535556543f6ea9f4dd45
Fix minor leaks caused by failed initialization in JNI_CreateJavaVM

Change-Id: I97e4b162fa729c97a1e71786b696f2befed56835
Fix some leaks in VfyBasicBlock & BitVector.

Change-Id: I20050135588fc96268911b8ab690b04c8ad949bc
If CheckJNI is enabled don't allow app workarounds

Change-Id: I2554bbb18439337d2ddbc066799c2450769c35cb
Fix a minor leak in dvmCreateInlineSubsTable

Change-Id: I1dce0e24c861903e8f5eccb23a7e2865ae8c9cec
Fix a minor bug in dvmCreateInterpThread

Change-Id: I452ee02290bc7e0be7fefcf5755c5cd9628142dc
[MIPS] Fix a problem with the FPU double alignment workaround.

This patch fixes the following cts failure:
tests.api.java.lang.reflect.MethodTest#test_invokeLjava_lang_Object$Ljava_lang_Object

Change-Id: If29c138418a3df6e195947c8e3d80f2cfd6aa9db
Signed-off-by: Douglas Leung <douglas@mips.com>
libdvm should block SIGPIPE like the RI does.

Normally AndroidRuntime.cpp patches over this lapse, but that means
that tests run by vogar or any other kind of "bare" VM doesn't handle
SIGPIPE correctly. I'll remove the workaround from AndroidRuntime.cpp.

(cherry-pick of 8723464b85290c1b348bf3e29d06e6d0a291fd4c.)

Bug: 10211309
Change-Id: I5ecb9cbb80b174590694a8837e71507b595ef6de