History log of /art/runtime/oat_file_manager.cc
Revision Date Author Comments
7c0a418d495cd0a14904c10ea49255a867107dd0 04-May-2017 Calin Juravle <calin@google.com> Revert "Revert "Ensure dex file are extracted and verified at load time""

The issue was caused by running device-gtests as root (which will always
have full write access everywhere).

For now, disable the tests that rely on file permissions when running as
root.

Test: m test-art-target-gtest-oat_file_assistant_test
Bug: 36605597
Bug: 36824842

This reverts commit 9bfc6bb1f44797aec19a151e47c0902ef2516095.

(cherry picked from commit 357c66dcc20ce15108ecf05f5ecf69a80b383dab)

Change-Id: I73820b8ff9d78af8d9bcb232c8345a07c5788539
ade165ccf61fcf1b5fa102a9b545433259591833 28-Apr-2017 Narayan Kamath <narayan@google.com> oat_file_manager: Avoid global collision check.

Avoid the global collision check in case we encounter a classloader
that we don't recognize. This seems overly conservative. Instead, trust
that the classloader does the right thing.

Bug: 36480683
Bug: 37777332

Test: make test-art-host
Test: manual testing

(cherry picked from commit 04aa213e96c1095e8d1e07cbc426d009777de241)

Change-Id: I45ca1a12c14ba303bd27e9463e612f7c73c778ec
c23f851300109b1c8fd4b3f0b70cb5105ef1aa7f 19-Apr-2017 Calin Juravle <calin@google.com> Ignore the optimized location passed to DexFile.loadDex()

This ensures that apps don't trigger dex2oat to locations
that are not recognized (anymore) by the runtime.

The background compilation job will takes care of optimizing
the dex files loaded via DexClassLoader.

Test: m test-art-host
Bug: 36824842

(cherry picked from commit 1f7079b72965cba0b1a40f53be97a4944ecb4a51)

Change-Id: Icf07ac70b5d2df7b9e6259877908d12b96827a82
e681bf7685ecf6a0645affe8a9c78b10a875d835 06-Apr-2017 Jeff Hao <jeffhao@google.com> Allow dex2oat to handle relative paths.

During installation at compile time, the PackageManager is passing
shared libraries to dex2oat with -classpath. For split apps, we want the
splits to have the proper dependencies, and are now passing previous
parts of the split apk as shared libraries as we compile them all. These
apks are staged in a temp dir during compilation, so we pass a relative
path for them instead.

Since PackageManager can now pass relative paths to dex2oat as shared
libraries, dex2oat has an added --classpath-dir switch to specify the
directory to use for relative class paths. At runtime when checking
shared libraries, we use oat file functionality to resolve relative paths
to determine if the paths match.

Bug: 34169257
Test: cts-tradefed run singleCommand cts -d --module
CtsAppSecurityHostTestCases -t android.appsecurity.cts.SplitTests

(cherry-picked from commit f79ac83a8c18b0bd81aafc9c8823f6bed35d8847)

Change-Id: Ib1f93b6920474d4ed008492da67d3a63174c5397
1f7079b72965cba0b1a40f53be97a4944ecb4a51 19-Apr-2017 Calin Juravle <calin@google.com> Ignore the optimized location passed to DexFile.loadDex()

This ensures that apps don't trigger dex2oat to locations
that are not recognized (anymore) by the runtime.

The background compilation job will takes care of optimizing
the dex files loaded via DexClassLoader.

Test: m test-art-host
Bug: 36824842
Change-Id: I6883740407203b4aa9511e7d15a8201db3df1168
16d4843433e024100b4ecd183f827ad5bd8772a6 06-Apr-2017 Jeff Hao <jeffhao@google.com> Allow dex2oat to handle relative paths.

During installation at compile time, the PackageManager is passing
shared libraries to dex2oat with -classpath. For split apps, we want the
splits to have the proper dependencies, and are now passing previous
parts of the split apk as shared libraries as we compile them all. These
apks are staged in a temp dir during compilation, so we pass a relative
path for them instead.

Since PackageManager can now pass relative paths to dex2oat as shared
libraries, dex2oat has an added --classpath-dir switch to specify the
directory to use for relative class paths. At runtime when checking
shared libraries, we use oat file functionality to resolve relative paths
to determine if the paths match.

