Remove Zygote.fork

Currently unused. Note that ART does not have a native
definition of this function.

Change-Id: If75830ca231db7a597dfe726fb0968828fca9593
Move zygote initialization code to the framework.

The framework class com.android.internal.os.ZygoteInit
will call back to the runtime before / after the fork, so
that it can perform runtime specific bringup / teardown.

Change-Id: I9730e12da8b22f03397658b1bddc7fd73f4fbc7d

Conflicts:
	vm/native/dalvik_system_Zygote.cpp
Fix debugging on dalvik.

u4* args is a pointer to a flat array of 4 byte values,
so the "debugFlags" arg of postForkChild(long, int debugFlags)
is at args[2], not args[1].

bug: 13926783

Change-Id: Icd3bbf9dd249cdd70e085acdd4dd7daa415cd698
Remove usage of pthread_cond_timedwait_monotonic_np.

Replaced with the posix compliant pthread_condattr_setclock.
Unfortunately, mac OS doesn't support CLOCK_MONOTONIC
or (pthread_condattr_setclock) so we fall back to using
the "default" pthread_condattr_t value like we did earlier.

Change-Id: I23475ef0d4e392d9e14402c6b5f8f658c5ed4063
Don't implicitly cast NULL to a bool

The code is wrong and causes an error when building with clang 3.4
(-Werror,-Wnull-conversion)

Change-Id: I223649ebcebf6f5df4b1024651bf07e85288f0b8
Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org>
Move dalvik off cacheflush so we can deprecate it.

Bug: 12965705
Change-Id: I805428e3103ff578d048ecbbc6ae30c0ead19ef9
Let dalvik use <stdint.h> for SIZE_MAX.

Bug: 12708004
Change-Id: I96a167e1161d6350dfb97aff1c59d1ec39db9628
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
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
Switch dalvik over to a long in DexFile.

Change-Id: I75798b22a64ee3f5aa8429bb22ac25e5b9966247
Add native binding for isDexOptNeededInternal.

Dalvik has no profiler, so we can safely ignore the
"defer" argument.

Keeps dalvik functional on master.

Change-Id: I2ace9a215e7ff471294927aa870e55cf7c0327b1
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
Define kInstructionSet for x86-64 and arm64.

This fixes 64-bit host compilation of libdex.

Change-Id: I364b624e12620f844cc7bbaa08e679c8a529f87c
Align 64-bit registers on even dalvik registers

The following alignments are done during register allocation
- Align 64-bit registers that are not parameters by modifying the method
giving the next free register to take into account alignment constraints.
- Align the first register of a range to maximize the number of 64-bit
registers that will be aligned into the range.

The following alignments are done during instruction massaging
- Mov instructions inserted to transfer registers which are not compatible
with the selected instruction will use even registers for 64-bit registers
- Insert the right number of registers during instruction massaging in order
not to break alignment done by the register allocator
- Align parameters to maximize the number of 64-bit register aligned.

Change-Id: Iaac6d7038f33699e9d9897b95d923297c72e20c6
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
Add interface for updating process state.

Used only in ART. Stub function added to Dalvik.

Bug: 8981901
Change-Id: Icc4d3c73c7959bae97d43752f3b4c5e146b7cb1f
Support new VMRuntime native method

Implements isCheckJniEnabled method.

Bug: 14888999
Bug: 14888124
Change-Id: I8a2d3f22f84a093be2fbc74464af6aa7b2a2bebb

Conflicts:
	vm/native/dalvik_system_VMRuntime.cpp