History log of /art/patchoat/
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
f0e3a368c80b7d32e2f85ffa948751525a9f903b 05-Jun-2018 David Srbecky <dsrbecky@google.com> Add check to CheckImageIdenticalToOriginalExceptForRelocation

Add defensive check which fails gracefully if the
relocation offset is larger than the image size.

Add tests.

(cherry picked from commit b16e4a3c7563f83df0d6fd10c0aa4f1d36be8079)

Fix patchoat_test for heap poisoning

The test was disabled for heap poisoning; keep it disabled.

The TEST_DISABLED_FOR_HEAP_POISONING macro is in fact just
a conditional return, and I didn't account for it properly.

(cherry picked from commit 23ae5322a4e53d0fbe3ea514ec1a6941de472067)

Bug: 109677607
Test: test-art-host-gtest-patchoat_test SANITIZE_HOST=address
Test: test-art-host-gtest-patchoat_test ART_HEAP_POISONING=true

Merged-In: Ic989d5b7c77fd66e77b9e8ba90df1bf490a46e43
Merged-In: I40266d0a06102e4d8bc52357b884b0e7d9fd2630
Change-Id: If2c83bee3c19eb9d53154d35fcaf0b3edf152872
atchoat.cc
atchoat_test.cc
4bcde15734613057d8343742b59d0aaae4e133a7 09-Mar-2018 Andreas Gampe <agampe@google.com> ART: Make patchoat more resistant

Disable relocation, disallow dex-file fallback. These are unwelcome
when patching.

Refactor to have one set of options.

(cherry picked from commit c7d25083a51e73bef66f15198f84767de84beb0f)

Bug: 73887870
Test: m test-art-host
Test: Flash-wipe device, boot
Merged-In: Ic7698cb83d1a8b4bb318af472f388dc88981c49c
Change-Id: Ic7698cb83d1a8b4bb318af472f388dc88981c49c
atchoat.cc
8f4b056427a9d2321e3aa4f21ca8ffb18b3e5ae6 02-Mar-2018 David Sehr <sehr@google.com> Move most of runtime/base to libartbase/base

Enforce the layering that code in runtime/base should not depend on
runtime by separating it into libartbase. Some of the code in
runtime/base depends on the Runtime class, so it cannot be moved yet.
Also, some of the tests depend on CommonRuntimeTest, which itself needs
to be factored (in a subsequent CL).

Bug: 22322814
Test: make -j 50 checkbuild
make -j 50 test-art-host

Change-Id: I8b096c1e2542f829eb456b4b057c71421b77d7e2
Merged-In: c431b9dc4b23cc950eb313695258df5d89f53b22

(cherry picked from commit c431b9dc4b23cc950eb313695258df5d89f53b22)
atchoat.cc
atchoat.h
67bf42e89592c3a1c648f927f2ce3ccb189a1161 27-Feb-2018 David Sehr <sehr@google.com> Header library to remove dependence on runtime/

Add a new header library to remove libdexfile and others' dependence on
runtime (typically runtime/base) includes in libdexfile. Also a small step
to tease dexlayout and profman away from relying on these as well.

Bug: 22322814
Test: make -j 50 checkbuild
make -j 50 test-art-host-gtest

Change-Id: I38e2fe399a75f4bc6318c77a71954c00ea73ec2b
atchoat.cc
atchoat_test.cc
88c6d26dd8686bdb366d54937a505f10f3bf1cd8 14-Feb-2018 Chris Morin <cmtm@google.com> patchoat: take directories instead of filenames

patchoat was already ignoring the basename part of the filename passed
to it for both --output-image-file and --output-image-relocation-file.
We can therefore just pass in the directories instead.

Bug: 72828459
Test: make test-art-host-gtest-patchoat_test
Change-Id: I1a699d1f6746f068078ae768d30690431578d84e
atchoat.cc
atchoat_test.cc
ae6832f12bbbe00d79a8ea82a16584c562fb3f8b 10-Feb-2018 Chris Morin <cmtm@google.com> Have patchoat --verify verify symlinks

patchoat --verify now verifies that the vdex and oat symlinks in
/data/dalvik-cache point to the correct vdex and oat files in /system/.
This is to protect attacks that would change the symlink targets.
Refactoring of patchoat code was done too.

Bug: 66697305
Test: make test-art-host-gtest-patchoat_test
Test: remove a symlink and ensure patchoat verification fails
Test: modify a symlink and ensure patchoat verification fails
Change-Id: I18e8f9f6363cf18ad8fa879aeb4d8c7badf679a7
atchoat.cc
atchoat.h
b348b3b28469d6afe720a202d1a8d23e7345c4ff 26-Jan-2018 Orion Hodson <oth@google.com> ART: patchoat compilation fix for mac sdk

Updates format strings for int64_t value.

Bug: 66697305
Test: m -j32
Change-Id: Icc460724264acacdbdadb691a17f187813877412
atchoat.cc
754b7575e65f0e0cc8b080b268378daf54881c65 20-Jan-2018 Chris Morin <cmtm@google.com> patchoat: add ability to verify relocated .art files

Patchoat can verify that a relocated .art file hasn't been modified
after generation using the --verify flag.

Test: adb shell /system/bin/patchoat --verify \
--input-image-location=/system/framework/boot.art \
--output-image-file=/data/dalvik-cache/arm64/system@framework@boot.art \
--instruction-set=arm64
Bug: 66697305

Change-Id: If6ea02a0527381c520078cd6f3ae2c275a8a8ab1
atchoat.cc
atchoat.h
atchoat_test.cc
3856af0d6e09525a4e774bec729dd781a72d5549 23-Oct-2017 Alex Klyubin <klyubin@google.com> Reland: Enable patchoat to write image relocation files

This adds an off by default feature to patchoat whereby it can write
image relocation information (i.e., which offsets are patched up by
patchoat) to .rel files. .rel file writing is enabled by specifying
the name of boot.art.rel file using command-line parameter
--output-image-relocation-file=...

The currently intended use case is to make the Android build process
store these files on the system image next to boot*.art files. At boot
time, in follow-up commits, these .rel files will then be used to
verify that all differences between /system boot*.art and
/data/dalvik-cache boot*.art files can be explained by relocation. The
goal is to mitigate /data/dalvik-cache boot*.art being a persistence
vector.

Test: ./art/test/testrunner/run_build_test_target.py art-gtest-debug-gc
Test: make test-art-host-gtest-patchoat_test
Test: ART_HEAP_POISONING=true make test-art-host-gtest-patchoat_test
Test: make test-art-target-gtest-patchoat_test
Test: ANDROID_ROOT=out/target/product/sailfish/system \
ANDROID_DATA=out/target/product/sailfish/dex_bootjars/system/framework/arm64/ \
out/host/linux-x86/bin/patchoat \
--input-image-location=<full path to>/out/target/product/sailfish/dex_bootjars/system/framework/boot.art \
--output-image-file=out/target/product/sailfish/dex_bootjars/system/framework/arm64/boot.art \
--instruction-set=arm64 --base-offset-delta=0x10000000
produces same boot*.art files as prior to this change
Test: ANDROID_ROOT=out/target/product/sailfish/system \
ANDROID_DATA=out/target/product/sailfish/dex_bootjars/system/framework/arm64/ \
out/host/linux-x86/bin/patchoat \
--input-image-location=<full path to>/out/target/product/sailfish/dex_bootjars/system/framework/boot.art \
--output-image-relocation-file=out/target/product/sailfish/dex_bootjars/system/framework/arm64/boot.art.rel \
--instruction-set=arm64 --base-offset-delta=0x10000000
produces no boot*.art files, but produces expected boot.art.rel files
Bug: 66697305

Change-Id: Ia6b548c61429c61a62706d4021f8e6f22c49082e
ndroid.bp
atchoat.cc
atchoat.h
atchoat_test.cc
24e4f73f21c098e6fdffc5fc28fd3d185f94c27d 11-Jan-2018 Mathieu Chartier <mathieuc@google.com> Revert "Enable patchoat to write image relocation files"

This reverts commit fbe5f2f85244bf57707afb5520b2f9aa189d9d55.

Test is failing very often on the buildbots.

Bug: 66697305

Change-Id: I9be7471b1c988bdddeca732c39b9323125e4384d
ndroid.bp
atchoat.cc
atchoat.h
atchoat_test.cc
fbe5f2f85244bf57707afb5520b2f9aa189d9d55 23-Oct-2017 Alex Klyubin <klyubin@google.com> Enable patchoat to write image relocation files

This adds an off by default feature to patchoat whereby it can write
image relocation information (i.e., which offsets are patched up by
patchoat) to .rel files. .rel file writing is enabled by specifying
the name of boot.art.rel file using command-line parameter
--output-image-relocation-file=...

The currently intended use case is to make the Android build process
store these files on the system image next to boot*.art files. At boot
time, in follow-up commits, these .rel files will then be used to
verify that all differences between /system boot*.art and
/data/dalvik-cache boot*.art files can be explained by relocation. The
goal is to mitigate /data/dalvik-cache boot*.art being a persistence
vector.