Bug: 34169257
Test: cts-tradefed run singleCommand cts -d --module
CtsAppSecurityHostTestCases -t android.appsecurity.cts.SplitTests

Merged-In: I9667f0069c8d12e94598f8a78888d3855d870824
(cherry-picked from commit f79ac83a8c18b0bd81aafc9c8823f6bed35d8847)

Change-Id: I8e4703fdd4bfeb94f982e93abb7eb0cd71060fce
f79ac83a8c18b0bd81aafc9c8823f6bed35d8847 06-Apr-2017 Jeff Hao <jeffhao@google.com> Allow dex2oat to handle relative paths.

During installation at compile time, the PackageManager is passing
shared libraries to dex2oat with -classpath. For split apps, we want the
splits to have the proper dependencies, and are now passing previous
parts of the split apk as shared libraries as we compile them all. These
apks are staged in a temp dir during compilation, so we pass a relative
path for them instead.

Since PackageManager can now pass relative paths to dex2oat as shared
libraries, dex2oat has an added --classpath-dir switch to specify the
directory to use for relative class paths. At runtime when checking
shared libraries, we use oat file functionality to resolve relative paths
to determine if the paths match.

Bug: 34169257
Test: cts-tradefed run singleCommand cts -d --module
CtsAppSecurityHostTestCases -t android.appsecurity.cts.SplitTests

Change-Id: I9667f0069c8d12e94598f8a78888d3855d870824
0471ece3d0166097619da19c9f43522200bfda78 08-Apr-2017 Jeff Hao <jeffhao@google.com> Add option for duplicate classes check to return all dupes.

When verbose oat is enabled, duplicate classes check will not stop at
the first duplicate found, outputting all duplicates found.
Can be enabled via: adb shell setprop dalvik.vm.extra-opts -verbose:oat

Test: mm test-art-host
Change-Id: If1cd55e2ad18fa4bb12d9237e18735ee0f89840b
8ec0a20abae9a1e9a708ee02dd2639351933c028 08-Mar-2017 Jeff Hao <jeffhao@google.com> Fix duplicate classes check to iterate over classes properly.

Previously would iterate in class index order, but classes are not
organized alphabetically. This changes the check to iterate over the
classes's type indexes, which are in alphabetical order.

Unit test to come.

Bug: 35477728
Test: mm test-art-host
Change-Id: Iddaad84c30be042d09dde56c998221fd07f04ab6
77651c4bbd56d502bcf05347e641061bbebca099 04-Mar-2017 Calin Juravle <calin@google.com> ART: Clean up code related to foreign dex use

We simplified the way we track whether or not a dex file is used by
other apps. DexManager in the framework keeps track of the data and we
no longer need file markers on disk.

Test: device boots, foreign dex markers are not created anymore

Bug: 32871170

(cherry picked from commit 868515e2606820ea96f8b9022b442f5bcc770867)

Change-Id: If51b3301c845a8c3bbaf87d0e35a12c700e1d0aa
Merged-In: I5a04d3bba29581dedf05e21b8b20d79afa9b405a
868515e2606820ea96f8b9022b442f5bcc770867 04-Mar-2017 Calin Juravle <calin@google.com> ART: Clean up code related to foreign dex use

We simplified the way we track whether or not a dex file is used by
other apps. DexManager in the framework keeps track of the data and we
no longer need file markers on disk.

Test: device boots, foreign dex markers are not created anymore

Bug: 32871170
Change-Id: I5a04d3bba29581dedf05e21b8b20d79afa9b405a
fa4333dcb481e564f54726b4e6f8153612df835e 14-Feb-2017 Andreas Gampe <agampe@google.com> ART: Add operator == and != with nullptr to Handle

Get it in line with ObjPtr and prettify our code.

Test: m
Change-Id: I1322e2a9bc7a85d7f2441034a19bf4d807b81a0e
90b936ddda63139ff46a6755c3b83ad6e4ab4ac5 31-Jan-2017 Andreas Gampe <agampe@google.com> ART: Refactor verify_object.h

Move the actual VerifyObject check into a new cc file, as we
commonly don't enable the check at all. This allows to cut the
-inl include from almost all current users.

This also exposes missing -inl includes. Also fix up some of our old
mess where .h defined functions require -inl.h defined functions.

