History log of /art/runtime/Android.mk
Revision Date Author Comments
bb11c8b1219f5b4b3154c2c83fca19ec8add6646 12-Apr-2016 Nicolas Geoffray <ngeoffray@google.com> Remove the JIT from the instrumentation framework.

This was slowing down the interpreter for no reason.
Also, call AddSamples for invoke-static and invoke-direct.

bug:27865109

(cherry picked from commit 274fe4adcb0610a9920be7814d9beb9cac6417ce)

Change-Id: I3519456ac8e0c7211cbe3f12e88d134beee87479
08305325d3468d5ef413eb0b36b1ea1b3746a6c4 05-Apr-2016 Jeff Hao <jeffhao@google.com> Remove AnnotationAccess and its remaining uses.

Art side of this change. Adds a test to ensure annotations not marked
for runtime retention can't be seen at runtime.

Bug: 27912552

(cherry picked from commit 1133db79350060158f99210c56f111c6dad43563)

Change-Id: I090a90bc82fc9b5e51aba02dcb3d8cccb6fb0f90
1133db79350060158f99210c56f111c6dad43563 05-Apr-2016 Jeff Hao <jeffhao@google.com> Remove AnnotationAccess and its remaining uses.

Art side of this change. Adds a test to ensure annotations not marked
for runtime retention can't be seen at runtime.

Bug: 27912552
Change-Id: I078069b7b3cb72bfe7d0b9ea61e527fee04d56a3
bf9611f821697b14bf9e170f503c3f47613b046b 26-Mar-2016 Andreas Gampe <agampe@google.com> ART: Clean up verifier

Clean up verifier post-Quick.

Change-Id: I0b05e10dd06edd228fe2068c8afffc4b7d7fdffa
7bcfcb80a31f57a84d754e00bca8698829365208 23-Mar-2016 Andreas Gampe <agampe@google.com> Revert "Revert "Use compiler filter to determine oat file status.""

This reverts commit 845e5064580bd37ad5014f7aa0d078be7265464d.

Add an option to change what OatFileManager considers up-to-date.
In our tests we're allowed to write to the dalvik-cache, so it
cannot be kSpeed.

(cherry picked from commit 29d38e77c553c6cf71fc4dafe2d22b4e3f814872)

Bug: 27689078
Change-Id: I6274188610f31dcd9d086fc080b2be93afae5a6b
29d38e77c553c6cf71fc4dafe2d22b4e3f814872 23-Mar-2016 Andreas Gampe <agampe@google.com> Revert "Revert "Use compiler filter to determine oat file status.""

This reverts commit 845e5064580bd37ad5014f7aa0d078be7265464d.

Add an option to change what OatFileManager considers up-to-date.
In our tests we're allowed to write to the dalvik-cache, so it
cannot be kSpeed.

Bug: 27689078
Change-Id: I0c578705a9921114ed1fb00d360cc7448addc93a
845e5064580bd37ad5014f7aa0d078be7265464d 23-Mar-2016 Nicolas Geoffray <ngeoffray@google.com> Revert "Use compiler filter to determine oat file status."

Bots are red. Tentative reverting as this is likely the offender.

Bug: 27689078

This reverts commit a62d2f04a6ecf804f8a78e722a6ca8ccb2dfa931.

Change-Id: I3ec6947a5a4be878ff81f26f17dc36a209734e2a
a62d2f04a6ecf804f8a78e722a6ca8ccb2dfa931 18-Mar-2016 Richard Uhler <ruhler@google.com> Use compiler filter to determine oat file status.

Record the compiler filter in the oat header. Use that to determine
when the oat file is up-to-date with respect to a target compiler
filter level.

New xxx-profile filter levels are added to specify if a profile should
be used instead of testing for the presence of a profile file.

This change should allow for different compiler-filters to be set for
different package manager use cases.

Bug: 27689078
Change-Id: Id6706d0ed91b45f307142692ea4316aa9713b023
f8cb1781a4e4be5df1f845206f7b37ed89092b64 19-Mar-2016 Mathieu Chartier <mathieuc@google.com> Move process state into runtime

Clean up.

Bug: 27420435

(cherry picked from commit f8484c8b55f4b423048f94dfabbe44110a039a9b)

Change-Id: Ia20781ee36e6a31c88ca41d3866b26813cff434d
f8484c8b55f4b423048f94dfabbe44110a039a9b 19-Mar-2016 Mathieu Chartier <mathieuc@google.com> Move process state into runtime

Clean up.

Bug: 27420435

Change-Id: I8fff84ed1b29a12310094b10fb6382268e69d54b
f525272b1edec721058e7d888545dd5d97b5045d 15-Mar-2016 Narayan Kamath <narayan@google.com> runtime: delete native/java_lang_Runtime.cc

We're now using Runtime.c from ojluni, which does the same set
of things via the JVM interface. This removes unnecessary duplication
of code between Runtime.cc and OpenJdkJvm.cc.

Also includes a few changes to JVM_NativeLoad to bring it in sync
with the version in Runtime.cc.

bug: 27387202

(cherry picked from commit 5f97157263d1b52bf4aea523b28294b21d694da1)

Change-Id: Ic2848755505a0cb25da8237150b07dadf0a42929
5f97157263d1b52bf4aea523b28294b21d694da1 15-Mar-2016 Narayan Kamath <narayan@google.com> runtime: delete native/java_lang_Runtime.cc

We're now using Runtime.c from ojluni, which does the same set
of things via the JVM interface. This removes unnecessary duplication
of code between Runtime.cc and OpenJdkJvm.cc.

Also includes a few changes to JVM_NativeLoad to bring it in sync
with the version in Runtime.cc.

bug: 27387202
Change-Id: I92aac81d131661aca588e352aee7a167593e17d4
48c3ce6733efbc545605b1bfe2ddbdf95a04edf3 03-Mar-2016 Stephen Hines <srhines@google.com> Enable clang for ARM builds.

Bug: http://b/25130937

We disable the integrated assembler for the ARM interpreter because
Clang can't handle the syntax present.

(cherry picked from commit a388c5a6291dbfb9a8366181a752050f4898d4ff)

Change-Id: Iefd5ba922eec54a2167e8a057c459b289aaf2ef3
a388c5a6291dbfb9a8366181a752050f4898d4ff 03-Mar-2016 Stephen Hines <srhines@google.com> Enable clang for ARM builds.

Bug: http://b/25130937

We disable the integrated assembler for the ARM interpreter because
Clang can't handle the syntax present.

Change-Id: I978d3f78e25819bb76ccb0f7f4b91a88e4b5a2de
00b53b7f3f9ce5996b767b52c28dd846f47a723c 03-Feb-2016 Alexey Frunze <Alexey.Frunze@imgtec.com> Fast ART MIPS64 interpreter

Change-Id: I5dda522df0acf9f9df626fe4f5ecfe6c4df600d3
6cbe0814952bd3bbb329c4ca4dc683ac87c2c2de 01-Mar-2016 Serguei Katkov <serguei.i.katkov@intel.com> Revert "Revert "Fast ART x86_64 interpretator""

CFI is updated. Now unwinder can fall through fast interpreter.

This reverts commit c4a575f58007036ff3408b15c2ec48108add20f3.

Change-Id: Ibb0a2ef41e4d02ab0b4ecc4f030ba0e72971aa9d
Signed-off-by: Serguei Katkov <serguei.i.katkov@intel.com>
c4a575f58007036ff3408b15c2ec48108add20f3 26-Feb-2016 Nicolas Geoffray <ngeoffray@google.com> Revert "Fast ART x86_64 interpretator"

Fails gcstress configuration.

This reverts commit c669beb798e273dd3d44cfa6a7a95ff90eba7209.

Change-Id: Ifac92471f91a116fc271d0dde8356fbbb0a08048
200f040af3e4fe9e178cb63c90860d58d90ef665 26-Feb-2016 Douglas Leung <douglas.leung@imgtec.com> [MIPS] Add Fast Art interpreter for Mips32.

Change-Id: I6b9714dc8c01b8c9080bcba175faec1d2de08f8f
c669beb798e273dd3d44cfa6a7a95ff90eba7209 14-Jan-2016 Serguei Katkov <serguei.i.katkov@intel.com> Fast ART x86_64 interpretator

Introduce the ART x86_64 fast interpreter.

Change-Id: I3649698eb251ac8acc98851969f9445f60d17b02
Signed-off-by: Serguei Katkov <serguei.i.katkov@intel.com>
05dfaaa8d1783bcf8fe603dd8ed260a939e846c0 28-Jan-2016 Serguei Katkov <serguei.i.katkov@intel.com> Mterp: Fix and restore mac host build

The following issues are fixed:
- Macro literal
- macro args should be comma separated
- no .type and .size for mac host build
- globals are _ prefixed

Change-Id: I28ef9138d5db06a6917a66b401c629bf66fac193
Signed-off-by: Serguei Katkov <serguei.i.katkov@intel.com>
274b455911a7083e72f09a27038d0e7e8e084e26 25-Jan-2016 Tamas Berghammer <tberghammer@google.com> Mark __jit_debug_register_code as a unique symbol on aarch64

The symbol have been marked as unique on arm, x86, x86_64 already.
This change mark it as unique on aarch64 as well because we switched
to gold linker and enabled identical code folding (ICF) for aarch64
also.

Change-Id: I3575e2db4ba4933fcc173eaaab6962881a7c9800
3b0b4b9d09baae7234fc26b7970b3ec55560735e 02-Feb-2016 Bill Buzbee <buzbee@google.com> Revert "Revert "ART: Mterp for arm64""

Looks like some of our assemblers disagree on valid arm64 assembly syntax
Force use of clang for art runtime. In a subsequent CL, will use form
that both gcc and clang accept.

This reverts commit 43f3fb960bce978df699c8a68a972be2a0d0d221.

Change-Id: Ice83072171ab502c43d492e2238b446c4814ea67
43f3fb960bce978df699c8a68a972be2a0d0d221 02-Feb-2016 Sebastien Hertz <shertz@google.com> Revert "ART: Mterp for arm64"

This reverts commit e0c269e0a5f50b1a551ddba1205f6e5b4b5e6c98.

The CL is causing build breakages on arm64 targets.

Change-Id: I7402fe34869258ae870c57308b2062e50d801bdd
e0c269e0a5f50b1a551ddba1205f6e5b4b5e6c98 27-Jan-2016 buzbee <buzbee@google.com> ART: Mterp for arm64

Ready for review. All opcodes handled. All applicable run-tests pass.
Device boots to desktop in interpret-only mode.

Change-Id: I937d8bcf848a831e04d4b9de8d1914667a197d75
7c58bd41046bb9f87642caa0c2b094dc98be29ca 20-Jan-2016 Bill Buzbee <buzbee@google.com> Revert "Revert "Fast ART x86 interpreter""

This reverts commit 2d093a1213cc2f85b5e5e02782332657c479eb94.

Disable x86 mterp compilation on Mac host builds (but keep enabled
for all target builds).

Change-Id: Ie355279f166d2964a786646ee53f065b7e0f5ede
2d093a1213cc2f85b5e5e02782332657c479eb94 20-Jan-2016 Bill Buzbee <buzbee@google.com> Revert "Fast ART x86 interpreter"

This reverts commit 99229c71efda9363faa571017c52a215c6e28f83.

Assembly syntax issue with the Mac build.

Change-Id: I271d18d31963fae46e4077ddd39313bec0b3a39e
99229c71efda9363faa571017c52a215c6e28f83 31-Dec-2015 Serguei Katkov <serguei.i.katkov@intel.com> Fast ART x86 interpreter

Port of ART Dalvik-style interpreter for x86.
See Bill's patch for details
https://android-review.googlesource.com/#/c/188977/

Included fixes
https://android-review.googlesource.com/#/c/196153/
ART: Mterp read barrier fix + minor cleanup

https://android-review.googlesource.com/#/c/196501/
ART: Mterp - remove redundant null check

Change-Id: If447e3a14088559e3aa0b82cb2c91721bea586ee
Signed-off-by: Serguei Katkov <serguei.i.katkov@intel.com>
1452bee8f06b9f76a333ddf4760e4beaa82f8099 06-Mar-2015 buzbee <buzbee@google.com> Fast Art interpreter

Add a Dalvik-style fast interpreter to Art.
Three primary deficiencies in the existing Art interpreter
will be addressed:

1. Structural inefficiencies (primarily the bloated
fetch/decode/execute overhead of the C++ interpreter
implementation).
2. Stack memory wastage. Each managed-language invoke
adds a full copy of the interpreter's compiler-generated
locals on the shared stack. We're at the mercy of
the compiler now in how much memory is wasted here. An
assembly based interpreter can manage memory usage more
effectively.
3. Shadow frame model, which not only spends twice the memory
to store the Dalvik virtual registers, but causes vreg stores
to happen twice.

This CL mostly deals with #1 (but does provide some stack memory
savings). Subsequent CLs will address the other issues.

Current status:
Passes all run-tests.
Phone boots interpret-only.
2.5x faster than Clang-compiled Art goto interpreter on fetch/decode/execute
microbenchmark, 5x faster than gcc-compiled goto interpreter.
1.6x faster than Clang goto on Caffeinemark overall
2.0x faster than Clang switch on Caffeinemark overall
68% of Dalvik interpreter performance on Caffeinemark (still much slower,
primarily because of poor invoke performance and lack of execute-inline)
Still nearly an order of magnitude slower than Dalvik on invokes
(but slightly better than Art Clang goto interpreter.
Importantly, saves ~200 bytes of stack memory per invoke (but still
wastes ~400 relative to Dalvik).

What's needed:
Remove the (large quantity of) bring-up hackery in place.
Integrate into the build mechanism. I'm still using the old Dalvik manual
build step to generate assembly code from the stub files.
Remove the suspend check hack. For bring-up purposes, I'm using an explicit
suspend check (like the other Art interpreters). However, we should be
doing a Dalvik style suspend check via the table base switch mechanism.
This should be done during the alternative interpreter activation.
General cleanup.
Add CFI info.
Update the new target bring-up README documentation.
Add other targets.

In later CLs:
Consolidate mterp handlers for expensive operations (such as new-instance) with
the code used by the switch interpreter. No need to duplicate the code for
heavyweight operations (but will need some refactoring to align).
Tuning - some fast paths needs to be moved down to the assembly handlers,
rather than being dealt with in the out-of-line code.
JIT profiling. Currently, the fast interpreter is used only in the fast
case - no instrumentation, no transactions and no access checks. We
will want to implement fast + JIT-profiling as the alternate fast
interpreter. All other cases can still fall back to the reference
interpreter.
Improve invoke performance. We're nearly an order of magnitude slower than
Dalvik here. Some of that is unavoidable, but I suspect we can do
better.
Add support for our other targets.

Change-Id: I43e25dc3d786fb87245705ac74a87274ad34fedc
068131cabcb579dc81cd1ce6abf9238553bb6238 05-Jan-2016 Josh Gao <jmgao@google.com> Remove unused reference to MALLOC_IMPL.

Bug: http://b/26390299
Change-Id: I2e779282d8d585519c2ed1bff246d2202eee61c8
4d77b6a511659f26fdc711e23825ffa6e7feed7a 01-Dec-2015 Calin Juravle <calin@google.com> Save profile information in a separate thread.

Previously we would save the profiling information only when the app
was sent to background. This missed on an important number of updates
on the jit code cache and it didn't work for background processes.

Bug: 26080105

Change-Id: I84075629870e69b3ed372f00f4806af1e9391e0f
18d209582e0bb1caed97102a86b416173f5aad42 22-Dec-2015 Narayan Kamath <narayan@google.com> Override notice file for OpenJdk based modules.

Change-Id: Iff63708c83c2a18b82f0de6aa884e1388ed8b32b
6ca77ecadde2f5fe622ce50db4f5865364d2b519 18-Dec-2015 Narayan Kamath <narayan@google.com> Separate OpenjdkJvm.cc into its own shared library.

Change-Id: Ibb0e64b81cb033764a865be1f05be5f3334feaa5
67feb1701277cd90be15f86c7633752721408b57 17-Dec-2015 David Srbecky <dsrbecky@google.com> Move JIT debugger interface code to its own file.

Change-Id: Ie788daa8caf60f2f0f93484681a8a9fcce61c23f
44409d33e05cd2f73d69e0a98daa5c9e2fe38089 11-Nov-2015 Dmitriy Ivanov <dimitry@google.com> Use isolated namespaces for app native libs

Linker namespaces provide necessary level
of isolation for application native libraries.

The native libraries will no longer be able to
mistakenly depend on platform private libraries
like /system/lib/libssl.so

This change creates one namespace for each instance
of class-loader and uses it when loading native libraries.

For backwards compatibility with older apps we keep
using default namespace and LD_LIBRARY_PATH if target
sdk version is <= 23. (currently set to 0 for testing)

Bug: http://b/22548808
Change-Id: I64e97af7450fbf7e3740ccddda96bb2f7c52e03b
(cherry picked from commit f5a3099c509cf9b8a4ce9c3073a4db47e14a23bc)
76e5eab8610dcded41455e3bc8131dc6d26b4929 02-Sep-2015 Tamas Berghammer <tberghammer@google.com> Mark __jit_debug_register_code as a unique symbol

This symbol is used to notify the debugger about JIT library load/unload
events. Because of ICF, several functions with the same body put to the
same adress by the linker what causes the debugger to get notifictaion
about JIT load/unload events in several case where it isn't really happened.

This change disable ICF for the __jit_debug_register_code symbol to prevent
this behavior with keeping the symbol unique in the object file.

This is the 3rd attemp to mark the __jit_debug_register_code symbol unique
as the previous 2 failed because of some confilict with unrelated changes.

Tracking bug for making the same change for aarch64 after we switch to gold
there: b/26149442

Change-Id: I6edc45f27d5e57a66fb9d98c32a081f711565810
f5a3099c509cf9b8a4ce9c3073a4db47e14a23bc 11-Nov-2015 Dmitriy Ivanov <dimitry@google.com> Use isolated namespaces for app native libs

Linker namespaces provide necessary level
of isolation for application native libraries.

The native libraries will no longer be able to
mistakenly depend on platform private libraries
like /system/lib/libssl.so

This change creates one namespace for each instance
of class-loader and uses it when loading native libraries.

For backwards compatibility with older apps we keep
using default namespace and LD_LIBRARY_PATH if target
sdk version is <= 23. (currently set to 0 for testing)

Bug: http://b/22548808
Change-Id: I64e97af7450fbf7e3740ccddda96bb2f7c52e03b
ceb07b3285eaab350a8cd12f7d74be3e40a255dd 10-Dec-2015 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Add support for LZ4 compressed image files""

Needed to call compiler_driver_->SetSupportBootImageFixup(false).

Bug: 22858531

This reverts commit 83d4d72aa0e4170209ab50c67ba22e46b71352c1.

Change-Id: Iaed6a810a0c088f1f2c57cf2f12087f3978a3de1
83d4d72aa0e4170209ab50c67ba22e46b71352c1 10-Dec-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "Add support for LZ4 compressed image files"

Tentative. Looks like it breaks image_test for hammerhead:
art/compiler/linker/arm/relative_patcher_thumb2.cc:36] Check failed: target_offset & 1u == 1u (target_offset & 1u=0, 1u=1)

