History log of /art/compiler/oat_test.cc
Revision Date Author Comments
c9dbb1df3b5c06ba122cacaf35b17cb53c6be3c6 04-Jun-2016 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Hold dex caches live in class table""

Bug: 29083330

This reverts commit f102faf1bcbdb2149e3e7bf27b1819f621b7894b.

Change-Id: Ibc6d260247b3113beec7d33552061512a36c9ce8
f102faf1bcbdb2149e3e7bf27b1819f621b7894b 04-Jun-2016 Brian Carlstrom <bdc@google.com> Revert "Hold dex caches live in class table"

This reverts commit d6d49e56c2b7b11f474acb80cb02bb1fe9b7861e.

Bug: 29083330
Change-Id: Ie209b27897b8079f2d13fd0837fe5f83a7e61afc
d6d49e56c2b7b11f474acb80cb02bb1fe9b7861e 02-Jun-2016 Mathieu Chartier <mathieuc@google.com> Hold dex caches live in class table

Prevents temporary dex caches being unloaded for the same dex file.
Usually this is OK, but if someone resolved a string in that dex
cache, it could leave stale pointers in BSS. Also it can use extra
memory in linear alloc if we allocate dex cache arrays multiple
times.

Bug: 29083330

(cherry picked from commit f284d448e3edd428b6ade473d0993028638b2064)

Change-Id: Ie1b0b0cf835a998e19227cbb90014011a6cd40c4
2c6b49498e2f084ce217fcd3327103eadc1e0c37 24-May-2016 Jeff Hao <jeffhao@google.com> Don't update checksum if data ptr is null.

Passing a nullptr to adler32 resets it to its initial value.

Bug: 28874264
Change-Id: I863fa4d489618c1c6fa579cc89fb050f4cd23760
cdca476bf3394ce9d97a369e84e701b427009318 28-Apr-2016 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Write conflict tables in image""

Added test.

Bug: 27906566

This reverts commit 8e2478d23e89a7022c93ddc608dcbba7b29b91e6.

Change-Id: I0894f5f7cd11af29ed9d0345b51f527fc8a41d19
9d07e3d128ccfa0ef7670feadd424a825e447d1d 31-Mar-2016 Vladimir Marko <vmarko@google.com> Clean up OatQuickMethodHeader after Quick removal.

This reduces the size of the pre-header by 8 bytes, reducing
oat file size and mmapped .text section size. The memory
needed to store a CompiledMethod by dex2oat is also reduced,
for 32-bit dex2oat by 8B and for 64-bit dex2oat by 16B. The
aosp_flounder-userdebug 32-bit and 64-bit boot.oat are each
about 1.1MiB smaller.

Disable the broken StubTest.IMT, b/27991555 .

Change-Id: I05fe45c28c8ffb7a0fa8b1117b969786748b1039
3c94f0945ed596ceee39783fa075f013b65e80a1 21-Mar-2016 Nicolas Geoffray <ngeoffray@google.com> Remove Quick from tree.

So long, old friend.

Change-Id: I0241c798a34b92bf994fed83888da67d6e7f1891
0b4cbd0c2a75b47ae09d21e5d73d2b1709cb5b9e 09-Mar-2016 Mathieu Chartier <mathieuc@google.com> Add oatdump support for app images

Example usage on host:
oatdumpd --app-oat=art/plus32.odex --app-image=art/plus32.art
--image=art/oats/system@framework@boot.art --instruction-set=arm

TODO: Add to oatdump test.

Bug: 27408512
Bug: 22858531

(cherry picked from commit bcb6a72569a1401b36a3ad3b6aa4d13e29966cf0)

Change-Id: I9d1aa7eaa16795e5fbabc6974d245849e16b1d03
bcb6a72569a1401b36a3ad3b6aa4d13e29966cf0 09-Mar-2016 Mathieu Chartier <mathieuc@google.com> Add oatdump support for app images

Example usage on host:
oatdumpd --app-oat=art/plus32.odex --app-image=art/plus32.art
--image=art/oats/system@framework@boot.art --instruction-set=arm

TODO: Add to oatdump test.

Bug: 27408512
Bug: 22858531

Change-Id: I320db8b76c780c6eadabcb45ce88f45950741484
5d8112029d0e085c5a0099257daa4c7e29c12310 08-Mar-2016 David Srbecky <dsrbecky@google.com> Propagate InstructionSetFeatures to ElfBuilder.

This is subset of CL171665 and it separates it into two.
It will be needed to generate .MIPS.abiflags ELF section.

Change-Id: I5557e7cb98d0fa1dc57c85cf6161e119c6d50a1a
944da603cde59a4277f3bbc31d860a90842a1a2a 19-Feb-2016 Vladimir Marko <vmarko@google.com> ART: Allow method references across oat files for multi-image, 2nd attempt.

These were disabled because we didn't have sufficient
information about the multi-image layout when processing
link-time patches in OatWriter. This CL refactors the
ELF file creation so that the information is available.

Also clean up ImageWriter to use oat file indexes instead
of filenames and avoid reopening the oat file to retrieve
the checksum.

Change-Id: Icc7b528deca29da1e473c8f079521a36d6c4892f
7ead0c009c64f1e10aa39e44ea10383dd859d332 22-Feb-2016 Alex Light <allight@google.com> Make JNI work correctly with default methods.

Also adds some tests for JNI and DefaultMethods.

Bug: 27259142
Bug: 24618811

(cherry picked from commit 3612149aee482ab7a17da68b0ef5fef3879729a2)

Change-Id: I31222e3e41059d803be1dbb0f40e1144ac4bf457
3612149aee482ab7a17da68b0ef5fef3879729a2 22-Feb-2016 Alex Light <allight@google.com> Make JNI work correctly with default methods.

Also adds some tests for JNI and DefaultMethods.

Bug: 27259142
Bug: 24618811

Change-Id: I31222e3e41059d803be1dbb0f40e1144ac4bf457
d07e1b338ddedd03728136f136a2c4cb6df50dc4 17-Feb-2016 Alex Light <allight@google.com> Fix issue with copied methods not being checked.

In several places we were using IsMiranda to check if a method is
copied. This misses cases involving default methods.

(cherrypicked commit fcea56f9cc51957161fe7a6e35e895fd8c4c4a7f)

Bug: 27216437

Change-Id: I8c800e3e622a9c0ca0f8752c3d5202f433af9a1c
fcea56f9cc51957161fe7a6e35e895fd8c4c4a7f 17-Feb-2016 Alex Light <allight@google.com> Fix issue with copied methods not being checked.

In several places we were using IsMiranda to check if a method is
copied. This misses cases involving default methods.

Bug: 27216437
Change-Id: I8c800e3e622a9c0ca0f8752c3d5202f433af9a1c
45724f9a0cc38dbb3071beb3eeab96499868b49c 17-Feb-2016 Vladimir Marko <vmarko@google.com> Revert "Allow method references across oat files for multi-image."

Breaks Quick tests.

This reverts commit 6065402316da2b51eed5fc34cffbd991766bd408.