Test: m

Change-Id: I3dd821bbe2015564a29bf1ed9be00f7a7276ad61
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
b4f52304d53162a27ca7047aeeb4d18fcb95143b 15-Nov-2016 Jeff Hao <jeffhao@google.com> Fix use of std::stoi without error handling.

Changed to use strtoul, with a break if it fails to read the checksum.

Test: mm test-art-host
Bug: 32066687
Change-Id: Ic1299c23aae15a8329ad57b4eca5c0857f6eefb6
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
08883debd927d18c9ecf66683a2a11aa98165656 08-Nov-2016 Andreas Gampe <agampe@google.com> ART: Refactor jfieldID handling

ArtField objects have been native since Marshmallow.
Remove the dependency on being runnable. Refactor the
code into the jni_internal header.

Test: m test-art-host
Change-Id: I46708c70f9b4b566d7e26e4c5ffc3f0cbadc43fa
4c481a4245aebe6821914237249f11d03e687bf9 03-Nov-2016 Andreas Gampe <agampe@google.com> ART: Make some variables references

Avoid copying values.

Bug: 32619234
Test: m
Change-Id: I86bc206d6f6fccdf730c62c60317a7a4ae26c11b
5c657fe8e3afdce77dc610446f37a43865cff702 03-Nov-2016 Vladimir Marko <vmarko@google.com> Pass some arguments by const reference.

Test: Rely on TreeHugger.
Bug: 32619234
Change-Id: Ia26277893641dcb3562eaeacaec4e089a978d56a
46aba36a1c982567d7e80a62b0cff9c0935e7455 28-Oct-2016 Andreas Gampe <agampe@google.com> ART: Move pathList well-known-field to actual class

Use the actual declaring class, BaseDexClassLoader.

Test: m test-art-host
Change-Id: Ie051e7d45dd73f6adc3c90bc8acc523f204dfab5
709b070044354d9f47641f273edacaeeb0240ab7 13-Oct-2016 David Sehr <sehr@google.com> Remove mirror:: and ArtMethod deps in utils.{h,cc}

The latest chapter in the ongoing saga of attempting to dump a DEX
file without having to start a whole runtime instance. This episode
finds us removing references to ArtMethod/ArtField/mirror.

One aspect of this change that I would like to call out specfically
is that the utils versions of the "Pretty*" functions all were written
to accept nullptr as an argument. I have split these functions up as
follows:
1) an instance method, such as PrettyClass that obviously requires
this != nullptr.
2) a static method, that behaves the same way as the util method, but
calls the instance method if p != nullptr.
This requires using a full class qualifier for the static methods,
which isn't exactly beautiful. I have tried to remove as many cases
as possible where it was clear p != nullptr.

Bug: 22322814
Test: test-art-host
Change-Id: I21adee3614aa697aa580cd1b86b72d9206e1cb24
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
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
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
a463b6a920a2a0bf14f9cca20a561b412b9349d1 13-Aug-2016 Andreas Gampe <agampe@google.com> ART: Refactor ImageSpace loading

Make the code more straightforward so it is easier to reason
about and extend.

Also change return types to unique pointers so it's clear that
it is the caller's responsibility to free those when necessary.

Bug: 30832951
Test: m test-art-host
Test: device booting
Change-Id: I3216eb702e45357a48af5158dacbe40e79bd1ae9
d1472a27e856ec68ab5a27abaaebe9c61d91d343 16-Apr-2016 Richard Uhler <ruhler@google.com> profile_changed should not effect GetBestOatFile.

This change moves the check for whether a profile changed from
GetBestOatFile to GetDexOptStatus, because profile_changed should not
effect what oat files are loaded.

Test: OatFileAssistantTest.ProfileOatUpToDate
Change-Id: Iafd12677f20d2844809337d1d83b688f17461cc0
37d6a3bbf5826abb73f872ed0bc4c6ae9553e274 22-Jun-2016 Aart Bik <ajcbik@google.com> Support the -i flag in the new dexdump.

Rationale:
The old dexdump supported the -i feature (ignore checksum failures).
This CL adds the same functionality to the new dexdump. Note that
this feature is, for example, useful to inspect DEX files that are
extracted from images (with quickened instructions), since the
checksum is not always valid in those cases.

BUG=29548017