Bug: 22858531

This reverts commit c6f41b5b3ca3d7ac3c12ad3995ffef4e831973a0.

Change-Id: I9bc5738a8b5c8f8bc8b73309f9420fd691bc79a9
c6f41b5b3ca3d7ac3c12ad3995ffef4e831973a0 05-Dec-2015 Mathieu Chartier <mathieuc@google.com> Add support for LZ4 compressed image files

Added dex2oat option --image-format=(store|lz4). Using lz4 means
that the main image section (all data other than header and bitmap)
are stored in a compressed state.

N5 results:
Boot image size: 8067128 -> 2827605
Decompression time 18.93ms
Decompression rate: 426MB/s

Patchoat is not currently supported since it maps the source image
directly. In order to support compressed images we would need to
recompress the output image and then write it back out to a file.
Also there are not many cases where we would want to patch a
compressed image since they are going to be dirty memory when
uncompressed anyways. Might as well just patch as we are loading.

Bug: 22858531

Change-Id: I8c54ccf73408273011161a61bb891736735074d9
5096e66d07db8041589518f8c5b0281d859d0817 08-Dec-2015 Vladimir Marko <vmarko@google.com> ART: Add FdFile::Copy() to copy data from another file.

Also move utilities for inspecting file magic numbers to
base/file_magic.{h,cc} and drop the unused IsOatMagic().

Change-Id: I2cc4dd18a5e8b9738fb386c8057faad3722bdd68
31f2c155975c5794d481df03eb0947cb48d2c6b5 23-Oct-2015 Calin Juravle <calin@google.com> Save jit profiling info to file.

Currently saves only the hot method references and omits the inline
cache.

Change-Id: I79e91f855f6b52dc19a9a86662604f2eee16613c
a7a4759946d9f11c88dc108b2b6a9518ce9c1e18 24-Nov-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "lambda: Add support for invoke-interface for boxed innate lambdas"

955-lambda is flaky

Bug: 24618608
Bug: 25107649

This reverts commit 457e874459ae638145cab6d572e34d48480e39d2.

(cherry picked from commit 3a0909248e04b22c3981cbf617bc2502ed5b6380)

Change-Id: I24884344d21d7a4262e53e3f5dba57032687ddb7
3a0909248e04b22c3981cbf617bc2502ed5b6380 24-Nov-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "lambda: Add support for invoke-interface for boxed innate lambdas"

955-lambda is flaky

Bug: 24618608
Bug: 25107649

This reverts commit 457e874459ae638145cab6d572e34d48480e39d2.

Change-Id: I24884344d21d7a4262e53e3f5dba57032687ddb7
457e874459ae638145cab6d572e34d48480e39d2 23-Oct-2015 Igor Murashkin <iam@google.com> lambda: Add support for invoke-interface for boxed innate lambdas

Lambda closures created with the 'create-lambda' instruction
(termed "innate lambdas") can be turned into an object with 'box-lambda'.

This CL enables support for those kinds of lambdas to work with
'invoke-interface' by generating a proxy class for the lambda.

Note: MIPS32/64 support not included.

Bug: 24618608
Bug: 25107649
Change-Id: Ic8f1bb66ebeaed4097e758a50becf1cff6ccaefb
763a31ed7a2bfad22a9cb07f5301a71c0f97ca49 17-Nov-2015 Mathieu Chartier <mathieuc@google.com> Add immune spaces abstraction

ImmuneSpaces is a set of spaces which are not reclaimable by the GC in
the current collection. This set of spaces does not have requirements
about space adjacency like the old ImmuneRegion. ImmuneSpaces generates
the largest immune region for the GC. Since there is no requirement on
adjacency, it is possible to have multiple non-adjacent applicaton
image files.

For image spaces, we also look at the oat code which is normally after
the application image. In this case, we add the code as part of the
immune region. This is required to have both the boot image and the
zygote space be in the same immune region (for performance reasons).

Bug: 22858531

Change-Id: I5103b31c0e39ad63c594f5557fc848a3b288b43e
0fd581232892a9b38bde759c67fefa9e79c4edbd 12-Nov-2015 Tamas Berghammer <tberghammer@google.com> Revert "Mark __jit_debug_register_code as a unique symbol"

This reverts commit e7132a9a5d98103fa52a750287476b063fa88863.

We are still using ld on some targets instead of gold when compiling for ararch64. Revert until we figure out why.

Change-Id: If09fac8d72485dc8adbc81e44a2af84ed91dcd91
e7132a9a5d98103fa52a750287476b063fa88863 02-Sep-2015 Tamas Berghammer <tberghammer@google.com> Mark __jit_debug_register_code as a unique symbol

This symbol is used to notify the debugger about JIT library load/unload
events. Because of ICF, several functions with the same body put to the
same adress by the linker what causes the debugger to get notifictaion
about JIT load/unload events in several case where it isn't really happened.

This change disable ICF for the __jit_debug_register_code symbol to prevent
this behavior with keeping the symbol unique in the object file.

This is the recommit of 5caf652d7bfb43bdd2f3addfe8021a5fb8e3f796 after
fixing the compilation issue on sdk_phone_armv7-sdk (mac) target.

Change-Id: I027d2c7964098d47ed350ee6b7c74d82c88a5d1f
df0b17a474306198b7b0320311496e42d707a00e 24-Apr-2015 Piotr Jastrzebski <haaawk@google.com> Add an ART implementation of jvm.h

Change-Id: Icce4ec04f614979fbe07ebd2e96399116b5d2afa
6c7aae9110f65ec1c95bfad557e1ba0c4ba91845 06-Nov-2015 Andreas Gampe <agampe@google.com> Revert "Mark __jit_debug_register_code as a unique symbol"

This reverts commit 5caf652d7bfb43bdd2f3addfe8021a5fb8e3f796.

Something's going wrong on the Mac host side, even though this should be target only.

Change-Id: I165f23ee25cb1c4b0732e1d1afcae75271abcb09
5caf652d7bfb43bdd2f3addfe8021a5fb8e3f796 02-Sep-2015 Tamas Berghammer <tberghammer@google.com> Mark __jit_debug_register_code as a unique symbol

This symbol is used to notify the debugger about JIT library load/unload
events. Because of ICF, several functions with the same body put to the
same adress by the linker what causes the debugger to get notifictaion
about JIT load/unload events in several case where it isn't really happened.

This change disable ICF for the __jit_debug_register_code symbol to prevent
this behavior with keeping the symbol unique in the object file.

Change-Id: I392be25d8a07f47f8217bf693c8e5919d29cac7b
751beff19b36f777d9e3a966d754fd9cfad5d534 28-Aug-2015 Phil Wang <phil.wang@linaro.org> Revert "Revert "Introduce support for hardware simulators, starting with ARM64""

This reverts commit 4cd27d64b0bbdde61fa3f6674ceb24221853ac2c.

This depends on VIXL 1.11.

Change-Id: I402c1fd6bbb218ba80ef8e59af203c9276151059
d9786b0e5be23ea0258405165098b4216579209c 14-Oct-2015 Artem Udovichenko <artem.u@samsung.com> Implementation of fast lookup table to search class_def by descriptor

Lookup table is a hash table which built at compile time and stored
into oat file. At runtime the table is restored and used in the
method DexFile::FindClassDef(const char*) to perform fast search of
the class_def_idx by class descriptor. Advantages of the lookup table
over the HashSet (runtime/base/hash_set.h) are:
1. Lookup table is built at compile time and uses read-only memory at
runtime
2. Lookup table uses less memory then DexFile::Index (less by 80% for
/system/framework/framework.jar on Nexus5)
3. Lookup table does less string comparisons compared with HashSet
(less by 70% for zygote process on Nexus5)
The disadvantage of the lookup table is it increased boot.oat size by
0.2% on Nexus5 and application .oat file by 0.3% in average on Nexus5.

mathieuc changes:
Create lookup table in dex2oat to speed up compilation. Clean up code
to follow style guide and use less static functions. Added
performance measurements.

Compile ~100 APKs 5 times with filter interpret-only:
Before:
real 1m8.989s
user 0m59.318s
sys 0m7.773s

After:
real 1m1.493s
user 0m52.055s
sys 0m7.581s

App launch (AOSP N5 maps, average of 45 runs):
Before: 966.84ms
After: 923.733ms
Launch speedup is 4.7%

Memory usage compared to HashSet index on 50 various APK:
32 bit: HashSet ~625694b vs TypeLookupTable ~404268b
64 bit: HashSet ~1251390b vs TypeLookupTable ~404268b

Bug: 10921004
Bug: 20269715

Change-Id: I7246c1d9ad9fe81fe5c5907a4bf70396d8f9242a
e5d80f83ae53792bc1eebd4e33e4e99f7c031b0c 16-Oct-2015 Mathieu Chartier <mathieuc@google.com> Move ArenaBitVector into the runtime

Motivation is using arenas in the verifier.

Bug: 10921004
Change-Id: I3c7ed369194b2309a47b12a621e897e0f2f65fcf
524e7ea8cd17bad17bd9f3e0ccbb19ad0d4d9c02 16-Oct-2015 Nicolas Geoffray <ngeoffray@google.com> Remove ArtCode.

- Instead use OatQuickMethodHeader.
- Various cleanups now that we don't have all those
ArtMethod -> ArtCode -> OatQuickMethodHeader indirections.

As a consequence of this cleanup, exception handling got a bit
faster.

ParserCombinators benchmark (exception intensive) on x64: (lower is better)
Before:
ParserCombinators(RunTime): 1062500.0 us.
After:
ParserCombinators(RunTime): 833000.0 us.

Change-Id: Idac917b6f1b0dc254ad68fb3781cd61bccadb0f3
6bc4374e3fa00e3ee5e832e1761c43e0b8a71558 12-Oct-2015 Nicolas Geoffray <ngeoffray@google.com> Add an abstraction over a compiled code.

That's just step 1, moving code-related functions of ArtMethod to
another class. That class is only a wrapper on an ArtMethod, but will
be changed to be a wrapper around compiled code.

Change-Id: I6f35fc06d37220558dff61691e51ae20066b0dd6
f9c6fc610b27887f832e453a0da1789187293408 07-Oct-2015 Mathieu Chartier <mathieuc@google.com> Add OatFileManager

Takes over a large amount of functionality from the class linker.

Changed OatFile to loading the same OatFile multiple times. This is
required for unloading OatFiles and moving dex caches to BSS since
these require a different OatFile for each dex cache and class
loader.

Bug: 22720414

Change-Id: I0321096723a294dc72949f21e66da82727b512fc
3cfa4d05afa76e19ca99ec964b535a15c73683f0 07-Oct-2015 Andreas Gampe <agampe@google.com> ART: Remove interpreter entrypoints

These are no longer used as entrypoints. Make them proper runtime
functions local to the interpreter.

Bump oat version.

Change-Id: Icdd92e20eafc5668b68eeebf55cf624560f462b3
aa5168291c46f9b418d989bccf2d8e09338a83e6 03-Oct-2015 Mathieu Chartier <mathieuc@google.com> Add exclusion between instrumentation and GC

Instrumentation calls VisitClasses while exclusive holding the
mutator lock. This can cause deadlocks since VisitClasses needs to
decode JNI weak globals. If the system weak slow path flag is set,
then we wait holding locks while exclusive holding the mutator lock.
This causes a deadlock since the GC cannot acquire the mutator lock
to sweep system weaks.

This fixes a deadlock seen in one of the tracing tests.

Change-Id: I580152118e068a70f309dcc19df4144afec835dd
6918bf13eb855b3aa8ccdddda2d27ae8c60cec56 28-Sep-2015 Igor Murashkin <iam@google.com> Revert "Revert "lambda: Experimental support for capture-variable and liberate-variable""

This reverts commit 7bbb80ab52c203e44d2ded2c947b3b03b4b31ec4.

Change-Id: If806ce5c6c5e96fdb2c3761dee096f74e7e5b001
7bbb80ab52c203e44d2ded2c947b3b03b4b31ec4 27-Sep-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "lambda: Experimental support for capture-variable and liberate-variable"

Test fails.

This reverts commit b72123440d8541362ebdb131436f9dbdda5fd329.

Change-Id: Ic9ed92f8c826d8465eb36b746dc44af05caf041c
b72123440d8541362ebdb131436f9dbdda5fd329 25-Sep-2015 Igor Murashkin <iam@google.com> lambda: Experimental support for capture-variable and liberate-variable

Supports capturing/liberating any primitive variables.
No support for capturing objects/lambdas yet since they would both
need GC changes to track roots through closures.

Change-Id: Ibfb68bfe4c579dbf93823aac4c0e6ac8f6360c5d
5550ca8bcc742b109d77e62f3a0877c667d894d3 21-Aug-2015 Nicolas Geoffray <ngeoffray@google.com> Record profiling information before Jitting.

- Add a new instrumentation kind to record dynamic invokes.
- Use the JNI entry point field to store the profiling data.
- Record seen receivers for every dynamic invoke.

Change-Id: I2c1738ab2a72052d45964d055dc16b44b906e54c
fc1ccd740b7c8e96dfac675cfc580122cd1b40a6 31-Jul-2015 Igor Murashkin <iam@google.com> lambda: Infrastructure to support capture/liberate-variable dex opcodes

* ArtLambdaMethod - wrap an ArtMethod with extra runtime lambda info
* Closure - data representation for a runtime lambda closure (read-only)
* ClosureBuilder - writer for creating a Closure at runtime
* ShortyFieldType - char/enum wrapper for shorty_field_type in dex

Tests:
* Closure, ClosureBuilder, ShortyFieldType have full unit test coverage.
* ArtLambdaMethod does not, but it is tested indirectly and is otherwise
trivial getters.

Future CLs will include interpreter integration with minimal changes to
this Closure infrastructure.

Change-Id: I38a7aea8df1da7b154fd6623258c6c228c8e51df
4cd27d64b0bbdde61fa3f6674ceb24221853ac2c 19-Aug-2015 Alex Light <allight@google.com> Revert "Introduce support for hardware simulators, starting with ARM64"

This reverts commit c2e1a5edc438274159c6ef8e65455ac73723a8f1.

This breaks the build for x86_64 targets. This is because on target the libvixl is not included as a
library for the libart.so target build. The build of non-x86_64 targets only works because the
compilers removes the dead-code that contains the libvixl symbols.

Bug: 23321940
Change-Id: I39e93ff05b887665c47fb0986867f1d13ca65b9b
c2e1a5edc438274159c6ef8e65455ac73723a8f1 29-Jul-2015 Phil Wang <phil.wang@linaro.org> Introduce support for hardware simulators, starting with ARM64

Simulator support for ARM64 is implemented with VIXL.
Now codegen_test will also run on all supported hardware simulators.

Change-Id: Idc740f566175d1a23c373ea9292b8fc5ba526d00
9644ab4dc452aa5989a37963d62f154c31e82155 27-Jul-2015 Chih-Hung Hsieh <chh@google.com> ART: Use Clang default integrated assembler.

Issues with x86, arm32 and arm64 have been fixed.
Allow the use of the integrated assembler.

Bug: 22874917
Change-Id: Iacfffda29d57bfc931da568a9436c2e34cb38df6
028aec203da206f9996f01432474165e801cd328 29-Jul-2015 Shinichiro Hamaji <hamaji@google.com> Do not use -DUSE_*MALLOC for host build

When we use ninja and switch a lunch target to another, they
may cause unnecessary rebuild because ninja detects command
line changes. They are used in #ifdef HAVE_ANDROID_OS so there
should be no semantics changes.

Change-Id: I629c94c872c8fc8ba4b4c59b565338e14570c3fe
cc5ebdf29ea47e24e79279169e0192dfc08b38c8 27-Jul-2015 Mathieu Chartier <mathieuc@google.com> Split the class table for each class loader

Each class loader now has its own class table. This makes it easier
to mark classes when a classloader is marked.

Fixed a bug in LookupClass where we used to look ignore the return
value of InsertClass.

Bug: 22720414