Change-Id: I8a5469ba7cea5f46b85cb489b3e0ef06ed548f03
6065402316da2b51eed5fc34cffbd991766bd408 16-Feb-2016 Vladimir Marko <vmarko@google.com> Allow method references across oat files for multi-image.

These were disabled because we didn't have sufficient
information about the multi-image layout when processing
link-time patches in OatWriter. This CL refactors the
ELF file creation so that the information is available.

Change-Id: I6f2e8dc8572d143c72cc2693bb0ba4fd76f889ab
4fda4eb799c95be266f52aaf3461a440ea86b841 05-Feb-2016 David Srbecky <dsrbecky@google.com> Move code related to debug info generation to its own directory.

debug/dwarf/ contains helper classes which hide the details
of the DWARF file format. It acts as independent DWARF library.

debug/ contains ART-specific code which generates ELF debug
sections (which includes non-DWARF sections like .symtab).

Change-Id: Id351f604e4e64be2ca395a78324ea02e30481497
3a2bd29d274f60fdcfabebb052078edef0190164 27-Jan-2016 Andreas Gampe <agampe@google.com> ART: Make sure dex files are verified in the compiler

Follow-up to 9bdf108885a27ba05fae8501725649574d7c491b. Make sure
that dex files from the oat writer are verified with the dex file
verifier.

Bug: 26793137
Bug: 26808512
Change-Id: I1a5f51751491eead21d8f9f1b31e37c7374c72a5
9bdf108885a27ba05fae8501725649574d7c491b 21-Jan-2016 Vladimir Marko <vmarko@google.com> Revert "Revert "Write dex files to oat file early.""

This reverts commit 919f5536182890d2e03f59b961acf8f7c836ff61.

Fix linker error (Mac build):
Replace inline definition of art::ZipArchive::~ZipArchive()
with an out-of-line definition in zip_archive.cc to avoid
direct reference to CloseArchive() from libart-compiler due
to inlining. Note that libart is linked against -lziparchive
but libart-compiler is not.

Change-Id: I92620ea0200282ca7ba9b7f61a592cb6468d90d8
919f5536182890d2e03f59b961acf8f7c836ff61 20-Jan-2016 Vladimir Marko <vmarko@google.com> Revert "Write dex files to oat file early."

This reverts commit 625a64aad13905d8a2454bf3cc0e874487b110d5.

Breaks the Mac build:

Undefined symbols for architecture i386:
"_CloseArchive", referenced from:
... in oat_writer.o
ld: symbol(s) not found for architecture i386

Change-Id: I21608bc51437834e1e6abde9bcbe5e7d9998197e
c903b6af634927479915eaa9516d493eea23f911 18-Jan-2016 Nicolas Geoffray <ngeoffray@google.com> Move --dump-cfg and dump-cfg-append to CompilerOptions.

It simplifies passing the option to the JIT.

Change-Id: Iee1b722362899e5809ef97be90961e3dda1e16cc
625a64aad13905d8a2454bf3cc0e874487b110d5 26-Nov-2015 Vladimir Marko <vmarko@google.com> Write dex files to oat file early.

Write dex files to oat file before we actually open and
verify them. Instead, open and verify the copies from the
oat file and use these. This way, in the most common case
of zipped dex files, we have mmapped dex files instead of
inflated dex files. That reduces the number of dirty pages
used by dex2oat.

Reading /proc/self/statm after we write the oat file for
a compilation of a certain large app on Nexus 5 AOSP build
with -j1, three attempts before and after this CL gave
before: 346061 189462 6269 26 0 140723 0
346189 189450 6269 26 0 140851 0
346061 189463 6269 26 0 140723 0
after: 346186 185808 23040 27 0 140468 0
346186 185819 23040 27 0 140468 0
346186 185822 23040 27 0 140468 0
These values are in pages (4KiB), so while the "size"
(=VmSize) is essentially unchanged, the "resident" (=VmRSS)
is over 14MiB less and the "shared" (i.e. backed by a file)
is 65.5MiB more. That is, the amount of dirty non-pageable
memory used is reduced by about 80MiB.

The oat file format has changed slightly, the class offset
table has been moved from the OatDexFile to its own section.
This actually fixes the alignment of these offsets as they
could have been unaligned previously, yet accessed as normal
with significant performance impact if the kernel has to
emulate the unaligned access (say, mips).

Change-Id: I0f4799bb1f1ca28e3533156a3494f55345c3e10a
998c21661b5074c293cae818d0ab7c44dcda3a66 21-Dec-2015 Calin Juravle <calin@google.com> Perform profile file analysis in dex2oat

Dex2oat can accept now multiple profile files to drive a profile based
compilation. --profile-file and --reference-profile-file speficy a pair
of profile files which will be evaluated for significant differences
before starting the compilation. If the difference is insignificant
(according to some internal metric) the compilation is skipped and a
message is logged.

Multiple pairs of --profile-file and --reference-profile-file can be
specified. This effectively enables multi user support since profiles
for different users will be kept separately.

--reference-profile-file can be left out, case in which the decision is
solely based on --profile-file. If both flags are present, then their
repetition should form unique pairs.

If the compilation is performed and --reference-profile-file is given
then its data is merged with the data from the corresponding --profile-
file and saved back to the file.

If no profile flags are given, dex2oat proceeds as before and compiles
the dex files unconditionally.

As part of this change
- merge ProfileCompilationInfo and OfflineProfilingInfo under the same
object. There was no use to keep them separate anymore.
- SaveProfilingInfo now merges the data with what was in
the file before instead of overwriting it.

Bug: 26080105

Change-Id: Ia8c8b55587d468bca5179f78941854285426234d
dcdc85bbd569f0ee66c331b4219c19304a616214 04-Dec-2015 Jeff Hao <jeffhao@google.com> Dex2oat support for multiple oat file and image file outputs.

Multiple changes to dex2oat and the runtime to support a --multi-image
option. This generates a separate oat file and image file output for
each dex file input.

Change-Id: Ie1d6f0b8afa8aed5790065b8c2eb177990c60129
9865bde5d822f56c4732214c2005dfcaa41f94cf 21-Dec-2015 Mathieu Chartier <mathieuc@google.com> Rename NullHandle to ScopedNullHandle

This makes it clearer that is invalid to do things like:
Handle<T> h = ScopedNullHandle<T>();

Bug: 26233305
Change-Id: I6d8f54eae01ec2e901cb7043afa853ea77db79fe
e64300b8488716056775ecbfa2915dd1b4ce7e08 16-Dec-2015 Alex Light <allight@google.com> Revert "Revert "Combine direct_methods_ and virtual_methods_ fields of mirror::Class""

This reverts commit ae358c1d5cef227b44d6f4971b79e1ab91aa26eb.

Bug: 24618811

Change-Id: I8becf9bae3258450b90cfef5e79589db7c535a4d
2efb0aa57da168944f99a2d13aed2a426cfa76e7 15-Dec-2015 Alex Light <allight@google.com> Revert "Combine direct_methods_ and virtual_methods_ fields of mirror::Class"

This reverts commit 9539150b85142c18e9e8c2264b5b6100942667c3.