Test: ./art/test/testrunner/run_build_test_target.py art-gtest-debug-gc
Test: make test-art-host-gtest-patchoat_test
Test: make test-art-target-gtest-patchoat_test
Test: ANDROID_ROOT=out/target/product/sailfish/system \
ANDROID_DATA=out/target/product/sailfish/dex_bootjars/system/framework/arm64/ \
out/host/linux-x86/bin/patchoat \
--input-image-location=<full path to>/out/target/product/sailfish/dex_bootjars/system/framework/boot.art \
--output-image-file=out/target/product/sailfish/dex_bootjars/system/framework/arm64/boot.art \
--instruction-set=arm64 --base-offset-delta=0x10000000
produces same boot*.art files as prior to this change
Test: ANDROID_ROOT=out/target/product/sailfish/system \
ANDROID_DATA=out/target/product/sailfish/dex_bootjars/system/framework/arm64/ \
out/host/linux-x86/bin/patchoat \
--input-image-location=<full path to>/out/target/product/sailfish/dex_bootjars/system/framework/boot.art \
--output-image-relocation-file=out/target/product/sailfish/dex_bootjars/system/framework/arm64/boot.art.rel \
--instruction-set=arm64 --base-offset-delta=0x10000000
produces no boot*.art files, but produces expected boot.art.rel files
Bug: 66697305
Change-Id: If18814f03dba3d72ae15981625473f4da303b1d6
ndroid.bp
atchoat.cc
atchoat.h
atchoat_test.cc
a46e50b87508a87264b04bf526f86fa93e2d8c30 19-Dec-2017 Alex Klyubin <klyubin@google.com> Test all .art files in patchoat test

This augments the patchoat test to check all .art files produced by
dex2oat and patchoat, rather than just the main one -- boot.art.
For context, the test currently produces two .art files: boot.art and
boot-core-libart-hostdex.art.

Test: ./art/test/testrunner/run_build_test_target.py art-gtest-debug-gc
Test: make test-art-host-gtest-patchoat_test
Test: make test-art-target-gtest-patchoat_test
Bug: 66697305
Change-Id: I8a90e70811ac8b98a7c2de5bfe6a388ca884e259
atchoat_test.cc
d1d5c95f5ae38ca194c251914da82371e0192b60 15-Dec-2017 Alex Klyubin <klyubin@google.com> Revert^4 "Add patchoat test"

This reverts commit 1fb8d5ee6c7f03269cf08b18a0af5b4e25924a27.

Skip the patchoat test on the build server where the build is not
using read barriers. Read barriers (or CMS/MS garbage collector) are
required for the --force-determinism feature used by the test.

Test: ./art/test/testrunner/run_build_test_target.py art-gtest-debug-gc
Test: make test-art-host-gtest-patchoat_test
Test: make test-art-target-gtest-patchoat_test
Bug: 66697305
Change-Id: I99da0111ca0e34d32473dfe721b7a2f49289e850
ndroid.bp
atchoat_test.cc
1fb8d5ee6c7f03269cf08b18a0af5b4e25924a27 14-Dec-2017 Alex Klyubin <klyubin@google.com> Revert "Revert "Revert "Add patchoat test"""

This reverts commit 203010a86542b16991ede122085b07eea6c55bec.

Reason for revert: This test is breaking on a build server -- no idea why as no output can be seen.

Change-Id: Ibb93d84e673c45e13ba81b1f045eb7c8d31494fd
ndroid.bp
atchoat_test.cc
203010a86542b16991ede122085b07eea6c55bec 13-Dec-2017 Alex Klyubin <klyubin@google.com> Revert "Revert "Add patchoat test""

This reverts commit 5dd08acd0b568bb05e2e75fc02d8a6d3d7aa6f8e.

This attempt removes any remaining non-determinism, by passing in
--force-determinism to dex2oat in the test. As a result, the test
now passes both host-side and device-side.

Test: make test-art-host-gtest-patchoat_test
Test: make test-art-target-gtest-patchoat_test
Bug: 66697305
Change-Id: I8192ced68cec9f270b004488eb264f429bf7ab60
ndroid.bp
atchoat_test.cc
bc96fc6e2d8dd02e9b085b1c7ec03c3f01982816 12-Dec-2017 Nicolas Geoffray <ngeoffray@google.com> Merge "Revert "Add patchoat test""
5dd08acd0b568bb05e2e75fc02d8a6d3d7aa6f8e 12-Dec-2017 Nicolas Geoffray <ngeoffray@google.com> Revert "Add patchoat test"

Bug: 66697305

Fails on device

This reverts commit 14e895ed419fcb67c16be1387d248a4e973cf940.

Change-Id: Id817d738be32f44c5dfc97d2646b0090824dc404
ndroid.bp
atchoat_test.cc
ce61d757e8cef76f0027eeda1ea2a7ac1be432b0 12-Dec-2017 Treehugger Robot <treehugger-gerrit@google.com> Merge "Add patchoat test"
14e895ed419fcb67c16be1387d248a4e973cf940 22-Nov-2017 Alex Klyubin <klyubin@google.com> Add patchoat test

The test checks that relocating an image using dex2oat and patchoat
yields the same ART file, except for OAT checksum and patch offset
delta.

Test: make test-art-host-gtest-patchoat_test
Bug: 66697305
Change-Id: I80f8b996bc8fc88ef798dceac9fd9ecd629045a3
ndroid.bp
atchoat_test.cc
170331f0e44a0e07fcfe0b5932517e0500f5cd1f 08-Dec-2017 Andreas Gampe <agampe@google.com> ART: Remove base/logging from heap-inl.h

Hide the single uncommon VLOG and remove the include. Fix up
transitive includes.

Test: m
Change-Id: I917df597cb62c57040c1fb0e0079df4d95e5a658
atchoat.cc
2ffb703bf431d74326c88266b4ddaf225eb3c6ad 08-Nov-2017 Igor Murashkin <iam@google.com> cpplint: Cleanup errors

Cleanup errors from upstream cpplint in preparation
for moving art's cpplint fork to upstream tip-of-tree cpplint.

Test: cd art && mm
Bug: 68951293
Change-Id: I15faed4594cbcb8399850f8bdee39d42c0c5b956
atchoat.h
33bff25bcd7a02d35c54f63740eadb1a4833fc92 01-Nov-2017 Vladimir Marko <vmarko@google.com> ART: Make InstructionSet an enum class and add kLast.

Adding InstructionSet::kLast shall make it easier to encode
the InstructionSet in fewer bits using BitField<>. However,
introducing `kLast` into the `art` namespace is not a good
idea, so we change the InstructionSet to an enum class.
This also uncovered a case of InstructionSet::kNone being
erroneously used instead of vixl32::Condition::None(), so
it's good to remove `kNone` from the `art` namespace.

Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Change-Id: I6fa6168dfba4ed6da86d021a69c80224f09997a6
atchoat.cc
6cfbdbc359ec5414d3e49f70d28f8c0e65b98d63 25-Jul-2017 Vladimir Marko <vmarko@google.com> Use mmapped boot image intern table for PIC app HLoadString.

Implement new HLoadString load kind for boot image strings
referenced by PIC-compiled apps (i.e. prebuilts) that uses
PC-relative load from a boot image InternTable mmapped into
the apps .bss. This reduces the size of the PIC prebuilts
that reference boot image strings compared to the kBssEntry
as we can completely avoid the slow path and stack map.

We separate the InternedStrings and ClassTable sections of
the boot image (.art) file from the rest, aligning the
start of the InternedStrings section to a page boundary.
This may actually increase the size of the boot image file
by a page but it also allows mprotecting() these tables as
read-only. The ClassTable section is included in
anticipation of a similar load kind for HLoadClass.

Prebuilt services.odex for aosp_angler-userdebug (arm64):
- before: 20862776
- after: 20308512 (-541KiB)
Note that 92KiB savings could have been achieved by simply
avoiding the read barrier, similar to the HLoadClass flag
IsInBootImage(). Such flag is now unnecessary.

Test: m test-art-host-gtest
Test: testrunner.py --host
Test: testrunner.py --host --pictest
Test: testrunner.py --target on Nexus 6P.
Test: testrunner.py --target --pictest on Nexus 6P.
Test: Nexus 6P boots.
Bug: 31951624
Change-Id: I5f2bf1fc0bb36a8483244317cfdfa69e192ef6c5
atchoat.cc
cd87c3ee6fefc505010c795284cfc4bca076edf2 05-Sep-2017 Vladimir Marko <vmarko@google.com> Clean up ImageHeader section getters.

Test: m art-test-host-gtest
Test: testrunner.py --host
Change-Id: Iaea7ce6f9bc3ff3c6d9bb6fb598aa62333ebf30c
atchoat.cc
5122e6ba34d46851cd89f2ad55bf6bb067e038d6 17-Aug-2017 Vladimir Marko <vmarko@google.com> ART: Remove ArtMethod::dex_cache_resolved_methods_.

Test: m test-art-host-gtest
Test: testrunner.py --host
Test: testrunner.py --target on Nexus 6P
Test: Repeat the above tests with ART_HEAP_POISONING=true
Test: Build aosp_mips64-eng
Change-Id: I9cd0b8aa5001542b0863cccfca4f9c1cd4d25396
atchoat.cc
8cf9cb386cd9286d67e879f1ee501ec00d72a4e1 19-Jul-2017 Andreas Gampe <agampe@google.com> ART: Include cleanup

Let clang-format reorder the header includes.

Derived with:

* .clang-format:
BasedOnStyle: Google
IncludeIsMainRegex: '(_test|-inl)?$'

* Steps:
find . -name '*.cc' -o -name '*.h' | xargs sed -i.bak -e 's/^#include/ #include/' ; git commit -a -m 'ART: Include cleanup'
git-clang-format -style=file HEAD^
manual inspection
git commit -a --amend