Change-Id: I6017b2f3d789f450560b568297f43c62bf9453b1
14d7b3e37b6129d845d6c8da8ee8d612937c63d4 10-Jun-2016 Mathieu Chartier <mathieuc@google.com> Fix dex file leak in oat file manager

Simplified ownership by having a vector of unique pointers own
all newly opened dex files.

Bug: 29246280

(cherry picked from commit fed316715faeec7bf34e3c4a878288c1342cb0e8)

Change-Id: I97db09ced76db8ffdbae371ff72977c4276a0494
1fdbe1b034d97b852551d24e70245df64f03ebeb 10-Jun-2016 Andreas Gampe <agampe@google.com> ART: Add ATRACE section for collision check

The collision check for duplicate classes is potentially expensive.
Add a ScopedTrace to mark it.

Bug: 26880306
Change-Id: Icd75bd0ccc15f0d1f321d85382a4d038fa8ab049
fed316715faeec7bf34e3c4a878288c1342cb0e8 10-Jun-2016 Mathieu Chartier <mathieuc@google.com> Fix dex file leak in oat file manager

Simplified ownership by having a vector of unique pointers own
all newly opened dex files.

Bug: 29246280
Change-Id: I1ffcfef35c14c732e15e83ce4674034eddfc136b
af0e482f81ed77c86b0e67ad5f1a7f7dbefda348 25-May-2016 Richard Uhler <ruhler@google.com> Don't use dlopen on host for already loaded oat files.

Because the behavior of dlopen on the host is different then the
target in that case, and it causes tests to fail.

Bug: 28826195

(cherry picked from commit a206c745dbb64b14f05c87891d425475c2f6d63a)

Change-Id: I29b04be07b4d26dc1ac5e6f35550745eb15e6728
a206c745dbb64b14f05c87891d425475c2f6d63a 25-May-2016 Richard Uhler <ruhler@google.com> Don't use dlopen on host for already loaded oat files.

Because the behavior of dlopen on the host is different then the
target in that case, and it causes tests to fail.

Bug: 28826195

Change-Id: Id202bbac3318bade89a4133a9bcb1ee01e8b6182
01be68100e96a44b4ff8cb4cb3c9baa346ff048d 17-May-2016 Richard Uhler <ruhler@google.com> Only compile dex files if they are not up to date.

Instead of trying to compile them all the time, and relying on file
permissions to keep us from overwriting up-to-date dex files with
different compiler filters.

Bug: 27641809
Bug: 28639246
Bug: 28826195
Change-Id: Ie717089d58517427b6f9a522b48146761c57a1a9
6619cdd9f133c90f5d3a28d7723887b888a9f45a 17-May-2016 Richard Uhler <ruhler@google.com> Only compile dex files if they are not up to date.

Instead of trying to compile them all the time, and relying on file
permissions to keep us from overwriting up-to-date dex files with
different compiler filters.

Bug: 27641809
Bug: 28639246
Bug: 28826195
Change-Id: Ie717089d58517427b6f9a522b48146761c57a1a9
f0192c86a58b2f43378c9a2113007538dd38ddbf 29-Mar-2016 Jeff Hao <jeffhao@google.com> Support to pass <uses-library> option through to dex2oat.

This change takes an app's shared libraries specified by <uses-library>
and passes it through to dex2oat to be used during compilation.

Part of a multi-project change.

Bug: 26880306

(cherry-picked from commit 26e8a2f150cd7f7195a10650ab8a5b6fa5014bc8)

Change-Id: I72a352abdfc37eacd8bedfa6c218e3809ca8e39c
f4b3487ee77e3c2e3d5372ae9e857cd3429bb808 13-Apr-2016 Richard Uhler <ruhler@google.com> Remove -XOatFileManagerCompilerFilter argument.

Instead use the value of '-Xcompiler-option --compiler-filter=XXX' for
the target compiler filter to use to determine if the runtime should
try to invoke dex2oat when oat files are loaded.

Bug: 27641809
Change-Id: I1856e0e37df91835b81105567c70d8a285a88f62
5872d7cd6ceffe67550d0b021191ec66f1a34c5d 27-Apr-2016 Jeff Hao <jeffhao@google.com> Support to pass <uses-library> option through to dex2oat.