Change-Id: I596876cd643ec0ad524a56621efb6b89e8886230
ae358c1d5cef227b44d6f4971b79e1ab91aa26eb 15-Dec-2015 Alex Light <allight@google.com> Revert "Combine direct_methods_ and virtual_methods_ fields of mirror::Class"

This reverts commit 6286a97bea0f584342803a215550038852b24776.

Change-Id: I5b00f6d1350e9c587acd4b185367dc815ea707de
7c1559a06041c9c299d5ab514d54b2102f204a84 15-Dec-2015 Roland Levillain <rpl@google.com> x86 Baker's read barrier fast path implementation.

Introduce an x86 fast path implementation in Optimizing for
Baker's read barriers (for both heap reference loads and GC
root loads). The marking phase of the read barrier is
performed by a slow path, invoking a new runtime entry point
(artReadBarrierMark).

Other read barrier algorithms continue to use the original
slow path based implementation, which has been renamed as
GenerateReadBarrierSlow/GenerateReadBarrierForRootSlow.

Bug: 12687968
Change-Id: Ie610c4befc19ff22378a8cba38b422dcacb54320
9539150b85142c18e9e8c2264b5b6100942667c3 04-Dec-2015 Alex Light <allight@google.com> Combine direct_methods_ and virtual_methods_ fields of mirror::Class

Manual cherry-pick of 6286a97 to master

This makes several parts of the overall runtime simpler and reduces
the size of a class object by 32-bits.

Bug: 24618811

Change-Id: I36129b52189e26898ea56fa2b7b45652e06af236
6286a97bea0f584342803a215550038852b24776 04-Dec-2015 Alex Light <allight@google.com> Combine direct_methods_ and virtual_methods_ fields of mirror::Class

This makes several parts of the overall runtime simpler and reduces
the size of a class object by 32-bits.

Bug: 24618811

Change-Id: I36129b52189e26898ea56fa2b7b45652e06af236
49b0f45d5a9023653ab00c355735910aa51ee0ba 10-Dec-2015 Vladimir Marko <vmarko@google.com> Refactor and clean up OatWriter and Dex2Oat.

This is in preparation for early writing of dex files
to oat file.

Change-Id: I31195f3c94eb8ff676c600c60bd35ae531f457b4
a4f1220c1518074db18ca1044e9201492975750b 06-Aug-2015 Mark Mendell <mark.p.mendell@intel.com> Optimizing: Add direct calls to math intrinsics

Support the double forms of:
cos, sin, acos, asin, atan, atan2, cbrt, cosh, exp, expm1,
hypot, log, log10, nextAfter, sinh, tan, tanh

Add these entries to the vector addressed off the thread pointer. Call
the libc routines directly, which means that we have to implement the
native ABI, not the ART one. For x86_64, that includes saving XMM12-15
as the native ABI considers them caller-save, while the ART ABI
considers them callee-save. We save them by marking them as used by the
call to the math function. For x86, this is not an issue, as all the XMM
registers are caller-save.

Other architectures will call Java as before until they are ready to
implement the new intrinsics.

Bump the OAT version since we are incompatible with old boot.oat files.

Change-Id: Ic6332c3555c09393a17d1ad4daf62932488722fb
Signed-off-by: Mark Mendell <mark.p.mendell@intel.com>
131980fc9aeb2b4d03480443e0fb494c76ce03a2 03-Dec-2015 Vladimir Marko <vmarko@google.com> Add ElfWriter::GetStream().

This will be used for writing the OatHeader which is
currently oddly written through the .text stream.

Also move the error delaying output stream out of the
ElfBuilder<> to its own file and move all output stream
files to compiler/linker/.

Change-Id: I00db4e33ed80ac4757ec459946c7b5ae014a3a2e
10c13565474de2786aad7c2e79757ea250747a15 25-Nov-2015 Vladimir Marko <vmarko@google.com> Refactor oat file writing to give Dex2Oat more control.

This is the first step towards writing dex files to oat file
and mapping them from there for the actual AOT compilation.

Change-Id: Icb0d27487eaf6ba3a66c157e695f9bdc5bb9cf9a
9515b51c6ae1ad9c8b0a9d07334ef62af16cec6a 11-Nov-2015 Yi Kong <yikong@google.com> Fix oat_test

by reducing the DexFileCount test condition from static to dynamically
determined.

Change-Id: I3d97009a1ebfbe3ac9d41f0cdd508db0155660f8
0d5a281c671444bfa75d63caf1427a8c0e6e1177 13-Nov-2015 Roland Levillain <rpl@google.com> x86/x86-64 read barrier support for concurrent GC in Optimizing.

This first implementation uses slow paths to instrument heap
reference loads and GC root loads for the concurrent copying
collector, respectively calling the artReadBarrierSlow and
artReadBarrierForRootSlow (new) runtime entry points.

Notes:
- This implementation does not instrument HInvokeVirtual
nor HInvokeInterface instructions (for class reference
loads), as the corresponding read barriers are not stricly
required with the current concurrent copying collector.
- Intrinsics which may eventually call (on slow path) are
disabled when read barriers are enabled, as the current
slow path infrastructure does not support this case.
- When read barriers are enabled, the code generated for a
HArraySet instruction always go into the array set slow
path for object arrays (delegating the operation to the
runtime), as we are lacking a mechanism to keep a
temporary register live accross a runtime call (needed for
the instrumentation of type checking code, which requires
two successive read barriers).

Bug: 12687968
Change-Id: I14cd6107233c326389120336f93955b28ffbb329
da5b28adf5ba013f0784578a8b97577782e23d95 05-Nov-2015 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Add basic image writer support for app images""

No changes, bug fixed in:
https://android-review.googlesource.com/#/c/180886/

Bug: 22858531

This reverts commit 4b018565e57c3349a3c1b5ec8ac9dae261c5e00b.

Change-Id: I86d9c2b55d535d803c6e1b3b8b4836bf6ff077e5
07ddb6f713f8c919e6da7c4b473cfb3bacb7cf10 05-Nov-2015 Mathieu Chartier <mathieuc@google.com> Fix elf writer to properly handle empty text sections

Previously, empty text sections caused an underflow in the oat file
size.

Added regression test.

Bug: 22858531
Change-Id: I9391a3666ab04e32472a9776d5217fe1743417a9
4b018565e57c3349a3c1b5ec8ac9dae261c5e00b 05-Nov-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "Add basic image writer support for app images"

interpreter and jit tests fail.

Bug: 22858531

This reverts commit c033474cfbfe1e963c07fa5c38aed02e35ed6f91.

Change-Id: Ic12a3e2a1908ac0db52d21a0b44b2508c88b2585
c033474cfbfe1e963c07fa5c38aed02e35ed6f91 02-Nov-2015 Mathieu Chartier <mathieuc@google.com> Add basic image writer support for app images

Needed to handle references from app image -> boot image.

Generate app images for tests to enable some testing.

Bug: 22858531

Change-Id: I1af98b6c4dfcb3a147fb5b0dea64aa4946c7ce57
d1eaf0dc9abc42dbcbbd9c4b98bf930ae5f394f3 29-Oct-2015 Vladimir Marko <vmarko@google.com> Keep list of dex files for oat file in CompilerDriver.