Test: mmma art
Change-Id: Ia963a8ce3ce5f96b5e78acd587e26908c7a70d02
atchoat.cc
atchoat.h
07bfbace6f835e6c748fd68ec7624992478b16c1 06-Jul-2017 Vladimir Marko <vmarko@google.com> Hash-based DexCache methods array.

Total boot*.art size for aosp_angler-userdebug:
- arm64:
- before: 11603968
- after: 10129408 (-1.4MiB, -12.7%)
- arm:
- before: 8626176
- after: 7888896 (-0.7MiB, -8.5%)

Test: m test-art-host-gtest
Test: testrunner.py --host
Test: Nexus 6P boots.
Test: testrunner.py --target
Test: Build aosp_mips64-eng
Bug: 30627598
Change-Id: I7f858605de5f074cbd7f0d9c4c072fbd44aee28f
atchoat.cc
0c18338ebae6b3597c882887f8354b64abb5e90f 14-Jul-2017 Andreas Gampe <agampe@google.com> ART: Replace or remove some ObjectCallback Walk functions

Replace with visitor functions in RegionSpace and SpaceBitmap. Remove
old ObjectCallback version in HeapBitmap. Fix up users. Move some
thread-safety annotations.

Move ObjectCallback definition to the only remaining user (ModUnionTable).

Test: m
Change-Id: I10307aeacad0c60d21fbade2081ec040d6a6ac4c
atchoat.cc
atchoat.h
51d80ccca5eb2ea0eef0de836dcc03e0545f63db 22-Jun-2017 Andreas Gampe <agampe@google.com> ART: Refactor abort code

Remove Runtime::Aborter and let Runtime::Abort set the abort message
on target.

This works around a missing tail-call optimization that leads to a
superfluous frame on the call-stack when aborting.

Partially reverts commit 3fec9ac0d5af1358d216eb2fdc2000ec0205f3f0.

Bug: 62810360
Test: m test-art-host
Test: Manual inspection of abort dump
Change-Id: Ie4efc8bbdc8b665b23081b37a11921fe26b182b4
atchoat.cc
a3d27ebd2802fd6031cc928a67752541775bf52b 11-May-2017 Narayan Kamath <narayan@google.com> ScopedFlock: Refactor it to be a subclass of FdFile.

Makes callers cleaner, since they only have to worry about
dealing with regular File objects that they know will be locked
for the duration of their existence. Prevents issues and other
clunky code relating to acquire

Test: scoped_flock_test, test_art_host
Bug: 36369345

Change-Id: I2c9644e448acde6ddac472d88108c7d9a4e1a892
atchoat.cc
b2d18fa4e33ca119654ced872c70fe198b0b2db5 07-Jun-2017 Andreas Gampe <agampe@google.com> ART: Clean up asm_support.h

The includes are only ever really needed for tests. Factor out
generation of the test function into asm_support_check.h

Fix up missing includes, mainly intern_table.h.

Test: m
Test: m test-art-host
Change-Id: I435199e6211e368be0a06c80d8fa95b9593aca31
atchoat.cc
5115efb3369d522ad34b919114de2797bcd81642 25-May-2017 Andreas Gampe <agampe@google.com> ART: Fix soong defaults order

Defaults are prepended in order of their appearance. Move debug
defaults first.

Bug: 31098551
Test: m test-art-host
Change-Id: I9a64db34d0e398d336dac080c7234cad77b719ee
ndroid.bp
b8cc1754535f27fff1f1cb8324a543797eaacbcd 27-Apr-2017 Andreas Gampe <agampe@google.com> ART: Shut down runtime in patchoat

When in a debug build, or under sanitization, shut down the runtime
after patching an image. This avoids tripping leak checks, while
keeping regular shutdown fast (similar to dex2oat).

Bug: 37728254
Test: m SANITIZE_HOST=true test-art-host
Change-Id: I812cf0c7e60745081b3c1c0e68d4631a43783ead
atchoat.cc
c6ea7d00ad069a2736f603daa3d8eaa9a1f8ea11 02-Feb-2017 Andreas Gampe <agampe@google.com> ART: Clean up art_method.h

Clean up the header. Fix up other headers including the -inl file,
in an effort to prune the include graph. Fix broken transitive
includes by making includes explicit. Introduce new -inl files
for method handles and reference visiting.

Test: source build/envsetup.sh && lunch aosp_angler-userdebug && mmma art
Test: source build/envsetup.sh && lunch aosp_mips64-userdebug && mmma art
Change-Id: I8f60f1160c2a702fdf3598149dae38f6fa6bc851
atchoat.cc
8c19d2431f45861ca11cf5ebc4fdaf10200f2458 06-Mar-2017 Mathieu Chartier <mathieuc@google.com> Refactor image writer

Aim to have common functions for copying references and pointers.
Required for adding support for faster image fixups.

Test: test-art-host -j32

Bug: 34927277
Bug: 34928633
Change-Id: Ia654efc483b332eea3535570496bfeccd7c635ee
atchoat.cc
f44d36c8423f81cbb5e9f55d8813e26ffa1a7f3b 14-Mar-2017 Vladimir Marko <vmarko@google.com> Revert^2 "Hash-based DexCache field array."

Test: testrunner.py --host --interpreter
Bug: 30627598

This reverts commit 6374c58f2ea403b3a05fb27376110fe4d0fc8e3f.

Change-Id: I275508e288a85d3aa08f7405a1a4f362af43b775
atchoat.cc
8d6768d47b66a688d35399d524ad5a5450e9d9d4 14-Mar-2017 Vladimir Marko <vmarko@google.com> Revert^6 "Hash-based dex cache type array."

Fixed ImageWriter to write class table also if it contains
only boot class loader classes. Added a regression test and
added extra checks for debug-build to verify that dex cache
types from app image are also in the class table. Removed
some unnecessary debug output.

Test: 158-app-image-class-table
Bug: 34839984
Bug: 30627598
Bug: 34659969

This reverts commit 0b66d6174bf1f6023f9d36dda8538490b79c2e9f.

Change-Id: I6a747904940c6ebc297f4946feef99dc0adf930c
atchoat.cc
0b66d6174bf1f6023f9d36dda8538490b79c2e9f 13-Mar-2017 Vladimir Marko <vmarko@google.com> Revert^5 "Hash-based dex cache type array."

For app images, ImageWriter does not add boot image
classes to the app image class table even though it
keeps them in the dex caches. The reason for that is
unknown, the code looks OK.

Bug: 34839984
Bug: 30627598
Bug: 34659969

Also reverts "Improve debugging output for a crash."

This reverts commits
bfb80d25eaeb7a604d5dd25a370e3869e96a33ab,
8dd56fcb3196f466ecaffd445397cb11ef85f89f.

Test: testrunner.py --host
Change-Id: Ic8db128207c07588c7f11563208ae1e85c8b0e84
atchoat.cc
6374c58f2ea403b3a05fb27376110fe4d0fc8e3f 13-Mar-2017 Vladimir Marko <vmarko@google.com> Revert "Hash-based DexCache field array."

Reverting to allow rebasing the revert
https://android-review.googlesource.com/351689
without too many conflicts.

Bug: 30627598

This reverts commit 1aea3510b8dd0c512cec61c91c5ef1f1e5d53d64.

Change-Id: I4af65e9f41c8bad8106c028947eca7c5a9534c53
atchoat.cc
1aea3510b8dd0c512cec61c91c5ef1f1e5d53d64 08-Dec-2016 Vladimir Marko <vmarko@google.com> Hash-based DexCache field array.

Test: m test-art-host, both AOT and interpreter
Test: m test-art-target, both AOT and interpreter
Test: m valgrind-test-art-host
Bug: 30627598
Change-Id: If992f091aadd862d17b09928d21659573dd285a0
atchoat.cc
4bc11d0585b8c09c57a811361e6879d62a3206ce 01-Feb-2017 Richard Uhler <ruhler@google.com> "Revert^4 "Remove unused code for patching oat files."

This reverts commit cb6a5916cce4f18c7183fa8731446a084fb28fe5.

Test: m test-art-host
Change-Id: I8029dcc93e7fa614d8d50030362d3133caabfe54
atchoat.cc
atchoat.h
bfb80d25eaeb7a604d5dd25a370e3869e96a33ab 14-Feb-2017 Vladimir Marko <vmarko@google.com> Revert^4 "Hash-based dex cache type array."

Added extra output to the abort message to collect more data
when we hit the crash. Added extra check when loading an app
image to verify that the class table isn't already broken.

Test: testrunner.py --host
Bug: 34839984
Bug: 30627598
Bug: 34659969

This reverts commit 5812e20ff7cbc8efa0b8d7486ada2f58840a6ad5.

Change-Id: I9bb442a184c236dcb75b3e42a095f39cd6bee59d
atchoat.cc
c069a30d42aefd902c20e8bc09dfad1683f07ded 18-Jan-2017 Orion Hodson <oth@google.com> ART: invoke-custom support

Adds invoke-custom instruction to the interpreter.

Bug: 33191717,30550796
Test: art/test/run-test --host 952
Change-Id: I3b754128649a8b3a00ade79ba2518d0e377f3a1e
atchoat.cc
5812e20ff7cbc8efa0b8d7486ada2f58840a6ad5 14-Feb-2017 Mathieu Chartier <mathieuc@google.com> Revert^3 "Hash-based dex cache type array."