Change-Id: If2cd717989a20a6e245ebec24ad52dc47dd3207d
e2facc5b18cd756a8b5500fb3d90da69c9ee0fb7 10-Jul-2015 Igor Murashkin <iam@google.com> runtime: Add lambda box/unbox object equality

A lambda that is boxed with box-lambda is now stored as a weak reference
in a global runtime table (lambda::BoxTable). Repeatedly boxing the same
lambda closure value will always return the same java.lang.Object back.

Since there is no way to observe the address of an object, a GC can
happen and clean up the table of any dead boxed lambdas, which can also
shrink the table to prevent the memory use from growing too much.

(Note that a lambda closure is immutable, so hashing over it is
guaranteed safe.)

Change-Id: I786c1323ff14eed937936b303d511875f9642524
14c3bf91b2ec434295ec84d6446f495fb7de6d5c 13-Jul-2015 Mathieu Chartier <mathieuc@google.com> Change intern table to not use WaitHoldingLocks

Bug: 22423014
Change-Id: I9e16b8cb4def72fff73f1783a182877105feb7aa
65e069df6f864102b062fc04de8877f8230034a8 08-Jun-2015 Calin Juravle <calin@google.com> Build statically linked version of dex2oat.

Change-Id: Icde39b770781095af7bd87ae6b907ad97a8a05da
0b3ac8e60fe44d56054eb37e2441b730f165d605 30-Jun-2015 Evgenii Stepanov <eugenis@google.com> Explicitly link libz-host to libart.

A change in system/core/libziparchive will make libziparchive-host
depend on libz-host as a shared library instead of a static library.
As a result, only on MacOS, libziparchive-host will stop re-exporting
libz-host interface. Libart uses both and must link both.

Change-Id: Ie4ae9b27903cbcbdb2d2043969a7fceba32249be
8c2ff641294715864013737fdec57cdfd410270c 28-May-2015 Man Cao <manc@google.com> Add allocation stack traces for HPROF dump.

This feature is currently only enabled when DDMS's allocation tracking
is enabled. In the future there should be a way to enable this feature
before an application starts.

Also updates DDMS's recent allocation tracking to use a new backend
data structure that is shared with this feature.

The following system properties controls customizable parameters:
dalvik.vm.allocTrackerMax: max number of objects that have allocation
records, default 512K;

dalvik.vm.recentAllocMax: max number of records that are sent to DDMS
when clicking "Get allocation" button,
default 64K-1 (limit of the protocol);

dalvik.vm.allocStackDepth: max number of stack frames in an allocation
record, default 4.

Bug: 20037135
Change-Id: I26ed378a5613678bd3c43e846025f90470a8e059
12bd7210bb2f5738e33dfa3f2f1cba2e0aab4955 04-Jun-2015 Roland Levillain <rpl@google.com> If heap poisoning is on, pass the relevant flag to LOCAL_ASFLAGS.

This change ensures assembly files honoring heap poisoning
(notably used by stub_test) are compiled with
-DART_HEAP_POISONING=1 when this feature is turned on.

Bug: 21621105
Change-Id: I13fe456cd2733a09bdfd3a9808cfd70513b14698
3d21bdf8894e780d349c481e5c9e29fe1556051c 22-Apr-2015 Mathieu Chartier <mathieuc@google.com> Move mirror::ArtMethod to native

Optimizing + quick tests are passing, devices boot.

TODO: Test and fix bugs in mips64.

Saves 16 bytes per most ArtMethod, 7.5MB reduction in system PSS.
Some of the savings are from removal of virtual methods and direct
methods object arrays.

Bug: 19264997

(cherry picked from commit e401d146407d61eeb99f8d6176b2ac13c4df1e33)

Change-Id: I622469a0cfa0e7082a2119f3d6a9491eb61e3f3d

Fix some ArtMethod related bugs

Added root visiting for runtime methods, not currently required
since the GcRoots in these methods are null.

Added missing GetInterfaceMethodIfProxy in GetMethodLine, fixes
--trace run-tests 005, 044.

Fixed optimizing compiler bug where we used a normal stack location
instead of double on ARM64, this fixes the debuggable tests.

TODO: Fix JDWP tests.

Bug: 19264997

Change-Id: I7c55f69c61d1b45351fd0dc7185ffe5efad82bd3

ART: Fix casts for 64-bit pointers on 32-bit compiler.

Bug: 19264997
Change-Id: Ief45cdd4bae5a43fc8bfdfa7cf744e2c57529457

Fix JDWP tests after ArtMethod change

Fixes Throwable::GetStackDepth for exception event detection after
internal stack trace representation change.

Adds missing ArtMethod::GetInterfaceMethodIfProxy call in case of
proxy method.

Bug: 19264997
Change-Id: I363e293796848c3ec491c963813f62d868da44d2

Fix accidental IMT and root marking regression

Was always using the conflict trampoline. Also included fix for
regression in GC time caused by extra roots. Most of the regression
was IMT.

Fixed bug in DumpGcPerformanceInfo where we would get SIGABRT due to
detached thread.

EvaluateAndApplyChanges:
From ~2500 -> ~1980
GC time: 8.2s -> 7.2s due to 1s less of MarkConcurrentRoots

Bug: 19264997
Change-Id: I4333e80a8268c2ed1284f87f25b9f113d4f2c7e0

Fix bogus image test assert

Previously we were comparing the size of the non moving space to
size of the image file.

Now we properly compare the size of the image space against the size
of the image file.

Bug: 19264997
Change-Id: I7359f1f73ae3df60c5147245935a24431c04808a

[MIPS64] Fix art_quick_invoke_stub argument offsets.

ArtMethod reference's size got bigger, so we need to move other args
and leave enough space for ArtMethod* and 'this' pointer.

This fixes mips64 boot.

Bug: 19264997
Change-Id: I47198d5f39a4caab30b3b77479d5eedaad5006ab
e401d146407d61eeb99f8d6176b2ac13c4df1e33 22-Apr-2015 Mathieu Chartier <mathieuc@google.com> Move mirror::ArtMethod to native

Optimizing + quick tests are passing, devices boot.

TODO: Test and fix bugs in mips64.

Saves 16 bytes per most ArtMethod, 7.5MB reduction in system PSS.
Some of the savings are from removal of virtual methods and direct
methods object arrays.

Bug: 19264997
Change-Id: I622469a0cfa0e7082a2119f3d6a9491eb61e3f3d
41b175aba41c9365a1c53b8a1afbd17129c87c14 19-May-2015 Vladimir Marko <vmarko@google.com> ART: Clean up arm64 kNumberOfXRegisters usage.

Avoid undefined behavior for arm64 stemming from 1u << 32 in
loops with upper bound kNumberOfXRegisters.

Create iterators for enumerating bits in an integer either
from high to low or from low to high and use them for
<arch>Context::FillCalleeSaves() on all architectures.

Refactor runtime/utils.{h,cc} by moving all bit-fiddling
functions to runtime/base/bit_utils.{h,cc} (together with
the new bit iterators) and all time-related functions to
runtime/base/time_utils.{h,cc}. Improve test coverage and
fix some corner cases for the bit-fiddling functions.

Bug: 13925192

(cherry picked from commit 80afd02024d20e60b197d3adfbb43cc303cf29e0)

Change-Id: I905257a21de90b5860ebe1e39563758f721eab82
80afd02024d20e60b197d3adfbb43cc303cf29e0 19-May-2015 Vladimir Marko <vmarko@google.com> ART: Clean up arm64 kNumberOfXRegisters usage.

Avoid undefined behavior for arm64 stemming from 1u << 32 in
loops with upper bound kNumberOfXRegisters.

Create iterators for enumerating bits in an integer either
from high to low or from low to high and use them for
<arch>Context::FillCalleeSaves() on all architectures.

Refactor runtime/utils.{h,cc} by moving all bit-fiddling
functions to runtime/base/bit_utils.{h,cc} (together with
the new bit iterators) and all time-related functions to
runtime/base/time_utils.{h,cc}. Improve test coverage and
fix some corner cases for the bit-fiddling functions.

Bug: 13925192
Change-Id: I704884dab15b41ecf7a1c47d397ab1c3fc7ee0f7
3c683c5d107cb43e8027d740ed579ef92a88af2e 04-May-2015 Mathieu Chartier <mathieuc@google.com> Revert "HACK: Disable native stack trace dumping for tetra. DO NOT MERGE"

This reverts commit 471b7cb6c1b8128bb343b49198f2654f9f5b8f86.

Change-Id: Ia22615b401fd28ea94e6269f9eac5653e103a6fd
657318c0b1b51e5cfd2859b874d26336c5330908 28-Apr-2015 Narayan Kamath <narayan@google.com> Add dependency on libbase.

Used by the static libziparchive dependency on target.

Change-Id: Ib88dd67941f0679682bcae01346277ffe8d6df9b
471b7cb6c1b8128bb343b49198f2654f9f5b8f86 29-Apr-2015 Mathieu Chartier <mathieuc@google.com> HACK: Disable native stack trace dumping for tetra. DO NOT MERGE

Hopefully stops deadlocks.

Bug: 20640601
Change-Id: I3e19217b6da002d328ffa7d941e14bfe734442c3
848f70a3d73833fc1bf3032a9ff6812e429661d9 15-Jan-2014 Jeff Hao <jeffhao@google.com> Replace String CharArray with internal uint16_t array.

Summary of high level changes:
- Adds compiler inliner support to identify string init methods
- Adds compiler support (quick & optimizing) with new invoke code path
that calls method off the thread pointer
- Adds thread entrypoints for all string init methods
- Adds map to verifier to log when receiver of string init has been
copied to other registers. used by compiler and interpreter

Change-Id: I797b992a8feb566f9ad73060011ab6f51eb7ce01
fc58af45e342ba9e18bbdf597f205a58ec731658 17-Apr-2015 Mathieu Chartier <mathieuc@google.com> Add AbstractMethod, Constructor, Method

Moves functionality to ART from libcore. Precursor to moving
ArtMethods to native. Mostly performance improvements.

N5 perf before (irrelevant results removed):
Class_getConstructor 962.87 ===========
Class_getDeclaredMethod 2394.37 ============================
Class_getMethod 2509.20 ==============================
Class_newInstance 1999.81 =======================
Method_invokeI 1439.02 =================
Method_invokePreBoxedI 1415.82 ================
Method_invokeStaticI 1456.24 =================
Method_invokeStaticPreBoxedI 1427.32 =================
Method_invokeStaticV 814.47 =========
Method_invokeV 816.56 =========
After:
benchmark ns linear runtime
Class_getConstructor 1302.04 ================
Class_getDeclaredMethod 1459.01 ==================
Class_getMethod 1560.40 ===================
Class_newInstance 2029.94 =========================
Method_invokeI 1312.89 ================
Method_invokePreBoxedI 1255.01 ===============
Method_invokeStaticI 1289.13 ===============
Method_invokeStaticPreBoxedI 1196.52 ==============
Method_invokeStaticV 790.82 =========
Method_invokeV 791.73 =========

Performance improvements are more than just fixing regressions introduced
in: http://android-review.googlesource.com/#/c/146069/

Bug: 19264997

Change-Id: Ife79c469fdb09f30e3aefcfc3e0ce5ed32303fce
c785344b87221f5e4e6473e5b762e4e61fe65dcf 27-Mar-2015 Mathieu Chartier <mathieuc@google.com> Move ArtField to native

Add linear alloc. Moved ArtField to be native object. Changed image
writer to put ArtFields after the mirror section.

Savings:
2MB on low ram devices
4MB on normal devices

Total PSS measurements before (normal N5, 95s after shell start):
Image size: 7729152 bytes
23112 kB: .NonMoving
23212 kB: .NonMoving
22868 kB: .NonMoving
23072 kB: .NonMoving
22836 kB: .NonMoving
19618 kB: .Zygote
19850 kB: .Zygote
19623 kB: .Zygote
19924 kB: .Zygote
19612 kB: .Zygote
Avg: 42745.4 kB

After:
Image size: 7462912 bytes
17440 kB: .NonMoving
16776 kB: .NonMoving
16804 kB: .NonMoving
17812 kB: .NonMoving
16820 kB: .NonMoving
18788 kB: .Zygote
18856 kB: .Zygote
19064 kB: .Zygote
18841 kB: .Zygote
18629 kB: .Zygote
3499 kB: .LinearAlloc
3408 kB: .LinearAlloc
3424 kB: .LinearAlloc
3600 kB: .LinearAlloc
3436 kB: .LinearAlloc
Avg: 39439.4 kB

No reflection performance changes.

Bug: 19264997
Bug: 17643507

Change-Id: I10c73a37913332080aeb978c7c94713bdfe4fe1c
b4524fd56c098c4de4d80e05136d9583eac64c76 02-Apr-2015 Brian Carlstrom <bdc@google.com> Switch to shared libcutils on host to fix odr-violation

Change-Id: Ia8eb950806a09e12fec2956d51eff99852920bee
SUMMARY: AddressSanitizer: odr-violation: global atrace_is_ready at system/core/libcutils/trace-host.c:23:25
daaf3265806eb2eadb2e03302bd68022fab5ca28 24-Mar-2015 Mathieu Chartier <mathieuc@google.com> Add AccessibleObject and Field to mirror

Main motivation is to remove all the functionality / field access on
java side to ArtField. Also comes with some reflection speedups /
slowdowns.

Summary results:
getDeclaredField/getField are slower mostly due to JNI overhead.
However, there is a large speedup in getInt, setInt,
GetInstanceField, and GetStaticField.

Before timings (N5 --compiler-filter=everything):

benchmark ns linear runtime
Class_getDeclaredField 782.86 ===
Class_getField 832.77 ===
Field_getInt 160.17 =
Field_setInt 195.88 =
GetInstanceField 3214.38 ==============
GetStaticField 6809.49 ==============================

After:
Class_getDeclaredField 1068.15 ============
Class_getField 1180.00 ==============
Field_getInt 121.85 =
Field_setInt 139.98 =
GetInstanceField 1986.15 =======================
GetStaticField 2523.63 ==============================

Bug: 19264997

Change-Id: Ic0d0fc1b56b95cd6d60f8e76f19caeaa23045c77
004c230b4cfc856690c61faabc41864061813c88 20-Mar-2015 Nicolas Geoffray <ngeoffray@google.com> Compress the StackMaps.

First step towards the compression of the StackMap (not
the DexRegisterMap). Next step will be to just use what is
needed (instead of byte -> word).

Change-Id: I4f81b2d05bf5cc508585e16fbbed1bafbc850e2e
e84e4f77388ec9c1d63fb4b21605eedca2a2e932 18-Mar-2015 Colin Cross <ccross@android.com> Remove the Android.mk GCC-only source files hackery

The complexity in Android.mk to deal with GCC-only source files is
unnecessary, use #if !defined(__clang__) around the contents of
interpreter/interpreter_goto_table_impl.cc, the same way
interpreter/interpreter.cc does around references to it.

Bug: 17716550
Change-Id: I775c23b6790d38b0d73a92529c696a31e6a4ae83
2969bcdcd80624e4a4fef696b54c2c76b44b6853 09-Mar-2015 Andreas Gampe <agampe@google.com> ART: Refactor unstarted runtime

Refactor and clean up unstarted runtime.

Bug: 19542228
Change-Id: Ib3e4b3517e06e8242d4fed32ca59419fef553a47
0aa50ce2fb75bfc2e815a0c33adf9b049561923b 10-Mar-2015 Nicolas Geoffray <ngeoffray@google.com> Remove ThrowLocation.

Note that this is a cleanup change, and has no functionality change.
The ThrowLocation had no use anymore.

Change-Id: I3d2126af1dc673cec3a0453ff3d56a172663a5f6
66d874d96d5699bb090c59f47a5a528956ca053e 15-Jan-2015 Richard Uhler <ruhler@google.com> Create OatFileAssistant class for assisting with oat files.

The oat file assistant is used for determining whether dex2oat or
patchoat is needed, for running dex2oat or patchoat as needed to make
an oat file up to date, and to load dex files associated with a given
dex location.

The introduction of the OatFileAssistant class is meant to clean up and
consolidate code related to the management of oat files that was
duplicated and spread across dalvik_system_DexFile.cc and
class_linker.cc.

Bug: 11301553
Change-Id: I0c16027b9bae4570c2c50faa9c14f581c0cbafb8
4858a935868162266ead90ef2f7802108711371d 23-Jan-2015 Mathieu Chartier <mathieuc@google.com> Change card cache mod-union table to use bitmaps

Previously used card sets, using bitmaps saves memory and slightly
increases performance.

Added mod union table test.

Performance EvaluateAndApplyChanges (minimal changes):

Before (card cache image mu table):
UpdateAndMarkImageModUnionTable: Avg: 524.320us
ImageModUnionClearCards: Avg: 54.580us
Native PSS: ~67500kB

After (card cache image mu table):
UpdateAndMarkImageModUnionTable: Avg: 515.600us
ImageModUnionClearCards: Avg: 53.780us
Native PSS: ~66014kB

Native PSS was higher before since the mod_union_table->SetCards()
which happens pre zygote fork was allocating a large amount of
std::nodes.

Bug: 11859910

Change-Id: I956b7e51d5572feec1393ffa618b7b7d8c147b28
e5f13e57ff8fa36342beb33830b3ec5942a61cca 24-Feb-2015 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Add JIT""

Added missing EntryPointToCodePointer.

This reverts commit a5ca888d715cd0c6c421313211caa1928be3e399.

Change-Id: Ia74df0ef3a7babbdcb0466fd24da28e304e3f5af
a5ca888d715cd0c6c421313211caa1928be3e399 24-Feb-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "Add JIT"