Use this list to improve invoke-static/-direct dispatch for
intra-oat calls.

Also fix a latent ArmBaseRelativePatcher::ReserveSpaceEnd()
bug exposed by a buggy early version of this CL: when we
have unresolved patches at the end of all code, we need to
emit a final thunk. Though the OatWriter will try to patch
the unresolved call to a trampoline at the beginning of the
oat file, that trampoline may be too far and the relative
patcher doesn't know about it anyway, so it needs to assume
that a thunk is needed.

This reduces the overall size of oat files present in dalvik
cache on Nexus 9 after first boot by over 1MiB, AOSP ToT,
aosp_flounder-userdebug build.

Change-Id: I98604b70cb17377eed057c1c23971865cf344e43
35831e8bfa1c0944d4c978d99c4c5b9577945170 11-Sep-2015 Vladimir Marko <vmarko@google.com> Reduce memory used by CompiledMethods.

Use LengthPrefixedArray<>s instead of SwapVector<>s to store
CompiledMethod data and get rid of the unnecessary members
of CompiledMethod to reduce dex2oat memory usage. Refactor
the deduplication from CompilerDriver to a new class.

Use HashSet<> instead of std::set<> for the DedupeSet<> to
further decrease the memory usage and improve performance.

This reduces the dex2oat memory usage when compiling boot
image on Nexus 5 (with Optimizing, -j1) by ~6.75MiB (5%).
This also reduces the compile time by ~2.2% (~1.6% dex2oat
time; with Optimizing, without -j).

Change-Id: I974f1f5e58350de2bf487a2bca3907fa05fb80ea
87000a948524cba7538ccc5438f6a9ecbd4e347e 24-Aug-2015 Calin Juravle <calin@google.com> Add option to append to the cfg dump.

This makes life easier when verifying tests with unresolved classes
(which call dex2oat at rutime).

Change-Id: I7985b2b7c0f343462e03a26b8395297c810b1d95
b1d8c314b55bb2df2b2bb72a3daaf5db65b7ebc7 04-Aug-2015 Igor Murashkin <iam@google.com> Revert "cleanup: Replace pointers with out-parameters and fix-up formatting"

This reverts commit a315f5c546b796f55f4872bb6efc15eb858d9639.

--

Revert "runtime: cleanup class_linker out-parameters and formatting"

This reverts commit bc1d78daa463572c5a770cdca858a3b51d8e1b7b.

--

Revert "base: replace raw pointers for out-parameters with safer out<T>"

This reverts commit fb326cffc679cab8eb873b9e44795706f023cb3c.
a315f5c546b796f55f4872bb6efc15eb858d9639 01-Aug-2015 Igor Murashkin <iam@google.com> cleanup: Replace pointers with out-parameters and fix-up formatting

Cleans all of oat_file.h/.cc, parsed_options.h./cc, runtime.h/.cc

Other files are touched only incidentally to use outof(x) instead of &x.

Change-Id: I0bb15111149d53bb21aac2199ef33bd35333b0ca
1aee900d5a0b3a8d78725a7551356bda0d8554e1 15-Jul-2015 Man Cao <manc@google.com> Add read barrier support to the entrypoints.

Also remove "THIS_LOAD_REQUIRES_READ_BARRIER" since reading
an ArtMethod* no longer needs read barrier.

stub_test should also work with read barriers now.

Change-Id: I3fba18042de2f867a18dbdc38519986212bd9769
90443477f9a0061581c420775ce3b7eeae7468bc 17-Jul-2015 Mathieu Chartier <mathieuc@google.com> Move to newer clang annotations

Also enable -Wthread-safety-negative.

Changes:
Switch to capabilities and negative capabilities.

Future work:
Use capabilities to implement uninterruptible annotations to work
with AssertNoThreadSuspension.

Bug: 20072211

Change-Id: I42fcbe0300d98a831c89d1eff3ecd5a7e99ebf33
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
1cc71ebf333ca323ae0e130fefbce4593e385c10 07-May-2015 Hiroshi Yamauchi <yamauchi@google.com> Insert a read barrier in the JNI bridge.

Bug: 20720510
Bug: 12687968
Change-Id: Ia9edb614853bad45ec25d6e2142361a8bda1eccf
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
70bef0d8f6aa30b0da5c6ca56e1bc5729f74654b 15-Apr-2015 Andreas Gampe <agampe@google.com> ART: Add compiled-methods

Add a dex2oat option for compiled-methods, a more granular filter
than compiled-classes. Add compiler-driver support for it.

Refactor dex2oat to reuse file reading.

Add a test to oat_test.

Change-Id: I78d0d040bce7738b4bb7aabe7768b5788d2587ac
d43b3ac88cd46b8815890188c9c2b9a3f1564648 01-Apr-2015 Mingyao Yang <mingyao@google.com> Revert "Revert "Deoptimization-based bce.""

This reverts commit 0ba627337274ccfb8c9cb9bf23fffb1e1b9d1430.

Change-Id: I1ca10d15bbb49897a0cf541ab160431ec180a006
20f85597828194c12be10d3a927999def066555e 19-Mar-2015 Vladimir Marko <vmarko@google.com> Fixed layout for dex caches in boot image.

Define a fixed layout for dex cache arrays (type, method,
string and field arrays) for dex caches in the boot image.
This gives those arrays fixed offsets from the boot image
code and allows PC-relative addressing of their elements.

Use the PC-relative load on arm64 for relevant instructions,
i.e. invoke-static, invoke-direct, const-string,
const-class, check-cast and instance-of. This reduces the
arm64 boot.oat on Nexus 9 by 1.1MiB.

This CL provides the infrastructure and shows on the arm64
the gains that we can achieve by having fixed dex cache
arrays' layout. To fully use this for the boot images, we
need to implement the PC-relative addressing for other
architectures. To achieve similar gains for apps, we need
to move the dex cache arrays to a .bss section of the oat
file. These changes will be implemented in subsequent CLs.

(Also remove some compiler_driver.h dependencies to reduce
incremental build times.)

Change-Id: Ib1859fa4452d01d983fd92ae22b611f45a85d69b
bb9c6b1c55e9e2308b4f5892a398a8837231fdbd 29-Mar-2015 Andreas Gampe <agampe@google.com> ART: Refactor callbacks_ in common_runtime_test

The callback is now important for some runtime checks, and just
resetting callbacks_ is not correct anymore.

Change-Id: I2cb806f1916fd5ea190911a833ce460be557a428
4585f876eb5dfb936bd0d6cb6acd78a1f2182ba6 28-Mar-2015 Andreas Gampe <agampe@google.com> ART: Some runtime cleanup

Use an enum for the compiler-callback mode.

Refactor and remove some unnecessary includes in runtime.h.

Change-Id: If2245fa470171311b8e05b677cf6bb28f209585a
81c6f8db12b203878a7d72444ead2bc7cf5c47ad 26-Mar-2015 Andreas Gampe <agampe@google.com> ART: PathClassLoader for compiler

Use an actual PathClassLoader when compiling apps, instead of a
side structure and cutout.