Assert failing for "earchbox:search":
F zygote64: class_linker.cc:4612] Check failed: handle_scope_iface.Get() != nullptr

Test: m test-art-host
Bug: 34839984
Bug: 30627598
Bug: 34659969

This reverts commit 85c0f2ac03417f5125bc2ff1dab8109859c67d5c.

Change-Id: I39846c20295af5875b0f945be7035c73ded23135
atchoat.cc
85c0f2ac03417f5125bc2ff1dab8109859c67d5c 02-Feb-2017 Vladimir Marko <vmarko@google.com> Revert^2 "Hash-based dex cache type array."

The reason for the revert was fixed by
https://android-review.googlesource.com/332666 .
We now enable clearing dex cache types in test 155 from that
CL. Also avoid an unnecessary store in LookupResolvedTypes()
and prevent verifier from messing up the dex cache types.

Test: m test-art-host
Bug: 34839984
Bug: 30627598
Bug: 34659969

This reverts commit d16363a93053de0f32252c7897d839a46aff14ae.

Change-Id: Ie8603cfa772e78e648d005b0b6eae59062ae729d
atchoat.cc
d16363a93053de0f32252c7897d839a46aff14ae 01-Feb-2017 Vladimir Marko <vmarko@google.com> Revert "Hash-based dex cache type array."

Reverting to work around some programs crashing with
Check failed: handle_scope_iface.Get() != nullptr.
though the reason for the failure not yet understood.

Test: m test-art-host
Bug: 34839984
Bug: 30627598
Bug: 34659969
Bug: 30419309

This reverts commit ec7862283dd49f5a58d0ac45960ce27c2f7671b8.

Change-Id: Ifded663633082f1e59e5b6ff2e026dc559bd6b82
atchoat.cc
ec7862283dd49f5a58d0ac45960ce27c2f7671b8 20-Dec-2016 Vladimir Marko <vmarko@google.com> Hash-based dex cache type array.

Test: m test-art-host (Interpreter, Optimizing, JIT)
Test: m test-art-target on Nexus 6P (Interpreter, Optimizing, JIT)
Test: Nexus 6P boots
Test: m valgrind-test-art-host
Bug: 30627598
Bug: 34659969
Bug: 30419309
Change-Id: Ic00eda89e58088a3573fc9ec0ad04c0e69e161d1
atchoat.cc
9cd522b50a5f0209e97a2e6bcf8c9c350d3f3f83 18-Jan-2017 Nicolas Geoffray <ngeoffray@google.com> Remove now unused dex_cache_resolved_types_ from ArtMethod.

Test: test-art-host test-art-target
Change-Id: I004c040da165934f74eb8b8e85e99e7c6621c2df
atchoat.cc
78985875702c52657066da158c0246ef07115385 17-Jan-2017 Nicolas Geoffray <ngeoffray@google.com> Revert "Remove unused code for patching oat files."

oat_file_assistant_test fails on target.

Bug: 33192586

This reverts commit c9f76628ce1dc54f852b689ed1722b7e154b2a9d.

Change-Id: Ie3b8900ed16d0f4033a76c7eb60ac8e9ad13f089
atchoat.cc
atchoat.h
c9f76628ce1dc54f852b689ed1722b7e154b2a9d 12-Jan-2017 Richard Uhler <ruhler@google.com> Remove unused code for patching oat files.

patchoat is now only used for patching images. It no longer needs to
support patching of non-PIC oat files. This change removes code from
patchoat that was specific to patching of non-PIC oat files.

Bug: 33192586
Test: m test-art-host
Test: device boots
Change-Id: I8918a708e441493a21f25d537ed0b74748bb9641
atchoat.cc
atchoat.h
46ee31b67d7ee1bd085fbc240502053caa3cf8fa 14-Dec-2016 Andreas Gampe <agampe@google.com> ART: Move to libbase StringPrintf

Remove ART's StringPrintf implementation. Fix up clients. Add
missing includes where necessary.

Test: m test-art-host
Change-Id: I564038d5868595ac3bb88d641af1000cea940e5a
atchoat.cc
9186ced255f2e7402646b5b286deebb540640734 12-Dec-2016 Andreas Gampe <agampe@google.com> ART: Clean up utils.h

Remove functionality provided by libbase. Move some single-use
functions to their respective users.

Test: m test-art-host
Change-Id: I75594035fa975200d638cc29bb9f31bc6e6cb29f
atchoat.cc
58c3f6a0d15a4340c0a11ab7fbc8c4b990c64b77 01-Dec-2016 Mathieu Chartier <mathieuc@google.com> Reduce calls to DescriptorEquals

Store the low 3 bits of the descriptor hash inside of class set
entries. Compare these bits before comparing descriptors.

Simpleperf interpret-only compile of facebook:
mirror::Class::DescriptorEquals(char const*): 3.66% -> 1.03%

Bug: 32641252

Test: test-art-host

Change-Id: I8d898d4ac7c95383c49401fbcd85bfde226e026c
atchoat.cc
ad06b985bb8792bc82835acbe93eda8f9839c6d2 17-Nov-2016 Vladimir Marko <vmarko@google.com> Make ImageWriter and PatchOat helper classes nested.

Nested classes are better for encapsulation. For example,
we've had an art::FixupRootVisitor in both image_writer.cc
and patchoat.cc and we didn't get an ODR violation only
because these two files are never used in the same process.

Test: Rely on the TreeHugger.
Change-Id: I39a86994923a9c0faa5f05d8c9ede982ce9c0c4c
atchoat.cc
atchoat.h
6beced4c017826f7c449f12fac7fa42403657f2b 16-Nov-2016 Mathieu Chartier <mathieuc@google.com> Change iftable to never be null

Simplifies code generation by removing a null check. The null case
is rare.

Ritzperf code size: 13107624 -> 13095336

Also addressed comments from previous CL.

Bug: 32577579

Test: test-art-host, run ritzperf both with CC

Change-Id: I2b31e800867112869d7f0643e16c08826296979e
atchoat.cc
ca620d7bc03b23a0bcf0ef58df58603ee000dca0 08-Nov-2016 Andreas Gampe <agampe@google.com> ART: Fix tidy warnings

Switch to char versions of find variants.

Add "explicit" constructor variants or refactor and
remove defaults.

Use const references.

Bug: 32619234
Test: m test-art-host
Change-Id: I970cc2f47d6cf8f0c74104b994b075b2fafb3d45
atchoat.cc
12b58b23de974232e991c650405f929f8b0dcc9f 01-Nov-2016 Hiroshi Yamauchi <yamauchi@google.com> Clean up the runtime read barrier and fix fake address dependency.

- Rename GetReadBarrierPointer to GetReadBarrierState.
- Change its return type to uint32_t.
- Fix the runtime fake address dependency for arm/arm64 using inline
asm.
- Drop ReadBarrier::black_ptr_ and some brooks code.

Bug: 12687968
Test: test-art with CC, Ritz EAAC, libartd boot on N9.
Change-Id: I595970db825db5be2e98ee1fcbd7696d5501af55
atchoat.cc
3e2e2f1bfb01d9e0066fd737d2a94e1782ed8d2b 18-Oct-2016 Narayan Kamath <narayan@google.com> Merge "Fix handling of dex cache arrays for method types."
27b88f3a2aaaa2dd3e03706d02590a07a96d8c30 18-Oct-2016 Treehugger Robot <treehugger-gerrit@google.com> Merge "Remove logging dependency on runtime"
f57589fd40e5b69dad5aff060ccef756507f381a 17-Oct-2016 David Sehr <sehr@google.com> Remove logging dependency on runtime

Moved the abort backtracing function to runtime, forcing callers to
supply the aborter at InitLogging. This makes runtime properly layer
on top of logging by removing the cyclic dependency.

Bug: 22322814
Test: test-art-host
Change-Id: I8b2e72174e937bb88fe1bddd6d04b564cfb011a9
atchoat.cc
38a4223fcc0493553d9ad324a1dc145869eb663a 17-Oct-2016 Mathieu Chartier <mathieuc@google.com> Merge "Move most mirror:: args to ObjPtr"
31e88225b2ef68e7f32f11186acf922c74ddabab 15-Oct-2016 Mathieu Chartier <mathieuc@google.com> Move most mirror:: args to ObjPtr

Fixed possible moving GC bugs in ClinitImageUpdate class.

Bug: 31113334

Test: test-art-host
Change-Id: I0bf6578553d58b944aaa17665f1350bdf5ed15ec
atchoat.cc
atchoat.h
7fe56583220d813980f2241e0df13f5aa6627611 14-Oct-2016 Narayan Kamath <narayan@google.com> Fix handling of dex cache arrays for method types.

- Add support for relocating method type dex cache arrays.
- Add missing call to MethodTypeDexCachePair::Initialize in the
class_linker.
- Fix alignment calculation for method_types in
DexCacheArraysLayout.
- Removed unused MethodTypeOffset(uint32_t) method.

Fixes tests with --pic.

Test: make test-art-host
Bug: 30550796

Change-Id: I2bba7228762b9e9834e7659fe62090be78afdfa8
atchoat.cc
f5b0f2cef8554efaa90adc6a1ae04c2b533970ed 14-Oct-2016 Brian Carlstrom <bdc@google.com> Ensure OpenDexFilesFromImage closes file to prevent file descriptor leak

(cherry picked from commit 645e477c2ce7a59ac98bc86463826cf082a13ad8)

