summaryrefslogtreecommitdiff
path: root/runtime/native/java_lang_VMClassLoader.cc
AgeCommit message (Collapse)Author
2025-02-10Use `std::string_view` for `DescriptorToDot()`, ... Vladimir Marko
... `DotToDescriptor()` and `DescriptorToName()` parameter. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 338123769 Change-Id: I9cda6e70f52ed8779fcd532a4e34515c12c40c78
2024-11-11Avoid `strlen()` for `ClassLinker::FindClass()`... Vladimir Marko
... and related functions in most cases. Note that the `CompilerDriver` previously resolved the `ClassLoader` and `TransactionAbortError` using the provided class loaders. We're now using the `ClassLoader` from the class roots and resolving the `TransactionAbortError` in the BCP class loader. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 181943478 Bug: 338123769 Change-Id: I38e480cdcdb8bf02c958e4d0773437f5766f6be0
2024-11-05Use `std::string_view` for `ClassTable` operations. Vladimir Marko
Use `std::string_view` instead of `const char*` descriptor. This uses faster `memcmp` instead of the slower`strcmp` for descriptor comparison. Note that the `ScopedTrace` passes `const char*` across the `libartpalette` boundary, so we cannot easily replace the `const char* descriptor` with `std::string_view descriptor` in certain `ClassLinker` functions because we actually need to pass a null-terminated string and the `string_view` API does not technically guarantee null-terminated data. Therefore we resort to explicitly passing around the descriptor and its length as separate arguments. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 181943478 Bug: 338123769 Change-Id: Ie3fa251390acc582c54b4686d18696eb89b32361
2024-01-15Add visibility attributes in runtime/native Dmitrii Ishcheikin
Don't add visibility attributes in dalvik_system_VMRuntime.{h,cc} for now, because it breaks some apps. Bug: 260881207 Test: launch app from b/319255249 Test: presubmit Test: abtd app_compat_drm Test: abtd app_compat_top_100 Test: abtd app_compat_banking Change-Id: I538c4f82a753c71fb9d008762d09ada5e1273427
2024-01-10Revert "Add visibility attributes in runtime/entrypoints and runtime/native" Daniel Chapin
This reverts commit 3d10d9399776f36955bdcd7d75a5e0fe8648d020. Reason for revert: b/319255249 Change-Id: I46c96f5ae78606a7c7c6e2df7368ca1b3362d501
2024-01-05Add visibility attributes in runtime/entrypoints and runtime/native Dmitrii Ishcheikin
Bug: 260881207 Test: presubmit Test: abtd app_compat_drm Test: abtd app_compat_top_100 Test: abtd app_compat_banking Change-Id: I9481b7d876f6dd3a65cfc825b9b3f475c43131aa
2023-11-09Change IsMultiDexLocation to std::string_view David Srbecky
Test: ./art/test.py -b --host --optimizing --64 Change-Id: I70ffa88d30f3b43cc36161ed81a2722bbf4c3bb7
2022-12-02Remove class root duplicates from well known classes. Vladimir Marko
And get well known exception classes as declaring classes of their constructors. Also change function `ThreadForEnv()` to `Thread::ForEnv()` and use it where appropriate, mostly in code added recently while cleaning up well-known methods. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: I2ededa429863a6cddbcbb879a223277fd6245557
2022-11-30Change well known method `String.charAt()` to `ArtMethod*`. Vladimir Marko
Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: Idb34c5de408b98db746d385ae6e012a8997fcc96
2022-11-30Filter BCP in `VMClassLoader.getBootClassPathEntries`. Vladimir Marko
Avoid duplicate BCP entries. Found while working on https://android-review.googlesource.com/2319093 and cleaning up `WellKnownClasses::java_lang_String` uses. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: Iefe5c041154cfd534dc104ddc1d8c6d6ba3f4c42
2022-11-09Clean up decoding well-known classes. Vladimir Marko
Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: I27b4e8f5513511ce1c320e3224dd9c2a40880b69
2020-07-29Revert^3 "VIXL simulator for ART (Stage1)" Ulya Trafimovich
This reverts commit e886d68b9c40c941d8966b9c90d0e265c75fb19e. Reason for revert: simulator implemention is not ready yet. Test: lunch aosp_cf_x86_phone-userdebug && m Test: art/test.py --run-test --optimizing --host Change-Id: I03c8c09ea348205b0238d7a26caef3477cd6ae3b
2020-07-17Revert^2 "VIXL simulator for ART (Stage1)" Ulyana Trafimovich
This reverts commit 3060bb919cd2f37c6a97e87c1581ac5294af72b3. Reason for revert: relanding original change. The fix is setting `device_supported: false` for libart(d)-simulator module in the .bp file (`m checkbuild` attempted to build it for arm32 and failed). Original commit message: VIXL simulator for ART (Stage1) Quick User Guide: test/README.simulator.md This CL enables running ART run-tests in a simulator on host machine. Some benefits of using this simulator approach: - No need to use a target device at all. Save developers from solving the device troubles: build, flash, usb, adb, etc. - Speed up development/debug/test cycle. - Allows easy debugging/testing new instruction features without real hardware. - Allows using a smaller AOSP Android manifest master-art. The Stage1 CL provides support for running 30% of current run-tests. The rest unsupported test cases are kept in knownfailures.json. Future work will be supporting proper stack frame layout between simulator and quick entrypoints, so that stack walk, QuickArgumentVisitor, deoptimization, etc can be supported. This CL adds libart(d)-simulator-container library to the ART APEX. It has caused the following increase of the APEX size (small, about 0.13% for release APEX, measured for target aosp_arm64-userdebug): Before: 88992 com.android.art.debug.apex 51612 com.android.art.release.apex 112352 com.android.art.testing.apex After: 89124 com.android.art.debug.apex 51680 com.android.art.release.apex 112468 com.android.art.testing.apex Change-Id: I461c80aa9c4ce0673eef1c0254d2c539f2b6a8d5 Test: art/test.py --run-test --optimizing --simulate-arm64 Test: art/test.py --run-test --optimizing --host Test: m test-art-host-gtest
2020-07-16Revert "VIXL simulator for ART (Stage1)" Ulyana Trafimovich
This reverts commit 48ca6a681efe1fa1cf82d8af918bf9bbfd35ae96. Reason for revert: broken build 6685551 on aosp-master on full-eng Bug: 161440641 Change-Id: I849fe53f56c4786f0f2a1605cbfd215559f11072
2020-07-16VIXL simulator for ART (Stage1) Xueliang Zhong
Quick User Guide: test/README.simulator.md This CL enables running ART run-tests in a simulator on host machine. Some benefits of using this simulator approach: - No need to use a target device at all. Save developers from solving the device troubles: build, flash, usb, adb, etc. - Speed up development/debug/test cycle. - Allows easy debugging/testing new instruction features without real hardware. - Allows using a smaller AOSP Android manifest master-art. The Stage1 CL provides support for running 30% of current run-tests. The rest unsupported test cases are kept in knownfailures.json. Future work will be supporting proper stack frame layout between simulator and quick entrypoints, so that stack walk, QuickArgumentVisitor, deoptimization, etc can be supported. This CL adds libart(d)-simulator-container library to the ART APEX. It has cause the following increase of the APEX size (small, about 0.13% for release APEX, measured for target aosp_arm64-userdebug): Before: 88992 com.android.art.debug.apex 51612 com.android.art.release.apex 112352 com.android.art.testing.apex After: 89124 com.android.art.debug.apex 51680 com.android.art.release.apex 112468 com.android.art.testing.apex Test: art/test.py --run-test --optimizing --simulate-arm64 Test: art/test.py --run-test --optimizing --host Test: m test-art-host-gtest Change-Id: I078812dde9aaf7128d9f262b2102251927596b7f
2019-04-18Revert^2 "Fix correctness for fast path class loading" Andreas Gampe
This reverts commit 2e2f9e8c6989dec22e4199a773a1e03954f82365. Bug: 130310316 Bug: 130293184 Bug: 130209120 Bug: 130746382 Test: m test-art-host Test: atest vm-tests-tf Change-Id: I2b6e6be530bb8b6c6222b11b7d93fb1f574d2ea4
2019-04-17Revert "Fix correctness for fast path class loading" Mathieu Chartier
Bug: 130310316 Bug: 130293184 Bug: 130209120 Bug: 130680590 Test: TH This reverts commit ef04ac6c05fa344428008ffa1eac7316c64a3467. Change-Id: I2ee8a20419da251eed2620b7feb390053c0cdcb9
2019-04-16Fix correctness for fast path class loading Mathieu Chartier
For the fast path, we currently remove all exceptions and only return ClassNotFoundExceptions. This CL preserves exceptions that might occur such as linkage errors. The follow up is to add an additional fast path for faster class not found exception generation. Bug: 130310316 Bug: 130293184 Bug: 130209120 Test: test-art-host (cherry picked from commit ca19f9a8547999cb13de06458364d64ab143cb09) Merged-In: Iae55aaaae2be5b1330e8e54bee36e862cf9e12e0 Change-Id: I0fff3a748c07b5f3e05f4de24d56678a8b046844
2018-10-25ART: Do some include-what-you-use Andreas Gampe
Help with transitive includes. In preparation for new specialized headers reducing transitivity. Bug: 118385392 Test: mmma art Change-Id: Ib465ecceec3331ea81588fb4a43eb65e766b6904
2018-06-01ObjPtr<>-ify array allocations. Vladimir Marko
And remove some unnecessary calls to ObjPtr<>::Ptr(). Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 31113334 Change-Id: Ie313980f7f23b33b0ccea4fa8d5131d643c59080
2018-05-31ObjPtr<>-ify ClassLinker::FindClass(), fix 1 stale reference use. Vladimir Marko
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
2018-05-30Move String::SizeOf<> to string.h . Vladimir Marko
string.h was already indirectly (through class.h) including everything needed for String::SizeOf<>, so move it to the string.h and make those includes direct. Then we can change the object-inl.h to include only string.h, reducing the number of indirectly included files. Test: m test-art-host-gtest Test: m testrunner.py --host --optimizing Change-Id: I51c462c034f205498c539abe6d888be9738d4a6e
2018-05-09ART: Move JNI files to runtime/jni/ . Vladimir Marko
Test: Rely on TreeHugger. Change-Id: I9cae11191ef1567ae9453be498882a7767285140
2018-04-13Move profile dependent modules to libartbase David Sehr
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
2018-02-21Remove duplication, split tests David Sehr
The code move to libdexfile/dex/descriptors_names.cc apparently did not remove the original code from runtime/utils.cc. Fix that duplication and all the header mentions needed. Also, split the test files to go along with the new locations for the code to be tested. Bug: 22322814 Test: make -j 50 checkbuild make -j 50 test-art-host-gtest flash & boot marlin Change-Id: Ie734672c4bca2c647d8016291f910b5608674545
2018-01-05Create dex subdirectory David Sehr
Move all the DexFile related source to a common subdirectory dex/ of runtime. Bug: 71361973 Test: make -j 50 test-art-host Change-Id: I59e984ed660b93e0776556308be3d653722f5223
2017-10-25ART: Depend on libnativehelper headers only Andreas Gampe
Depend on header-only versions where possible. Move projects excluding libart to libnativehelper_header_only. Bug: 65522645 Test: mmma art Change-Id: I53dd3b2a97e94ee685f72de007ed3858f7f5c6b6
2017-10-11Add DexFileLoader class Mathieu Chartier
Added DexFileLoader class, moved functionality from DexFile there: - Multidex loading logic - DexFile opening logic for Zip and etc - Some other helpers Bug: 63756964 Test: test-art-host Change-Id: Ic3dfa458947d4b69912dea5cdd836e7e8f55061c
2017-07-19Merge "Change kMultiDexSeparator from ':' to '!'" Calin Juravle
2017-07-18art: use proper nativehelper headers Steven Moreland
libnativeheader exports headers under nativeheader. These were available before incorrectly as global headers in order to give access to jni.h. Test: modules using art find headers Bug: 63762847 Change-Id: I5c820d677e94e07b2859e78610bc997fe51b41dc
2017-07-18Change kMultiDexSeparator from ':' to '!' Calin Juravle
The ':' separator is commonly used to separate class path elements. That means that we cannot easily encode multidex location in a classpath without complicating the parsing logic unnecessarily (e.g. when encoding classpaths in the oat file). For easy parsing and understanding kMultiDexSeparator and kClassPathSeparator should have different values. ':' is a wide spread classpath separator so this CL changes the value of kMultiDexSeparator to '!' which is also commonly used to denote an object inside a given container. Test: m test-art-host Bug: 38138251 Change-Id: I30995c553d9131478c6c071b27327df6d2de06a7
2017-06-01ART: Move RegisterNatives helper Andreas Gampe
Move the helper closer to the users. Test: m test-art-host Change-Id: Id05ce5f60af54d0c5aef0c7d8932706c4602fc94
2017-05-30ART: More header cleanup - jni_internal.h Andreas Gampe
Move jni_macros.h to the clients (users of RegisterNativeMethods). Test: mmma art Change-Id: I052ac9f703ec69f0a2df1efcaf9f4a450eb7be1c
2017-05-30Fix OOME handling in VMClassLoader.getBootClassPathEntries(). Vladimir Marko
Propagate the OOME out of the native method. Test: m test-art-host Test: testrunner.py --host Bug: 62185851 Change-Id: Ia0bc2ecd8fe1be6ad6febee373a1531de38f85cf
2017-04-21ART: Clean up art_field.h Andreas Gampe
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. Test: m Change-Id: I6ff2d6f89b741d8188e19426eccf4743fec688fc
2017-02-21jni: Switch to @FastNative for all JNI functions. Deprecate !bang JNI. Igor Murashkin
Switches all (248) methods that previously used !bang JNI in art/libcore to all use @FastNative. Also deprecate !bang JNI since nothing in Android seems to (or should be) using it anymore. This measures to be a 3% startup time improvement in system_server. Test: make test-art-host Bug: 34955272 Change-Id: I0881f401c7660c79f275235362777bfa58241deb
2017-01-24Add class status for resolved erroneous classes. Vladimir Marko
Split the old ambiguous status mirror::Class::kStatusError into kStatusErrorUnresolved and kStatusErrorResolved. Once a class has been resolved, IsResolved() shall return true even if the class later becomes erroneous. Allow returning erroneous class from ClassLinker::EnsureResolved() if it has been previously resolved. This allows consistent behavior for retrieving classes, immune to multi-threaded races and multi-dex weirdness. It also allows JVMTI to properly report "prepared" (i.e. resolved) classes that are also erroneous. The new behavior is consistent with the RI. Add regression tests to 008-exceptions for inconsistent behavior for multi-dex retrieval of erroneous resolved class (wrapping or not wrapping the old exception based on which dex file is used for lookup) and for a CHECK(IsResolved()) crash in ClassLinker::LoadSuperAndInterfaces() (without any tests for similar checks that could have previously failed only due to extremely unlikely race conditions; these should now also be fixed). Inconsistency still remains for class verification as shown by the new exceptionsForSuperClassInitFailure() test in 008-exceptions, where interpreter and Optimizing still cause different exceptions to be thrown. Note: This is partially changing behavior implemented for bug 28787733. Since we allow the class loader to retrieve an erroneous resolved class, the ExceptionInInitializerError is not thrown at all from VMClassLoader_findLoadedClass(), so there is nothing to wrap in ClassNotFoundException. Test: m test-art-host Bug: 30627598 Bug: 28787733 Change-Id: I86cdca00f35a0d6221d2559e3026ac0428a3613c
2016-11-02Revert "Revert "ART: Generalize FindClassInPathClassLoader"" Nicolas Geoffray
Bug: 32510706 Change is not responsible for the flakiness after all. This reverts commit af3572bc21cf66f970090c852b976095bb028083. Change-Id: I399049c217deeac6a5c3f9d678a46bdb84386e3f
2016-11-02Revert "ART: Generalize FindClassInPathClassLoader" Nicolas Geoffray
Bug: 32510706 This reverts commit fd1ae75a03b0b17fdbbb0097e856f494edf12312. Change-Id: Ie247477eea44a6a241d90864bf5dca29897ff4b8
2016-11-01ART: Generalize FindClassInPathClassLoader Andreas Gampe
Also accept DexClassLoader. Do a fast check for subclasses of BaseDexClassLoader that are in the boot classpath. Bug: 32510706 Test: m test-art-host Change-Id: I7d79aa90e0241e7717c5d146d1123f41746e4ffa
2016-10-25ART: Refactor class-linker methods Andreas Gampe
Hide the LookupClass with hash version. Clients should not have to know about that performance detail. Hide FindClassInPathClassLoader. This is an implementation detail. Test: m test-art-host Change-Id: I2378c6fed8d7d1fb1ead8e042b4cf07228adf25c
2016-10-18Remove mirror:: and ArtMethod deps in utils.{h,cc} David Sehr
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
2016-10-17Move art/native to ObjPtr Mathieu Chartier
Bug: 31113334 Test: test-art-host Change-Id: I67eb89cf042c762c6dcd5eb8b008b9a28e9b3319
2016-10-04Rename ObjPtr::Decode to ObjPtr::Ptr Mathieu Chartier
Done to prevent ambiguity with ScopedObjectAccess::Decode. Bug: 31113334 Test: test-art-host Change-Id: I07a2497cc9cf66386311798933547471987fc316
2016-09-29Clean up ScopedThreadStateChange to use ObjPtr Mathieu Chartier
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
2016-06-07Wrap certain exception types when loading an erroneous class. Jeff Hao
Bug: 28787733 Change-Id: I22e1e4339a95706a0fb9c1474b360e9bde232539
2015-08-04Revert "cleanup: Replace pointers with out-parameters and fix-up formatting" Igor Murashkin
This reverts commit a315f5c546b796f55f4872bb6efc15eb858d9639. -- Revert "runtime: cleanup class_linker out-parameters and formatting" This reverts commit bc1d78daa463572c5a770cdca858a3b51d8e1b7b. -- Revert "base: replace raw pointers for out-parameters with safer out<T>" This reverts commit fb326cffc679cab8eb873b9e44795706f023cb3c.
2015-07-31runtime: cleanup class_linker out-parameters and formatting Igor Murashkin
* Use out<T> instead of parameters * Fixes up some other signatures to be more correct * Reformat parameters to be one per line if they can't fit on one line * Reformat locks to be one per line if they can't fit on the decl line Change-Id: Ib71b08707d3ed0bb85299406c0b23a1de4e92a1c
2015-06-04Revert "Revert "Modification to the way boot classpath resources are loaded"" Neil Fuller
This reverts commit 1e27c5bd372fbe55c46127c8f233a13d9994334c. Change-Id: I8f45a890ae1d3c0b0497e4fea4fb5a4c7a07b59f
2015-06-03Revert "Modification to the way boot classpath resources are loaded" Neil Fuller
This reverts commit 0e08b767f1bd0b892e3ac5724d517caae70f5c04. Change-Id: Ie3d3caec98f5a65759bb6d44c1f8c76dc6aa2afa