This CL sets up a minimal object 'cluster' that recreates the Java
side of a regular ClassLoader such that the Class-Linker will
recognize it and use the internal native fast-path.

This CL removes the now unnecessary compile-time-classpath and
replaces it with a single 'compiling-the-boot-image' flag in the
compiler callbacks.

Note: This functionality is *only* intended for the compiler, as
the objects have not been completely initialized.

Bug: 19781184

Change-Id: I7f36af12dd7852d21281110a25c119e8c0669c1d
e5fed03772144595c0904faf3d6974cc55214c8c 18-Mar-2015 Richard Uhler <ruhler@google.com> Support relative encoded dex locations in oat files.

Now when opening an oat file, the caller can pass an absolute dex
location used to resolve the absolute path for any relative
encoded dex locations in the oat file.

Bug: 19550105
Change-Id: I6e9559afe4d86ac12cf0b90176b5ea696a83d0e7
0ba627337274ccfb8c9cb9bf23fffb1e1b9d1430 24-Mar-2015 Andreas Gampe <agampe@google.com> Revert "Deoptimization-based bce."

This breaks compiling the core image:

Error after BCE: art::SSAChecker: Instruction 219 in block 1 does not dominate use 221 in block 1.

This reverts commit e295e6ec5beaea31be5d7d3c996cd8cfa2053129.

Change-Id: Ieeb48797d451836ed506ccb940872f1443942e4e
e295e6ec5beaea31be5d7d3c996cd8cfa2053129 07-Mar-2015 Mingyao Yang <mingyao@google.com> Deoptimization-based bce.

A mechanism is introduced that a runtime method can be called
from code compiled with optimizing compiler to deoptimize into
interpreter. This can be used to establish invariants in the managed code
If the invariant does not hold at runtime, we will deoptimize and continue
execution in the interpreter. This allows to optimize the managed code as
if the invariant was proven during compile time. However, the exception
will be thrown according to the semantics demanded by the spec.

The invariant and optimization included in this patch are based on the
length of an array. Given a set of array accesses with constant indices
{c1, ..., cn}, we can optimize away all bounds checks iff all 0 <= min(ci) and
max(ci) < array-length. The first can be proven statically. The second can be
established with a deoptimization-based invariant. This replaces n bounds
checks with one invariant check (plus slow-path code).

Change-Id: I8c6e34b56c85d25b91074832d13dba1db0a81569
5bdab12d8b48ca4c395d9d2c506ebff0df01b734 27-Jan-2015 Mathieu Chartier <mathieuc@google.com> Clean up pass driver

Added pass manager to hold the state which used to be in global
variables.

Static variables caused issues with Runtime.exit since they are
destroyed by the global destructors while threads are still
executing.

Bug: 17950037
Change-Id: Ie0e4546dc9e48909c8df996a5c135be682d50044
fbef44de596d298dc6430f482dffc933a046dd28 23-Dec-2014 Richard Uhler <ruhler@google.com> Use unique_ptr to track ownership of dex files.

Bug: 18809837
Change-Id: Ie571eae8fc19ee9207390cff5c7e2a38071b126a
866c03125a3fcd74c9fff04da87865f5eb1767d9 13-Jan-2015 David Brazdil <dbrazdil@google.com> ART: dex2oat flag for HGraphVisualizer dump file

This patch adds a new '--dump-cfg=<file>' flag to dex2oat which
specifies the file that HGraphVisualizer will store its output into.
Until now the graph was dumped to 'art.cfg' in the current working
directory. To make Checker work with run-test, the output directory
needs to be customizable.

Change-Id: I4a940f7708b88deea5a0e51d13aed13e52199349
e21dc3db191df04c100620965bee4617b3b24397 09-Dec-2014 Andreas Gampe <agampe@google.com> ART: Swap-space in the compiler

Introduce a swap-space and corresponding allocator to transparently
switch native allocations to memory backed by a file.

Bug: 18596910

(cherry picked from commit 62746d8d9c4400e4764f162b22bfb1a32be287a9)

Change-Id: I131448f3907115054a592af73db86d2b9257ea33
62746d8d9c4400e4764f162b22bfb1a32be287a9 09-Dec-2014 Andreas Gampe <agampe@google.com> ART: Swap-space in the compiler

Introduce a swap-space and corresponding allocator to transparently
switch native allocations to memory backed by a file.

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

Change-Id: I3bf3250fa866fd2265f1b115d52fa5dedc48a7fc
89ea4176ae89b81702e6a803828de5b95b161393 24-Nov-2014 Mathieu Chartier <mathieuc@google.com> Fix failing tests

Forgot to fix these with other CL.

Change-Id: I5ac158ca0d312b601fbf1e12722fe271751c88f2
957ca1cd025104fccb0b08928f955f9bdb4ab91c 22-Nov-2014 Mathieu Chartier <mathieuc@google.com> Delete ArtMethod gc_map_ field

Moved the gc_map field from OatMethod to OatQuickMethodHeader.
Deleted the ArtMethod gc_map_ field.

Bug: 17643507

Change-Id: Ifa0470c3e4c2f8a319744464d94c6838b76b3d48

(cherry picked from commit 807140048f82a2b87ee5bcf337f23b6a3d1d5269)
85448d4b9c0720049a7ee4afa331870e87d83995 11-Nov-2014 Andreas Gampe <agampe@google.com> ART: Compiled-classes list for compiler-driver

Similar to the image-classes list, introduce a list of class names
that are to be compiled when creating a boot image. This defaults
to all classes.

Bug: 18336591

(cherry picked from commit 26318f722958ac1cba6a812026a1377f37c54941)

Change-Id: I95f69afdb500a9defb6795803d4040bbe67c5a01
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
4bf3ae9930a155f238dfd471413c866912b2579e 11-Nov-2014 Andreas Gampe <agampe@google.com> ART: Compiled-classes list for compiler-driver

Similar to the image-classes list, introduce a list of class names
that are to be compiled when creating a boot image. This defaults
to all classes.

Bug: 18336591

(cherry picked from commit 26318f722958ac1cba6a812026a1377f37c54941)

Change-Id: I95f69afdb500a9defb6795803d4040bbe67c5a01
26318f722958ac1cba6a812026a1377f37c54941 11-Nov-2014 Andreas Gampe <agampe@google.com> ART: Compiled-classes list for compiler-driver

Similar to the image-classes list, introduce a list of class names
that are to be compiled when creating a boot image. This defaults
to all classes.

Bug: 18336591
Change-Id: I95f69afdb500a9defb6795803d4040bbe67c5a01
48447025389cd67605041a28d4ded1528381bc4e 22-Oct-2014 Igor Murashkin <iam@google.com> ART: Add support for patching and loading OAT files compiled with PIC

* Images (.art) compiled with pic now have a new field added.
* isDexOptNeeded will now skip patch-ing for apps compiled PIC
* First-boot patching now only copies boot.art, boot.oat is linked

As a result, all system preopted dex files (with --compile-pic) no
longer take up any space in /data/dalvik-cache/<isa>.

(cherry-picked from AOSP master
46774767fcf7780d1455e755729198648d08742e)