Sorry, run-test crashes on target:
0-05 12:15:51.633 I/DEBUG (27995): Abort message: 'art/runtime/mirror/art_method.cc:349] Check failed: PcIsWithinQuickCode(reinterpret_cast<uintptr_t>(code), pc) java.lang.Throwable java.lang.Throwable.fillInStackTrace() pc=71e3366b code=0x71e3362d size=ad000000'
10-05 12:15:51.633 I/DEBUG (27995): r0 00000000 r1 0000542b r2 00000006 r3 00000000
10-05 12:15:51.633 I/DEBUG (27995): r4 00000006 r5 b6f9addc r6 00000002 r7 0000010c
10-05 12:15:51.633 I/DEBUG (27995): r8 b63fe1e8 r9 be8e1418 sl b6427400 fp b63fcce0
10-05 12:15:51.633 I/DEBUG (27995): ip 0000542b sp be8e1358 lr b6e9a27b pc b6e9c280 cpsr 40070010
10-05 12:15:51.633 I/DEBUG (27995):

Bug: 17950037
This reverts commit 2535abe7d1fcdd0e6aca782b1f1932a703ed50a4.

Change-Id: I6f88849bc6f2befed0c0aaa0b7b2a08c967a83c3
2535abe7d1fcdd0e6aca782b1f1932a703ed50a4 17-Feb-2015 Mathieu Chartier <mathieuc@google.com> Add JIT

Currently disabled by default unless -Xjit is passed in.

The proposed JIT is a method JIT which works by utilizing interpreter
instrumentation to request compilation of hot methods async during
runtime.

JIT options:
-Xjit / -Xnojit
-Xjitcodecachesize:N
-Xjitthreshold:integervalue

The JIT has a shared copy of a compiler driver which is accessed
by worker threads to compile individual methods.

Added JIT code cache and data cache, currently sized at 2 MB
capacity by default. Most apps will only fill a small fraction of
this cache however.

Added support to the compiler for compiling interpreter quickened
byte codes.

Added test target ART_TEST_JIT=TRUE and --jit for run-test.

TODO:
Clean up code cache.
Delete compiled methods after they are added to code cache.
Add more optimizations related to runtime checks e.g. direct pointers
for invokes.
Add method recompilation.
Move instrumentation to DexFile to improve performance and reduce
memory usage.

Bug: 17950037

Change-Id: Ifa5b2684a2d5059ec5a5210733900aafa3c51bca
b666f4805c8ae707ea6fd7f6c7f375e0b000dba8 18-Feb-2015 Mathieu Chartier <mathieuc@google.com> Move arenas into runtime

Moved arena pool into the runtime.

Motivation:
Allow GC to use arena allocators, recycle arena pool for linear alloc.

Bug: 19264997
Change-Id: I8ddbb6d55ee923a980b28fb656c758c5d7697c2f
aaebaa0121be3b9d9f13630585304482cbcaeb4b 26-Jan-2015 Igor Murashkin <iam@google.com> art: Refactor RuntimeOptions/ParsedOptions

Refactor the RuntimeOptions to be a
type-safe map (VariantMap, see runtime_options.h) and the ParsedOptions
to delegate the parsing to CmdlineParser (see cmdline/cmdline_parser.h).

This is the start of a command line parsing refactor, and may include
more in the future (dex2oat, patchoat, etc).

For more details of the command line parsing generator usage see cmdline/README.md

Change-Id: Ic67c6bca5e1f33bf2ec60e2e3ff8c366bab91563
d25f84250700c35f006d5a1d295231af174c3734 31-Jan-2015 Hiroshi Yamauchi <yamauchi@google.com> Clean up enums in RegionSpace.

Split enum RegionState into two enums, RegionState and
RegionType. Merge the latter with SubSpaceType.

Use RefToRegionUnlocked in RegionSpace::AddLiveBytes.

Turn some CHECKs into DCHECKs.

Improve the Ritz EAAC run time and the GC time by ~20%.

Bug: 12687968
Change-Id: Icdb8ab3e9ec2a1eefc8c9a2e4bb19befcf2562a6
31fb26054349db03b3f1627fe975ed099ade69dd 01-Oct-2014 Dan Albert <danalbert@google.com> Add options for building/testing with coverage.

acov --clean
mm -B NATIVE_COVERAGE=true ART_COVERAGE=true test-art-host
acov --host

-B is needed because you need to be sure you rebuild *all* of ART with
coverage.

Change-Id: Ib94ef610bd1b44dc45624877710ed733051b7a50
f36df544d421aa60fc4cf8a5db6356b45f97953b 29-Jan-2015 Dan Albert <danalbert@google.com> Remove libcxx.mk cruft.

This is on by default now. No need to leave it in the makefiles.

Change-Id: I20eab7426da4bbbf8b70ffc5b9af7b97487d885d
2cd334ae2d4287216523882f0d298cf3901b7ab1 09-Jan-2015 Hiroshi Yamauchi <yamauchi@google.com> More of the concurrent copying collector.

Bug: 12687968
Change-Id: I62f70274d47df6d6cab714df95c518b750ce3105
1a5c40672783fac98aca5a04ac798a0a0014de65 15-Jan-2015 Andreas Gampe <agampe@google.com> ART: Mips64 runtime support

Interpret-only Mips64 runtime support.

Change-Id: Iee22d0c8c77105d9b2f03a67dc4e09957fe0ab0a
e34fa1df67fbe0173b4ea9abddcc3ae3d0537037 14-Jan-2015 Mathieu Chartier <mathieuc@google.com> Print more info in MarkSweep::VerifyRoot

Refactored old root callback to use a new class called RootInfo.
RootInfo contains all the relevant info related to the root
associated with the callback. The MarkSweep::VerifyRoot function
now uses this info to print the StackVisitor's described location
if the GC root is of the type kRootJavaFrame.

Some other cleanup.

Example output:
E/art (12167): Tried to mark 0x123 not contained by any spaces
E/art (12167): Attempting see if it's a bad root
E/art (12167): Found invalid root: 0x123 with type RootJavaFrame
E/art (12167): Location=Visiting method
'void java.lang.Runtime.gc()' at dex PC 0xffffffff (native PC 0x0)
vreg=0

(cherry picked from commit 12f7423a2bb4bfab76700d84eb6d4338d211983a)

Bug: 18588862
Change-Id: Ic5a2781f704e931265ffb3621c2eab4b2e25f60f
57b34294758e9c00993913ebe43c7ee4698a5cc6 15-Jan-2015 Andreas Gampe <agampe@google.com> ART: Allow to compile interpret-only mips64 files

Include enough infrastructure to allow cross-compiling for mips64,
interpret-only. This includes the instruction-set-features, frame
size info and utils assembler.

Also add a disassembler for oatdump, and support in patchoat.

Note: the runtime cannot run mips64, yet.

Change-Id: Id106581fa76b478984741c62a8a03be0f370d992
12f7423a2bb4bfab76700d84eb6d4338d211983a 14-Jan-2015 Mathieu Chartier <mathieuc@google.com> Print more info in MarkSweep::VerifyRoot

Refactored old root callback to use a new class called RootInfo.
RootInfo contains all the relevant info related to the root
associated with the callback. The MarkSweep::VerifyRoot function
now uses this info to print the StackVisitor's described location
if the GC root is of the type kRootJavaFrame.

Some other cleanup.

Example output:
E/art (12167): Tried to mark 0x123 not contained by any spaces
E/art (12167): Attempting see if it's a bad root
E/art (12167): Found invalid root: 0x123 with type RootJavaFrame
E/art (12167): Location=Visiting method
'void java.lang.Runtime.gc()' at dex PC 0xffffffff (native PC 0x0)
vreg=0

Bug: 18588862
Change-Id: Ic5a2781f704e931265ffb3621c2eab4b2e25f60f
a5eae69589ff562ad66c57665882cd16f237321c 18-Dec-2014 Mathieu Chartier <mathieuc@google.com> Add heap task processor

The heap task processor processes async tasks which may be delayed.
The motivation for this change is preventing deadlocks which
can occur when the daemon threads get suspended by GetThreadStack.

Other improvements, reduces daemon thread count by one.
Cleaner pending transition VS heap trimming logic.

Bug: 18739541

Change-Id: Idab52b2d9661a6385cada74b93ff297ddc55fc78
956af0f0cb05422e38c1d22cbef309d16b8a1a12 11-Dec-2014 Elliott Hughes <enh@google.com> Remove portable.

Change-Id: I3bf3250fa866fd2265f1b115d52fa5dedc48a7fc
14317f030db862bb2210135b9af510df429059fd 03-Dec-2014 Ian Rogers <irogers@google.com> Remove unused headers.

Push Closure into only use in thread_pool.h.
Remove StringFile and NullFile that existed purely for a test.

Change-Id: I329892d5e1f5f017caeb3d60600f803a74114fc1
b5fb207ed5e3570ec14e18811b3fa066168fe493 03-Dec-2014 Ian Rogers <irogers@google.com> Remove MethodHelper::HasSameSignatureWithDifferentClassLoaders.

Move sole use to a static function within class_linker.cc.
Remove unused MutableMethodHelper and empty method_helper.cc.

Change-Id: Ia26bc76674ed2ee7c9c546de820cc181005fed77
08f1f50d6c2e8f247b8f5f19711d75a792851c7a 03-Dec-2014 Ian Rogers <irogers@google.com> Remove FieldHelper.

Change-Id: I2d74e2d5b3c35a691c95339de0db9361847fca11
6c36a8bc6c514664ad91ce377df33de839342a8d 13-Nov-2014 Dehao Chen <dehao@google.com> Restrict FDO to only apply to target build.

Change-Id: I0ef4199b34c123a17eaf2c2f18bc8a1496e03cf8
4303ba97313458491e038d78efa041d41cf7bb43 06-Nov-2014 Andreas Gampe <agampe@google.com> ART: Track Flush & Close in FdFile

Implement a check that aborts when a file hasn't been explicitly
flushed and closed when it is destructed.

Add WARN_UNUSED to FdFile methods.

Update dex2oat, patchoat, scoped_flock and some gtests to pass with
this.

(cherry picked from commit 9433ec60b325b708b9fa87e699ab4a6565741494)

Change-Id: I9ab03b1653e69f44cc98946dc89d764c3e045dd4
9433ec60b325b708b9fa87e699ab4a6565741494 06-Nov-2014 Andreas Gampe <agampe@google.com> ART: Track Flush & Close in FdFile

Implement a check that aborts when a file hasn't been explicitly
flushed and closed when it is destructed.

Add WARN_UNUSED to FdFile methods.

Update dex2oat, patchoat, scoped_flock and some gtests to pass with
this.

Change-Id: I9ab03b1653e69f44cc98946dc89d764c3e045dd4
72a122c33dadde5661a39aaa0a10bc1dbff16ce6 14-Nov-2014 Andreas Gampe <agampe@google.com> ART: Fix last lpae occurrence, Arm64 generic

Fix the last occurrence of an lpae string in the default
instruction-set-feature strings (should be removed).

Allow "generic" Arm64 variant (same as "default").

Change-Id: I8bdd9fc7f596245e6541469664db01b3e781c51c
d582fa4ea62083a7598dded5b82dc2198b3daac7 06-Nov-2014 Ian Rogers <irogers@google.com> Instruction set features for ARM64, MIPS and X86.

Also, refactor how feature strings are handled so they are additive or
subtractive.
Make MIPS have features for FPU 32-bit and MIPS v2. Use in the quick compiler
rather than #ifdefs that wouldn't have worked in cross-compilation.
Add SIMD features for x86/x86-64 proposed in:
https://android-review.googlesource.com/#/c/112370/

Bug: 18056890

Change-Id: Ic88ff84a714926bd277beb74a430c5c7d5ed7666
e73a0642386aa48e93c4761d85f5fa07d703c04f 12-Nov-2014 Dan Albert <danalbert@google.com> Use the new name for the libc++ libbacktrace.

I'm removing the stlport flavored libbacktrace, so the libc++ one can
have the normal name now.

Bug: 15193147
Change-Id: Ie138bc8034533cae56ea15095eebc5f52e56f32d
6a3c1fcb4ba42ad4d5d142c17a3712a6ddd3866f 31-Oct-2014 Ian Rogers <irogers@google.com> Remove -Wno-unused-parameter and -Wno-sign-promo from base cflags.

Fix associated errors about unused paramenters and implict sign conversions.
For sign conversion this was largely in the area of enums, so add ostream
operators for the effected enums and fix tools/generate-operator-out.py.
Tidy arena allocation code and arena allocated data types, rather than fixing
new and delete operators.
Remove dead code.

Change-Id: I5b433e722d2f75baacfacae4d32aef4a828bfe1b
872dd8208f00c667af8d9e0fd07fdd0ada56d437 30-Oct-2014 Ian Rogers <irogers@google.com> Tidy and reduce ART library dependencies on the host.

Move to shared rather than static libraries. Avoids capture of all static
libraries library dependencies.

Change-Id: I2be96e92dad4ed1842d76b044745f2a2e15372eb
5667fdbb6e441dee7534ade18b628ed396daf593 23-Oct-2014 Zheng Xu <zheng.xu@arm.com> ARM: Use hardfp calling convention between java to java call.

This patch default to use hardfp calling convention. Softfp can be enabled
by setting kArm32QuickCodeUseSoftFloat to true.

We get about -1 ~ +5% performance improvement with different benchmark
tests. Hopefully, we should be able to get more performance by address the left
TODOs, as some part of the code takes the original assumption which is not
optimal.

DONE:
1. Interpreter to quick code
2. Quick code to interpreter
3. Transition assembly and callee-saves
4. Trampoline(generic jni, resolution, invoke with access check and etc.)
5. Pass fp arg reg following aapcs(gpr and stack do not follow aapcs)
6. Quick helper assembly routines to handle ABI differences
7. Quick code method entry
8. Quick code method invocation
9. JNI compiler

TODO:
10. Rework ArgMap, FlushIn, GenDalvikArgs and affected common code.
11. Rework CallRuntimeHelperXXX().

Change-Id: I9965d8a007f4829f2560b63bcbbde271bdcf6ec2
c7dd295a4e0cc1d15c0c96088e55a85389bade74 22-Oct-2014 Ian Rogers <irogers@google.com> Tidy up logging.

Move gVerboseMethods to CompilerOptions. Now "--verbose-methods=" option to
dex2oat rather than runtime argument "-verbose-methods:".
Move ToStr and Dumpable out of logging.h, move LogMessageData into logging.cc
except for a forward declaration.
Remove ConstDumpable as Dump methods are all const (and make this so if not
currently true).
Make LogSeverity an enum and improve compile time assertions and type checking.
Remove log_severity.h that's only used in logging.h.
With system headers gone from logging.h, go add to .cc files missing system
header includes.
Also, make operator new in ValueObject private for compile time instantiation
checking.

Change-Id: I3228f614500ccc9b14b49c72b9821c8b0db3d641
677cd61ad05d993c4d3b22656675874f06d6aabc 15-Oct-2014 Ian Rogers <irogers@google.com> Make ART compile with GCC -O0 again.

Tidy up InstructionSetFeatures so that it has a type hierarchy dependent on
architecture.
Add to instruction_set_test to warn when InstructionSetFeatures don't agree
with ones from system properties, AT_HWCAP and /proc/cpuinfo.
Clean-up class linker entry point logic to not return entry points but to
test whether the passed code is the particular entrypoint. This works around
image trampolines that replicate entrypoints.
Bug: 17993736

(cherry picked from commit 6f3dbbadf4ce66982eb3d400e0a74cb73eb034f3)

Change-Id: I3e7595f437db4828072589d475a5453b7f31003e
6f3dbbadf4ce66982eb3d400e0a74cb73eb034f3 15-Oct-2014 Ian Rogers <irogers@google.com> Make ART compile with GCC -O0 again.

Tidy up InstructionSetFeatures so that it has a type hierarchy dependent on
architecture.
Add to instruction_set_test to warn when InstructionSetFeatures don't agree
with ones from system properties, AT_HWCAP and /proc/cpuinfo.
Clean-up class linker entry point logic to not return entry points but to
test whether the passed code is the particular entrypoint. This works around
image trampolines that replicate entrypoints.
Bug: 17993736

Change-Id: I5f4b49e88c3b02a79f9bee04f83395146ed7be23
c9596958f8da9603c2b17a5df4d7fa6cbd01ff1e 16-Oct-2014 Chih-Hung Hsieh <chh@google.com> Add -no-integrated-as at local level.

Later we will enable integrated-as as default at the global level.

BUG: 17820427
BUG: 17443165
Change-Id: Idbbeccb7f725a63530c65e33723d1328c80443b3
2549478302c978a7e5c0f171bdc8e667244eadaf 30-Sep-2014 Nicolas Geoffray <ngeoffray@google.com> Remove selinux dependency.

Seems that the dependency was for the zygote code, which is
now in frameworks.

Change-Id: Id186d6ff794730e710628f275b258be499950051
fa888d06fd9ae90565254456e9b2e0cd62fbc91f 30-Sep-2014 Sebastien Hertz <shertz@google.com> Revert "Enable computed goto interpreter on the host"

This reverts commit 66d9bdb94f21106aaaa31a8fd686098672075e04.

Bug: 17716550
Change-Id: Ib404242c86e96e8edf019a2dcc14f0f8294b79e8
66d9bdb94f21106aaaa31a8fd686098672075e04 28-Aug-2014 Sebastien Hertz <shertz@google.com> Enable computed goto interpreter on the host

We disabled the computed goto interpreter when compiling with clang because of
compilation issues. Since we compile with clang on the host, we used the
switch-based interpreter.

Now clang is able to compile the computed goto interpreter, we can use it by
default on the host.