This change takes an app's shared libraries specified by <uses-library>
and passes it through to dex2oat to be used during compilation.

Part of a multi-project change.

Includes fix from a6d46161aea07ebd1cbd6ab78b2b323f940e9c1e

Bug: 26880306

(cherry-picked from commit 26e8a2f150cd7f7195a10650ab8a5b6fa5014bc8)

Change-Id: I6bfc13693dbb835ca52fed2d03ec5346d43ec5d9
0b791279f67b0f4b72db991707b16b737871bcde 18-Apr-2016 Calin Juravle <calin@google.com> Skip profiling if the dex file is fully compiled

The OatFile does not store the original dex location that was used to
compile the file. So in order to get the oat file for a given code path
we need to iterate over the inner oat dex files and check against them.

Also, we used to pass the unfiltered code_paths set to the saver which
would make the filtering useless. This fixes the parameter passing as
well.

Bug: 27893309

(cherry picked from commit 7506423b2b9ea13fc5fa9711ab0106977876a5a2)

Change-Id: I99388dee40f2d0e70f970b3f5c6a4171a7e97c0e
26e8a2f150cd7f7195a10650ab8a5b6fa5014bc8 29-Mar-2016 Jeff Hao <jeffhao@google.com> Support to pass <uses-library> option through to dex2oat.

This change takes an app's shared libraries specified by <uses-library>
and passes it through to dex2oat to be used during compilation.

Part of a multi-project change.

Bug: 26880306

Change-Id: Ib70a48ff700a5db9a5b4aaf731552556878ad8f7
25792ae2011efa1832a81280f99cfc0f0b0bb78e 20-Apr-2016 Alex Light <allight@google.com> Make dex file loading failure more explicit about failure.

We make sure that if we fail to load a dex file due to having an
unsupported dex version number we will say so explicitly in the
exceptions.

Bug: 28269864
Change-Id: I3c61d088cd0d04cf2a02246e69a4161180e3f2d8
(cherry picked from commit 3045b66613404fa973aafc8c2aae3728e9c12d9a)
3045b66613404fa973aafc8c2aae3728e9c12d9a 20-Apr-2016 Alex Light <allight@google.com> Make dex file loading failure more explicit about failure.

We make sure that if we fail to load a dex file due to having an
unsupported dex version number we will say so explicitly in the
exceptions.

Bug: 28269864
Change-Id: I3c61d088cd0d04cf2a02246e69a4161180e3f2d8
7506423b2b9ea13fc5fa9711ab0106977876a5a2 18-Apr-2016 Calin Juravle <calin@google.com> Skip profiling if the dex file is fully compiled

The OatFile does not store the original dex location that was used to
compile the file. So in order to get the oat file for a given code path
we need to iterate over the inner oat dex files and check against them.

Also, we used to pass the unfiltered code_paths set to the saver which
would make the filtering useless. This fixes the parameter passing as
well.

Bug: 27893309
Change-Id: Ia95d61a82a9e74769ebf3329bb1f9c714bcff27f
1153ae16f243adb30fc8509c619025d30408c74a 04-Apr-2016 Richard Uhler <ruhler@google.com> Restore fallback behavior in the no-image stripped-dex case.

Add --strip-dex option to run-test to test this case.

Bug: 27599626

(cherry picked from commit 76f5cb6026b9c83bf00fd1007703503a327f704d)

Change-Id: I96bd2b013dd11ca1256f259181ea9c6087f16287
76f5cb6026b9c83bf00fd1007703503a327f704d 04-Apr-2016 Richard Uhler <ruhler@google.com> Restore fallback behavior in the no-image stripped-dex case.

Add --strip-dex option to run-test to test this case.

Bug: 27599626
Change-Id: I010543f48c39adbda007e2e05dda62ac1d70715c
ff0274bd8a67e3512ff85cc05b77fd01df368638 30-Mar-2016 Richard Uhler <ruhler@google.com> Refine OatFileAssistant.MakeUpToDate failure result.

Avoid misleading log messages if MakeUpToDate fails because we decided
not to compile dex code.

Bug: 27641809
(cherry picked from commit 1e860619cdcc9c0b6a202a247c50cf7633ac7b74)