Test: m -j32 test-art-host
Bug: 32095919
Change-Id: I44541edeb403a508e1b9794ee09fb1f55e3f42bf
atchoat.cc
1cc62e4ea24828fdb3f3da0b8603f0b107d09a04 04-Oct-2016 Mathieu Chartier <mathieuc@google.com> Rename ObjPtr::Decode to ObjPtr::Ptr

Done to prevent ambiguity with ScopedObjectAccess::Decode.

Bug: 31113334

Test: test-art-host
Change-Id: I07a2497cc9cf66386311798933547471987fc316
atchoat.cc
3398c7874e002beaa6c2b2fadf183e7d1ddad23a 30-Sep-2016 Mathieu Chartier <mathieuc@google.com> Move ArtField to ObjPtr

Added EXPECT_OBJ_PTR_EQ and variants to gtests.

Fixed moving GC bugs in:
ClassLinker::CreatePathClassLoader
ClassLinkerTest: StaticFields

ObjPtr Decode call sites: 186 -> 181.

Some tests fail due to ResolvedFieldAccessTest, will fix in follow
up CL.

Bug: 31113334

Test: test-art-host CC baker

Change-Id: I8b266ad00f3c20c8cbe7cfdf280d175083df0b88
atchoat.cc
0795f23920ee9aabf28e45c63cd592dcccf00216 28-Sep-2016 Mathieu Chartier <mathieuc@google.com> Clean up ScopedThreadStateChange to use ObjPtr

Also fixed inclusion of -inl.h files in .h files by adding
scoped_object_access-inl.h and scoped_fast_natvie_object_access-inl.h

Changed AddLocalReference / Decode to use ObjPtr.

Changed libartbenchmark to be debug to avoid linkage errors.

Bug: 31113334

Test: test-art-host

Change-Id: I4d2e160483a29d21e1e0e440585ed328b9811483
atchoat.cc
3fec9ac0d5af1358d216eb2fdc2000ec0205f3f0 13-Sep-2016 Andreas Gampe <agampe@google.com> ART: Use libbase logging

Move most of our logging infrastructure over to system/core/base.
Retain VLOG.

Using unified Android infrastructure has two main advantages. First,
it reduces the complexity/maintenance burden in ART. Second, it
allows to detach logging for the cases where we do not want or need
a runtime, e.g., dexdump, the disassembler, etc. As a part of the
latter, libbase is also supported for all hosts (including Windows).

From a developer viewpoint, there are minor behavior changes for the
LOG statements (see above), but otherwise usage is the same. Explicit
severity enum items are in the android::base namespace now.

Bug: 31338270
Test: m test-art-host
Change-Id: I5abcb2f45f5b03d49951874c48544f72a283a91b
ndroid.bp
0e8443995af602bcc2e70dcef1d20ee48acec934 08-Sep-2016 Neil Fuller <nfuller@google.com> Collapse ART's AbstractMethod class into Executable

After the OpenJDK 8 pull there is now a common base class
for Method and Constructor that can be used instead.

Methods that are abstract on Executable but on Android
were implemented in AbstractMethod are now consistently
renamed to "{method}Internal", declared final and
given package-protected access.

For consistency with all other private, natively
implemented methods, the method getDeclaredAnnotations()
has been renamed getDeclaredAnnotationsNative().

Bug: 28666126
Bug: 31052885
Test: make test-art-host and cts run of CtsLibcoreTestCases
Change-Id: Ibfe6af6a47fe0cfffd0859ffbe58980aeb84e053
atchoat.cc
c7376e0f8002d7838c3d69569028fbc9b91a38f3 08-Sep-2016 Colin Cross <ccross@android.com> Convert more of art to Android.bp

Convert dex2oat, imgdiag, patchoat, and profman to Android.bp.

Test: m -j test-art-host
Test: mmma -j art
Change-Id: If2acd47189e5a944732c2c00c2bf31265f887161
ndroid.bp
ndroid.mk
7b49e6cade09bc65b3b5f22d45fc9d0a7184e4f2 01-Sep-2016 David Brazdil <dbrazdil@google.com> Introduce VDEX file, use it for DEX files

This patch introduces a new output file called VDEX. In the future,
VDEX files will store pre-validated DEX files which do not need to be
re-extracted and re-verified when recompiling, e.g. due to new
profiling information or after a system update.

With this CL, the OatWriter writes DEX files into the VDEX and the
rest of its output into OAT. The OatFile class and related classes
are updated to load the VDEX at runtime and mmap the DEX file section
from it. Patchoat creates symlinks to the source VDEX files in the
target directory or copies the files if passed in as file descriptors.

The feature can be disabled by setting the environment variable
ART_ENABLE_VDEX to false.

Test: m test-art-host
Bug: 30937355
Change-Id: I54dcaececf6814c258c80524ec15e2e2ef69c8dd
atchoat.cc
bdf7f1c3ab65ccb70f62db5ab31dba060632d458 31-Aug-2016 Andreas Gampe <agampe@google.com> ART: SHARED_REQUIRES to REQUIRES_SHARED

This coincides with the actual attribute name and upstream usage.
Preparation for deferring to libbase.

Test: m
Test: m test-art-host
Change-Id: Ia8986b5dfd926ba772bf00b0a35eaf83596d8518
atchoat.cc
atchoat.h
bf44e0e5281de91f2e38a9378b94ef8c50ad9b23 18-Aug-2016 Christina Wadsworth <cwadsworth@google.com> ART: Implement a fixed size string dex cache

Previously, the string dex cache was dex_file->NumStringIds() size, and
@ruhler found that only ~1% of that cache was ever getting filled. Since
many of these string dex caches were previously 100,000+ indices in
length, we're wasting a few hundred KB per app by storing null pointers.
The intent of this project was to reduce the space the string dex cache
is using, while not regressing on time that much. This is the first of a
few CLs, which implements the new fixed size array and disables the
compiled code so it always goes slow path. In four other CLs, I
implemented a "medium path" that regresses from the previous "fast path"
only a bit in assembly in the entrypoints. @vmarko will introduce new
compiled code in the future so that we ultimately won't be regressing on
time at all. Overall, space savings have been confirmed as on the order
of 100 KB per application.

A 4-5% slow down in art-opt on Golem, and no noticeable slow down in the
interpreter. The opt slow down should be diminished once the new
compiled code is introduced.

Test: m test-art-host

Bug: 20323084

Change-Id: Ic654a1fb9c1ae127dde59290bf36a23edb55ca8e
atchoat.cc
542451cc546779f5c67840e105c51205a1b0a8fd 26-Jul-2016 Andreas Gampe <agampe@google.com> ART: Convert pointer size to enum

Move away from size_t to dedicated enum (class).

Bug: 30373134
Bug: 30419309
Test: m test-art-host
Change-Id: Id453c330f1065012e7d4f9fc24ac477cc9bb9269
atchoat.cc
atchoat.h
75f0885d7c3d72a0351912b6d47682e1c860efdf 19-Jul-2016 Andreas Gampe <agampe@google.com> ART: Rename ArtMethod JNI field

The field is multi-purpose, rename it to data and clean up
accessors in preparation of more checks.

Test: m test-art-host
Change-Id: Ib4b84b7b1a51ca201544bc488ce8770aa858c7fd
atchoat.cc
a62cb9bb6cb2278cb41ab0664191623e178c6a4f 30-Jun-2016 Artem Udovichenko <artem.u@samsung.com> Revert "Revert "Optimize IMT""

This reverts commit 88f288e3564d79d87c0cd8bb831ec5a791ba4861.

Change-Id: I49605d53692cbec1e2622e23ff2893fc51ed4115
atchoat.cc
atchoat.h
88f288e3564d79d87c0cd8bb831ec5a791ba4861 29-Jun-2016 Nicolas Geoffray <ngeoffray@google.com> Revert "Optimize IMT"

Bug: 29188168 (for initial CL)
Bug: 29778499 (reason for revert)

This reverts commit badee9820fcf5dca5f8c46c3215ae1779ee7736e.

Change-Id: I32b8463122c3521e233c34ca95c96a5078e88848
atchoat.cc
atchoat.h
badee9820fcf5dca5f8c46c3215ae1779ee7736e 13-May-2016 Nelli Kim <nelli.kim@samsung.com> Optimize IMT

* Remove IMT for classes which do not implement interfaces
* Remove IMT for array classes
* Share same IMT

Saved memory (measured on hammerhead):
boot.art:
Total number of classes: 3854
Number of affected classes: 1637
Saved memory: 409kB

Chrome (excluding classes in boot.art):
Total number of classes: 2409
Number of affected classes: 1259
Saved memory: 314kB

Google Maps (excluding classes in boot.art):
Total number of classes: 6988
Number of affected classes: 2574
Saved memory: 643kB

Performance regression on benchmarks/InvokeInterface.java benchmark
(measured timeCall10Interface)
1st launch: 9.6%
2nd launch: 6.8%

Change-Id: If07e45390014a6ee8f3c1c4ca095b43046f0871f
atchoat.cc
atchoat.h
e42888f9df4163303244070c65d5229d3e201742 14-Apr-2016 Mathieu Chartier <mathieuc@google.com> Write conflict tables in image

Add image sections for runtime methods and conflict tables. This
makes it that we do not need to fake up a length prefixed array
for runtime methods.

Reduces .art private dirty and PSS.

System wide .art PSS goes from 32.5MB to 30.5MB after system boot.