Change-Id: Ifa2a2d3c171b1116ecd3b3f213382c3c85e93f66
5db9b01329f81e5634d060084ce55fa5e4312d2a 18-Sep-2014 Brian Carlstrom <bdc@google.com> Revert "Use homogeneous space compaction if proper flag is set."

This reverts commit 44bd8c1cc4d8e0ffcdbdf51ed496af94fc2083e5.

(cherry-picked from commit 890da84d37cc80640c1a379e035a9e0fdea08865)

Change-Id: I9f02d6a3bb3b8760a8b9f0554930c1ac831277d8
890da84d37cc80640c1a379e035a9e0fdea08865 18-Sep-2014 Brian Carlstrom <bdc@google.com> Revert "Use homogeneous space compaction if proper flag is set."

This reverts commit 44bd8c1cc4d8e0ffcdbdf51ed496af94fc2083e5.

Change-Id: Ie62307d5b5bd0135d871855c5c5182add1c40939
a5a53efea976af505f4f849b5925d5e14c4f8e5c 12-Sep-2014 Mathieu Chartier <mathieuc@google.com> Add native support for FinalizerList.makeCircularListIfUnenqueued

Called from FinalizerReference.enqueueSentinelReference to prevent
a race where the GC updates pendingNext of the sentinel reference
before enqueueSentinelReference.

Bug: 17462553

(cherry picked from commit 3256166df40981f1f1997a5f00303712277c963f)

Change-Id: I7ad2fd250c2715d1aeb919bd548ef9aab24f30a2
3256166df40981f1f1997a5f00303712277c963f 12-Sep-2014 Mathieu Chartier <mathieuc@google.com> Add native support for FinalizerList.makeCircularListIfUnenqueued

Called from FinalizerReference.enqueueSentinelReference to prevent
a race where the GC updates pendingNext of the sentinel reference
before enqueueSentinelReference.

Bug: 17462553

Change-Id: I7ad2fd250c2715d1aeb919bd548ef9aab24f30a2
1ee99e31c630d6277c1e69f7c57bcf0b350538f6 11-Sep-2014 Stephen Hines <srhines@google.com> Revert "Disable Clang internal assembler."

This reverts commit d619cab991f116d7a90c9abeff8770e7d7a3a45a.

Change-Id: I69da36d734678dd5e9a99c1c53093fcaf81a66c3
d619cab991f116d7a90c9abeff8770e7d7a3a45a 09-Sep-2014 Chih-Hung Hsieh <chh@google.com> Disable Clang internal assembler.

To avoid compilation errors with macros and directives in asm_support_x86.S.

BUG: 17443165
Change-Id: Ia89387bf2213cf1bfd4dd7248a19b47391e8fb67
bad0267eaab9d6a522d05469ff90501deefdb88b 25-Aug-2014 Mathieu Chartier <mathieuc@google.com> Add native memory accounting through custom allocator.

Added a custom allocator that lets you pass in a special tag which
specifices where the allocation came from. This is used when
dumping. The performance overhead is low since each allocation only
does a atomic add/sub for each allocation/free.

The measurements are dumped to traces.txt during SIGQUIT.

Example output:
I/art (27274): AllocatorTagHeap active=120 max=120 total=168
I/art (27274): AllocatorTagMonitorList active=1572 max=6240 total=11724
I/art (27274): AllocatorTagClassTable active=185208 max=185208 total=268608
I/art (27274): AllocatorTagInternTable active=430368 max=430368 total=436080
I/art (27274): AllocatorTagMaps active=5616 max=6168 total=34392
I/art (27274): AllocatorTagLOS active=1024 max=1536 total=2044
I/art (27274): AllocatorTagSafeMap active=0 max=51936 total=533688
I/art (27274): AllocatorTagLOSMaps active=144 max=1248 total=5760
I/art (27274): AllocatorTagReferenceTable active=10944 max=11840 total=19136
I/art (27274): AllocatorTagHeapBitmap active=32 max=40 total=56
I/art (27274): AllocatorTagHeapBitmapLOS active=8 max=8 total=8
I/art (27274): AllocatorTagVerifier active=0 max=18844 total=1073156
I/art (27274): AllocatorTagModUnionCardSet active=5300 max=5920 total=56020
I/art (27274): AllocatorTagModUnionReferenceArray active=24864 max=24864 total=24864
I/art (27274): AllocatorTagJNILibrarires active=320 max=320 total=320
I/art (27274): AllocatorTagOatFile active=1400 max=1400 total=5852

Change-Id: Ibb470ef2e9c9a24563bb46422d46a55799704d82

(cherry picked from commit 5369c40f75fdcb1be7a7c06db212ce965c83a164)
5369c40f75fdcb1be7a7c06db212ce965c83a164 25-Aug-2014 Mathieu Chartier <mathieuc@google.com> Add native memory accounting through custom allocator.

Added a custom allocator that lets you pass in a special tag which
specifices where the allocation came from. This is used when
dumping. The performance overhead is low since each allocation only
does a atomic add/sub for each allocation/free.

The measurements are dumped to traces.txt during SIGQUIT.

Example output:
I/art (27274): AllocatorTagHeap active=120 max=120 total=168
I/art (27274): AllocatorTagMonitorList active=1572 max=6240 total=11724
I/art (27274): AllocatorTagClassTable active=185208 max=185208 total=268608
I/art (27274): AllocatorTagInternTable active=430368 max=430368 total=436080
I/art (27274): AllocatorTagMaps active=5616 max=6168 total=34392
I/art (27274): AllocatorTagLOS active=1024 max=1536 total=2044
I/art (27274): AllocatorTagSafeMap active=0 max=51936 total=533688
I/art (27274): AllocatorTagLOSMaps active=144 max=1248 total=5760
I/art (27274): AllocatorTagReferenceTable active=10944 max=11840 total=19136
I/art (27274): AllocatorTagHeapBitmap active=32 max=40 total=56
I/art (27274): AllocatorTagHeapBitmapLOS active=8 max=8 total=8
I/art (27274): AllocatorTagVerifier active=0 max=18844 total=1073156
I/art (27274): AllocatorTagModUnionCardSet active=5300 max=5920 total=56020
I/art (27274): AllocatorTagModUnionReferenceArray active=24864 max=24864 total=24864
I/art (27274): AllocatorTagJNILibrarires active=320 max=320 total=320
I/art (27274): AllocatorTagOatFile active=1400 max=1400 total=5852

Bug: 16238192

Change-Id: Ibb470ef2e9c9a24563bb46422d46a55799704d82
93de4273d72a2558a7b3423547b5074cd76c5796 12-Aug-2014 Calin Juravle <calin@google.com> [ART] Move to system/core native bridge library

Some cleanups on the way:
- move NativeBridgeRuntimeCallbacks from a global to a field
- rename native_bridge_library_string to the more suggestive
navtive_bridge_library_path
- clean up imports

Bug: 16884833

(cherry picked from commit I73aab8e212860ba5aee9444d801806d3da326a41)

Change-Id: I67f037ea81d2a4ede4294afd8b84b7640e534a13
c8423521c1d1136c70b153479b7df3bf4fd7fc2a 12-Aug-2014 Calin Juravle <calin@google.com> [ART] Move to system/core native bridge library

Some cleanups on the way:
- move NativeBridgeRuntimeCallbacks from a global to a field
- rename native_bridge_library_string to the more suggestive
navtive_bridge_library_path
- clean up imports

Bug: 16884833
Change-Id: I73aab8e212860ba5aee9444d801806d3da326a41
44bd8c1cc4d8e0ffcdbdf51ed496af94fc2083e5 14-Aug-2014 Mathieu Chartier <mathieuc@google.com> Use homogeneous space compaction if proper flag is set.

If the flag ART_USE_HSPACE_COMPACT is set then we use
hspace compaction.

Bug: 16401001

Change-Id: I74e1db764f9ff16c007fa3bd16cb2c9b468ec83c
b162bf5af5c2e508c6947471ceffaa98991794f4 14-Aug-2014 Mathieu Chartier <mathieuc@google.com> Use homogeneous space compaction if proper flag is set.

If the flag ART_USE_HSPACE_COMPACT is set then we use
hspace compaction.

Bug: 16401001

Change-Id: I74e1db764f9ff16c007fa3bd16cb2c9b468ec83c
b0f05b9654eb005bc8c8e15f615a7f5a312f640c 17-Jul-2014 Dave Allison <dallison@google.com> Add implicit checks for x86_64 architecture.

This combines the x86 and x86_64 fault handlers into one. It also
merges in the change to the entrypoints for X86_64.

Replaces generic instruction length calculator with one that only
works with the specific instructions we use.

Bug: 16256184

Change-Id: I1e8ab5ad43f46060de9597615b423c89a836035c
Signed-off-by: Chao-ying Fu <chao-ying.fu@intel.com>
76ab347dc9b89970da1451568965ee208c728c43 11-Aug-2014 Junmo Park <junmoz.park@samsung.com> Fix art build script

Use ART_BUILD_HOST_NDEBUG instead of ART_BUILD_NDEBUG.

Change-Id: I0ff590552f47d3354287a155b51936a7aef82f1f
Signed-off-by: Junmo Park <junmoz.park@samsung.com>
6a763f149f0c6f705cab8fb1984aa6f9198b2841 10-Aug-2014 Dan Albert <danalbert@google.com> Proper fix after -Bsymbolic change.

Marking the offending symbols as hidden allows the linker to resolve
them at build time.

Bug: 16853291
Change-Id: I1480c1520c23f81e42831a66737bba7bdf3433c2
58bea4a6114b9ea4b00e36186357e5b431430123 10-Aug-2014 Dan Albert <danalbert@google.com> Proper fix after -Bsymbolic change.

Marking the offending symbols as hidden allows the linker to resolve
them at build time.

Bug: 16853291
Change-Id: I1480c1520c23f81e42831a66737bba7bdf3433c2
f70a5f4517c6b8cbf1377b7cfd8d33f1a8abf8d4 08-Aug-2014 Dan Albert <danalbert@google.com> Workaround for test failures after Bsymbolic fix.

Bug: 16853291
Change-Id: I0c2e2efbeb5060d4ec5ba706dab422b3c2caaa96
(cherry picked from commit 3bed41cf3ace3105686f626fed2ac802376852f3)
68d8b42ddec39ec0174162d90d4abaa004d1983e 17-Jul-2014 Ian Rogers <irogers@google.com> Wire up check JNI force copy mode.

Increase check JNI checks.
Break apart jni_internal.h in to jni_env_ext.h and java_vm_ext.h.
Fix the abuse of ScopedObjectAccess/annotalysis by ScopedCheck in the case
of VM routines.
Make class loader override and shared library class loader JNI global
references rather than mirror pointers.
Clean-ups to native bridge.

Change-Id: If7c6110b5aade7a402bfb67534af86a7b2cdeb55
dfd3b47813c14c5f1607cbe7b10a28b1b2f29cbc 17-Jul-2014 Dave Allison <dallison@google.com> Add implicit checks for x86_64 architecture.

This combines the x86 and x86_64 fault handlers into one. It also
merges in the change to the entrypoints for X86_64.

Replaces generic instruction length calculator with one that only
works with the specific instructions we use.

Bug: 16256184

Change-Id: I1e8ab5ad43f46060de9597615b423c89a836035c
Signed-off-by: Chao-ying Fu <chao-ying.fu@intel.com>
3bed41cf3ace3105686f626fed2ac802376852f3 08-Aug-2014 Dan Albert <danalbert@google.com> Workaround for test failures after Bsymbolic fix.

Change-Id: I0c2e2efbeb5060d4ec5ba706dab422b3c2caaa96
2a0bffd2ae4725a89b400279a2d58f07ff610685 30-Jul-2014 Varvara Rainchik <varvara.rainchik@intel.com> Add x86_64 optimized __memcmp16 implementation;
fix tabs in 32-bit implementation.

Change-Id: I7bbfb344074aed66511c1a845998dc38798116ea
Signed-off-by: Varvara Rainchik <varvara.rainchik@intel.com>
1740eca19de8870a319033eacde16793ef391825 25-Jul-2014 Dehao Chen <dehao@google.com> Remove the per-project FDO support. Use the common FDO support from build/core.
LOCAL_FDO_SUPPORT indicates if the module should enable FDO builds.

Change-Id: I1eab8bf418b7ceb060eea18bdd304a06597af3d3
355383f61d28f2dc8072fbde2639c80627adf16d 24-Jul-2014 Yong WU <yong.wu@intel.com> Integrate ART with NativeBridge interfaces

Native-bridge will provide the following interfaces to ART:

struct NativeBridgeCallbacks {
bool (*initialize )(NativeBridgeArtCallbacks* vm_itf);
void* (*loadLibrary )(const char* libpath, int flag);
void* (*getTrampoline)(void* handle, const char* name, const char* shorty,
uint32_t len);
bool (*isSupported )(const char* libpath);
};

Native-bridge will expose a symbol NativeBridgeItf with the
type of NativeBridgeCallbacks to ART.

And ART will provide the interfaces below to native-bridge:

struct NativeBridgeArtCallbacks {
int (*logger )(int prio, const char* tag, const char* fmt, ...);
const char* (*getMethodShorty)(JNIEnv* env, jmethodID mid);
int (*getNativeMethodCount )(JNIEnv* env, jclass clazz);
int (*getNativeMethods )(JNIEnv* env, jclass clazz, JNINativeMethod* methods,
uint32_t method_count);
};

Based on the interfaces, if an ART call to dlopen fails to open a native library,
it queries the native bridge by using NativeBridgeCallbacks::isSupported(). If the
native library is supported by native-bridge, ART can load the native library
using NativeBridgeCallbacks::loadLibrary() and get a trampoline for a specific
native method using NativeBridgeCallbacks::getTrampoline(). ART can then call
the native method using the normal signature and the address of the trampoline.

On the other side, in the case of a native method calling JNI native function
CallXXXXMethodY(), native-bridge calls back to Art for the shorty of the method
using NativeBridgeArtCallbacks::getMethodShorty() so that it can prepare based
on host calling convention.

In case of JNI function RegisterNatives()/UnregisterNatives(), native bridge can
call back to NativeBridgeArtCallbacks::getNativeMethodCount() and NativeBridgeArtCallbacks
::getNativeMethods() to get all native methods of specified class so that all
corresponding trampolines can be prepared/destroyed.

Class NativeBridge is created to encapsulate the function pointers of
NativeBridgeCallbacks and provides better abstraction to ART.

Note: functionality is turned off in native_bridge.cc at the moment.

Change-Id: I652755044957a7960254648652b538cce70dd011
38c488bcd41ba632a646d7a1d790ec71a2fcf6fa 16-Jul-2014 Mathieu Chartier <mathieuc@google.com> Recycle mem-maps for collector transitions.

We now create spaces when we need them for collector transitions or
homogeneous compaction by recycling mem maps. Change the bump
pointer space size to be as large as the heap capacity instead of
1/2 heap capacity like it used to be. For GSS, bump pointer spaces
are set to 32MB currently.

Changed GSS to have main space == non moving space since we don't
need to copy from the main space.

Fixes GC stress tests 074, 096.
Fixed test 080 oom throw with -Xmx2m for GC stress test, this was
broken since it was allocating a 4 MB array before starting the
OOM process.

Bug: 14059466
Bug: 16406852

(cherry picked from commit b363f666883860d40823d5528df3c98c897f74f4)

Change-Id: I62877cfa24ec944a6f34ffac30334f454a8002fd
b363f666883860d40823d5528df3c98c897f74f4 16-Jul-2014 Mathieu Chartier <mathieuc@google.com> Recycle mem-maps for collector transitions.

We now create spaces when we need them for collector transitions or
homogeneous compaction by recycling mem maps. Change the bump
pointer space size to be as large as the heap capacity instead of
1/2 heap capacity like it used to be. For GSS, bump pointer spaces
are set to 32MB currently.

Changed GSS to have main space == non moving space since we don't
need to copy from the main space.

Fixes GC stress tests 074, 096.
Fixed test 080 oom throw with -Xmx2m for GC stress test, this was
broken since it was allocating a 4 MB array before starting the
OOM process.

Bug: 14059466
Bug: 16406852
Change-Id: I62877cfa24ec944a6f34ffac30334f454a8002fd
147eb41b53729ec8d5c188d1cac90964a51afb8a 11-Jul-2014 Dave Allison <dallison@google.com> Revert "Revert "Revert "Revert "Add implicit null and stack checks for x86""""

This reverts commit 0025a86411145eb7cd4971f9234fc21c7b4aced1.

Bug: 16256184
Change-Id: Ie0760a0c293aa3b62e2885398a8c512b7a946a73

Conflicts:
compiler/dex/quick/arm64/target_arm64.cc
compiler/image_test.cc
runtime/fault_handler.cc
d85614222fa062ec809af9d65f04ab6b7dc1c248 11-Jul-2014 Fred Shih <ffred@google.com> Revert "Revert "Revert "Revert "Add intrinsic for Reference.get()""""

Fixed TargetReg issue causing build failure for x86.
This reverts commit 9e82bd3f0ce9e5f5777bea2f752ff3e251d32f9f.

(cherry picked from commit 4ee7a665e7f9cd2c5ace2d6304e33f64067b209f)

Change-Id: I555f4e06955711262e6b37ffbeabee9698ec695c
907194a395ffa5bc27cad81adbed241f9fd772f0 14-Jul-2014 Alexander Ivchenko <alexander.ivchenko@intel.com> Add optimized assembler implementation of __memcmp16 for x86.

