Add support for ARMv6J and ARMv6-VFP processor target

Merged in code from gingerbread branch with updated code in ics.

Change-Id: I8e757bc11e1b282598b6e8640c11f9a720936d21
DexOpt anything in /system on /cache

Allow system property to disable use of /cache for dexfiles.

(manually cherry-picked commit 15d27bbe10e307136e081bedb7cf25131896f1cb)

Change-Id: I4f141277d14b151bc0e23fdb4ce32f84d7c8a84a
Exclude sha1.c when building libdex for device

In bionic, there is already an optimized SHA-1 hash implementation,
and the file 'sha1.c' in libdex is almost identical.  It is only
necessary to build sha1.c for host version of libdex.

In addition, the SHA-1 hash implementation in bionic is slightly faster
than the one included in libdex.

Here is the reference SHA-1 benchmark on Nexus S:

[libdex]
Rounds: 100000, size: 6250K, time: 1.28s,  speed: 4.768 MB/s

[bionic]
Rounds: 100000, size: 6250K, time: 1.184s, speed: 5.156 MB/s

(manually cherry-picked commit 55ac5b0a908b85c050f34dc603f62dd4b1fc4e9f)

Change-Id: I40ac0c939c0e19fa18052ec9c5b94418a73bdd43
[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
dalvik: fix a bug in redundant branch elimination

Change-Id: I02467a3abf57665fa07e650fed441a899678ba44
  Trim after explicit gc.

  On Gingerbread, dvmHeapSourceTrim() is called 5 seconds
  after every kind of GC. Current AOSP do trim only for
  concurrent GC. That makes OOM killer too busy.

  At least explicit GC need trim and in case of explicit
  GC, there are no need to delay 5 seconds before trim.

Change-Id: I8fde8f773398bf20c674cfa6f686d7d745d56492
dalvik: Increase HEAP_IDEAL_FREE to 7.2 MB

Increase HEAP_IDEAL_FREE to 7.2 MB
To avoid frequent garbage collections,
which causes stutters while scrolling sms/contacts.

Change-Id: I037a0375d530670f2e6f0c06883ee394b1839e39

vm: Add interface to make GC IDEAL_FREE and CONCURRENT_START
configurable from framework

Change-Id: Ib566d945ccad12b2d7fb5de56e26f892f8be6352
dalvik: Fix various compile failures with gcc 4.6

This fixes numerous compile errors with gcc 4.6, and combinations
of -DNDEBUG, -DLOG_NDEBUG resulting in variables being defined but
not used - resulting in a compiler warning (or build breakage
with -Werror).

Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>

dalvik: Fix aliasing violation

Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>

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: Fix build with ISO C++11

Fixes some confusion between jchar and the new char16_t

Change-Id: I092addd16852205ef6ae4ac42b3ae8691c7e9e0b
Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
Revert "  Trim after explicit gc."

This reverts commit a6cecb830d12f706138acd870abf0f4a73b31ffe.

Has been reverted in AOSP

Explanation:
This patch had been causing trouble on low-memory devices, so let's back it out until we have time to work on some more sophisticated heuristics.
(one problem with our current heap trimming implementation is that its cost is proportional to the number of allocations, not the number of free pages, so it's easy to end up paying a lot and getting nothing in return.)

Change-Id: I98e4f652596b9e5ccea17295fb349010816aa4a4
ThumbVFP.cpp:231:10: error: variable 'wide' set but not used [-Werror=unused-but-set-variable]

Change-Id: If6828c8cf8c2c4ab28567f6e39126e537d0020c1
Added missing <include sys/resource.h> for gcc-4.7.1

Patch Set 2: Added gcc version check as suggested by jeagoss

Change-Id: I7743d5fab8d026e12ad9e9ef4d4fbabe0a9bded7
Fix a possible off-by-one in the verifier.

Bug: http://code.google.com/p/android/issues/detail?id=10863
Change-Id: I604f9a5ea08b6a6934b3ba522e1fda0bb738f81c
dalvik: Update ARMv6 code to compile and bring in line with ARMv5

Change-Id: I2764002422ade74db602cc2292108ed67241f0be