Conflicts (from aosp master):
compiler/image_test.cc
compiler/image_writer.cc
compiler/image_writer.h
compiler/oat_test.cc
dex2oat/dex2oat.cc
oatdump/oatdump.cc
runtime/elf_file.cc
runtime/elf_file.h
runtime/elf_file_impl.h
runtime/oat_file.cc
runtime/oat_file.h

Bug: 18035729

(cherry picked from commit 90ca5c0301651101de0e363842e5d08ae65233f7)

Change-Id: I8d99f95cc3d1fa221fc530ebb1fcc4b3263c183d
277ccbd200ea43590dfc06a93ae184a765327ad0 04-Nov-2014 Andreas Gampe <agampe@google.com> ART: More warnings

Enable -Wno-conversion-null, -Wredundant-decls and -Wshadow in general,
and -Wunused-but-set-parameter for GCC builds.

Change-Id: I81bbdd762213444673c65d85edae594a523836e5
90ca5c0301651101de0e363842e5d08ae65233f7 22-Oct-2014 Igor Murashkin <iam@google.com> ART: Add support for patching and loading OAT files compiled with PIC

* Images (.art) compiled with pic now have a new field added.
* isDexOptNeeded will now skip patch-ing for apps compiled PIC
* First-boot patching now only copies boot.art, boot.oat is linked

As a result, all system preopted dex files (with --compile-pic) no
longer take up any space in /data/dalvik-cache/<isa>.

(cherry-picked from AOSP master
46774767fcf7780d1455e755729198648d08742e)

Conflicts (from aosp master):
compiler/image_test.cc
compiler/image_writer.cc
compiler/image_writer.h
compiler/oat_test.cc
dex2oat/dex2oat.cc
oatdump/oatdump.cc
runtime/elf_file.cc
runtime/elf_file.h
runtime/elf_file_impl.h
runtime/oat_file.cc
runtime/oat_file.h

Bug: 18035729
Change-Id: Ie1acad81a0fd8b2f24e1f3f07a06e6fdb548be62
46774767fcf7780d1455e755729198648d08742e 22-Oct-2014 Igor Murashkin <iam@google.com> ART: Add support for patching and loading OAT files compiled with PIC

* Images (.art) compiled with pic now have a new field added.
* isDexOptNeeded will now skip patch-ing for apps compiled PIC
* First-boot patching now only copies boot.art, boot.oat is linked

As a result, all system preopted dex files (with --compile-pic) no
longer take up any space in /data/dalvik-cache/<isa>.

Bug: 18035729
Change-Id: Ie1acad81a0fd8b2f24e1f3f07a06e6fdb548be62
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
d4c4d953035d4418126d36517e402f411d6a87f3 17-Oct-2014 Ian Rogers <irogers@google.com> Some code clean-up.

Change-Id: I4b745fd5298cd61c793e3b57514b48347bd66c0e
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
13735955f39b3b304c37d2b2840663c131262c18 08-Oct-2014 Ian Rogers <irogers@google.com> stdint types all the way!

Change-Id: I4e4ef3a2002fc59ebd9097087f150eaf3f2a7e08
f4da675bbc4615c5f854c81964cac9dd1153baea 01-Aug-2014 Vladimir Marko <vmarko@google.com> Implement method calls using relative BL on ARM.

Store the linker patches with each CompiledMethod instead of
keeping them in CompilerDriver. Reorganize oat file creation
to apply the patches as we're writing the method code. Add
framework for platform-specific relative call patches in the
OatWriter. Implement relative call patches for ARM.

Change-Id: Ie2effb3d92b61ac8f356140eba09dc37d62290f8
928f72bd75c385ba2708c58521171a77264d4486 10-Sep-2014 Andreas Gampe <agampe@google.com> ART: Fix things for valgrind

Wire up valgrind gtests. Add valgrind-test-art-host, currently
only depending on valgrind-test-art-host-gtest32.

Fix an Alloc setting to allow running valgrind.

Refactor the fault handler to manage (and correctly release) the
handlers.

Fix minor failure-case leaks exposed by tests.

Failing tests:

The optimizing compiler is leaking non-arena-ed structures
(e.g., assembler buffers), as code generators are not destroyed.
The solution has been moved to a follow-up CL.

Note: All 64b tests are failing as we cannot allocate a heap.

Change-Id: I7f854cfd098d9f68107ce492363e7dba9a82b9fa
37f05ef45e0393de812d51261dc293240c17294d 17-Jul-2014 Fred Shih <ffred@google.com> Reduced memory usage of primitive fields smaller than 4-bytes

Reduced memory used by byte and boolean fields from 4 bytes down to a
single byte and shorts and chars down to two bytes. Fields are now
arranged as Reference followed by decreasing component sizes, with
fields shuffled forward as needed.

Bug: 8135266
Change-Id: I65eaf31ed27e5bd5ba0c7d4606454b720b074752
53c913bb71b218714823c8c87a1f92830c336f61 13-Aug-2014 Andreas Gampe <agampe@google.com> ART: Clean up compiler

Clean up the compiler: less extern functions, dis-entangle
compilers, hide some compiler specifics, lower global includes.

Change-Id: Ibaf88d02505d86994d7845cf0075be5041cc8438
a59dd80f9f48cb750d329d4d4af2d99d72b484d1 03-Jul-2014 Alex Light <allight@google.com> Runtime can now be set to require relocation

Add a pair of runtime flags -Xrelocate and -Xnorelocate that can force
the runtime to require that all files that are run are relocated, to
prevent attacks based on the known art base address.

Add support for running patchoat on oat files compiled without an image.

Change run-test to have new --prebuild and --relocate flags.

Bug: 15358152

Change-Id: I91166c62dd1ab80e5cbcb7883a2cd0d56afca32d
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
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
d9cb8ae2ed78f957a773af61759432d7a7bf78af 09-Jul-2014 Douglas Leung <douglas@mips.com> Fix art test failures for Mips.

This patch fixes the following art test failures for Mips:
003-omnibus-opcodes
030-bad-finalizer
041-narrowing
059-finalizer-throw

Change-Id: I4e0e9ff75f949c92059dd6b8d579450dc15f4467
Signed-off-by: Douglas Leung <douglas@mips.com>
e63db27db913f1a88e2095a1ee8239b2bb9124e8 16-Jul-2014 Ian Rogers <irogers@google.com> Break apart header files.

Create libart-gtest for common runtime and compiler gtest routines.
Rename CompilerCallbacksImpl that is quick compiler specific.
Rename trace clock source constants to not use the overloaded profiler term.

Change-Id: I4aac4bdc7e7850c68335f81e59a390133b54e933
22f8e5c82d12951be38cd893426e13bee33fd69d 09-Jul-2014 Andreas Gampe <agampe@google.com> Revert "Revert "ART: Key-Value Store in Oat header""

This reverts commit 452bee5da9811f62123978e142bd67b385e9ff82.

Heap-allocate a couple of objects in dex2oat to avoid large frame
size.

Includes fixes originally in 100596 and 100605.

Change-Id: Id51a44198c973c91f0a3f87b9d992a5dc110c6f8
c87d27b25994da8670d82a8f7bad6327b693bfff 27-Jun-2014 Andreas Gampe <agampe@google.com> ART: Key-Value Store in Oat header