Change-Id: Ia442dd749f8113244ea580f97d574ebaa73e4989
Signed-off-by: Alexander Ivchenko <alexander.ivchenko@intel.com>
69dfe51b684dd9d510dbcb63295fe180f998efde 11-Jul-2014 Dave Allison <dallison@google.com> Revert "Revert "Revert "Revert "Add implicit null and stack checks for x86""""

This reverts commit 0025a86411145eb7cd4971f9234fc21c7b4aced1.

Bug: 16256184
Change-Id: Ie0760a0c293aa3b62e2885398a8c512b7a946a73
22d5e735f403c57525fe868304c7123f0ce66399 16-Jul-2014 Ian Rogers <irogers@google.com> Remove object_utils.h.

Break into object_lock, field_helper and method_helper.
Clean up header files following this.
Also tidy some of the Handle code in response to compiler errors when resolving
the changes in this CL.

Change-Id: I73e63015a0f02a754d0866bfaf58208aebcaa295
4ee7a665e7f9cd2c5ace2d6304e33f64067b209f 11-Jul-2014 Fred Shih <ffred@google.com> Revert "Revert "Revert "Revert "Add intrinsic for Reference.get()""""

Fixed TargetReg issue causing build failure for x86.
This reverts commit 9e82bd3f0ce9e5f5777bea2f752ff3e251d32f9f.

Change-Id: I7e6a526954467aaf68deeed999880dfe9aa5f06e
fc35de0a04eccc4134ea14e1fbe1c9efad79bcc0 11-Jul-2014 Christopher Ferris <cferris@google.com> Make jemalloc the default choice.

Change-Id: Iadf29d28758bc17904098b4eeb9bc14a0a51299e
a9b870b73a155ce70c867d5b3f9758fab0b45f07 11-Jul-2014 Christopher Ferris <cferris@google.com> Revert "Add intrinsic for Reference.get()"

This reverts commit 460503b13bc894828a2d2d47d09e5534b3e91aa1.

Change-Id: Ie63f43049307e02e3b90f4e034abc9ea54ca4e24
7fb36ded9cd5b1d254b63b3091f35c1e6471b90e 10-Jul-2014 Dave Allison <dallison@google.com> Revert "Revert "Add implicit null and stack checks for x86""

Fixes x86_64 cross compile issue. Removes command line options
and property to set implicit checks - this is hard coded now.

This reverts commit 3d14eb620716e92c21c4d2c2d11a95be53319791.

Change-Id: I5404473b5aaf1a9c68b7181f5952cb174d93a90d
d4415e8bd04c4a9367744ff0149597b4f37a0e0a 11-Jul-2014 Christopher Ferris <cferris@google.com> Revert "Revert "Add intrinsic for Reference.get()""

This reverts commit a9b870b73a155ce70c867d5b3f9758fab0b45f07.

Change-Id: Ic2a9b47f2b911bef4b764d10bc33cf000e4b4211
9e82bd3f0ce9e5f5777bea2f752ff3e251d32f9f 11-Jul-2014 Sebastien Hertz <shertz@google.com> Revert "Revert "Revert "Add intrinsic for Reference.get()"""

This reverts commit d4415e8bd04c4a9367744ff0149597b4f37a0e0a.

Change-Id: I34553ccbdcfea35c7742d21be2a74dc7085ab2a0
0025a86411145eb7cd4971f9234fc21c7b4aced1 11-Jul-2014 Nicolas Geoffray <ngeoffray@google.com> Revert "Revert "Revert "Add implicit null and stack checks for x86"""

Broke the build.

This reverts commit 7fb36ded9cd5b1d254b63b3091f35c1e6471b90e.

Change-Id: I9df0e7446ff0913a0e1276a558b2ccf6c8f4c949
460503b13bc894828a2d2d47d09e5534b3e91aa1 18-Jun-2014 Fred Shih <ffred@google.com> Add intrinsic for Reference.get()

Added an intrinsic function for Reference.get(). Return immediately
without going through JNI if the slow path is not currently in use.
Otherwise, branch off to the the existing JNI function.

Approximately 47x speedup for cases where slow path is not enabled.

Change-Id: I13ad65a356fe4e104d8d83980694dc2740d7d039
34e826ccc80dc1cf7c4c045de6b7f8360d504ccf 29-May-2014 Dave Allison <dallison@google.com> Add implicit null and stack checks for x86

This adds compiler and runtime changes for x86
implicit checks. 32 bit only.

Both host and target are supported.
By default, on the host, the implicit checks are null pointer and
stack overflow. Suspend is implemented but not switched on.

Change-Id: I88a609e98d6bf32f283eaa4e6ec8bbf8dc1df78a
3d14eb620716e92c21c4d2c2d11a95be53319791 10-Jul-2014 Dave Allison <dallison@google.com> Revert "Add implicit null and stack checks for x86"

It breaks cross compilation with x86_64.

This reverts commit 34e826ccc80dc1cf7c4c045de6b7f8360d504ccf.

Change-Id: I34ba07821fc0a022fda33a7ae21850957bbec5e7
7ac7e32fb84b6a933181d31694d8a2d81ddca6d6 28-Jun-2014 Elliott Hughes <enh@google.com> Fix the x86 textrel and remove -Wl,--no-fatal-warnings.

Bug: 11358761
Change-Id: I825cecce121a9011f74c5fdf77d1fbecd30adbc7
86797a791d692f81def5c1b5f0918992c49ed122 19-Jun-2014 Serban Constantinescu <serban.constantinescu@arm.com> AArch64: Add memcmp16() for Arm64; ensure xSELF not clobbered

This patch modifies memcmp() to memcmp16(). Please note that this
implementation of memcmp16() is based on the bionic's memcmp().

However, to reflect a recent specification change, the file has been
modified to respect the new String.compareTo() behavior.

A test for memcmp16() has been added. The string_compareto test in
stub_test has been changed to invoke __memcmp16 in assembly stubs.

Add artIsAssignableFromCode to the list of native downcalls to
store and reload x18. Remove CheckSuspendFromCode, as it is unused.

Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
Change-Id: Ie0b5425ecfb62906d29a5d02e84c7e07ffb34a11
afd9acc30bdd11cdd12d8209eb994cb371c65e33 17-Jun-2014 Ian Rogers <irogers@google.com> Multilib ART host.

Build ART for the host as a multilib project with dalvikvm32 and dalvikvm64
running as 32 or 64-bit repsectfully. Note, currently multilib host builds
are not the default, you make the so by setting BUILD_HOST_64bit=1.
Extend tests to execute in both 32 and 64-bit modes. By default both 32 and
64-bit tests are run, add 32 or 64 to the end of a test name to run it in
purely that flavor.
Given the extra spam, modify oat tests to only generate console output when
the test fails.
Change the test harness so that common commands are run when a test should be
skipped, when it passes or when it fails. Use these commands to generate a
summary of passing, skipped and failing tests. Tests will be skipped if they
are known to be broken or if a test has already failed. Setting the variable
TEST_ART_KEEP_GOING=true will force working tests not to be skipped.
In this change all tests running on the optimizing compiler are marked broken
due to breakages running them in a multilib environment.
Break apart Android.common.mk into its constituent parts, along with other
pieces of reorganization.

Stylistic nit, we refer to make rule targets as targets thereby overloading
the term target. While consistent with make's terminology, its confusing with
the Android notion of target. I've switched to just calling targets rules to
avoid confusion in host tests.

Change-Id: I5190fc3de46800a949fbb06b3f4c258ca89ccde9
52e4b43d62896b56f8c2bd041e528472bb4a0d8d 10-Jun-2014 Mathieu Chartier <mathieuc@google.com> Add mark compact collector.

The mark compact collector is a 4 phase collection, doing a normal
full mark_sweep, calculating forwarding addresses of objects in the
from space, updating references of objects in the from space, and
moving the objects in the from space.

Support is diabled by default since it needs to have non movable
classes and field arrays. Performance numbers is around 50% as fast.

The main advantage that this has over semispace is that the worst
case memory usage is 50% since we only need one space isntead of two.

TODO: Make field arrays and classes movable. This causes complication
since Object::VisitReferences relies on these, so if we update the
fields of an object but another future object uses this object to
figure out what fields are reference fields it doesn't work.

Bug: 14059466

Change-Id: I661ed3b71ad4dde124ef80312c95696b4a5665a1
4d0589c90971e19c25894414ae7da579269e1fe2 11-Jun-2014 Andreas Gampe <agampe@google.com> ART: Move __memcmp16 from Bionic to ART

Handle __memcmp16 / MemCmp16 in ART. Import assembly implementations
for arm and mips from Bionic. Use a generic C version for all other
platforms.

Removes the memcmp16 quick entrypoint, as it is never used. Bump
the oat version and update thread.cc and checks to reflect the
structural change.

Change-Id: I54a5a1da2a0a43ef271c8aeda0bf2276b8b11ac6
c5f17732d8144491c642776b6b48c85dfadf4b52 06-Jun-2014 Ian Rogers <irogers@google.com> Remove deprecated WITH_HOST_DALVIK.

Bug: 13751317
Fix the Mac build:
- disable x86 selector removal that causes OS/X 10.9 kernel panics,
- madvise don't need does zero memory on the Mac, factor into MemMap
routine,
- switch to the elf.h in elfutils to avoid Linux kernel dependencies,
- we can't rely on exclusive_owner_ being available from other pthread
libraries so maintain our own when futexes aren't available (we
can't rely on the OS/X 10.8 hack any more),
- fix symbol naming in assembly code,
- work around C library differences,
- disable backtrace in DumpNativeStack to avoid a broken libbacktrace
dependency,
- disable main thread signal handling logic,
- align the stack in stub_test,
- use $(HOST_SHLIB_SUFFIX) rather than .so in host make file variables.

Not all host tests are passing on the Mac with this change. dex2oat
works as does running HelloWorld.
Change-Id: I5a232aedfb2028524d49daa6397a8e60f3ee40d3
624010286eea15c0526c2ff75341ddfd906332b1 11-Jun-2014 Andreas Gampe <agampe@google.com> ART: Fix MIPS build

Wrong name for an assembly file. Also, registers need $ prefix
in our assembler.

Change-Id: Ic2d5961ec7d0c8e65ca5b27d681487da847c9065
d1c606f280797be81e2592c483869a6ec836a9f3 09-Jun-2014 Narayan Kamath <narayan@google.com> Add locking around boot image generation.

If zygote aborts due to an error, it will restart and
spawn another dex2oat process while the old one is still
running. If this happens fast enough, the system will
eventually need a kernel reboot since neither the zygote
nor dex2oat are killable.

This brings boot image generation in line with dex2oat
generation, which uses a similar pattern of advisory
locking.

bug: 15415316

Change-Id: Iaccd274d3d96ab002b04e246ec4b3ef9a422ff7c
5ca4eaace8ba513f97309bbdc2e156de4b1d648a 29-May-2014 Andreas Gampe <agampe@google.com> ART: Make LOCAL_CLANG architecture dependent for the target

Be selective for which target we compile with Clang. Currently we
only want to compile with Clang for ARM64, which means we need to
be careful about ARM, which is the second architecture for that.

Bug: 15014252

(cherry picked from commit 9689e3768621130b2536564f4e00fcb6b3d25df4)

Change-Id: I312e1caea08f2f3a20304b27f979d3c7b72b0a04
ffddfdf6fec0b9d98a692e27242eecb15af5ead2 03-Jun-2014 Tim Murray <timmurray@google.com> DO NOT MERGE

Merge ART from AOSP to lmp-preview-dev.

Change-Id: I0f578733a4b8756fd780d4a052ad69b746f687a9
5cf98196d488437acd1e989c08a554ef697fded1 30-May-2014 Ian Rogers <irogers@google.com> Don't report down-calls as unhandled exceptions.

Bug: 15310540
Also, narrow scope of catch/deoptimize stack visitors that are specific to
quick exception delivery.

Change-Id: Ib13a006ce1347acb93a36b0186550d4c3ec2034b
9689e3768621130b2536564f4e00fcb6b3d25df4 29-May-2014 Andreas Gampe <agampe@google.com> ART: Make LOCAL_CLANG architecture dependent for the target

Be selective for which target we compile with Clang. Currently we
only want to compile with Clang for ARM64, which means we need to
be careful about ARM, which is the second architecture for that.

Bug: 15014252
Change-Id: I239591f65eab537deac39a25bd20530dce5c4786
f4b80bcc7190fe75023b983d56a795b440a0c515 15-May-2014 Dave Allison <dallison@google.com> Make use of sigchainlib for signal chaining for implicit checks

This adds a preload library that overrides sigaction and sigprocmask
to implement signal chaining. Signal chaining allows us to chain
any signal so that the ART runtime receives it before any signal
handler registered in native code by an application. If the
ART signal handler doesn't want it, it will pass it on to the
user's handler.

ART uses signals for null pointer checks, stack overflow checks and
suspend points.

Also adds an OAT test to test this in isolation.

Change-Id: I9545f9f7343774c091410eb810504d9855fd399f
c4ddc042eaf5232a3f9b111f42af39eeab6e0294 13-May-2014 Christopher Ferris <cferris@google.com> Add support for jemalloc instead of dlmalloc.

Bug: 981363
Change-Id: I226ce3249c0d982eb1a9fdb9d04b25737f77345d
2a0e954ecf7c60e6ec62d64b9382cc4ee447e224 21-May-2014 Dan Albert <danalbert@google.com> Move art host to libc++

Change-Id: Ia51a4fdfdbae7377130a43c401c2d8d241671d1e
8ab7e78be6835d63a2cee9f234334ed8fb409781 20-May-2014 Mathieu Chartier <mathieuc@google.com> Improve heap verification for invalid roots.

The new root verification prints the root type and owner thread id as
well as the type of the object.

Also a bit of work for planned multi-threaded verification.

Bug: 14289301

Change-Id: Ia73c517dc11ec6dd82f3d945604ee3836b3db536
700a402244a1a423da4f3ba8032459f4b65fa18f 20-May-2014 Ian Rogers <irogers@google.com> Now we have a proper C++ library, use std::unique_ptr.

Also remove the Android.libcxx.mk and other bits of stlport compatibility
mechanics.

Change-Id: Icdf7188ba3c79cdf5617672c1cfd0a68ae596a61
ba0c51fd282c4f47b95230c5444e76f342900cfa 16-May-2014 Ian Rogers <irogers@google.com> Switch ART to libc++.

TODO: remove all vestiges of stlport.

Change-Id: I95a3cb0b53d0898f0a5d388b606e79522f4d85e0
c6585b7db95771782b2b0144efb8a18fa0f6906f 24-Apr-2014 Ying Wang <wangying@google.com> 64-bit host multilib build.

Bug: 13751317
Change-Id: I98c0d593e441add79d51ec1b690c4abd3489a8cf
b14329f90f725af0f67c45dfcb94933a426d63ce 15-May-2014 Andreas Gampe <agampe@google.com> ART: Fix MonitorExit code on ARM

We do not emit barriers on non-SMP systems. But on ARM, we have
places that need to conditionally execute, which is done through
an IT instruction. The guide of said instruction thus changes
between SMP and non-SMP systems.

To cleanly approach this, change the API so that GenMemBarrier
returns whether it generated an instruction. ARM will have to
query the result and update any dependent IT.

Throw a build system error if TARGET_CPU_SMP is not set.

Fix runtime/Android.mk to work with new multilib host.

Bug: 14989275
Change-Id: I9e611b770e8a1cd4ca19367d7dae0573ec08dc61
78f7b4c04ab6e8b5581921bc95b67a9beee1c246 06-May-2014 Mathieu Chartier <mathieuc@google.com> Add concurrent reference processing.

Concurrent reference processing currently works by going into native
code from java.lang.ref.Reference.get(). From there, we have a fast
path if the references aren't being processed which returns the
referent without needing to access any locks. In the slow path we
block until reference processing is complete. It may be possible to
improve the slow path if the referent is blackened.

TODO: Investigate doing the fast path in java code by using racy reads
of a static volatile boolean. This will work as long as there are no
suspend points inbetween the boolean read and referent read.

Bug: 14381653

Change-Id: I1546b55be4691fe4ff4aa6d857b234cce7187d87
fd3077e4b9ebadd281777310d26e64443858f653 23-Apr-2014 Sebastien Hertz <shertz@google.com> Refactor exception handling for deoptimization

This CL refactors the exception handling (on the quick side) by isolating the
search of catch handler and the preparation of deoptimization.

We rename the CatchFinder class to QuickExceptionHandler so it's less specific
to catch handler search.

Finding catch handler happens in QuickExceptionHandler::FindCatch. Since the
CatchBlockStackVisitor resolves exception types, it may cause thread suspension
and breaks the assertion current thread can't be suspended. Therefore, we place
the exception in a SirtRef (while it is detached from the current thread) and
remove the thread suspension assertion.

Deoptimization now happens in QuickExceptionHandler::DeoptimizeStack. It uses
the new DeoptimizeStackVisitor class to create shadow frames.

We also add the Thread::GetDeoptimizationException method to get the definition
of the fake exception in only one place.

Change-Id: I01b19fa72af64329b5c3b6c7f0c3339d2d724978
bd5ea6a2f7c61c4cd7b66fead1bedd96e938369d 17-Apr-2014 Ian Rogers <irogers@google.com> Preparation for transition to libc++.

Move the dependency on libc++ to its own makefile so that we can switch in a
single place between libc++ and stlport.

Change-Id: Ie61e7d054dcd049e36d5e7298c27d8a4abe6edf7
5f3ded46a1da26f6a51cad16d421ca2fdc0f23ad 04-Apr-2014 Mathieu Chartier <mathieuc@google.com> Restore the args in the invoke trampoline slow paths.

