Changed dvmDexCacheStatus to check for odex file first.

This prevents the generation of a new dexfile when an odex file already
exists when switching between Art and Dalvik.

(cherry picked from commit 36e356c96640775f0a3f167bd2426ea0f0093b8b)

Change-Id: Ieafdca8453f70c96edb787b5a3a3ac7c7aeea021

Conflicts:
	vm/JarFile.cpp
Remove inconsistent usage of macros that broke Thread.sleep/wait on host

Code for managing Thread.sleep/wait used both !defined(__APPLE__) and
HAVE_POSIX_CLOCKS interchangeably to mean the same thing. That worked when
one or other was set but failed on host because neither were set and could also
fail if they were both set. This changed to use HAVE_POSIX_CLOCKS consistently.

The code that used this was spread across 4 separate files with quite a lot of
duplication so that has been replaced with a new method
dvmInitCondForTimedWait in Sync.cpp.

A few extra comments were added to make some things that were a bit confusing
clearer, hopefully.

Change-Id: I7660c931f0cafcd0563afd1165de2aa615040602
Bug: https://code.google.com/p/android/issues/detail?id=68402

Conflicts:
	vm/Sync.cpp
	vm/Thread.cpp
	vm/alloc/HeapSource.cpp
	vm/compiler/Compiler.cpp
Track package manager changes for arch specific dexopt.

- Changes signature of isDexOptNeededInternal. No behavioural
  changes are needed because dalvik only uses the first argument
  to the function (the "name") and dexopt is architecture agnostic.

- Changes dexOptGenerateCacheFileName to place dex files under
  /data/dalvik-cache/<instruction-set>. This allows us to avoid
  needing dalvik specific logic in the package manager and installd.

(cherry picked from commit f752d041dac2cc8e26d03292ffec986a2bf905f9)

Change-Id: Ie31c9925269d6ac97d358ce49219557692704329

Conflicts:
	libdex/OptInvocation.cpp
	vm/native/dalvik_system_DexFile.cpp
Define kInstructionSet for x86-64 and arm64.

This fixes 64-bit host compilation of libdex.

Change-Id: I364b624e12620f844cc7bbaa08e679c8a529f87c
Return the correct error code in multi-thread mode

Bug: 14062905

In "--num-threads" mode, dx did not return a result code different
than zero in case of a Throwable.
This CL aims to have the same behaviour in multi-threaded mode as in
normal mode.
There are 2 cases:
- When there is an Exception, it is supposed to be handled by
ClassPathOpener.Consumer.onException(). The number of errors is then
incremented, which is used in "com.android.dx.command.dexer.Main" to
return the error code. With "--num-threads" it couldn't be handled by
onException(). So I've modified the ParallelProcessor to use the
ClassPathOpener, so that the Exception is handled inside the thread.
- When there is an Error it is handled using the Futures of
ParallelProcessors through ExecutorService.

Change-Id: Idc9d8d8bc737587ca518f8f9166e5e511ec22908
Remove tests of dead code.

Bug: 14903517
Change-Id: I9fc7dd742e80850eeb461f91be7750530585cfb3
Add support for jemalloc.

This is good enough to get dalvik to compile, but it still requires
more work to make it really work.

Bug: 981363
Change-Id: I411428a2e859c1f474fa0d7aaf406979bba9ed72
Build host libdvm as 32-bit only.

Bug: 13751317
Change-Id: I97add3cfb9ad84df4da97096d41059091608f216
Support new VMRuntime native method

Implements isCheckJniEnabled method.

Bug: 14888999
Bug: 14888124
Change-Id: I8a2d3f22f84a093be2fbc74464af6aa7b2a2bebb

Conflicts:
	vm/native/dalvik_system_VMRuntime.cpp
Clean-up some compiler warning messages.

Change-Id: I24522a57eaabedd4191856b80e5efe1b845be2fd
Split multicatch so they have different handlers.

This is a workaround for bug 14256107. See bug 14499218 for more discussion
about the motivations for this change.

(cherry picked from commit 38f3f7c42f4d71e80f98e6bb7b45072fe6b884fa)

Change-Id: Ia99b8ba64217f712c72bf9ffb6a5396409639550
Fix dalvik script to invoke dalvikvm with the right library.

Change-Id: I1271488d5c3ac334270bbb27d94a221dd997682b

Conflicts:
	vm/dalvik
Move target dalvik off __memcmp16.

The host was already using the other code path, and this lets us move
__memcmp16 out of bionic and into art where it belongs without having
to duplicate the work for dalvik too.

Change-Id: I99e21ecd35e67b9711bb28d14d2f31c451b7ecb7
Really move dalvik off bionic's __memcmp16.

The inline assembler calls back to C for "long" strings, so we still need
the stub.

Change-Id: I894ea1aef1f60738a30c19aac728ed101d228111