Allows the storage of string-string pairs in the oat header. The
first significant use of this is storing the implicit-check flags,
so that an oat file can be rejected if it doesn't agree with the
current runtime.

Bump the oat version as the header structure changes.

Change-Id: I15a1c16886e6b8fa7b881c918c19c1efa5c7c00f
452bee5da9811f62123978e142bd67b385e9ff82 09-Jul-2014 Nicolas Geoffray <ngeoffray@google.com> Revert "ART: Key-Value Store in Oat header"

Broke arm64 build.

This reverts commit c87d27b25994da8670d82a8f7bad6327b693bfff.

Change-Id: I4c2ade295d2b5aa77fc3ad810e0e859629a5bf09
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
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
ffddfdf6fec0b9d98a692e27242eecb15af5ead2 03-Jun-2014 Tim Murray <timmurray@google.com> DO NOT MERGE

Merge ART from AOSP to lmp-preview-dev.

Change-Id: I0f578733a4b8756fd780d4a052ad69b746f687a9
055c29fd0f752328981f1b7ccadb1862eecedd40 27-May-2014 buzbee <buzbee@google.com> Art compiler: remove unnecessary sqrt call

For reasons lost in the mists of time, the Dalvik JIT tested
the results of an inlined sqrt for NaN on Arm targets, and then
called an out-of-line routine to recompute if true. The Quick
compiler inherited this behavior. It is not necessary, and the CL
purges it (along with the out-of-line sqrt entrypoint).

Change-Id: I8c8fa6feacf9b7c3b9e190dfc6f728932fd948c6
0cd81352a7c06e381951cea1b104fd73516f4341 23-May-2014 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Fix an outstanding compaction bug in interpreter.""

Fixed the generic trampoline to not use ToJObject when unnecessary.

Bug: 15167269

This reverts commit 3bdb873122964da7937eb070cbcf2ef638a8e459.

Change-Id: I0525d0e0f3afb753c770e1572070a0fa22b02271
3bdb873122964da7937eb070cbcf2ef638a8e459 23-May-2014 Mathieu Chartier <mathieuc@google.com> Revert "Fix an outstanding compaction bug in interpreter."

This reverts commit e09ae0920be57760fb390b6944bce420fa0b5582.

Change-Id: I48036306130d5ccfec683d0dc3e9a642a02ee9c1
e09ae0920be57760fb390b6944bce420fa0b5582 15-May-2014 Mathieu Chartier <mathieuc@google.com> Fix an outstanding compaction bug in interpreter.

Fixed a bug in DoFieldPut where the FieldHelper GetType could cause
thread suspension which would result in a stale obj.

Added more handles in the class linker to facilitate moving fiels
and methods in the future.

Removed un-necessarly passing handle references since these are value
types and don't need to be passed by reference.

Added a special NullHandle type which allows null handles without a
handle scope.

Change-Id: I1b51723920a2e4f4f8b2907066f578a3e879fd5b
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
a2eca52f55e545c6f90807ce8bbf778495c4a6f6 15-May-2014 Andreas Gampe <agampe@google.com> ART: Fix oat_test for 64b

The QuickEntryPoints structure has a size dependent on the pointer
size.

Change-Id: I369353200430a6ccaccded7589105312fd411b97
eb8167a4f4d27fce0530f6724ab8032610cd146b 08-May-2014 Mathieu Chartier <mathieuc@google.com> Add Handle/HandleScope and delete SirtRef.

Delete SirtRef and replaced it with Handle. Handles are value types
which wrap around StackReference*.

Renamed StackIndirectReferenceTable to HandleScope.

Added a scoped handle wrapper which wraps around an Object** and
restores it in its destructor.

Renamed Handle::get -> Get.

Bug: 8473721

Change-Id: Idbfebd4f35af629f0f43931b7c5184b334822c7a
7624d25dad2d1ba25969ae704fccf68649103ae5 02-May-2014 Vladimir Marko <vmarko@google.com> Move quick frame info to OatQuickMethodHeader.

Rename OatMethodHeader to OatQuickMethodHeader, move frame
info from OatMethodOffsets to OatQuickMethodHeader. Retrieve
the info from other places for non-quick methods (portable
compiled bytecode or jni stub, generic jni, runtime,
abstract and proxy).

This change has a libcore/ companion CL
"Remove ArtMethod's quick fields for frame size and spills."
https://android-review.googlesource.com/94164

Bug: 11767815
Change-Id: I0e31a7875d76732e1ec479c86b9b5ca01203507f
8a630577ed2d9e9571c3434c505e5de223b23c07 09-Apr-2014 Vladimir Marko <vmarko@google.com> Move mapping table and vmap table offsets to OatMethodHeader.

This change has a libcore/ companion CL
"Remove ArtMethod's quick fields mapping table and vmap table."
https://android-review.googlesource.com/91254

Bug: 11767815
Change-Id: I46ce2067e1ecd915da3890606498e31ffc332813
d3c5bebcb52a67cb06e7ab303eaf45f230c08b60 11-Apr-2014 Vladimir Marko <vmarko@google.com> Avoid allocating OatFile::OatClass on the heap.

Avoid allocating a BitVector for OatFile::OatClass::bitmap_
with kOatClassSomeCompiled methods. That makes the OatClass
copy-constructible as it doesn't own any memory. We use that
in OatFile::OatDexFile::GetOatClass() to return the result
by value thus avoiding one or two heap allocations per call.

Change-Id: Ic7098109028a5b49e39ef626f877de86e732ed18
b34f69ab43aaf7a6e6045c95f398baf566ef5023 07-Mar-2014 Nicolas Geoffray <ngeoffray@google.com> Add command line support for enabling the optimizing compiler.

Also run tests with the optimizing compiler enabled when
the file art/USE_OPTIMIZING_COMPILER is present.

Change-Id: Ibc33eed62a43547bc3b9fe786d014c0d81b5add8
2da882315a61072664f7ce3c212307342e907207 27-Feb-2014 Andreas Gampe <agampe@google.com> Initial changes towards Generic JNI option

Some initial changes that lead to an UNIMPLEMENTED. Works
by not compiling for JNI right now and tracking native methods
which have neither quick nor portable code. Uses new trampoline.

Change-Id: I5448654044eb2717752fd7359f4ef8bd5c17be6e
3d504075f7c1204d581923460754bf6d3714b13f 01-Mar-2014 Ian Rogers <irogers@google.com> Make out arguments non-reference types.

Also, tidy some portable related code.

Change-Id: I67c8aa52eef8b556ca117ecda1b1e75465ba06a5
a1ce1fef2d49d1d537776a5308ace7102a815fe5 25-Feb-2014 Brian Carlstrom <bdc@google.com> Split up CommonTest into CommonRuntimeTest and CommonCompilerTest

Change-Id: I8dcf6b29a5aecd445f1a3ddb06386cf81dbc9c70
9837939678bb5dcba178e5fb00ed59b5d14c8d9b 25-Feb-2014 Ian Rogers <irogers@google.com> Avoid std::string allocations for finding an array class.

