summaryrefslogtreecommitdiff
path: root/runtime/class_linker-inl.h
Commit message (Collapse)AuthorAgeFilesLines
* Workaround for b/145491866Nicolas Geoffray2021-03-311-0/+10
| | | | | | | | | Check if the type is resolved before invoking CheckInvokeClassMismatch. Test: test.py Bug: 145491866 Bug: 73760543 Change-Id: I02714480cef2eece614ef487af60d257f070f46b
* Revert "Lazily allocate DexCache arrays."Orion Hodson2021-02-251-12/+46
| | | | | | | | | | This reverts commit 1214319d27e7fb4c4ff00b39799df6f15288098a. Reason for revert: Post-submit fails Bug: b/181097963 Test: TH Change-Id: I9fd21140f1703d0020458b786f48bd39889a9948
* Lazily allocate DexCache arrays.David Srbecky2021-02-231-46/+12
| | | | | | | | | | | We rarely need the DexCache for compiled code. Delay the allocation in hope we never need it. This reduces DexCache memory usage by ~25% at startup. Test: m test-art-host-gtest Test: test.py -r -b --host Change-Id: I680a59c905c2b821ee954e4b32abd5d24876bd11
* Remove pointer-size arguments from DexCache.David Srbecky2021-02-181-6/+5
| | | | | | | | The DexCache is always allocated at runtime now and thus it always has runtime pointer-size. Remove the dead code. Test: m test-art-host-gtest Change-Id: Ic21dc20649e1fd70f8981602d75b5690065aec20
* Prepare compiler for adding VarHandle support.Andra Danciu2020-07-241-0/+1
| | | | | | | | | | | | | | | | | | | This commit prepares the ground for adding VarHandle support in the compiler. The intrinsic locations builder and code generator are now triggered for HInvokePolymorphic nodes. VarHandle and MethodHandle intrinsics are marked as unimplemented rather than unreachable. Since the Varhandle intrinsics are not implemented yet, the functionality is not changed (i.e. the intrinsics are evaluated at runtime and not compiled). I manually tested that the intrinsic Visit* methods are triggered for the VarHandle methods. Bug: b/65872996 Test: art/test.py --host -r -t 713-varhandle-invokers Test: art/test.py --host --all-compiler -r Change-Id: I3333728c5f16d8dc4f92ceae2738ed59b3e31e6a
* Workaround for b/160292234.Nicolas Geoffray2020-07-071-4/+20
| | | | | | | | | Resolve the type if not found before invoking CheckInvokeClassMismatch. Test: test.py Bug: 160292234 Bug: 73760543 Change-Id: Ia8ae4c2fff19af758b5bb7586a13b76972f50711
* Add some logging for diagnosing a crash.Nicolas Geoffray2020-07-031-1/+1
| | | | | | Test: m Bug: 160292234 Change-Id: I578f7b64b4f78ff32d1a4e17ea0570d351ff4980
* Proactively dequicken on debuggable switch.Alex Light2019-12-101-0/+15
| | | | | | | | | | | | | | | | | | Previously we would generally not really consider dex2dex quickening with debuggable processes. This could cause problems for structural redefinition since the -quick opcodes are incompatible with the types of changes structural redefinition allows. Furthermore this can cause some unexpected behavior where (for example) check-casts might appear to pass even if debugger activity should cause it to fail. In order to fix these issues we make the runtime more proactively dequicken dex-files when we start or switch to JAVA_DEBUGGABLE mode. Test: ./test.py --target --host Test: adb install -t ~/misc/Bandhook-Kotlin/app/build/outputs/apk/debug/app-debug.apk && adb shell monkey -p com.antonioleiva.bandhookkotlin -c android.intent.category.LAUNCHER 1 Bug: 134162467 Bug: 144168550 Change-Id: I2673c91b72ae7048d2ff71a1cf68cf552d4e8004
* ART: Move dex structs into own headerAndreas Gampe2019-01-021-2/+4
| | | | | | | | | 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
* ART: Move to using locks.h instead of mutex.hAndreas Gampe2018-12-061-0/+1
| | | | | | | | When only annotating lock requirements, use locks.h. Bug: 119869270 Test: mmma art Change-Id: I1608b03254712feff0072ebad012c3af0cc3dda4
* ART: Fix ResolveType with ArtMethodAndreas Gampe2018-11-211-2/+2
| | | | | | | | | | | | ArtMethods may be obsolete. In that case, the dex cache of the declaring class is not correct. Refactor the code to avoid issues. Partially reverts commit 09c5ca40635faee00f40f6ca0581dd475efd545e. Bug: 119830111 Test: m test-art-host Change-Id: Ibf89af48e6384569c2abd6d5846cf05c929679d0
* ART: Do some include-what-you-useAndreas Gampe2018-10-251-1/+8
| | | | | | | | | Help with transitive includes. In preparation for new specialized headers reducing transitivity. Bug: 118385392 Test: mmma art Change-Id: Ib465ecceec3331ea81588fb4a43eb65e766b6904
* ART: Refactor for bugprone-argument-commentAndreas Gampe2018-10-231-2/+2
| | | | | | | | Handles runtime. Bug: 116054210 Test: WITH_TIDY=1 mmma art Change-Id: Ibc0d5086809d647f0ce4df5452eb84442d27ecf0
* Refactor String resolution.Vladimir Marko2018-06-041-0/+48
| | | | | | | | | | Use the same pattern as type resolution and avoid some unnecessary read barriers in the fast path. Consolidate naming between ArtField and ArtMethod. Test: m test-art-host-gtest Test: testrunner.py --host Change-Id: Iea69129085f61f04a4add09edd0eadbb7ac9ecb2
* ObjPtr<>-ify array allocations.Vladimir Marko2018-06-011-8/+7
| | | | | | | | | And remove some unnecessary calls to ObjPtr<>::Ptr(). Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 31113334 Change-Id: Ie313980f7f23b33b0ccea4fa8d5131d643c59080
* Clean up class resolution and lookup.Vladimir Marko2018-06-011-20/+36
| | | | | | | | | | | Simplify the code and avoid read barriers when appropriate. Relax class status check in ArtField::GetDeclaringClass() because we can see ClassStatus::kIdx from the from-space class object for kReadBarrierOption=kWithoutReadBarrier. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: I83886a64fe5a99a1c3c30eab3b35dae449e6b4bc
* ObjPtr<>-ify ClassLinker::FindClass(), fix 1 stale reference use.Vladimir Marko2018-05-311-2/+2
| | | | | | | | | | Thread::CreateAnnotatedStackTrace() was using a stale reference `aste_array_class`. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 31113334 Change-Id: I191907c0053456bb57de425aa6ccd9668df818a2
* Refactor ClassRoot/GetClassRoot().Vladimir Marko2018-05-251-8/+0
| | | | | | | | | | | | | Move it outside the ClassLinker, into its own header file, and add retrieval based on a mirror class template argument. Keep the SetClassRoot() as a private member of ClassLinker. Make the new GetClassRoot()s return ObjPtr<>. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 31113334 Change-Id: Icbc6b62b41f6ffd65b437297a21eadbb0454e2b7
* Refactor method resolution in class linker.Nicolas Geoffray2018-02-151-8/+1
| | | | | | | | | | | Rewrite all runtime callers of DexCache::SetResolvedMethod to call a shared method that will do the dex cache update. bug: 64759619 Test: test-art-host Test: device boots, runs Change-Id: Icc1aca121030e2864de09667bdbc793b502e3802
* Fix default method verifier check for compact dexMathieu Chartier2018-01-021-1/+1
| | | | | | | | | | | | | | | | | | Add a feature flag and mark if the compact dex file was generated from a dex file that supported default methods or not. This is done to maintain the existing verifier behavior differences for dex files that do and don't support default methods. Fixed callers to use a virtual function instead of always checking the dex file version. Re-enabled run-test 975. Bug: 70930171 Bug: 63756964 Test: test-art-host Change-Id: I46ac5d3cde0d0c9f41cbc68cccaf954b531e0edf
* Do not pass DexFile to ClassLinker::Lookup/ResolveType().Vladimir Marko2017-12-121-24/+92
| | | | | | | | | | | | | The DexFile can be easily retrieved from the DexCache, so reduce the number of arguments that need to be passed. Also refactor the code to avoid doing the DexCache lookup twice and avoid unnecessary read barriers in the initial DexCache lookup (also for Lookup/ResolveField()). Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: Idea9aa42b6a5bade947e93e330b1abdb9d11b2da
* Do not pass DexFile to ClassLinker::Lookup/ResolveMethod().Vladimir Marko2017-12-111-3/+1
| | | | | | | | | The DexFile can be easily retrieved from the DexCache, so reduce the number of arguments that need to be passed. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: I2e47280e7cb8b84595130c4abfb5ece18d7f5c75
* Do not pass DexFile to ClassLinker::ResolveField*().Vladimir Marko2017-12-081-2/+1
| | | | | | | | | The DexFile can be easily retrieved from the DexCache, so reduce the number of arguments that need to be passed. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: I0579db64c63afea789c7c9ad8db81e37c9248e97
* Determine HLoadClass/String load kind early.Vladimir Marko2017-12-081-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This helps save memory by avoiding the allocation of HEnvironment and related objects for AOT references to boot image strings and classes (kBootImage* load kinds) and also for JIT references (kJitTableAddress). Compiling aosp_taimen-userdebug boot image, the most memory hungry method BatteryStats.dumpLocked() needs - before: Used 55105384 bytes of arena memory... ... UseListNode 10009704 Environment 423248 EnvVRegs 20676560 ... - after: Used 50559176 bytes of arena memory... ... UseListNode 8568936 Environment 365680 EnvVRegs 17628704 ... Test: m test-art-host-gtest Test: testrunner.py --host --optimizing --jit Bug: 34053922 Change-Id: I68e73a438e6ac8e8908e6fccf53bbeea8a64a077
* ART: Remove ArtMethod::dex_cache_resolved_methods_.Vladimir Marko2017-08-291-2/+4
| | | | | | | | | 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
* Use class unloading in dex2oat for verify and extractMathieu Chartier2017-07-281-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Unload the main classloader in between each dex file compilation to reduce RAM. This frees the whole java heap and associated linear allocs. This is only used for quickening since filters that do compilation may require loaded classes in the compiler and oat writer. This reduces dex2oat peak PSS for compiling a large app from 196MB to 135MB. Only works for verify and extract since the current approach is incompatible with oat writer patching. b/63911263 Added a verification override that reads the compiled class status to avoid ever verifying classes that were quickened (since this is not supported and causes failures). There is still some duplicated verification for some class with superclasses in other dex files. Support for quicken will be added in a follow up CL. Bug: 63467744 Test: test-art-host Test: test/testrunner/testrunner.py --interpreter --host -j40 Change-Id: Id0e4f84eb5db91d6143f752b498f4832a5b25b6e
* ART: Include cleanupAndreas Gampe2017-07-241-3/+3
| | | | | | | | | | | | | | | | | | | 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
* Hash-based DexCache methods array.Vladimir Marko2017-07-201-31/+27
| | | | | | | | | | | | | | | | | | 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
* ART: Change method lookup to be more consistent to JLS and the RI.Vladimir Marko2017-07-201-23/+128
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The method lookup for different invoke types was previously widely different and didn't work well with the dex cache method array where we have only a single slot for each MethodId. The new behavior is to perform the same lookup for all cases, distinguishing only between interface and non-interface referencing class, and to further align the behavior with the JLS and the RI. Where the JLS conflicts with the RI, we follow the JLS semantics. The new lookup for class methods first searches the methods declared in the superclass chain (ignoring "copied" methods) and only then looks in the "copied" methods. If the search in the superclass chain finds a method that has not been inherited (i.e. either a private method or a package-access method where one of the classes in the chain does not belong to the same package, see JLS 8.4.8), we still search the "copied" methods as there may actually be a method inherited from an interface. This follows the JLS semantics where inherited methods are included in the search (JLS 15.12.2.1) but conflicts with the RI where the private or package-access method takes precedence over methods inherited from interfaces. Note that this search can find an accessible method that is not inherited by the qualifying type, either for a package access method when the referrer is in the same package but the qualifying type is in another package, or for a private method where the referrer is in the same class but the qualifying type is actually a subclass. For the moment we allow such calls and we shall consider whether to throw an IncompatibleClassChangeError in this situation in future to comply with JLS 15.12.4.3. The new lookup for interface methods searches the interface class, then all the superinterfaces and then the java.lang.Object class, see implicitly declared methods in interfaces, JLS 9.2. The search for the maximally-specific non-abstract superinterface method is not yet implemented, but the difference should be difficult to observe as the usual subsequent call to FindVirtualMethodForInterface() should yield the same result for any matching method. The new test 162-method-idx-clash exposes several cases where we previously completely messed up due to the effects of the DexCache, or where we were out of line with the RI. It also tests a case where the JLS and the RI disagree and we follow the JLS. Test: art/test/run-test --host --jvm 162-method-resolution Test: m test-art-host-gtest Test: testrunner.py --host Test: testrunner.py --host --interp-ac Test: Nexus 6P boots. Test: testrunner.py --target Bug: 62855082 Bug: 30627598 Change-Id: If450c8cff2751369011d649c25d28a482a2c61a3
* ART: Add object-readbarrier-inl.hAndreas Gampe2017-04-211-1/+1
| | | | | | | | | Move some read-barrier code into a new header. This prunes the include tree for the concurrent-copying collector. Clean up other related includes. Test: mmma art Change-Id: I40ce4e74f2e5d4c692529ffb4df933230b6fd73e
* ART: Clean up art_method.hAndreas Gampe2017-04-211-47/+0
| | | | | | | | | | | 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
* Revert^2 "Hash-based DexCache field array."Vladimir Marko2017-03-141-4/+11
| | | | | | | | | Test: testrunner.py --host --interpreter Bug: 30627598 This reverts commit 6374c58f2ea403b3a05fb27376110fe4d0fc8e3f. Change-Id: I275508e288a85d3aa08f7405a1a4f362af43b775
* Revert^6 "Hash-based dex cache type array."Vladimir Marko2017-03-141-19/+12
| | | | | | | | | | | | | | | | | 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
* Revert^5 "Hash-based dex cache type array."Vladimir Marko2017-03-131-12/+19
| | | | | | | | | | | | | | | | | | | | 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
* Revert "Hash-based DexCache field array."Vladimir Marko2017-03-131-11/+4
| | | | | | | | | | | | 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
* Hash-based DexCache field array.Vladimir Marko2017-03-101-4/+11
| | | | | | | | 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
* Revert^4 "Hash-based dex cache type array."Vladimir Marko2017-02-201-19/+12
| | | | | | | | | | | | | | | 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
* Revert^3 "Hash-based dex cache type array."Mathieu Chartier2017-02-131-12/+19
| | | | | | | | | | | | | | 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
* Revert^2 "Hash-based dex cache type array."Vladimir Marko2017-02-101-19/+12
| | | | | | | | | | | | | | | | | 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
* Various improvements to stack walking speedMathieu Chartier2017-02-021-1/+1
| | | | | | | | | | | Make BitMemoryRegion constructor inlined, remove read barrier for IsProxyMethod. Around 15% speedup for pmd benchmark, maybe more for CC. Test: test-art-host Change-Id: Ib4392649e041406e538cc944c26c69f68d388fb4
* Revert "Hash-based dex cache type array."Vladimir Marko2017-02-011-12/+19
| | | | | | | | | | | | | | | | 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
* Remove Deoptimization code from class transformation.Alex Light2017-01-301-2/+2
| | | | | | | | | | | | | | | | Since we removed the current_method from the compiled code we don't need to deoptimize all frames anymore. This is a partial revert of commit dba614810. Bug: 32369913 Bug: 33630159 Test: ART_TEST_TRACE=true \ ART_TEST_JIT=true \ ART_TEST_INTERPRETER=true mma -j40 test-art-host Change-Id: I44a6dd89e1d96bd8c82c2c24a2f42fef023a80be
* Hash-based dex cache type array.Vladimir Marko2017-01-301-27/+14
| | | | | | | | | | | 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
* Reduce using ArtMethod's dex_cache_resolved_types_.Vladimir Marko2017-01-171-20/+10
| | | | | | | | | | | | | | | | | | | | | | Avoid using the ArtMethod's dex cache type array shortcut in runtime, preparing for its removal. We do not completely remove the shortcut yet because it is still used by array allocation entrypoints. Fix ArgArray::BuildArgArrayFromObjectArray in reflection.cc to not ask for the parameter type to be resolved. It should have been previously resolved when retrieving the Method. Also partially revert https://android-review.googlesource.com/310717 because it relied on the removed AIOOBE check in the removed ArtMethod::GetDexCacheResolvedType(). The removed check was simply defensive but it could not be triggered without some memory corruption. Test: m test-art-host Bug: 30627598 Change-Id: Ic45a5ff8c66b79429e440cbc08d67bf22a083682
* Merge "Revert "Revert "Revert "Revert "Basic obsolete methods support"""""Treehugger Robot2017-01-051-7/+2
|\
| * Revert "Revert "Revert "Revert "Basic obsolete methods support""""Alex Light2016-12-211-7/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A GetDeclaringClass()->GetDexCache() got inserted during the merge/review process meaning that we would try to access incorrect dex-cache in obsolete methods in some situations. Also when using tracing we would loop forever (or at least until an OOM error) in test 916 due to tracing forcing InterpretOnly mode meaning methods would never be jitted. Bug: 32369913 Bug: 33630159 Test: ART_TEST_TRACE=true \ ART_TEST_JIT=true \ ART_TEST_INTERPRETER=true mma -j40 test-art-host This reverts commit f6abcda293b115a9d7d8a26376ea2dcf2d1dc510. Change-Id: I0773bfcba52e3cd51a83be815c6a50c189558f48
* | Remove racy DCHECK on string dex cache.Nicolas Geoffray2017-01-051-3/+0
|/ | | | | Test: test-art-host Change-Id: I58940031d43d89f434d3c3239a218b99ebb1106b
* Merge "Remove dex cache string from mirror::Class."Nicolas Geoffray2016-12-161-1/+1
|\
| * Remove dex cache string from mirror::Class.Nicolas Geoffray2016-12-151-1/+1
| | | | | | | | | | | | | | The compiled code does not need it anymore. Test: test-art-host test-art-target Change-Id: I71c08ce12d450ab2b2cd018330d42a8b8c9e3da2
* | Don't call into ResolveType with possible exceptionMathieu Chartier2016-12-141-7/+19
|/ | | | | | | | Bug: 33307169 Test: test-art-host Change-Id: Ic4d499d772828ba1da7a1b9acfc2026f0fcec2b2