Previously, there were errors caused by not restoring the args for
the slow path in artInvokeInterfaceTrampoline and artInvokeCommon. The
slow path in artInvokeInterfaceTrampoline occurs when you attempt
to do an interface dispatch of a method in another dex file. The slow
path in artInvokeCommon occurs when the method in dex cache is not
already resolved.

Since FindMethodFromCode may resolve a method, it can occasionally
cause thread suspension/GC. If a moving GC occurred at this point it
resulted in this_object being invalid after the trampoline returned
the code pointer. This caused a native crash in one of the money runs
since there was an unbundeled app which did a List.iterator call.

Bug: 12934910
Change-Id: Ib454faad14bef0d7732a6d7f1ca5803472d502a6
8afeb85d3def12b559b7565fb6d3956f81b55132 02-Apr-2014 Ian Rogers <irogers@google.com> Pass instruction-set from runtime through to spawned dex2oat.

Change-Id: I1727af7beb9f710c29124d4d6bc9175e4856f3cc
d59b7b18d9c63a0a8902718d6d70154037489fef 01-Apr-2014 Christopher Ferris <cferris@google.com> Keep the symbol table in the shared libraries.

In order to allow the unwinder code to have meaningful names for
art functions, leave the symbol table.

Here are the size increases:

Platform Size Increase
-------- -------------
arm ~631K
arm64 ~631K
mips ~424K
x86 ~565K
x86_64 ~565K

Bug: 12958251
Change-Id: Ib8bf11bef648f8296f4d6544f7b2af0d7f969ad8
8b2c8b9642d5fe037f93ab0cb6a5065e2a192e40 31-Mar-2014 Narayan Kamath <narayan@google.com> Move most zygote related code to frameworks/base.

Avoids code duplication across art/dalvik. Also, most of
this code is not directly related to the runtime (mounting external
storage, multi user etc.) and therefore belongs in the frameworks.

Change-Id: Icf4723dd0ec4521ef6b1f785c99d50aebca7779a
dd7624d2b9e599d57762d12031b10b89defc9807 15-Mar-2014 Ian Rogers <irogers@google.com> Allow mixing of thread offsets between 32 and 64bit architectures.

Begin a more full implementation x86-64 REX prefixes.
Doesn't implement 64bit thread offset support for the JNI compiler.

Change-Id: If9af2f08a1833c21ddb4b4077f9b03add1a05147
d5307ec41c8344be0c32273ec4f574064036187d 28-Mar-2014 Hiroshi Yamauchi <yamauchi@google.com> An empty collector skeleton for a read barrier-based collector.

Bug: 12687968

Change-Id: Ic2a3a7b9943ca64e7f60f4d6ed552a316ea4a6f3
b95a5345ae4217b70ca36f0cced92f68dda7caf5 12-Mar-2014 Stuart Monteith <stuart.monteith@arm.com> AArch64: Add arm64 runtime support.

Adds support for arm64 to ART. Assembler stubs are sufficient for
down calls into interpreter. JNI compiler and generics are not finished.

Basic Generic JNI functionality.

Change-Id: I4a07c79d1e037b9f5746673480e32cf456867b82
38e68e9978236db87c9008bbe47db80525d2fa16 07-Mar-2014 Hiroshi Yamauchi <yamauchi@google.com> Use the card table to speed up the GSS collector.

Scan only dirty cards, as opposed to the whole space, to find
references from the non-moving spaces to the bump pointer spaces at
bump pointer space only collections.

With this change, the Ritz MemAllocTest speeds up by 8-10% on host and
2-3% on N4. The Ritz EvaluateFibonacci speeds up by 8% and its average
pause time is reduced by 43% on N4.

Bug: 11650816
Change-Id: I1eefe75776bc37e24673b301ffa65a25f9bd4cde
737d7c3638cf87cfe00488468b0ea5623c5880b5 14-Mar-2014 Brian Carlstrom <bdc@google.com> Fix path for arch/mips/fault_handler_mips.cc

Change-Id: I4af53b2d1f34641e2c5b68474f80f88613a51bbe
b373e091eac39b1a79c11f2dcbd610af01e9e8a9 21-Feb-2014 Dave Allison <dallison@google.com> Implicit null/suspend checks (oat version bump)

This adds the ability to use SEGV signals
to throw NullPointerException exceptions from Java code rather
than having the compiler generate explicit comparisons and
branches. It does this by using sigaction to trap SIGSEGV and when triggered
makes sure it's in compiled code and if so, sets the return
address to the entry point to throw the exception.

It also uses this signal mechanism to determine whether to check
for thread suspension. Instead of the compiler generating calls
to a function to check for threads being suspended, the compiler
will now load indirect via an address in the TLS area. To trigger
a suspend, the contents of this address are changed from something
valid to 0. A SIGSEGV will occur and the handler will check
for a valid instruction pattern before invoking the thread
suspension check code.

If a user program taps SIGSEGV it will prevent our signal handler
working. This will cause a failure in the runtime.

There are two signal handlers at present. You can control them
individually using the flags -implicit-checks: on the runtime
command line. This takes a string parameter, a comma
separated set of strings. Each can be one of:

none switch off
null null pointer checks
suspend suspend checks
all all checks

So to switch only suspend checks on, pass:
-implicit-checks:suspend

There is also -explicit-checks to provide the reverse once
we change the default.

For dalvikvm, pass --runtime-arg -implicit-checks:foo,bar

The default is -implicit-checks:none

There is also a property 'dalvik.vm.implicit_checks' whose value is the same
string as the command option. The default is 'none'. For example to switch on
null checks using the option:

setprop dalvik.vm.implicit_checks null

It only works for ARM right now.

Bumps OAT version number due to change to Thread offsets.

Bug: 13121132
Change-Id: If743849138162f3c7c44a523247e413785677370
8d562103c3a3452fb15ef4b1c64df767b70507a4 13-Mar-2014 Mathieu Chartier <mathieuc@google.com> Refactor immune region logic into its own file.

Added immune_region.cc/.h in the collector directory. Changed the
functionality to no longer assume spaces are added to immune region
in ascending order.

Change-Id: Id1d643b3849ad2695e8a151dbbb74a5035644472
e3e0260c23d8999b9433715ac7ee5296ee2fd633 12-Mar-2014 Vladimir Marko <vmarko@google.com> Move inline method detection to runtime.

The debugger needs this for selective deoptimization.

Change-Id: I8100000449b56e619288fb05d41ea6f02b53b334
9719cd2b6ca766e9a6313793730b337c980643ff 09-Mar-2014 Brian Carlstrom <bdc@google.com> Support WITHOUT_CLANG builds

(cherry picked from commit c9f7723cdb39f9791775166ec1942e456086ad3c)

Change-Id: I9443e73a07b81038452c694a2f138faecdeff500
c9f7723cdb39f9791775166ec1942e456086ad3c 09-Mar-2014 Brian Carlstrom <bdc@google.com> Support WITHOUT_CLANG builds

Change-Id: I29ce1e394137596f3663c7f2c13640f9b73d5c9e
719d1a33f6569864f529e5a3fff59e7bca97aad0 06-Mar-2014 Ian Rogers <irogers@google.com> Enable annotalysis on clang ART builds.

Fix clang build errors aswell as restructure locking/mutex code for correct
thread safety analysis support.
Reorder make dependencies so that host builds build first as they should
provide better compilation errors than target.
Remove host's use of -fno-omit-frame-pointer as it has no value with correct
use of CFI, which we should have.

Change-Id: I72cea8da9a3757b1a0b3acb4081feccb7c6cef90
ed8dd492e43cbaaa435c4892447072c84dbaf2dc 11-Feb-2014 Serban Constantinescu <serban.constantinescu@arm.com> AArch64: Add ARM64 Assembler

This patch adds the ARM64 Assembler and ManagedRegister backend.
The implementation of the Arm64Assembler class is based on VIXL (a
programmatic A64 Assembler - see external/vixl ).

Change-Id: I842fd574637a953c19631eedf26f6c70d9ed7f9e
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
d889178ec78930538d9d6a66c3df9ee9afaffbb4 02-Mar-2014 Mathieu Chartier <mathieuc@google.com> Guard entrypoint changing by runtime shutdown lock.

There was a race when we changed the allocation entrypoints where a
new thread would be starting (Thread::Init) and initialize to the
wrong entrypoints. Guarding allocation entrypoint changing
with the runtime shutdown lock fixes this race condition since
Thread::Init is only called with the runtime shutdown lock held.

Bug: 13250963

Change-Id: I8eb209c124b6bf17020de874e1b0083f158b8200
491ca9e75fad381468dd7f5fdbff56d1a9738dd7 03-Mar-2014 Brian Carlstrom <bdc@google.com> Add ART -help and -showversion

Bug: https://code.google.com/p/android/issues/detail?id=62149
Change-Id: I5c21c0433f5f341f94e7d977e8d2d69cc46d6fe3
b48b9eb6d181a1f52e2e605cf26a21505f1d46ed 01-Mar-2014 Ian Rogers <irogers@google.com> Fix clang to compile and run host tests.

Don't use the computed goto interpreter with clang 3.4 as it causes compilation
to hang.
Avoid inclusion of LLVM_(HOST|DEVICE)_BUILD_MK except for with portable as it
sets clang incompatible cflags.
Most fixes are self-evident, for the quick dex file method inliner the enums
were being used with ostreams, so fix the enums and operator out python script
to allow this.
Note this change effects portable but this is untestable as portable was broken
by ELF file and mc linker changes.

Change-Id: Ia54348f6b1bd3f76d3b71c6e8c5f97626386b903
659d87d4a61f83f5582d816ee0bc94f00e19b46c 27-Feb-2014 Dmitry Petrochenko <dmitry.petrochenko@intel.com> art: Fix build errors for x86_64 target

Fixes build issues introduced by multilib, CompilerOptions and ElfFile patches.

Change-Id: Ic05d149e3c7a1e644d0cb50cc7c3599025c90bdf
Signed-off-by: Dmitry Petrochenko <dmitry.petrochenko@intel.com>
dc781a13ddb4dabf646bb45d0c53b65cab948e5b 05-Feb-2014 Colin Cross <ccross@android.com> art: convert makefiles to support multilib build

Convert makefiles to allow for building two architectures at the
same time. More changes may be necessary to get the tests to
build.

Change-Id: I02ba11706b7e5b5592d76e43c167bcbf0e665b93
d2fe10a3a34af171bf1631219cd2d6ff6b7778b5 15-Jan-2014 Sebastien Hertz <shertz@google.com> Remove blacklist

Removes the class initialization blacklist and use transaction to detect and
revert class initialization attempting to invoke native method. This only
concerns class initialization happening at compilation time when generating an
image (like boot.art for the system).

In transactional mode, we log every object's field assignment and array update.
Therefore we're able to abort a transaction to restore values of fields and
array as they were before the transaction starts. We also log changes to the
intern string table so we can restore its state prior to transaction start.

Since transactional mode only happens at compilation time, we don't need to log
all these changes at runtime. In order to reduce the overhead of testing if
transactional mode is on/off, we templatize interfaces of mirror::Object and
mirror::Array, respectively responsible for setting a field and setting an
array element.

For various reasons, we skip some specific fields from transaction:
- Object's class and array's length must remain unchanged so garbage collector
can compute object's size.
- Immutable fields only set during class loading: list of fields, method,
dex caches, vtables, ... as all classes have been loaded and verified before a
transaction occurs.
- Object's monitor for performance reason.

Before generating the image, we browse the heap to collect objects that need to
be written into it. Since the heap may still holds references to unreachable
objects due to aborted transactions, we trigger one collection at the end of
the class preinitialization phase.

Since the transaction is held by the runtime and all compilation threads share
the same runtime, we need to ensure only one compilation thread has exclusive
access to the runtime. To workaround this issue, we force class initialization
phase to run with only one thread. Note this is only done when generating image
so application compilation is not impacted. This issue will be addressed in a
separate CL.

Bug: 9676614
Change-Id: I221910a9183a5ba6c2b99a277f5a5a68bc69b5f9
ef7d42fca18c16fbaf103822ad16f23246e2905d 06-Jan-2014 Ian Rogers <irogers@google.com> Object model changes to support 64bit.

Modify mirror objects so that references between them use an ObjectReference
value type rather than an Object* so that functionality to compress larger
references can be captured in the ObjectRefererence implementation.
ObjectReferences are 32bit and all other aspects of object layout remain as
they are currently.

Expand fields in objects holding pointers so they can hold 64bit pointers. Its
expected the size of these will come down by improving where we hold compiler
meta-data.
Stub out x86_64 architecture specific runtime implementation.
Modify OutputStream so that reads and writes are of unsigned quantities.
Make the use of portable or quick code more explicit.
Templatize AtomicInteger to support more than just int32_t as a type.
Add missing, and fix issues relating to, missing annotalysis information on the
mutator lock.
Refactor and share implementations for array copy between System and uses
elsewhere in the runtime.
Fix numerous 64bit build issues.

Change-Id: I1a5694c251a42c9eff71084dfdd4b51fff716822
3b878f99dd84807543b9ec7964256c7634471aaf 21-Jan-2014 Duane Sand <duane.sand@imgtec.com> [MIPS64] Temporary placeholder build, to allow other projects to build

This needs to be reverted once proper mips64 port is available

Change-Id: I64d1c7ebbdb4d8b9cc5306830954df351e67d813
a1602f28c0e3127ad511712d4b08db89737ae901 14-Jan-2014 Mathieu Chartier <mathieuc@google.com> Add zygote space as its own space type.

Helps prevent errors caused from doing invalid operations on the
old alloc space.

Removed some duplicated code in mark_sweep.cc and semi_space.cc.

Change-Id: I67a772cab30d698744c918aad581053f282a4a99
43b2e0f9105848da6470458e7c04bf1fd7fcb25c 31-Jan-2014 Ian Rogers <irogers@google.com> Fix multi-line hex dumping and add unit test.

Change-Id: I7657018fef5d9c17410a9a634db275555f180014
81de680f77dcab50ea3c0ea5beca88ad75738c7c 22-Jan-2014 Colin Cross <ccross@android.com> art: rename aarch64 target to arm64

Rename aarch64 build targets to arm64. The gcc toolchain is still
aarch64.

Change-Id: Ia92d8a50824e5329cf00fd6f4f92eae112b7f3a3
4e3b284b2babf813c26ad9afb129f57e3d88f67d 18-Jan-2014 Brian Carlstrom <bdc@google.com> Update ElfWriterMclinker for klp

(cherry picked from commit a6263af9aea65c65744bdd845fed68c4814e9514)

Change-Id: I3eb9fee8afb1ef12aae4c87770882afee637971d
6f4ffe41649f1e6381e8cda087ad3749206806e5 13-Jan-2014 Hiroshi Yamauchi <yamauchi@google.com> Improve the generational mode.

- Turn the compile-time flags for generational mode into a command
line flag.

- In the generational mode, always collect the whole heap, as opposed
to the bump pointer space only, if a collection is an explicit,
native allocation-triggered or last attempt one.

Change-Id: I7a14a707cc47e6e3aa4a3292db62533409f17563
d45a1f5d1dd5bc9badfab3a8aee90c934d9f2227 09-Jan-2014 Sebastien Hertz <shertz@google.com> Avoid instrumentation stack corruption.

While debugging a throwing exception, we may end up updating instrumentation
stack frame after having already walked the native stack. This leads to not pop
instrumentation frames prior to catch handler (or upcall if exception is not
caught) and get it desynchronized with the native stack.

To solve this issue, we need to walk the stack again after having reporting the
exception to the instrumentation listener (for example: the debugger) which
may push new instrumentation stack frames. However we do it only when we know
instrumentation is enabled to not slow down exception delivery when executing
code without instrumentation.

Here are the main changes:
- Creates InstrumentationStackVisitor to compute the number of instrumentation
frames to pop (previously done in CatchBlockStackVisitor). We only count frames
prior to catch handler (or upcall). Popping instrumentation frames is done
after having reported the exception to the instrumentation listener.
- Updates the CatchBlockStackVisitor to remove instrumentation frame handling
and focus only on finding the catch handler and prepare deoptimization.
- Creates CatchFinder class to control both visitors and do the long jump.

Change-Id: I29b3871403f297bfb8c087e27f1330b002f5d56d
0aded089f565008ba5908e395e5914ca4f91f2de 07-Nov-2013 Dave Allison <dallison@google.com> Add sampling profiler

This adds a sampling profiler thread that runs every so often, gathering
profiling data and writing the results to a file in /data/data (specific to
app running). The intention is to use these files as input to the compiler
so that it can determine the best methods to compile.

Bug: 11539952
Change-Id: I0bfbb4146fb7966673c792f017ffac8107b6272d
8c1d1acd24c861c9e0b6666fe6e748ba6c830a4a 12-Dec-2013 Ashok Bhat <ashok.bhat@arm.com> AArch64: Temporary workaround to build art

This patch adds a temporary workaround to build art for
AArch64, thus allowing building of other dependent projects.

This needs to be reverted once proper AArch64 port is available.

Change-Id: Ib3d70b9d08ce774efbd4971ce319733dbdda86cc
Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
9e0668f2ef14838b3e5a07e23d581efca9d7b8a1 11-Dec-2013 Narayan Kamath <narayan@google.com> Add dependency on libutils for libziparchive

Change-Id: I02d58ad0d2f29cc7b94bc4214ca69d988595c4e5
92572be7f754c213e615a62955cc5f65ca8c0c0e 28-Nov-2013 Narayan Kamath <narayan@google.com> Use libziparchive for art zip processing.

This is part of the effort to move all VM & framework
zip parsing to a common implementation. This also has
the side effect of fixing various TODOs related to
crc32 checking.