Introduce ClassLinker::FindArrayClass which performs an array class lookup
given the element/component class. This has a 16 element cache of recently
looked up arrays.
Pass the current thread to ClassLinker Find .. Class routines to avoid calls
to Thread::Current().
Avoid some uses of FindClass in the debugger where WellKnownClasses is a
faster and more compacting GC friendly alternative.

Change-Id: I60e231820b349543a7edb3ceb9cf1ce92db3c843
6449c62e40ef3a9bb75f664f922555affb532ee4 11-Feb-2014 Brian Carlstrom <bdc@google.com> Create CompilerOptions

Package up most compiler related options in CompilerOptions. Details include:
- Includes compiler filter, method thresholds, SEA IR mode.
- Excludes those needed during Runtime::Init such as CompilerCallbacks and VerificationResults.
- Pass CompilerOptions to CompilerDriver.
- Remove CompilerOptions from Runtime.
- Add ability to pass options for app and image dex2oat to runtime via
-Xcompiler-option and -Ximage-compiler-option respectively.

Other
- Replace 2x CompilerCallbacks implementations with one.
- Factor out execv code for use by both image and oat generation.
- More OatFile error_msg reporting.
- DCHECK for SuspendAll found trying to run valgrind.

Change-Id: Iecb57da907be0c856d00c3cd634b5042a229e620
f5df8974173124faddb8e2b6a331959afdb94fdf 14-Feb-2014 Nicolas Geoffray <ngeoffray@google.com> Rewrite the compiler interface for CompilerDriver.

Change-Id: I15fa9afe7ffb7283ebda8d788a1e02793e3f75a6
ea3fa0b4ba13d7bd7f7c1cd85202ccbe141a35ae 10-Feb-2014 Nicolas Geoffray <ngeoffray@google.com> Re-apply: Implement cumulative timings for CompilerDriver.

The bug was due to how the test infrastructure works:
a compiler driver surives the stack where it is allocated.

Change-Id: I345fe0e4afb2bd15937233db8afb350f09429558
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
c7f832061fea59fd6abd125f26c8ca1faec695a5 24-Jan-2014 Vladimir Marko <vmarko@google.com> Refactor verification results.

Rename VerificationMethodsData to VerificationResults.
Create new class VerifiedMethod to hold all the data for
a given method.

Change-Id: Ife1ac67cede20f3a2f9c7f5345f08a851cf1ed20
650be76eb3c38ff905ec1d9675d73e5cb9a82dac 20-Jan-2014 Brian Carlstrom <bdc@google.com> Revert "Implement cumulative timings for CompilerDriver."

This reverts commit df013175d1aa04641e5c6175f8c786e547d31654.
df013175d1aa04641e5c6175f8c786e547d31654 13-Jan-2014 Nicolas Geoffray <ngeoffray@google.com> Implement cumulative timings for CompilerDriver.

Change-Id: I3b04de7f2717273f356b8120f68d69e2379bab2f
95a4de734c2d90481af9938e0759717895fdcc59 18-Dec-2013 Vladimir Marko <vmarko@google.com> Fix test-art setup.

Change-Id: I5762bd10d0bb8346541346b3d5711200a0208c4f
102a8f27cc8d719f4bf58aa294475112c1ae66b9 18-Dec-2013 Sebastien Hertz <shertz@google.com> Fix build - test issues.

Fix compilation errors in tests.

Change-Id: Id2405edc2eec5bef9ebf5f241db03a0bb4a6b5a3
ca368cb576cf6a436a32c357fca51fbb3082d7a9 16-Nov-2013 Ian Rogers <irogers@google.com> Break apart oat writing times.

Change-Id: I11045e29dc58ed1efbd19070ec1dcafc1044c95a
5fe9af720048673e62ee29597a30bb9e54c903c5 14-Nov-2013 Ian Rogers <irogers@google.com> Fix memory leaks relating to timing logger.

Bug: 11670287.
We use pointers to uninitialized values for control-flow in the timing logger
code, add TODO comments to clean this up later.
Remove base namespace and other bits of tidying.

Change-Id: I1e6600a1e92f974c8f58f3a405a4e4abb4d9f80f
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
88474b416eb257078e590bf9bc7957cee604a186 24-Oct-2013 Jeff Hao <jeffhao@google.com> Implement Interface Method Tables (IMT).

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

Change-Id: If0d290f4aebc778ff12d8fed017c270ad2ac3220
8d31bbd3d6536de12bc20e3d29cfe03fe848f9da 13-Oct-2013 Ian Rogers <irogers@google.com> Throw IOException at source of failing to open a dex file.

Before is:
java.lang.ClassNotFoundException: Didn't find class "GCBench" on path: DexPathList[[zip file "/disk2/dalvik-dev/out/host/linux-x86/framework/GCBench.jar"],nativeLibraryDirectories=[/disk2/dalvik-dev/out/host/linux-x86/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
Suppressed: java.lang.ClassNotFoundException: GCBench
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 1 more
Caused by: java.lang.NoClassDefFoundError: Class "LGCBench;" not found
... 5 more
And after is:
java.lang.ClassNotFoundException: Didn't find class "GCBench" on path: DexPathList[[zip file "/disk2/dalvik-dev/out/host/linux-x86/framework/GCBench.jar"],nativeLibraryDirectories=[/disk2/dalvik-dev/out/host/linux-x86/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
Suppressed: java.io.IOException: Zip archive '/disk2/dalvik-dev/out/host/linux-x86/framework/GCBench.jar' doesn't contain classes.dex
at dalvik.system.DexFile.openDexFile(Native Method)
at dalvik.system.DexFile.<init>(DexFile.java:80)
at dalvik.system.DexFile.<init>(DexFile.java:59)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:268)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:235)
at dalvik.system.DexPathList.<init>(DexPathList.java:113)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:48)
at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:38)
at java.lang.ClassLoader.createSystemClassLoader(ClassLoader.java:128)
at java.lang.ClassLoader.access$000(ClassLoader.java:65)
at java.lang.ClassLoader$SystemClassLoader.<clinit>(ClassLoader.java:81)
at java.lang.ClassLoader.getSystemClassLoader(ClassLoader.java:137)
Suppressed: java.lang.ClassNotFoundException: GCBench
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 1 more
Caused by: java.lang.NoClassDefFoundError: Class "LGCBench;" not found
... 5 more

Also, move dex file verifier messages out of logs.
In the process the ClassLinker::dex_lock_ needed tidying to cover a smaller
scope. Bug 11301553.

Change-Id: I80058652e11e7ea63457cc01a0cb48afe1c15543
756ee4e090bc1e1812b41fb7b4661df601a32ef9 04-Oct-2013 Brian Carlstrom <bdc@google.com> Find OatDexFile by DexFile name and checksum, not just checksum

Bug: 10614658
Change-Id: Ie0b5a34fd396b6299000c37909108c5e7e6ab80f
919b11c3edbc9aacff979cb5e702ae40f10615ae 30-Aug-2013 Brian Carlstrom <bdc@google.com> Remove conscrypt dependency from CommonTest

Bug: 10092469
Change-Id: I0c5dc72625ca4b5083ef3137d40334127bde8252
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