Change-Id: Iab6f8ff2756393bfe3a7be4643e908be648bd10d
1e860619cdcc9c0b6a202a247c50cf7633ac7b74 30-Mar-2016 Richard Uhler <ruhler@google.com> Refine OatFileAssistant.MakeUpToDate failure result.

Avoid misleading log messages if MakeUpToDate fails because we decided
not to compile dex code.

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

This reverts commit 845e5064580bd37ad5014f7aa0d078be7265464d.

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

(cherry picked from commit 29d38e77c553c6cf71fc4dafe2d22b4e3f814872)

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

This reverts commit 845e5064580bd37ad5014f7aa0d078be7265464d.

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

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

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

Bug: 27689078

This reverts commit a62d2f04a6ecf804f8a78e722a6ca8ccb2dfa931.

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

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

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

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

Bug: 27689078
Change-Id: Id6706d0ed91b45f307142692ea4316aa9713b023
04680f3d7b021a0afb460266d442f564186a3b6f 17-Mar-2016 Nicolas Geoffray <ngeoffray@google.com> Dump oat file information as part of DumpForSigQuit.

Change-Id: Ie8d256d8fa16565105cfe5c39cc96826983469da
b077e15d2d11b7c81aacbcd4a46c2b1e9c9ba20d 18-Feb-2016 Calin Juravle <calin@google.com> Update GetDexOptNeeded to handle different levels of compilation

extract-only or profile-guide oat files are considered up to date from
runtime perspective as they don't necessary need (re)compilation or
relocation. However, it is useful to return a more refined code to the
caller so that they can decide whether or not that's good enough.

For example, the package manager might decide to still compile a
previous extract-only and during profile guide compilation we should
always recompile even if we have an oat file.

Note that dex files compiled via ClassLoaders will still be fully
compiled.

This change introduces:
- a new key in the oat header kCompilationType to capture what type of
compilation has been made. Note tha the key might be missing. The
distinction is needed in order to avoid recompilation of a previous
fully compiled file during profile guide compilation analysis.
- a new argument to GetDexOptNeeded which tells the runtime to cast its
opinion whether or not the oat file is up to date relative to the
desired target type of compilation.

Bug: 27189430

(cherry picked from commit d91b8a2464b99625efe03caf7d30c8372bc378ed)

Change-Id: I6ce450350f388451f7bab7d285c1846d539a4b13
32ce2adefb8a3d0eda59a29f5e87c1eb43eef796 04-Mar-2016 Mathieu Chartier <mathieuc@google.com> Add more systracing everywhere

Added to:
JIT
DexFile functions
Oat file manager

Added helper ScopedTrace to prevent errors and reduce excess code.

Bug: 27502458

(cherry picked from commit dabdc0fe183d4684f3cf4d70cb09d318cff81b42)

Change-Id: Ifaeff8913d79eefc797380987d13cc00456266f8
dabdc0fe183d4684f3cf4d70cb09d318cff81b42 04-Mar-2016 Mathieu Chartier <mathieuc@google.com> Add more systracing everywhere

Added to:
JIT
DexFile functions
Oat file manager

Added helper ScopedTrace to prevent errors and reduce excess code.

Bug: 27502458

Change-Id: Ifaeff8913d79eefc797380987d13cc00456266f8
d91b8a2464b99625efe03caf7d30c8372bc378ed 18-Feb-2016 Calin Juravle <calin@google.com> Update GetDexOptNeeded to handle the different levels of compilation

extract-only or profile-guide oat files are considered up to date from
runtime perspective as they don't necessary need (re)compilation or
relocation. However, it is useful to return a more refined code to the
caller so that they can decide whether or not that's good enough.

For example, the package manager might decide to still compile a
previous extract-only and during profile guide compilation we should
always recompile even if we have an oat file.

Note that dex files compiled via ClassLoaders will still be fully
compiled.

This change introduces:
- a new key in the oat header kCompilationType to capture what type of
compilation has been made. Note tha the key might be missing. The
distinction is needed in order to avoid recompilation of a previous
fully compiled file during profile guide compilation analysis.
- a new argument to GetDexOptNeeded which tells the runtime to cast its
opinion whether or not the oat file is up to date relative to the
desired target type of compilation.

Bug: 27189430
Change-Id: Icd9794b1df6f6e21242e1dd1d5b5d064963dbbb7
c90bc92bc577020ff4d3caced4cee1cdf41fa5de 24-Feb-2016 Calin Juravle <calin@google.com> Record foreign dex files loaded by the app in the profile