Business card .art private dirty goes from 588K to 504K.

Increases image size by ~100K.

Bug: 27906566

(cherry picked from commit cda9386add68d94697449c6cb08b356747e55c21)

Change-Id: I38cbe3150c3eeb385b8cad7cf93614e3980f4162
atchoat.cc
atchoat.h
a13abbac97d38d726f9e7d5d786b571a5d37c227 21-Apr-2016 Mathieu Chartier <mathieuc@google.com> Fix heap check.

Previously, we only checked the image we were patching. This did not
work if the referent was in another image. Fixed the DCHECK to check
all the boot images.

Bug: 28286961

(cherry picked from commit 488849c584337a1aae8413a1d1e0fad8043bf672)

Change-Id: If2e8e48b500935d0969e8673816d28218888bd13
atchoat.cc
atchoat.h
d12f9c13599a6b5893cffd02c9b8d35b4db93bf3 22-Mar-2016 Serdjuk, Nikolay Y <nikolay.y.serdjuk@intel.com> ART: Save or erase the file even if I/O failed

It should close the file in any case.

Change-Id: Idb7db15bfecb0ac47839be3544cc2dce91096d7b
Signed-off-by: Serdjuk, Nikolay Y <nikolay.y.serdjuk@intel.com>
atchoat.cc
ec1514a91a34586aca3fd75d1565ad5992c54929 18-Mar-2016 Jeff Hao <jeffhao@google.com> Add patchoat check that input oat file has patch section.

Do this check before opening the output file in case this could be
causing the file to become truncated.

Bug: 27723864

(cherry-picked from commit 99503b9805def2ed7d4fe4bf285c6fdd8ddce6ed)

Change-Id: Icf71016adae5404e4f8588f2f5e23da6405ef2e7
atchoat.cc
7a1c0148a9bfbd15132c949f7758719027e9deb4 17-Mar-2016 Dimitry Ivanov <dimitry@google.com> Remove TEMP_FAILURE_RETRY for unlink

unlink(2) does not generate EINTR error

Change-Id: I546b00a61b8ffcbd43b01f5ae6ff31f335be00ab
atchoat.cc
6eb6a39bdcf669655190d40d20f8d2e663b262f4 11-Feb-2016 Andreas Gampe <agampe@google.com> ART: Simplify patchoat

Removed unused configurations. Cut out cruft that isn't used anymore
since multi-image. Make it smaller to not require new selinux
permissions for OTAs.

Split up the main function, to make the flow clearer for image vs
app/oat.

Bug: 25612095
Bug: 26317072

(cherry picked from commit 02bc0b70beedfe258c2147c2b4a205fbf3d6eebc)

Change-Id: Ieb55bd1a13cbb44fd0e2979a8a61a509df9c1e7e
atchoat.cc
atchoat.h
4a26f17b055cadc949c3e9fdfa637fe5656339d9 26-Jan-2016 Mathieu Chartier <mathieuc@google.com> Remove GetImageRoots read barrier for image relocation

Fixes CC assertion that failed if an app image was loaded when the GC
was running.

Bug: 26786304
Change-Id: I47bea7b4b947332b57be2e2db604c2c25d92b7e2
atchoat.cc
fbc31087932a65e036a153afab3049dc5298656a 24-Jan-2016 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Load app images""

This reverts commit 1bc977cf2f8199311a97f2ba9431a184540e3e9c.

Bug: 22858531

Change-Id: Ide00bf3a73a02cba3bb364177204ad1b13f70295
atchoat.cc
1bc977cf2f8199311a97f2ba9431a184540e3e9c 23-Jan-2016 Nicolas Geoffray <ngeoffray@google.com> Revert "Load app images"

Fails when a method is duplicated (see test 097-duplicate-method)

Bug: 22858531

This reverts commit f7fd970244f143b1abb956e29794c446e4d57f46.

Change-Id: Ib30ae5be00cc568e799290be6b3c8f29cbbe4c20
atchoat.cc
f7fd970244f143b1abb956e29794c446e4d57f46 09-Nov-2015 Mathieu Chartier <mathieuc@google.com> Load app images

Support in-place patching of the app image based on boot image
location and app oat location. Only loads for art run test so far
since we do not automatically generate app images for app installs.

N5 maps launch time (~200 runs):
Before: 930ms
After: 878.18ms
After + image class table: 864.57ms

TODO:
Oatdump support.
Store class loaders as class roots in image.

Bug: 22858531

Change-Id: I9cbc645645e62ea2ed1ad8e139e91af7d88514c1
atchoat.cc
ea0831f60d26e3297e6463634a9fbb6384f00661 29-Dec-2015 Mathieu Chartier <mathieuc@google.com> Re-enable adding intern table to image

Changed intern table to have a stack of tables similarily to
ClassTable. Adding an image intern table adds to the front of the
intern table stack. Also some cleanup.

Bug: 26317072

Change-Id: I7bbf9485b5dbbbf3707fed21e29de3beccfb8705
atchoat.cc
0d2af30df4000101b7c4b4e6b6350460a141edc8 05-Jan-2016 Jeff Hao <jeffhao@google.com> Fix multi-image TODOs in patchoat.

- Reinstated checks that were still valid (one check was removed).
- Removed unused path that patches only images.

Bug: 26317072

(cherry-picked from commit e271fe1e2797205c57c052212c32139234f781ea)

Change-Id: I0e140cb110abbfa469c097c805657ecfdc8552d6
atchoat.cc
atchoat.h
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
atchoat.cc
atchoat.h
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
atchoat.cc
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
atchoat.cc
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
atchoat.cc
41dc8cef5d1f86e3ade30b8aaf20d29d8d0c712b 05-Dec-2015 Mathieu Chartier <mathieuc@google.com> Combine class sets when writing a class table

Reduces the boot.art size since we allocate a new class set with the
default load factor. The load factor in the combined class table is
higher to pruning classes, this reduces the size of the boot image.

Also fixes the hypothetical case where the class table being written
has multiple class sets.

Boot.art size
Before: 8122368
After: 8044544

Slight cleanup in patchoat.cc.

Bug: 22858531
Change-Id: I31b3ea2004ece6f6c853ee906074bb2792dee958
atchoat.cc
208a5cb383dd9dcd3461f89b74af5df67dc8d794 03-Dec-2015 Mathieu Chartier <mathieuc@google.com> Store class tables in the image

Reduces how long it takes to load an application image.

N5 boot.art size
Before: 8007680
After: 8122368

Also reduces boot time by how long AddImageClassesToClassTable
used to take (~20ms).

Changed class hashes to be uint32_t to fix cross compilation. We need
serialized hash tables to be valid with different pointer sizes.

Bug: 22858531

Change-Id: I463fc83f499ff75f509e80c253a55b9116ee5b89
atchoat.cc
atchoat.h
4b00d3415beb7a816a3b5948f43f3b2e4b856ea8 13-Nov-2015 Mathieu Chartier <mathieuc@google.com> Refactor some patching logic

Reduce duplication since app images in-place relocation will require
this code also.

Bug: 22858531
Change-Id: Ibb901b67267e27ef3bc2a0baff77189d4dcd018a
atchoat.cc
atchoat.h
073b16c8429d302d5413e8ffc488b03b8f770780 10-Nov-2015 Mathieu Chartier <mathieuc@google.com> Image space cleanup for app images

Removed Heap::GetImageSpace, added Heap::GetBootImageSpace.

Generalized some logic in the class linker for image spaces.

Bug: 22858531

Change-Id: Ib3e12bb061a247e232d3dc93b0d6b35eb3a34d25
atchoat.cc
42bddcec51e71d206f6d3b30a881ee6c1d50a63c 10-Nov-2015 Mathieu Chartier <mathieuc@google.com> Add low_4gb support to MapFile and MapFileAtAddress

Motivation is to use this for loading app images in low 4GB at a
non fixed address.

Added test.

Bug: 22858531
Change-Id: I0f79a4a7bfbfbdfc112e41b25c8682b1fb932ab7
atchoat.cc
05792b98980741111b4d0a24d68cff2a8e070a3a 03-Aug-2015 Vladimir Marko <vmarko@google.com> ART: Move DexCache arrays to native.

This CL has a companion CL in libcore/
https://android-review.googlesource.com/162985

Change-Id: Icbc9e20ad1b565e603195b12714762bb446515fa
atchoat.cc
059ef3ddb2088f926ac452889e0953fdcd646a5e 18-Aug-2015 Mathieu Chartier <mathieuc@google.com> Always visit object class from VisitReferences

We don't want to unload classes which have instances.

Slight increase in CMS GC time from ~6.5s to ~7.3s on
EvaluateAndApplyChanges.

Bug: 22720414
Change-Id: I467ff9c9d55163d2a90b999aef3bdd7b3f648bac
atchoat.cc
5e289b2bca7a0bc67fcf00a1017d70db8b363113 17-Aug-2015 Alex Light <allight@google.com> Merge "Make patchoat match offset when given a patched image"
cf36d493124d8048efa0bd6f67d817ce3cd6b725 12-Aug-2015 Vladimir Marko <vmarko@google.com> ART: Compress LengthPrefixedArray on 32-bit targets.

Previously, the LengthPrefixedArray<ArtMethod> on 32-bit
targets contained a 64-bit length field followed by the
ArtMethod elements with size only a multiple of 4, not 8.
Consequently, an odd-length array broke the alignment for
the following array which would have the 64-bit length
placed at an unaligned address.

