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>
Use RETURN_PTR(NULL) instead of RETURN_VOID in newNonMovableArray.

RETURN_VOID doesn't set the return value. This means that we are
returning random garbage when the allocation doesn't succeed.

Bug: 11971220
Change-Id: I570562c7bb9dc573161294916f582709774b35fd
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
Fix a couple of minor publicly-reported GC bugs.

An assertion was incorrectly assigning rather than testing, and
there was the usual buggy attempt to recover from failure rather
than just aborting in the HeapSource.cpp dvmHeapSourceStartup.
(The Copying.cpp dvmHeapSourceStartup by contrast will just
segfault if an allocation fails, but that's fine too.)

Bug: https://code.google.com/p/android/issues/detail?id=61562
Bug: https://code.google.com/p/android/issues/detail?id=61563
Change-Id: I237a6f923a07d61709f99ab67c9a18dbc7e6c839