GC triggering performance optimizations

Copy the correct starting heap size at process init.
Interfaces to set GC/managed heap parameters.

Change-Id: If0b1637291e77f9781ae6249c5d0257f659253ca
Merge tag 'android-4.4.1_r1' into HEAD

Android 4.4.1 Release 1
Allow multiple gzip members in gzip streams.

We look for the gzip magic bytes at the end of every
member and try to decompress the remainder of the
stream if we find it.

Note that this changes the behaviour of this class wrt.
the underlying stream: It is no longer self limiting. It
will attempt to read past the gzip trailer to look for
more data to decompress. Before this change, it would've
been possible to (hackily) consume the rest of the compressed
stream directly by inspecting the value of
InflaterInputStream.inf.getRemainingBytes(). It's no longer
possible to sensibly support that.

bug: https://code.google.com/p/android/issues/detail?id=63873

Change-Id: I818f77c052a811ed98b76243f2ad8a1a4d236d70
Move DeleteOnExit to libcore.io.

Also makes the constructor private & a field final.

Change-Id: I1df833cee5f4217bd800c36104da2a76a1f1877d
Finish fixing Zygote descriptor leakage problem

In order to prevent Zygote descriptors from leaking into the child
environment, they should be closed by the forked-off child process
before the child switches to the application UID.  These changes close
the descriptors via dup2(), substituting a descriptor open to
/dev/null in their place; this allows the Zygote Java code to close
the FileDescriptor objects cleanly.

This is a multi-project change: dalvik, art, libcore, frameworks/base,
and external/sepolicy are affected.  The CLs need to be approved
together, lest the build break or the software fail to boot.

Bug: 12114500
Change-Id: I8ea69de7b1cfbd811977a5629eb0af665f6dd66a
Remove old fork-and-specialize API

As promised, this is the cleanup patch-set which removes the
old native "fork and specialize" API, which has been replaced
by a slightly-enhanced one which can close the Zygote socket
descriptors in the Zygote child.

Change-Id: Icaeab730bee8638354dc664524e4118cdd946d2f
libcore/luni: Use -fno-strict-aliasing for now

This will be reverted once we have a proper fix.

Change-Id: Iab4663a5f96ff9770371f54697aa872260037ac1
Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
Merge remote-tracking branch 'github/cm-11.0' into cm11mod-linaro
Merge remote-tracking branch 'github/cm-11.0' into cm11mod-linaro
Merge remote-tracking branch 'github/cm-11.0' into cm11mod-linaro
Merge remote-tracking branch 'cm/cm-11.0' into cm11mod-linaro
luni: Don't build with strict aliasing for now.
Merge remote-tracking branch 'cm/cm-11.0' into kk-mr2
Merge remote-tracking branch 'cm/cm-11.0' into kk-mr2
Implements some math functions for faster performance

Changes cosh, exp, expm1, log, log10, sinh, cbrt,
asin, acos, atan, tanh, log1p
These functions are now implemnted in java to
save the overhead of a jni call

Change-Id: I4d3b70dd1693378af5b04cbbe0fecd95d97c1cff
Implements some StrictMath functions for improved performance.

The functions ceil, floor, hypot, IEEEremainder, nextafter, and rint
have all been implemented in Java to save the native call. Benchmarking
numbers to show this performance improvement are included:

Native call (before change):
  benchmark=Ceil: 97.40 ns; σ=0.02 ns @ 3 trials
  benchmark=Floor: 98.73 ns; σ=0.02 ns @ 3 trials
  benchmark=Hypot: 714.62 ns; σ=0.44 ns @ 3 trials
  benchmark=IEEEremainder: 180.31 ns; σ=0.08 ns @ 3 trials
  benchmark=NextAfterD: 110.47 ns; σ=0.02 ns @ 3 trials
  benchmark=NextAfterF: 96.20 ns; σ=0.01 ns @ 3 trials
  benchmark=Rint: 92.21 ns; σ=0.02 ns @ 3 trials

Java implementation (after change):
  benchmark=Ceil: 47.32 ns; σ=0.01 ns @ 3 trials
  benchmark=Floor: 42.03 ns; σ=0.00 ns @ 3 trials
  benchmark=Hypot: 69.42 ns; σ=0.37 ns @ 3 trials
  benchmark=IEEEremainder: 49.64 ns; σ=0.04 ns @ 3 trials
  benchmark=NextAfterD: 63.32 ns; σ=0.17 ns @ 3 trials
  benchmark=NextAfterF: 64.67 ns; σ=0.12 ns @ 3 trials
  benchmark=Rint: 31.10 ns; σ=0.41 ns @ 10 trials

Change-Id: I9ee926514c0661cdb7a1e6ae3acfe5c31a4b9f20
A char array copy optimization (libcore).

- Based on measurements, copy char by char for arrays of length <= 64.
- With this change, the Ritz MemAllocBench got ~25% faster on Nexus 4
  and ~20% faster on host.
- This change only handles arraycopy calls in the core libraries and
  char arrays with the rest future work.

Bug: 7103825

(cherry picked from commit a3eb10feba1c3479ad99ef5c5323d011a5365f4b)

Change-Id: Ic002ced3bc2f2a682cd4b8cec07ede990edd7463
Fix an array copy optimization bug.

When we copy within the same array, we need to take care of
overlapping range cases and copy backward in some cases. Verifed with
TestBigDecimal and CTS tests.api.java.math.BigDecimalTest.

Bug: 11233386
Bug: 9986565

(cherry picked from commit 7f2504897c33ab3c312028b4546818bc2d037bc7)

Change-Id: I5243c01222c58c137ad2595048372022c689576d
Avoid running Runtime.gc() until we need to run finalization.

This prevents excessive explicit GC which are called from apps to get
good GC behavior on Dalvik. Calling System.gc() does not help on ART
since GC for alloc is much rarer.

If running finalizers is requested following a System.gc we remember
that a GC was requested and perform it ahead of finalization.

Bug: 12004934

Change-Id: Id1343ce8b5378c5f53c1e5649c06ddd045f56a3b
Throw an error when parsing an obviously bad Double

Thanks to Robbie Hott for the bug report.

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