To fix that, we make the length field 32-bit and explicitly
pass the alignment information to the LengthPrefixedArray.
This also makes the 32-bit boot image a bit smaller.
On Nexus 5, AOSP, ToT, the field section is 11528B smaller
and the method section is 21036B smaller. 64-bit targets
should see the same savings for the field section but no
difference for the methods section.

Change-Id: I3e03e7b94129025c8a1c117c27645a34dec516d2
atchoat.cc
0eb76d2603a52d3e8759fcf480586886d70433d1 12-Aug-2015 Alex Light <allight@google.com> Make patchoat match offset when given a patched image

Previously if we gave patchoat a patched image and a already patched
(but improperly relocated) oat file it would not correctly patch the
oat file to the same offset as the image.

Bug: 22599792
Bug: 23119724
Change-Id: I8773022bd75c2e0b7eb529893b147cbd8792bcad
atchoat.cc
atchoat.h
54d220eb9cc51215d75b9e0fe921b94bebbb3fd6 31-Jul-2015 Mathieu Chartier <mathieuc@google.com> Move ArtFields and ArtMethods to be a length prefixed array

Fixes race conditions between changing method and fields arrays
being seen in the wrong order by the GC.

Bug: 22832610
Change-Id: Ia21d6698f73ba207a6392c3d6b9be2658933073f
atchoat.cc
atchoat.h
da7c650022a974be10e2f00fa07d5109e3d8826f 24-Jul-2015 Mathieu Chartier <mathieuc@google.com> Visit class native roots from VisitReferences

Visit class roots when we call Class::VisitReferences instead of in
the class linker. This makes it easier to implement class unloading
since unmarked classes won't have their roots visited by the class
linker.

Bug: 22181835
Change-Id: I63f31e5ebef7b2a0b764b3ba3cb038b3f561b379
atchoat.h
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
atchoat.cc
atchoat.h
7bf2b4f1d08050f80782217febac55c8cfc5e4ef 08-Jul-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "Revert "Remove interpreter entrypoint in ArtMethod.""

The start of the interned strings in the image was not aligned
properly, now that ArtMethods just need to be word aligned.

This reverts commit 7070ccd8b6439477eafeea7ed3736645d78e003f.

bug:22242193

Change-Id: I580c23310c33c239fe0e5d15c72f23a936f58ed1
atchoat.cc
569e81e500725f52116b7d0342ec80a6d1e0089b 08-Jul-2015 Nicolas Geoffray <ngeoffray@google.com> Merge "Revert "Remove interpreter entrypoint in ArtMethod.""
7070ccd8b6439477eafeea7ed3736645d78e003f 08-Jul-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "Remove interpreter entrypoint in ArtMethod."

Build failures on bots. Investigating.

This reverts commit fa2c054b28d4b540c1b3651401a7a091282a015f.

Change-Id: Id65b2009aa66cb291fb8c39758a58e0b0d22616c
atchoat.cc
d5bd4fdd46dce3c33abf17376fbceadcc1aff547 08-Jul-2015 Nicolas Geoffray <ngeoffray@google.com> Merge "Remove interpreter entrypoint in ArtMethod."
fa2c054b28d4b540c1b3651401a7a091282a015f 01-Jul-2015 Nicolas Geoffray <ngeoffray@google.com> Remove interpreter entrypoint in ArtMethod.

Saves 4/8 bytes for each ArtMethod.

Change-Id: I110ecdddf8516b0759a31fa157609643e6d60b15
atchoat.cc
01aaf6ef3e3e35cc8e41cf3fe899a7bf337042f4 19-Jun-2015 Calin Juravle <calin@google.com> Allow for sig chain to be disabled.

Tools like dex2oat or patchoat don't need the sig chain or the fault
manager. This also enables building a statically link version of
dex2oat.

Change-Id: I9897728cac48acade854bb027bfde860628ebf84
ndroid.mk
atchoat.cc
d39645e22b8db1767cf64dc1200a9e4b2f939ed2 10-Jun-2015 Mathieu Chartier <mathieuc@google.com> Move image intern table into image

Previously we recreated this intern table during runtime startup.
This added 50-100ms of boot time.

Fixed bug where we didn't copy over hashcodes into the image.

Deleted some stale code.

(cherry picked from commit fac3a390a247fe33d4873773d742aad4cc100118)

Bug: 20727525
Bug: 19569780
Change-Id: I08959e9aa2a73cedb52f393033e2ffea3a26e76b
atchoat.cc
atchoat.h
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
atchoat.cc
atchoat.h
33d75bc75c72db7e5b1ea4ad0be287b1dfd72e69 28-May-2015 Andreas Gampe <agampe@google.com> Merge "ART: Fix VerifyObject runtime verification"
3b45ef277e4a5f7e0314d5df7ef82e480156ba75 27-May-2015 Andreas Gampe <agampe@google.com> ART: Fix VerifyObject runtime verification

Update some bit-rotted code to work again. Most tests now work, for
some the verification overhead results in a timeout.

Change-Id: Ieab4f2de474a05e915e24abc93da3c2eeed996eb
atchoat.cc
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
atchoat.h
3fc9903407c6e89ffbbc92ded9e272d9de58e9b6 13-May-2015 Vladimir Marko <vmarko@google.com> ART: Do not relocate app program headers in patchoat.

Change the check whether to relocate program headers in
patchoat to simply look whether there is a PT_LOAD section
with p_vaddr == 0. If there is, don't relocate the headers,
it should be an app. Otherwise, it's a boot image and needs
to be relocated.

Add overflow checking to ElfFileImpl<>::GetLoadedSize().

Bug: 21047854
Change-Id: Ie6737f338687296b6dbf4bb3b36358501dfb1587
atchoat.cc
2f6cdb01f74772c1c521a125776ef57ea3c73d43 11-Apr-2015 David Srbecky <dsrbecky@google.com> Relocate DWARF using .oat_patches.

The current solution is to hard-code knowledge of DWARF in the linker.
This works for simple use of DWARF, but breaks as soon as I try to do
anything more complex. Making the linker fully support DWARF would be
non-trivial task and would be essentially rewrite. Using .oat_patches
is much easier solution.

Relocating .debug_* sections required extending .oat_patches to support
more sections than just .text. I have encoded each section as
null-terminated section name followed by ULEB128 deltas.

The ULEB128 encoding shrinks .oat_patches for .text by factor of
about 6 with 64-bit compiler, and factor of 3 with 32-bit compiler.

On the other hand, it grows by the extra .oat_patches for DWARF which
were not present before (if debug symbols are included).

Overall, it is still a clear improvement even with the DWARF patches.

Change-Id: I78ffeda0f8a3da03341995a3b5ef15c954e16e9f
atchoat.cc
atchoat.h
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
atchoat.cc
atchoat.h
3296f4cb397f75044e7bd5f9b345f4b29d0275f3 21-Mar-2015 Richard Uhler <ruhler@google.com> Host dex2oat and patchoat require libcutils.

When atrace_* functions are defined for both target and host, host
dex2oat and patchoat require libcutils.

Change-Id: I89397e83986686a2b6a6f245c25017eb379081b1
ndroid.mk
a473f510620958e94b586efb5398cb87f263be2f 05-Mar-2015 Julien Delayen <julien.delayen@intel.com> patchoat: DisableAutoClose when patching in place

Installd can give the same input and output when
patching directly in the dalvik-cache.
For this particular case, we need to DisableAutoClose
to avoid closing twice the same fd.

Change-Id: Ic1c0f1006f776e6aeb3772c83c52309c78a4bdfd
Signed-off-by: Julien Delayen <julien.delayen@intel.com>
Signed-off-by: Guilhem IMBERTON <guilhem.imberton@intel.com>
atchoat.cc
794ad76e8d5b5b9132819d5b08a0570e27615644 23-Feb-2015 Andreas Gampe <agampe@google.com> ART: Introduce NO_RETURN, Mark DoLongJump noreturn

Add NO_RETURN macro that adds C++11 noreturn attribute. Mark
DoLongJump methods as noreturn.

Change-Id: Ifde4318e370493237050d4c1349285a0382df23f
atchoat.cc
6f6114140fbc09c5c7bec441922412635a7f7ff1 22-Jan-2015 Andreas Gampe <agampe@google.com> ART: Refactor common ELF->InstructionSet code

Move code into instruction_set.h/cc.

Change-Id: I34d5c82791042c68629df84e0f4b9321231d51b9
atchoat.cc
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
atchoat.cc
c5a3ea7522b59c18daa4325d69703a6f7f743378 14-Jan-2015 Andreas Gampe <agampe@google.com> ART: Introduce Mips32 R6

Add an instruction-set feature for Mips R6. Currently restricted
to the interpreter.

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

Change-Id: I3bf3250fa866fd2265f1b115d52fa5dedc48a7fc
atchoat.cc
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)
atchoat.cc
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
atchoat.cc
2d7210188805292e463be4bcf7a133b654d7e0ea 10-Nov-2014 Mathieu Chartier <mathieuc@google.com> Change 64 bit ArtMethod fields to be pointer sized

Changed the 64 bit entrypoint and gc map fields in ArtMethod to be
pointer sized. This saves a large amount of memory on 32 bit systems.
Reduces ArtMethod size by 16 bytes on 32 bit.

Total number of ArtMethod on low memory mako: 169957
Image size: 49203 methods -> 787248 image size reduction.
Zygote space size: 1070 methods -> 17120 size reduction.
App methods: ~120k -> 2 MB savings.