bug: 10193060

Change-Id: I407f9ad5a94fc91d96ff43556adde00a00df1f14
2ef411b95eec751e8a8f0f0629df0cdb7aec9546 27-Nov-2013 Pavel Chupin <pavel.v.chupin@intel.com> x86_64: Updating makefile to avoid early fail of other projects build

x86_64 porting should be done later

Change-Id: I73b336b1c46cb2c95dfacfc33aec490be9e357a7
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
cbb2d20bea2861f244da2e2318d8c088300a3710 15-Nov-2013 Mathieu Chartier <mathieuc@google.com> Refactor allocation entrypoints.

Adds support for switching entrypoints during runtime. Enables
addition of new allocators with out requiring significant copy
paste. Slight speedup on ritzperf probably due to more inlining.

TODO: Ensuring that the entire allocation path is inlined so
that the switch statement in the allocation code is optimized
out.

Rosalloc measurements:
4583
4453
4439
4434
4751

After change:
4184
4287
4131
4335
4097

Change-Id: I1352a3cbcdf6dae93921582726324d91312df5c9
cf58d4adf461eb9b8e84baa8019054c88cd8acc6 26-Sep-2013 Hiroshi Yamauchi <yamauchi@google.com> A custom 'runs-of-slots' memory allocator.

Bug: 9986565
Change-Id: I0eb73b9458752113f519483616536d219d5f798b
39e3261168e7761fea6d873494d7c5d191285791 13-Nov-2013 Mathieu Chartier <mathieuc@google.com> Refactor reference queues.

Refactored the reference queue processing to reside in the heap code.
This removes significant code duplication in the semispace and
marksweep garbage collectors.

Changed the soft reference behaviour to preserve all soft references
unless the GC requires them to be cleared to avoid an out of memory
error. It may be worth investigating a better heuristic in the
future to preserve soft references by LRU order.

Change-Id: I1f3ff5bd4b3c5149271f4bb4fc94ba199e2f9bc2
590fee9e8972f872301c2d16a575d579ee564bee 13-Sep-2013 Mathieu Chartier <mathieuc@google.com> Compacting collector.

The compacting collector is currently similar to semispace. It works by
copying objects back and forth between two bump pointer spaces. There
are types of objects which are "non-movable" due to current runtime
limitations. These are Classes, Methods, and Fields.

Bump pointer spaces are a new type of continuous alloc space which have
no lock in the allocation code path. When you allocate from these it uses
atomic operations to increase an index. Traversing the objects in the bump
pointer space relies on Object::SizeOf matching the allocated size exactly.

Runtime changes:
JNI::GetArrayElements returns copies objects if you attempt to get the
backing data of a movable array. For GetArrayElementsCritical, we return
direct backing storage for any types of arrays, but temporarily disable
the GC until the critical region is completed.

Added a new runtime call called VisitObjects, this is used in place of
the old pattern which was flushing the allocation stack and walking
the bitmaps.

Changed image writer to be compaction safe and use object monitor word
for forwarding addresses.

Added a bunch of added SIRTs to ClassLinker, MethodLinker, etc..

TODO: Enable switching allocators, compacting on background, etc..

Bug: 8981901

Change-Id: I3c886fd322a6eef2b99388d19a765042ec26ab99
7020278bce98a0735dc6abcbd33bdf1ed2634f1d 23-Oct-2013 Dave Allison <dallison@google.com> Support hardware divide instruction

Bug: 11299025

Uses sdiv for division and a combo of sdiv, mul and sub for modulus.
Only does this on processors that are capable of the sdiv instruction, as determined
by the build system.

Also provides a command line arg --instruction-set-features= to allow cross compilation.
Makefile adds the --instruction-set-features= arg to build-time dex2oat runs and defaults
it to something obtained from the target architecture.

Provides a GetInstructionSetFeatures() function on CompilerDriver that can be
queried for various features. The only feature supported right now is hasDivideInstruction().

Also adds a few more instructions to the ARM disassembler

b/11535253 is an addition to this CL to be done later.

Change-Id: Ia8aaf801fd94bc71e476902749cf20f74eba9f68
7b5f0cf08f74ff36760a813888779d28a175982d 01-Nov-2013 Christopher Ferris <cferris@google.com> Use libbacktrace instead of libcorkscrew.

Also, removed the ignore frames of 2, this was causing threads to chop
the lower two frames. The original code assumed that the calls to decode
the frame were in the unwind trace, but that's not the case.

Change-Id: Ifc0da0227f9114a5b462ef88e038439d58f951e9
ba150c37d582eeeb8c11ba5245edc281cf31793c 28-Aug-2013 Brian Carlstrom <bdc@google.com> Omit OatMethodOffsets for classes without compiled code

Change-Id: If0d290f4aebc778ff12d8fed017c270ad2ac3220
e3a21740ec7056d52a90620d988bbb72eca0997f 24-Oct-2013 Nick Kralevich <nnk@google.com> Add -Wl,--no-fatal-warnings to x86 build

libart.so has text relocations. When -Wl,--fatal-warnings is added
to the global LDFLAGS, these text relocations will become a compile
error.

This is a short term workaround until the text relocations can be
fixed properly.

Bug: 11358761
Bug: 11353056

(cherry picked from commit 59fe2a68b94daa4d215d69facec1b3079846df9e)

Change-Id: Id604bdec5d4fdf2606b9970cf65b6a358b9a673a
59fe2a68b94daa4d215d69facec1b3079846df9e 24-Oct-2013 Nick Kralevich <nnk@google.com> Add -Wl,--no-fatal-warnings to x86 build

libart.so has text relocations. When -Wl,--fatal-warnings is added
to the global LDFLAGS, these text relocations will become a compile
error.

This is a short term workaround until the text relocations can be
fixed properly.

Bug: 11358761
Bug: 11353056
Change-Id: I886d668a1bd6ed326f6552693d8c38c5d5a6b43d
d9c4fc94fa618617f94e1de9af5f034549100753 02-Oct-2013 Ian Rogers <irogers@google.com> Inflate contended lock word by suspending owner.

Bug 6961405.
Don't inflate monitors for Notify and NotifyAll.
Tidy lock word, handle recursive lock case alongside unlocked case and move
assembly out of line (except for ARM quick). Also handle null in out-of-line
assembly as the test is quick and the enter/exit code is already a safepoint.
To gain ownership of a monitor on behalf of another thread, monitor contenders
must not hold the monitor_lock_, so they wait on a condition variable.
Reduce size of per mutex contention log.
Be consistent in calling thin lock thread ids just thread ids.
Fix potential thread death races caused by the use of FindThreadByThreadId,
make it invariant that returned threads are either self or suspended now.

Code size reduction on ARM boot.oat 0.2%.
Old nexus 7 speedup 0.25%, new nexus 7 speedup 1.4%, nexus 10 speedup 2.24%,
nexus 4 speedup 2.09% on DeltaBlue.

Change-Id: Id52558b914f160d9c8578fdd7fc8199a9598576a
ee39a10e45a6a0880e8b829525c40d6055818560 19-Sep-2013 Ian Rogers <irogers@google.com> Use class def index from java.lang.Class.

Bug: 10244719
This removes the computation of the dex file index, when necessary this is
computed by searching the dex file. Its only necessary in
dalvik.system.DexFile.defineClassNative and DexFile::FindInClassPath, the
latter not showing up significantly in profiling with this change.

(cherry-picked from 8b2c0b9abc3f520495f4387ea040132ba85cae69)
Change-Id: I20c73a3b17d86286428ab0fd21bc13f51f36c85c
8b2c0b9abc3f520495f4387ea040132ba85cae69 19-Sep-2013 Ian Rogers <irogers@google.com> Use class def index from java.lang.Class.

Bug: 10244719
Depends on:
https://googleplex-android-review.git.corp.google.com/362363
This removes the computation of the dex file index, when necessary this is
computed by searching the dex file. Its only necessary in
dalvik.system.DexFile.defineClassNative and DexFile::FindInClassPath, the
latter not showing up significantly in profiling with this change.

Change-Id: I20c73a3b17d86286428ab0fd21bc13f51f36c85c
8ece050d85fc244c72610244e440b0e00aa618fa 07-Aug-2013 Sebastien Hertz <shertz@google.com> Add an interpreter using computed goto table.

This CL adds a new implementation of the interpreter using computed goto table.
In order to keep the switch-based implementation, it reorders things as the
following:
- Keep interpreter entrypoints into interpreter.h/.cc files.
- Move common interpreter parts to interpreter_common.h/.cc files.
- Separate both implementations to their own modules.

The interpreter implementation can be selected by changing the value of the
kInterpreterImplKind global variable (see interpreter.cc file). The default one
remains the switch-based implementation.

Also updates the exception handling (FindNextInstructionFollowingException) and
SPARSE_SWITCH switch handling (DoSparseSwitch) routines to share code between both
implementations.

Finally, adds a PACKED_SWITCH handling routine (DoPackedSwitch) so we are
consistent with SPARSE_SWITCH handling.

The computed goto implementation use two handlers table: one for normal
instruction handling and one for instrumentation handling. The current handlers
table to be used is updated on backward branch depending on whether there is
listener to DEX pc change.

Bug: 10602809
Change-Id: Ibb53bcc68be75c473fe5440835e78fc9a74381b3
02ed4c04468ca5f5540c5b704ac3e2f30eb9e8f4 06-Sep-2013 Ian Rogers <irogers@google.com> Move disassembler out of runtime.

Bug: 9877500.
Change-Id: Ica6d9f5ecfd20c86e5230a2213827bd78cd29a29
193bad9b9cfd10642043fa2ebbfc68bd5f9ede4b 30-Aug-2013 Mathieu Chartier <mathieuc@google.com> Multi threaded hashed deduplication during compilation.

Moved deduplication to be in the compiler driver instead of oat
writer. This enables deduplication to be performed on multiple
threads. Also added a hash function to avoid excessive comparison
of byte arrays.

Improvements:
Before (alloats host):
real 1m6.967s
user 4m22.940s
sys 1m22.610s

Thinkfree.apk (target mako):
0m23.74s real 0m50.95s user 0m9.50s system
0m24.62s real 0m50.61s user 0m10.07s system
0m24.22s real 0m51.44s user 0m10.09s system
0m23.70s real 0m51.05s user 0m9.97s system
0m23.50s real 0m50.74s user 0m10.63s system

After (alloats host):
real 1m5.705s
user 4m44.030s
sys 1m29.990s

Thinkfree.apk (target mako):
0m23.32s real 0m51.38s user 0m10.00s system
0m23.49s real 0m51.20s user 0m9.80s system
0m23.18s real 0m50.80s user 0m9.77s system
0m23.52s real 0m51.22s user 0m10.02s system
0m23.50s real 0m51.55s user 0m9.46s system

Bug: 10552630

Change-Id: Ia6d06a747b86b0bfc4473b3cd68f8ce1a1c7eb22
0e480cad5d2cf0904b98b7b56e90280e9b97ba30 16-Aug-2013 Ian Rogers <irogers@google.com> Move output_stream files out of runtime.

Also move image_test and oat_test that are more writing tests.

Change-Id: I6af1400d8e745bbf87f626ca87dae3e2d85b40f1
ea46f950e7a51585db293cd7f047de190a482414 30-Jul-2013 Brian Carlstrom <bdc@google.com> Refactor java.lang.reflect implementation

Cherry-picked from commit ed41d5c44299ec5d44b8514f6e17f802f48094d1.

Move to ArtMethod/Field instead of AbstractMethod/Field and have
java.lang.reflect APIs delegate to ArtMethod/ArtField.

Bug: 10014286.

Change-Id: Iafc1d8c5b62562c9af8fb9fd8c5e1d61270536e7
08bf1967611965b65ffd5de1aa603b60e7b2d6a8 12-Aug-2013 Dragos Sbirlea <dragoss@google.com> Work on SMALL_ART and PORTABLE working at the same time.

Change-Id: Iddedf63b6f9d908717a4d30f963e9b81a9604d49
468532ea115657709bc32ee498e701a4c71762d4 05-Aug-2013 Ian Rogers <irogers@google.com> Entry point clean up.

Create set of entry points needed for image methods to avoid fix-up at load time:
- interpreter - bridge to interpreter, bridge to compiled code
- jni - dlsym lookup
- quick - resolution and bridge to interpreter
- portable - resolution and bridge to interpreter

Fix JNI work around to use JNI work around argument rewriting code that'd been
accidentally disabled.
Remove abstact method error stub, use interpreter bridge instead.
Consolidate trampoline (previously stub) generation in generic helper.
Simplify trampolines to jump directly into assembly code, keeps stack crawlable.
Dex: replace use of int with ThreadOffset for values that are thread offsets.
Tidy entry point routines between interpreter, jni, quick and portable.

Change-Id: I52a7c2bbb1b7e0ff8a3c3100b774212309d0828e
(cherry picked from commit 848871b4d8481229c32e0d048a9856e5a9a17ef9)
848871b4d8481229c32e0d048a9856e5a9a17ef9 05-Aug-2013 Ian Rogers <irogers@google.com> Entry point clean up.

Create set of entry points needed for image methods to avoid fix-up at load time:
- interpreter - bridge to interpreter, bridge to compiled code
- jni - dlsym lookup
- quick - resolution and bridge to interpreter
- portable - resolution and bridge to interpreter

Fix JNI work around to use JNI work around argument rewriting code that'd been
accidentally disabled.
Remove abstact method error stub, use interpreter bridge instead.
Consolidate trampoline (previously stub) generation in generic helper.
Simplify trampolines to jump directly into assembly code, keeps stack crawlable.
Dex: replace use of int with ThreadOffset for values that are thread offsets.
Tidy entry point routines between interpreter, jni, quick and portable.

Change-Id: I52a7c2bbb1b7e0ff8a3c3100b774212309d0828e
834b394ee759ed31c5371d8093d7cd8cd90014a8 31-Jul-2013 Brian Carlstrom <bdc@google.com> Merge remote-tracking branch 'goog/dalvik-dev' into merge-art-to-dalvik-dev

Change-Id: I323e9e8c29c3e39d50d9aba93121b26266c52a46
025218c7e4330a4942b14f9a8f1f68bd3390261c 31-Jul-2013 Elliott Hughes <enh@google.com> Clean up stlport usage.

Change-Id: I133cd88f1da37f6f801a9e07a78ae23b671cf4f1
7655f29fabc0a12765de828914a18314382e5a35 29-Jul-2013 Ian Rogers <irogers@google.com> Portable refactorings.

Separate quick from portable entrypoints.
Move architectural dependencies into arch.

Change-Id: I9adbc0a9782e2959fdc3308215f01e3107632b7c
b07b8b7a1815fc22c0e7b3f0899406cc7eeebaca 29-Jul-2013 Ian Rogers <irogers@google.com> Move vector output stream to compiler.

Change-Id: Ia4c5edabb6be31a7d953c932b490ed2d89f941c1
166db04e259ca51838c311891598664deeed85ad 26-Jul-2013 Ian Rogers <irogers@google.com> Move assembler out of runtime into compiler/utils.

Other directory layout bits of clean up. There is still work to separate quick
and portable in some files (e.g. argument visitor, proxy..).

Change-Id: If8fecffda8ba5c4c47a035f0c622c538c6b58351
0a9dc05e704bfd033bac2aa38a4fc6f6b8e6cf93 25-Jul-2013 Mathieu Chartier <mathieuc@google.com> GC data structures allocation tracking

Adds a new stl compatible allocator that is used in most GC data
structures. When the data structures allocate and free memory, it
lets the heap know of how much memory was allocated or freed. Using
this info, we dump the approximated stl data structures memory usage
when a sigquit occurs.

The allocation tracking can be disabled with a compile time boolean
flag to remove performance impact.

Change-Id: Idddb6713169e07be913bceeb50f305c8573e4392
19e776ceb178397661b0323a9a982f6db249a56d 23-Jul-2013 Brian Carlstrom <bdc@google.com> Enable darwin target build for art.

Change-Id: I8fc04258360d663d2fcd07c307fdfdd2981cdd19
0e260a32601fb1178e11837c460807071d489f82 21-Jun-2013 Dragos Sbirlea <dragoss@google.com> Added code generation framework.

visitors.h: Contains only IR visitor declarations for now.
code_gen.h: Code generation vistor declaration (needs llvm).
code_gen.cc:Code generation visitor implementation (needs llvm).
instruction_nodes.h: Classes for each type of instruction; this
enables the visitor to visit each instruction differently and
corresponds to the sea of nodes paper.
sea_node.h : Moved base Sea IR Node to this separate header.
Replaced NO_REGISTER with enum (including RETURN_REGISTER)
sea.cc: Addded code generation call.
Set parent region for SignatureNodes.
Propagate method and class ids in IR generation routine.
Create InstructionNode subclasses.
*.mk: Updated to support the new files. Fixed some pre-existing formatting.
instruction_tools.h: Fixed double-define of NO_REGISTER to
refer to the new enum.
dex_instruction.cc: Added support for one more instruction in
HasRegXX and VRegXX functions.

Change-Id: I7c78f603e41df7bf9da5b77951b8485dd1b49200
7940e44f4517de5e2634a7e07d58d0fb26160513 12-Jul-2013 Brian Carlstrom <bdc@google.com> Create separate Android.mk for main build targets

The runtime, compiler, dex2oat, and oatdump now are in seperate trees
to prevent dependency creep. They can now be individually built
without rebuilding the rest of the art projects. dalvikvm and jdwpspy
were already this way. Builds in the art directory should behave as
before, building everything including tests.

Change-Id: Ic6b1151e5ed0f823c3dd301afd2b13eb2d8feb81