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)
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 that getClasses() method returns protected classes

In publicOnly condition, Dalvik_java_lang_Class_getDeclaredClasses()
returns non-public(protected) declared class.
It is not match with documentation and the result of host java vm.
Protected inner declared class is generated as ‘public’ class via host javac.
But, has ‘protected’ constructor.
This fix add check constructor’s modifier to decide whether public or not.
Related issue: http://code.google.com/p/android/issues/detail?id=60394

Change-Id: Ib93f8f8b117129a9fc588f5884490308c26cb802
Dump hprof when app encounters Out of memory

These changes will only dump application hprof when debug
property "dalvik.debug.oom" is set to -1.

CRs-Fixed: 471156

Change-Id: I41fbbd5cdaa852cd5e8896186e9d3993688a9cb0
(cherry picked from commit eac7514a989e78b191fde100475b907427158b8d)
(cherry picked from commit 63a1141f9bb9fc58beacdde1e8e24df82fe6e000)
Reject dex files that attempt to use unspecified class access flags

Change-Id: Ib1ecf3dfe1856a9014c2e9b0d6a1725ba7617f98
Move verification of class access flags to libdex

Change-Id: I020a168cfff46e319b0bebb6c7477f0b4139c6de

Conflicts:
	libdex/DexSwapVerify.cpp
Support setting capabilities in the top 32 bits.

We're already trying to use one such: CAP_BLOCK_SUSPEND.

Bug: 11508244
Change-Id: Ied12ffe52130fc2868903ffe6a3f46f6505f0970
export setThreadName() and add NULL check

Change-Id: I9b69a23b308fe851ed49722c0da3953433b3f5b8
Set Processes comm name to package name

When debugging audit logs, it is often helpful to
have the packages name. Bear in mind that the
package name is the right most chars up to
TASK_COMM_LEN. Although a possibility of truncation
exists, it can be useful for narrowing down the
possibilities.

Change-Id: Ia735b03f64352d155f8b96e1d47f48e6519b1d4f
Dalvik: DMB Optimisation

Replaces use of 'dmb' and 'dmb st' with inner-shareable versions.
This should improve performance in certain cases without harming
correctness.

Change-Id: Id30f58b93b34bf0e232bb01dc3956a82f7a69c40
Dalvik: DMB Optimisations for TracingJIT

Makes DMB domain ISH or ISHST instead of the implicit System.
ISH (Inner Shareable) should be sufficient for all cores/clusters,
but is not sufficient for GPU or other memory-mapped peripherals

Change-Id: Id159228daba97bc3692d2eb1ee2786bae2ee34a7
Fix "dalvikvm -help".

Showing the help because we were asked to isn't an error.
Showing the help because the command line made no sense is.

Bug: https://code.google.com/p/android/issues/detail?id=60009
Change-Id: I2d5097e7bcf47db833ea2e0e0f3b8164f6309272
Dalvik: Ensure that the array length complies with the final specifier

JSR-133, which Android 4 should comply with, "final" fields should be
visible to all threads at the time the constructor exits, regardless of
synchronization. This behaviour should also apply to the array lengths
as they are regarded as equivalent in behaviour to "final" fields.
Non-final fields require explicit synchronization in Java for them to be
accessed correctly.

The Dalvik VM in Android ensures constructors for ordinary object behave
properly by inserting a memory barrier ("DMB") on their return if the
object's class has a "final" field.

The issue, however, is that while Dalivk inserts a barrier in
constructors, it doesn't during array create. A barrier ought to be
inserted in order to ensure an array's length is visible when the array
itself can be observed by other threads.

In order for Dalvik to be correct in respect to JSR-133 and the ARM
memory model, it should be modified to have a memory barrier after an
array is allocated and initialized, before it is visible to other
threads.

Change-Id: I329656139264552bbd7cacd8c743b694ee2e0bb8
Signed-off-by: Stuart Monteith <Stuart.Monteith@arm.com>
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>