summaryrefslogtreecommitdiffstats
path: root/runtime/oat_file.cc
Commit message (Collapse)AuthorAgeFilesLines
* Allow stripped-down OatDexFile in system server.David Srbecky2019-05-151-2/+3
| | | | | | | | | (cherry picked from commit b5649f9b2bce5f4e90be7e2ccfbb9e33ff3105a0) Bug: 119800099 Test: boot Change-Id: I9b435eb87904b4b95e5f6e9c49b4353605e23a6a Merged-In: I6629ea1a96dcc945dda532720c7cc7c4dc305ab7
* Special case one class in jit zygote.Nicolas Geoffray2019-04-171-1/+1
| | | | | | | | | | | | Also remove obsolete comments. Bug: 119800099 Test: ZygoteServer.runSelectLoop not compiled at app startup (cherry picked from commit b10f02828b869cf6505bbd6eef6d2ae332c4e91b) Change-Id: I16b37d8ccc81606670b160fa1f9a6ad8873d0a9f Merged-In: Ie5834f411fa039ec4b299cd7c47c2de975d3492a
* jitzygote: create a type lookup table at runtime for bootclasspath dex files.Nicolas Geoffray2019-04-121-1/+3
| | | | | | | | | | | | | The normal configuration has them in the oat files. Create them at boot in the jitzygote configuration. Test: m Bug: 119800099 (cherry picked from commit dc2fbb6d9834733214c6cdedbacd526603754a74) Change-Id: I3a9bfd1db9bb09c8291807c408f5bd2691d982da Merged-In: I9ee1690d9541b70eba06818b91865bc603266bf6
* Fix dex location of boot oat files during preoptDavid Brazdil2019-04-111-39/+86
| | | | | | | | | | | | | | | | | | | | | | Dex location should reflect the path on target when preopting on host. This previously did not hold and this patch fixes the issue. Other paths remain the same as before. A DCHECK is added to class linker to guarantee that -Xboot-classpath-locations is not ignored. Simultaneously it refactors the logic for resolving a relative path to make it clearer which path is used for opening files (dex file name) and which reflects the location on target (dex location), as these differ when preopting. The patch also adds a missing dex2oat dependency for oat_file_test. Test: test-art-gtest-{host,target}-oat_file_test Test: compiles, no DCHECK crashes Bug: 129063331 Merged-In: I0629c7ee505b5fd50649800bb3e08efc1ee44102 Change-Id: I0629c7ee505b5fd50649800bb3e08efc1ee44102 (cherry picked from commit 3e8aae03770a4acceff2f7fb7d6db68e05602d84)
* Preverify InMemoryDexClassLoader-loaded classes from vdexDavid Brazdil2019-04-031-0/+150
| | | | | | | | | | | | This patch creates a new subclass of OatFile - OatFileBackedByVdex - which initializes OatDexClass instances using the verification info in a vdex file created by a previous instance of the class loader. The OatFile is not backed by an actual .oat file. Bug: 72131483 Test: art/tools/run-libcore-tests.sh Test: art/test.py -b -r -t 692 -t 693 Change-Id: I3fd055abe17ee9739c07f2e2f4fc2543e4ec8c9e
* Remove our custom elf.h header.David Srbecky2019-04-021-3/+0
| | | | | | | | It tends to clash with the system header, which we can use instead. Bug: 73344075 Test: Generated oat files on host are identical. Change-Id: I12db1dd9e9ec039d7c157650dc6cb61fe6a2524a
* Move elf_utils.h to libelffile library as well.David Srbecky2019-03-251-1/+1
| | | | | | | | Also move some of our ART-specific utils form elf.h. Bug: 73344075 Test: generated oat files on host are identical. Change-Id: I587afc30875b9ddb57220fb3d4e764f9bb7a0e25
* Return the same dex location for dex file whether backed by dex file or not.Nicolas Geoffray2019-03-221-8/+12
| | | | | | Bug: 126901248 Test: oat_file_assistant_test Change-Id: Idae49fb00bfad7007cc55e53a83e4a3e42f53e07
* Create libelffile library for ELF file manipulation.David Srbecky2019-03-201-0/+3
| | | | | | | | | | | Move some of our tooling to library to make it reusable. Remove MIPS support from the ELF builder. This is slightly easier than making it independent of the runtime. Bug: 110133331 Test: test.py -b --host Change-Id: I93343808d0e27ee8e1117e713a2503e8179fc245
* ART: Move .bss mappings check before .bss init.Vladimir Marko2019-02-061-35/+78
| | | | | | | | | | | | | Previously the check was done before we compared the dex file checksums, so an out of date oat file could have failed the check. Now we're doing the check only if we're initializing the .bss section for use by an executable oat file, i.e. after matching the dex file checksums. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 119601889 Change-Id: Ib79d84c5bc2cf0674fc1f76071c589d49663e13c
* Replace StringPiece with std::string_view in OatFile.Vladimir Marko2019-02-041-5/+5
| | | | | | | Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 123750182 Change-Id: Ia5a3c0bb5fdfba7cf88b82768c6722493e258554
* Selectively allow dead reference eliminationHans Boehm2019-01-281-0/+10
| | | | | | | | | | | | | | | | | Allow dead reference elimination in methods not containing @ReachabilitySensitive accesses or calls, when the class is marked @DeadReferenceSafe. Add 1339-dead-reference-safe to aggressively check that everything works as intended. Bug: 111453875 Test: art/test/testrunner/testrunner.py --host --64 -t 1339-dead-reference-safe Detect ReachabilitySensitive annotations. Change-Id: I70c20431fdbcfcfd2692b2255d12ad59e37cb669
* Adjust ResolveRelativeEncodedDexLocation.Nicolas Geoffray2019-01-241-12/+15
| | | | | | | | | | | | | | | | Now that jar files are in the apex, relax the prefix check between the absolute location of the oat file and the jar location for host compilation. For example we now have: - /system/framework/boot-core-oj.art - /apex/com.android.runtime/core-oj.jar Whereas before, the jar and the art file had the same prefix path. Test: m Change-Id: Ic216229dab7a853c64c98a36e32b387559f9cc0d
* ART: Move dex structs into own headerAndreas Gampe2019-01-021-6/+8
| | | | | | | | | Separating out the structs from DexFile allows them to be forward- declared, which reduces the need to include the dex_file header. Bug: 119869270 Test: m Change-Id: I32dde5a632884bca7435cd584b4a81883de2e7b4
* Keep dex location from OatDexFile.Vladimir Marko2018-12-191-5/+5
| | | | | | | | | | | | | | | This is needed for loading boot image with -Xbootclasspath: and -Xbootclasspath-locations: for app preopt. These options are necessary for loading additional components of the boot class path for preopt with a partial boot image. Test: Pixel 2 XL boots. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: m test-art-target-gtest Test: testrunner.py --target --optimizing Bug: 119868597 Change-Id: I5e42f85c08eb9126c1045258deacc55fc7eebe00
* C++17 compatibility: make WITH_TIDY=1 happy again.Elliott Hughes2018-11-291-1/+1
| | | | | | Bug: http://b/111067277 Test: builds Change-Id: I8b69ea3815e14bb6eb27f40c0dd01a85b340a355
* ART: Avoid some tidy nullptr warningsAndreas Gampe2018-11-201-1/+8
| | | | | | | | Sprinkle some (D)CHECKs to tell tidy our expectations. Bug: 32619234 Test: m test-art-host Change-Id: I315b1602b20475402dd8383e1accc49e5a63eb5c
* ART: Clean up android_dlopen_ext() call.Vladimir Marko2018-11-011-5/+2
| | | | | | | | | Remove the unnecessary ANDROID_DLEXT_FORCE_FIXED_VADDR flag. We do not produce oat files with non-zero minimum `p_vaddr`. Test: Pixel 2 XL boots. Test: m test-art-host-gtest Change-Id: I892eb10798f3c72544d100a5968f08309b980b60
* ART: Refactor for bugprone-argument-commentAndreas Gampe2018-10-231-1/+1
| | | | | | | | Handles runtime. Bug: 116054210 Test: WITH_TIDY=1 mmma art Change-Id: Ibc0d5086809d647f0ce4df5452eb84442d27ecf0
* Remove oat_data_begin checks from OatFile.Vladimir Marko2018-10-171-49/+25
| | | | | | | | | | | | | | | Make it a CHECK() directly in the ImageSpace instead. This check was a rather weird way to prevent the use of dlopen() for boot image on host because it would load the oat file at the wrong address. This is now done by refusing to use dlopen() on host when we have a memory `reservation`. Also clean up affected files for bugprone-argument-comment. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 77856493 Change-Id: I6f0f9d5a0542574017d98acc2f4f30a585b483f4
* Revert^2 "ART: Refactor typedef to using"Andreas Gampe2018-09-201-1/+1
| | | | | | | | | | | This reverts commit ee07743e03042c2ca36e0c9513847a9e7d2509f1. Reason for revert: fixed attributes. Bug: 32619234 Test: m test-art-host Test: m test-art-target-gtest-unstarted_runtime_test Change-Id: I6f0a775adfdf6ecd132b470f7c5446e949872e20
* Revert "ART: Refactor typedef to using"Andreas Gampe2018-09-201-1/+1
| | | | | | | | | This reverts commit 9a20ff06f7ccee08a742c315ec6d351ab56ba1cd. Reason for revert: Attributes on the wrong side. Bug: 32619234 Change-Id: I8fd2abef619b22c02ccfbf5ae629339f1a60918b
* ART: Refactor typedef to usingAndreas Gampe2018-09-191-1/+1
| | | | | | | | Add clang-tidy's modernize-use-using. Bug: 32619234 Test: WITH_TIDY=1 mmma art Change-Id: If50d37b5152af4270784e3cde7951292a9e19033
* Remove PIC option from oat files.Vladimir Marko2018-09-041-5/+0
| | | | | | | | | | | | | | | dex2oat has been producing only PIC code for some time, so there's no need to record it in the oat file anymore. Also get rid of the now unnecessary relocation logic that was using the flag. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: Pixel 2 XL boots. Test: m test-art-target-gtest Test: testrunner.py --target --optimizing Bug: 77856493 Change-Id: I070071ca5a808371f67883f4ae93d633a76231d0
* Merge changes from topic "fdsan_art_fdfile"Josh Gao2018-08-311-2/+2
|\ | | | | | | | | | | | | | | | | * changes: Fix various benign double fdsan warnings in tests. Use fdsan in FdFile. Clean up FdFile constructors. Remove FdFile::DisableAutoClose. Add DupCloexec to atomically dup and set FD_CLOEXEC.
| * Remove FdFile::DisableAutoClose.Josh Gao2018-08-301-2/+2
| | | | | | | | | | | | | | | | | | Remove a footgun that also makes it impossible to use fdsan, since we don't know whether the FdFile actually owns the fd or not. Bug: http://b/113558485 Test: mma Change-Id: I6a7767c33925db631852579f75d2def9ff6a44d5
* | Fix DlOpenOatFile::Dlopen() for mac build.Vladimir Marko2018-08-311-1/+1
| | | | | | | | | | | | Test: none Bug: 77856493 Change-Id: I23d84da604f4bf85c66957434a9fefbf6e4e28ae
* | Reserve boot image memory in one go.Vladimir Marko2018-08-311-78/+152
|/ | | | | | | | | | | | Load boot image components into the reserved memory. Test: m test-art-host-gtest Test: testrunner.py --host Test: Pixel 2 XL boots. Test: m test-art-target-gtest Test: testrunner.py --target --optimizing Bug: 77856493 Change-Id: I214f947979bc0bbfc6df4312527504e90b88a01d
* Use 'final' and 'override' specifiers directly in ART.Roland Levillain2018-08-281-11/+11
| | | | | | | | | | | | | | | Remove all uses of macros 'FINAL' and 'OVERRIDE' and replace them with 'final' and 'override' specifiers. Remove all definitions of these macros as well, which were located in these files: - libartbase/base/macros.h - test/913-heaps/heaps.cc - test/ti-agent/ti_macros.h ART is now using C++14; the 'final' and 'override' specifiers have been introduced in C++11. Test: mmma art Change-Id: I256c7758155a71a2940ef2574925a44076feeebf
* Remove unnecessary indirection from MemMap.Vladimir Marko2018-08-211-4/+4
| | | | | | | | | | | | | | | | | | Avoid plain MemMap pointers being passed around by changing the MemMap to moveable and return MemMap objects by value. Previously we could have a valid zero-size MemMap but this is now forbidden. MemMap::RemapAtEnd() is changed to avoid the explicit call to munmap(); mmap() with MAP_FIXED automatically removes old mappings for overlapping regions. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: Pixel 2 XL boots. Test: m test-art-target-gtest Test: testrunner.py --target --optimizing Change-Id: I12bd453c26a396edc20eb141bfd4dad20923f170
* ART: Do not use std::<container>::at().Vladimir Marko2018-07-031-1/+1
| | | | | | | | | | These functions are specified as throwing std::out_of_range and we do not use exceptions. Test: m Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: I67c365ed6d779c101a18b9f386c751c48ca76e16
* ART: Finish old move of OatDexFileAndreas Gampe2018-06-261-29/+28
| | | | | | | | The class has been made standalone so it can be forward-declared, but not all nested references had been updated. Test: mmma art Change-Id: Idc5f0af24af17dcae286dee290f729ba61693a11
* Add low_4gb MemMap and remove ashmem support for FuchsiaSteve Austin2018-06-211-1/+2
| | | | | Test: Tested with Fuchsia build system go/fuchsia-android Change-Id: I61b09614d6f4d24bf9c975baa1f34c6b5735ca3d
* Rewrite TypeLookupTable.Vladimir Marko2018-06-041-3/+5
| | | | | | | | | | | | | | Improve bit-packing of the data to store twice as many bits of the hash as previously. Check for bucket mismatch after the first partial hash conflict (previous comments alluded to the bucket check but it was not implemented). Avoid an unnecessary unique_ptr<> indirection by making the TypeLookupTable moveable. Test: Rely on Treehugger. Bug: 79514364 Change-Id: I9fa6f712b037a6e6904d09c88670966486f56621
* Remove MemMap dependency on libbacktraceDavid Sehr2018-05-111-4/+4
| | | | | | | | | | | | | | | | Remove the dependency on BacktraceMap/libbacktrace for MemMap. The removed code was entirely debug, but we may want to add back some of it to facilitate test debugging. This removes the dependency from libartbase on libbacktrace and makes it possible to use libartbase from libdexflie without causing a cyclic dependency. This facilitates moving ArtDexFileLoader and some other code into libartbase, and gets rid of some debt accumulated during all these refactorings. Bug: 78652467 Test: make -j 50 checkbuild Change-Id: Ic575a764817ba660b851f7d5b5c60e43f8356fea
* Pass the fd to OatFile::Setup to avoid selinux errors.Nicolas Geoffray2018-04-241-31/+60
| | | | | | bug: 77853712 Test: test.py Change-Id: I069cda5296b561284d71b067924e1bc4a8562710
* Merge "Move profile dependent modules to libartbase"Treehugger Robot2018-04-131-1/+1
|\
| * Move profile dependent modules to libartbaseDavid Sehr2018-04-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | Move mem_map and zip_archive to libartbase. This should be the last two remaining modules that profile_compilation_info is dependent upon. Bug: 22322814 Test: make -j 50 checkbuild make and boot a device Change-Id: I136ee23e426aa8ec7441e3d3f1978f1bebf4b562
* | Move more runtime code to libartbase, libdexfileDavid Sehr2018-04-091-1/+1
|/ | | | | | | | | Move some code that logically belongs to libartbase or libdexfile to those places respectively. Bug: 22322814 Test: make -j 50 checkbuild Change-Id: Idfded5d24b40d8587011681e6235b6672846da19
* Merge "Retrieve String/Class references from .data.bimg.rel.ro."Vladimir Marko2018-03-091-69/+9
|\
| * Retrieve String/Class references from .data.bimg.rel.ro.Vladimir Marko2018-03-081-69/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | For PIC AOT-compiled app, use the .data.bimg.rel.ro to load the boot image String/Class references instead of using the mmapped boot image ClassTable and InternTable. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing --pictest --npictest Test: Pixel 2 XL boots. Test: testrunner.py --target --optimizing --pictest --npictest Bug: 71526895 Change-Id: Id5703229777aecb589a933a41f92e44d3ec02a3d
* | Merge "Load ArtMethod* from .data.bimg.rel.ro entries."Vladimir Marko2018-03-081-17/+58
|\|
| * Load ArtMethod* from .data.bimg.rel.ro entries.Vladimir Marko2018-03-081-17/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce a new .data.bimg.rel.ro section in oat files where we store offsets of boot image objects from the beginning of the boot image. At runtime we relocate these entries using the actual boot image address to turn offsets to pointers. Use the .data.bimg.rel.ro to prepare the boot image methods used by HInvokeStaticOrDirect for PIC AOT app compilation. Loading the ArtMethod* from .data.bimg.rel.ro instead of the .bss avoids the initial call to the resolution trampoline. Test: Additional test in 522-checker-sharpening Test: m test-art-host-gtest Test: testrunner.py --host --optimizing --pictest --npictest Test: Pixel 2 XL boots. Test: testrunner.py --target --optimizing --pictest --npictest Bug: 71526895 Change-Id: Ie5f5b1f622704877b36730377146e59092e46c0c
* | Move most of runtime/base to libartbase/baseDavid Sehr2018-03-051-5/+5
|/ | | | | | | | | | | | | | 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
* ART: Do not mmap boot image tables for non-executable oat files.Vladimir Marko2018-03-021-0/+2
| | | | | | | | | | | | | Fix zygote crash causing boot loop in fall-back mode (trying to run without boot image) by allowing loading of oat files that need mmapped boot image tables as non-executable without the boot image. No regression test provided (would require boot test). Test: Rely on TreeHugger. Bug: 74092284 Change-Id: Ic233ac470a2ae0151235f9b2145c4aa529348b3a
* Add --compilation-reason option to dex2oatCalin Juravle2018-02-131-0/+4
| | | | | | | | | | | | | The compilation reason is an optional metadata specifying the reason for compiling the apk. If specified, the string will be embedded verbatim in the key value store of the oat file. This will allow a more precise performance monitoring based on the actual reason for compilation (e.g. install time vs background dexopt time). Test: dex2oat_test Bug: 73102540 Change-Id: I73c7fcc73e37a695f1684d9e282c7cc5be3030f8
* ART: Be more robust with multidex uncompressed-dex odex filesAndreas Gampe2018-02-091-0/+31
| | | | | | | | | | | | Reject odex/vdex files that mix embedded and uncompressed dex files. This simplifies the code and allows early detection of mismatches and corruption. Bug: 73086368 Test: m test-art-host Test: m test-art-host-gtest-oat_file_test Test: manual (with bug's environment) Change-Id: Icccb3ca29b6c5f5adefe3735c91b8b6eac113af6
* Revert "Revert "Make libdexfile build independent of runtime dir""David Sehr2018-01-311-1/+1
| | | | | | | | | | This reverts commit 787784f9effb126b5d0d3dc97d544c4a477b5daf. Reason for revert: Bot configuration issue. Change-Id: I6a10bb4a9571f89c7e4dd095f9157e830a44e2de Bug: 22322814 Test: make -j 50 checkbuild
* Revert "Make libdexfile build independent of runtime dir"David Sehr2018-01-301-1/+1
| | | | | | | | This reverts commit b40b7e73469339a6b667b4a2e2b8690112a74dc9. Reason for revert: on device libdexfile.so missing Change-Id: I9bd61a98bef870400580e8c991cb061d3f57fa72
* Make libdexfile build independent of runtime dirDavid Sehr2018-01-301-1/+1
| | | | | | | | | | | | Remove libdexfile's dependency on utils.cc and move utf.cc into /dex. Remove libdexfile's constituent sources from libart and use libdexfile wherever libart is. Also remove some ART-specific interfaces. Libdexfile's tests remain to be converted, plus moving the files to a new directory peer to runtime/. Bug: 22322814 Test: make -j 50 test-art-host Change-Id: Ifaf695216e4a0e43d3aa377984d933f7a2a243c2