Savings per app on low memory mako: 125K+ per app
(less active apps -> more image methods per app).

Savings depend on how often the shared methods are on dirty pages vs
shared.

TODO in another CL, delete gc map field from ArtMethod since we
should be able to get it from the Oat method header.

Bug: 17643507

Change-Id: Ie9508f05907a9f693882d4d32a564460bf273ee8

(cherry picked from commit e832e64a7e82d7f72aedbd7d798fb929d458ee8f)
atchoat.cc
atchoat.h
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
atchoat.cc
atchoat.h
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
atchoat.cc
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
atchoat.cc
atchoat.h
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
atchoat.cc
d4c4d953035d4418126d36517e402f411d6a87f3 17-Oct-2014 Ian Rogers <irogers@google.com> Some code clean-up.

Change-Id: I4b745fd5298cd61c793e3b57514b48347bd66c0e
atchoat.cc
atchoat.h
6e88ef6b604a7a945a466784580c42e6554c1289 15-Oct-2014 Mathieu Chartier <mathieuc@google.com> Change MemMap::maps_ to not be global variable

Runtime.exit() was causing globals to get destructed at the same time
that another thread was using it for allocating a new mem map.

Bug: 17962201
Change-Id: I400cb7b8141d858f3c08a6fe59a02838c04c6962
atchoat.cc
7223d44a4893522e90d00bca38b119f710e55122 11-Oct-2014 Ian Rogers <irogers@google.com> Switch to C++11 style [[noreturn]].

Also remove old comment about calls to Abort getting merged. We have few
LOG(FATAL)s so merging is less of an issue. Also, recompiling with O0 and
similar will avoid the optimization and we expect that for GDB debugging.

Change-Id: I840dc6f4b8511294be0e117c634ec15b745e7be5
atchoat.cc
647b1a86f518d8db0331b3d52a96392b7a62504b 10-Oct-2014 Ian Rogers <irogers@google.com> Fix 2 new sets of clang compiler warnings.

Fix issues that are flagged by -Wfloat-equal and -Wmissing-noreturn.
In the case of -Wfloat-equal the current cases in regular code are deliberate,
so the change is to silence the warning. For gtest code the appropriate fix is
to switch from EXPECT_EQ to EXPECT_(FLOAT|DOUBLE)_EQ.
The -Wmissing-noreturn warning isn't enabled due to a missing noreturn in
gtest. This issue has been reported to gtest.

Change-Id: Id84c70c21c542716c9ee0c41492e8ff8788c4ef8
atchoat.cc
13735955f39b3b304c37d2b2840663c131262c18 08-Oct-2014 Ian Rogers <irogers@google.com> stdint types all the way!

Change-Id: I4e4ef3a2002fc59ebd9097087f150eaf3f2a7e08
atchoat.cc
8c52a3f534c49580688239549fca937b36fc0aed 01-Oct-2014 Brian Carlstrom <bdc@google.com> Add some missing TEMP_FAILURE_RETRYs around unlink(2)

Change-Id: Ibf446d37092933dce165d7a95c0ff2e52b94ce46
atchoat.cc
62d1ca3182a6cbb921799825f43ad36821233fd7 04-Sep-2014 Tong Shen <endlessroad@google.com> ART: Prepare for ELF64.

Only expose necessary interface in ElfFile, and move all details into template class ElfFileImpl.

Change-Id: I9df2bbc55f32ba0ba91f4f3d5d0009e84a2ddf74
atchoat.cc
atchoat.h
c8ccf68b805c92674545f63e0341ba47e8d9701c 30-Sep-2014 Andreas Gampe <agampe@google.com> ART: Fix some -Wpedantic errors

Remove extra semicolons.

Dollar signs in C++ identifiers are an extension.

Named variadic macros are an extension.

Binary literals are a C++14 feature.

Enum re-declarations are not allowed.

Overflow.

Change-Id: I7d16b2217b2ef2959ca69de84eaecc754517714a
atchoat.h
3c13a794845e0cf7887e33b2ec20de7e6ba85f8f 19-Sep-2014 Andreas Gampe <agampe@google.com> ART: Only allow the zygote to create the global boot image

Do not allow arbitrary processes, even when root, to write the
boot image in /data/dalvik-cache.

Bug: 17478752, 17510489, 17439961
Change-Id: Iba2b74be6d0752f4221f4ff5ee295b45a34cb2e1
(cherry picked from commit 33c36d4f22ab6a5e61eb47b654deaf647c34e49c)
atchoat.cc
daab38ca60c5b91787e29c87a161a2bb8c1b6f11 13-Sep-2014 Andreas Gampe <agampe@google.com> ART: Make elf loading not abort

Changes elf_file code to use less CHECKs and instead return error
values (usually nullptr). This avoids aborts.

In oat_file, when loading an oat file fails, try to unlink at. If
this succeeds, on the next run we may compile again.

Bug: 17491333

(cherry picked from commit afa6b8e93a0dc0de33c9d404945c7c5621e20b1a)

Change-Id: I50fdd2edacd86f25d4dacf2180ce2a6105eaf4af
atchoat.cc
20c89303a9d89ba857bf969ad14a31f12c3be878 20-Aug-2014 Andreas Gampe <agampe@google.com> ART: Relax GetInstructionSetFromString

Do not abort on an unknown instruction set string. Instead return
kNone and let the caller handle this.

Also simplify the patchoat tool to use this.

Bug: 17136416

(cherry picked from commit aabbb2066a715b3fd8e752291f74c6d77b970450)

Change-Id: I24131914bcf91c04ae93179bf809a2907f1f2b7a
atchoat.cc
e3ea83811d47152c00abea24a9b420651a33b496 08-Aug-2014 Yevgeny Rouban <yevgeny.y.rouban@intel.com> ART source line debug info in OAT files

OAT files have source line information enough for ART runtime needs like
jump to/from interpreter and thread suspension. But this information
is not enough for finer grained source level debugging and low-level
profiling (VTune or perf).

This patch adds to OAT files two additional sections:
.debug_line - DWARF formatted Elf32 section with detailed source line
information (mapping from native PC to Java source lines).

In addition to the debugging symbols added using the dex2oat option
--include-debug-symbols, the source line information is added to
the section .debug_line.

The source line info can be read by many Elf reading tools like objdump,
readelf, dwarfdump, gdb, perf, VTune, ...

gdb can use this debug line information in x86. In 64-bit mode
the information can be used if the oat file is mapped in the lower
address space (address has higher 32 bits zeroed). Relocation works.

Testing:
1. art/test/run-test --host --gdb [--64] 001-HelloWorld
2. in gdb: break Main.java:19
3. in gdb: break Runtime.java:111
4. in gdb: run - stops at void java.lang.Runtime.<init>()
5. in gdb: backtrace - shows call stack down to main()
6. in gdb: continue - stops at void Main.main() (only in 32-bit mode)
7. in gdb: backtrace - shows call stack down to main()
8. objdump -W <oat-file> - addresses are from VMA range of .text
section reported by objdump -h <file>
9. dwarfdump -ka <oat-file> - no errors expected

Size of aosp-x86-eng boot.oat increased by 11% from 80.5Mb to 89.2Mb
with two sections added .debug_line (7.2Mb) and .rel.debug (1.5Mb).

Change-Id: Ib8828832686e49782a63d5529008ff4814ed9cda
Signed-off-by: Yevgeny Rouban <yevgeny.y.rouban@intel.com>
atchoat.cc
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>
ndroid.mk
4b0d2d99b596eebd6da45679896d3af54bc5a935 06-Aug-2014 Alex Light <allight@google.com> Make patchoat use the sht_entsize when patching.

This fixes an occasional problem with multiarch use of patchoat.

Change-Id: I80799de36774720bd985704f9b709a8378bb5af5
atchoat.cc
atchoat.h
cf4bf386ef3f527825c70e01130b9276da4f786a 24-Jul-2014 Alex Light <allight@google.com> Tweaks to patchoat and other related things.

Removed some flags from patchoat that were poorly specified and fixed
some other issues with the relocation system.

Bug: 15358152

Change-Id: Ia6d47b1a008f02373307d833ba45f00ea408d76f
atchoat.cc
1c83cbc4a817acbd7f9abb5b29a2d418a958e6a1 23-Jul-2014 Andreas Gampe <agampe@google.com> ART: Make run tests out of oat tests

Transforms all former oat tests into run tests.

Change-Id: I190dd39456454c36e5538a2c044d993965a67533
atchoat.cc
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
atchoat.cc
atchoat.h
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
atchoat.cc
eefbe39799126afdf7d315a79359b9da23d1cef5 08-Jul-2014 Alex Light <allight@google.com> Fix some style nitpicks

Change-Id: Icfdd327f4ddf129f0a8607162c09ba271c1d49d9
atchoat.cc
atchoat.h
53cb16b98acf3cf6f3a1e2204ad4958ecf1b5a3c 12-Jun-2014 Alex Light <allight@google.com> Add patchoat tool to Art.

Add a new executable called patchoat to art. This tool takes already
compiled images and oat files and changes their base address, acting as
a cheap form of relocation.

Add a --include-patch-information flag to dex2oat and code to add
required patch information to oat files created with the quick compiler.

Bug: 15358152

Change-Id: Ie0c580db45bb14ec180deb84930def6c3628d97d
ndroid.mk
atchoat.cc
atchoat.h