A foreign dex file is a file which is not owned by the app
(it's not part of its code paths or its private data directory).

When such a dex file is loaded by the app, the runtime will record
a marker in a dedicated profile folder (foreing_dex_profile_path).
The marker is just a file named after the canonical location of the
dex file where '/' is replaced by '@'.

The markers will be used by the system server system server to
decide if the apk should be fully or profile guide compiled.

Bug: 27334750
Bug: 26080105

(cherry picked from commit 86a9ebe4197e963249ffbbaa1830da97ed642fa5)

Change-Id: I8be1fd4d854fa1e23c3c1054c9c083ad7b27317b
86a9ebe4197e963249ffbbaa1830da97ed642fa5 24-Feb-2016 Calin Juravle <calin@google.com> Record foreign dex files loaded by the app in the profile

A foreign dex file is a file which is not owned by the app
(it's not part of its code paths or its private data directory).

When such a dex file is loaded by the app, the runtime will record
a marker in a dedicated profile folder (foreing_dex_profile_path).
The marker is just a file named after the canonical location of the
dex file where '/' is replaced by '@'.

The markers will be used by the system server system server to
decide if the apk should be fully or profile guide compiled.

Bug: 27334750
Bug: 26080105
Change-Id: If4fa8208be4e2f6f0b748b8a5417c4ae9c2d5df6
167e638ffd46186ef4fa26d1c0b6c7e00ed51ccb 25-Feb-2016 Mathieu Chartier <mathieuc@google.com> Add lz4hc image compression format

Smaller than lz4 and decompresses at the same speed. Compression is
a bit slower.

Example saves on old FB APK:
Uncompressed: 44748800 bytes
LZ4: 12443648 bytes
LZ4HC: 11055104 bytes

Generating the image slows down by ~1s per 20MB of image due to
slower compression. Decompression is about the same speed but there
should be a slight speedup since less data needs to be read from
flash.

Added test.

Bug: 22858531

(cherry picked from commit a6e81ed4c185b7362cd5199ebe5507d00883a9b0)

Change-Id: Idd0bbe1ea45fc6ab75a42bfeb0ef250e8b3e2f1b
a6e81ed4c185b7362cd5199ebe5507d00883a9b0 25-Feb-2016 Mathieu Chartier <mathieuc@google.com> Add lz4hc image compression format

Smaller than lz4 and decompresses at the same speed. Compression is
a bit slower.

Example saves on old FB APK:
Uncompressed: 44748800 bytes
LZ4: 12443648 bytes
LZ4HC: 11055104 bytes

Generating the image slows down by ~1s per 20MB of image due to
slower compression. Decompression is about the same speed but there
should be a slight speedup since less data needs to be read from
flash.

Added test.

Bug: 22858531

Change-Id: Ib2704305b9bec5b0ba3b1e871f59f4eedff330b7
6cc91e4d8c5956d3c4323b416f2a344bf848f741 12-Feb-2016 Mathieu Chartier <mathieuc@google.com> Fix app image memory leak

There was a memory leak if we failed to add an image space, this
was caused by releasing ownership without adding it to the heap.

Bug: 22858531

(cherry picked from commit bd064ea2269b23360e32e8139c22d5993ddc385b)

Change-Id: Ib45c0140b82cee5da04ed4a9f101f7c554cb25da
bd064ea2269b23360e32e8139c22d5993ddc385b 12-Feb-2016 Mathieu Chartier <mathieuc@google.com> Fix app image memory leak

There was a memory leak if we failed to add an image space, this
was caused by releasing ownership without adding it to the heap.

Bug: 22858531

Change-Id: Ia3c97ec822ca5362f52008e813fa434107198bc9
61d2b2d353ba4ab952247d2bff2c905598118bb4 04-Feb-2016 Mathieu Chartier <mathieuc@google.com> Use GC critical section for adding and removing app images

A SuspendAll was not sufficient since there are points during the GC
when the mutator lock can be temporarily released. This was causing
at least some assert failures in CC such as attempting to clear
black read barrier pointers on app image objects with white read
barrier pointers.

Bug: 26979834
Bug: 26970811
Bug: 26786304
Bug: 22858531

Change-Id: I375fc05e787e629c40de6f345802447c02601ff0
c8c562c2dc145c9ba2d85634cb78bc56e5e3470e 03-Feb-2016 Mathieu Chartier <mathieuc@google.com> Revert "Disable app images for now"

Bug: 26872785
Bug: 22858531

This reverts commit 090cc319f64413e7c3c9d5ae106753d8ebbfd02f.
090cc319f64413e7c3c9d5ae106753d8ebbfd02f 29-Jan-2016 Mathieu Chartier <mathieuc@google.com> Disable app images for now

Until we figure out why there are crashes.

Bug: 26872785
Bug: 22858531
Change-Id: I1c5f187a7671bbd16aa6651aacb61ee8bbd44e57
a9d82fe8bc6960b565245b920e99107a824ca515 26-Jan-2016 Mathieu Chartier <mathieuc@google.com> Use mutator lock to guard adding and removing heap spaces

Too hard to add a new lock since dlmalloc ArtMoreCore requires
looping through the spaces while holding the allocator lock.

Bug: 22858531
Change-Id: Ieac2136da02c766b6795cd604a58798bee37ef2a
fbc31087932a65e036a153afab3049dc5298656a 24-Jan-2016 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Load app images""

This reverts commit 1bc977cf2f8199311a97f2ba9431a184540e3e9c.

Bug: 22858531

Change-Id: Ide00bf3a73a02cba3bb364177204ad1b13f70295
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
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
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
a28267fdbcafbbc08bae56c5997c8ffa9a008c50 16-Dec-2015 Nicolas Geoffray <ngeoffray@google.com> Update to INFO to not confuse adb logcat readers.

With the move to JIT, we can get such warnings as we may not
have an oat file and ART does not have the rights to create it.

We're working on a cleaner solution that will avoid emitting the
message.

bug:26217329

Change-Id: If4418274d0fb9bd9f79f5b504b82c197228a34a7
e722d2921615102941ca4b6717c9d9e1edae1192 15-Dec-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "Make the JIT the default in ART."

Few tests failing: oat_file_assistant_test and jit run tests.

This reverts commit 0a9b6826bc6e71d799eb3fe8829981597b890dee.

Change-Id: Ibbf73c191d244ebb9517b6ae97971dd9a9d37d7c
0a9b6826bc6e71d799eb3fe8829981597b890dee 11-Dec-2015 Nicolas Geoffray <ngeoffray@google.com> Make the JIT the default in ART.

Also don't dex2oat an application by default when the JIT is enabled.

Change-Id: I32673e80b966f24ca0f153a3e5b9aacaa1931107
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
80b37b7e679a530738c9bcbd39873b6dacf177e5 13-Oct-2015 Mathieu Chartier <mathieuc@google.com> Fix structural class checks

Enabled for debug builds to prevent bit rotting. Changed
DexFileAndClassPair to work with std::queue.

Re-enabled structural check tests.

Change-Id: Ia981564650bf1c7e418d8a73efcc15733ddf7501
e58991b3b2282b5761f1a6023a16c803e1c4eb45 13-Oct-2015 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Unload oat files""

Fixed a race where two threads calling OatFile::Open could both use
dlopen on the host.

Bug: 22720414

This reverts commit 72da5e7461fec3b1e116050f2e6f233efb9c54f3.

Change-Id: I1636045b724944d2a09417527280784967957095
72da5e7461fec3b1e116050f2e6f233efb9c54f3 13-Oct-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "Unload oat files"

Tentative, will monitor bots if flakiness is fixed.

Bug: 22720414

This reverts commit 18656fefc7e68e2549a8fa93455074d359d1efa8.

Change-Id: I53b645b73207ccd21cad6ddac1de483bcc158794
18656fefc7e68e2549a8fa93455074d359d1efa8 10-Oct-2015 Mathieu Chartier <mathieuc@google.com> Unload oat files

Unregister and delete oat file when we call DexFile.closeDexFile if
all of the dex files are no longer in use. We store the oat file as
the first element of the dex files array (cookie).

Added a test that reads the proc maps to ensure there are no
unload-ex maps. Also some clean up.

Bug: 22720414

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

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

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

Bug: 22720414

Change-Id: I0321096723a294dc72949f21e66da82727b512fc