summaryrefslogtreecommitdiff
path: root/runtime/class_table.h
Commit message (Collapse)AuthorAgeFilesLines
* Remove some dead code around ClassTable.Vladimir Marko2021-04-281-11/+1
| | | | | | | Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 175869411 Change-Id: Ifb3ac102129470aff6eb228e5523b240c113818f
* Avoid an unnecessary ComputeModifiedUtf8Hash().Vladimir Marko2021-02-081-5/+9
| | | | | | | | | | | | | The DescriptorHashPair already has the hash as the member `second`, so avoid recalculating it in release mode. Also split "HashEquals" classes into separate "Hash" and "Equals" classes to disambiguate their operators in traces. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 175869411 Change-Id: I87cbe613778c7d310ba5c2bf437729244780472c
* Rewrite class table construction in ImageWriter.Vladimir Marko2021-01-191-9/+0
| | | | | | | | | | | | | | | | | | | | | | Make sure that class tables in images are at maximum load factor (full) and make that maximum load factor independent of runtime parameters. As we pre-allocate a class table buffer of the right size in ImageWriter, we also avoid unnecessary resizing of the temporary class table. Make sure that app image class tables are deterministic. We previously just copied the class table from the app class loader even though some entries may have been inserted there during multi-threaded phases of the compilation, causing non-deterministic contents based on insertion order. Remove obsolete comment related to patchoat relocations. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: boots. Bug: 175869411 Change-Id: I605048b639f67a5ed4b03eb8888cbaafa9ba4091
* ObjPtr<>-ify ClassTable.Vladimir Marko2019-05-081-4/+6
| | | | | | | Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 31113334 Change-Id: Ieced7a452d381e5cacbafc91fd5d7672d9d92c30
* Avoid some read barriers in ClassTable.Vladimir Marko2019-05-081-3/+1
| | | | | | | | | And clean up ClassTable. Test: m test-art-host-gtest Test: testrunner.py --host --interpreter Bug: 119486698 Change-Id: Ie413bc5a56eb548352ae1fed0976b75c44e0c0d4
* ART: Simplify atomic.hOrion Hodson2018-03-231-3/+3
| | | | | | | | | | | Prefer std::atomic operations over wrappers in atomic.h. Exceptions are cases that relate to the Java data memory operations and CAS operations. Bug: 71621075 Test: art/test.py --host -j32 Test: art/test.py --target --64 -j4 Change-Id: I9a157e9dede852c1b2aa67d22e3e604a68a9ef1c
* Fix dangling SingleImplementations left after class unloadingAlexey Grebenkin2018-03-131-2/+2
| | | | | | | | Test: make test-art-host, manual using sample code bug: 73143991 Change-Id: I4d56b39c69d4ed60266a8b90b9e9d18fba7b8227
* Retrieve String/Class references from .data.bimg.rel.ro.Vladimir Marko2018-03-081-1/+0
| | | | | | | | | | | | | 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
* cpplint: Cleanup errorsIgor Murashkin2017-11-081-3/+3
| | | | | | | | | Cleanup errors from upstream cpplint in preparation for moving art's cpplint fork to upstream tip-of-tree cpplint. Test: cd art && mm Bug: 68951293 Change-Id: I15faed4594cbcb8399850f8bdee39d42c0c5b956
* Refactor linker files from compiler/ to dex2oat/.Vladimir Marko2017-09-201-2/+10
| | | | | | | | | | | | | | | | | | | | | | | This shifts some code from the libart-compiler.so to dex2oat and reduces memory needed for JIT. We also avoid loading the libart-dexlayout.so for JIT but the memory savings are minimal (one shared clean page, two shared dirty pages and some per-app kernel mmap data) as the code has never been needed in memory by JIT. aosp_angler-userdebug file sizes (stripped): lib64/libart-compiler.so: 2989112 -> 2671888 (-310KiB) lib/libart-compiler.so: 2160816 -> 1939276 (-216KiB) bin/dex2oat: 141868 -> 368808 (+222KiB) LOAD/executable elf mapping sizes: lib64/libart-compiler.so: 2866308 -> 2555500 (-304KiB) lib/libart-compiler.so: 2050960 -> 1834836 (-211KiB) bin/dex2oat: 129316 -> 345916 (+212KiB) Test: m test-art-host-gtest Test: testrunner.py --host Test: cd art/; mma; cd - Change-Id: If62f02847a6cbb208eaf7e1f3e91af4663fa4a5f
* Use mmapped boot image class table for PIC app HLoadClass.Vladimir Marko2017-09-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | Implement new HLoadClass load kind for boot image classes referenced by PIC-compiled apps (i.e. prebuilts) that uses PC-relative load from a boot image ClassTable mmapped into the apps .bss. This reduces the size of the PIC prebuilts that reference boot image classes compared to the kBssEntry as we can completely avoid the slow path and stack map unless we need to do the class initialization check. Prebuilt services.odex for aosp_angler-userdebug (arm64): - before: 20312800 - after: 19775352 (-525KiB) Test: m test-art-host-gtest Test: testrunner.py --host Test: testrunner.py --host --pictest Test: testrunner.py --target on Nexus 6P. Test: testrunner.py --target --pictest on Nexus 6P. Test: Nexus 6P boots. Bug: 31951624 Change-Id: I13adb19a1fa7d095a72a41f09daa6101876e77a8
* Use class unloading in dex2oat for verify and extractMathieu Chartier2017-07-281-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: More header cleanup - runtime.hAndreas Gampe2017-05-301-3/+2
| | | | | | | | Remove unnecessary runtime.h includes. Refactor other headers (move to forward declarations) to make this possible. Test: mmma art Change-Id: I297f0ad444ba92169edd16d8c7cbe95bb6dbb800
* Refactor image writerMathieu Chartier2017-03-291-0/+1
| | | | | | | | | | | Aim to have common functions for copying references and pointers. Required for adding support for faster image fixups. Test: test-art-host -j32 Bug: 34927277 Bug: 34928633 Change-Id: Ia654efc483b332eea3535570496bfeccd7c635ee
* Revert^6 "Hash-based dex cache type array."Vladimir Marko2017-03-141-2/+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
* Fix dex cache resolved types and class table mismatch.Vladimir Marko2017-02-091-0/+6
| | | | | | | | | | | | | | | | | | Record class table in ClassLinker::DexCacheData and use it in DexCache.setResolvedType() to store the type also in the initiating loader's class table if the dex file has been registered. Also throw InternalError when trying to register the same DexFile with multiple class loaders. (Different DexFile instances referencing the same file are OK.) Test: 155-java-set-resolved-type Test: m test-art-host Bug: 30627598 Bug: 34193123 Bug: 34839984 Change-Id: Ia48acb300337c45880ea1459d2d32789546d67f4
* Fix inserting classes to initiating loader's class table.Vladimir Marko2017-01-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Fix two cases that were missed in https://android-review.googlesource.com/312285 First, copy all class references to app image class table, including boot image classes where the class loader used for AOT is only the initiating loader, not the defining loader. Second, add array classes to the initiating loader's class table. Without these fixes, ClassLinker::LookupResolvedType() was actually relying on the type being in the dex cache because in some cases the slow path would not be able to find it. Add a test for ClassLinker::LookupResolvedType() with an array type and fix that function to avoid null pointer dereference. Test: m test-art-host Bug: 30627598 Change-Id: I7cb14788700e6a22d16c364f8a35e2b6b3d954e4
* Address some review commentsMathieu Chartier2016-12-131-0/+7
| | | | | | | | | Addressed comments in dex cache and class table. Added class table test. Test: mm test-art-host-gtest-class_table_test -j20 Change-Id: I3ec0282247187acb1ec7af25b309501f001a1c3e
* Revert^8 "Make sure that const-class linkage is preserved."Vladimir Marko2016-12-091-2/+11
| | | | | | | | | | | | | Replaced two ReaderMutexLocks with WriterMutexLocks. Removed some unnecessary debugging output. Test: m test-art-host Bug: 30627598 Original-Change-Id: Ie9b721464b4e9a5dcce8df8095548e983bba1fe8 This reverts commit 2c8c6b63da6ecb2ac701cc30f9b4fa4a8eea5cc8. Change-Id: I3a1aeecf64e4b202cef61cceb248d48106a2f4a6
* Reduce calls to DescriptorEqualsMathieu Chartier2016-12-061-13/+71
| | | | | | | | | | | | | | Store the low 3 bits of the descriptor hash inside of class set entries. Compare these bits before comparing descriptors. Simpleperf interpret-only compile of facebook: mirror::Class::DescriptorEquals(char const*): 3.66% -> 1.03% Bug: 32641252 Test: test-art-host Change-Id: I8d898d4ac7c95383c49401fbcd85bfde226e026c
* Revert "Make sure that const-class linkage is preserved, try again."Vladimir Marko2016-12-011-11/+2
| | | | | | | | | | | | | Reverting due to test failures as expected. Bug: 30627598 Bug: 33231647 This reverts commit cb5ab35980a86b05586c402924d2e7ca9df25758. Squashed revert "Additional debug logging for bug 33231647." This reverts commit 00a441033db28d243fc33692d30eb2755fa81728. Change-Id: I0c0ee1f70d47540fec99f8a797ce13571c16147c
* Make sure that const-class linkage is preserved, try again.Vladimir Marko2016-12-011-2/+11
| | | | | | | | | | | | | | This CL causes occasional test failures on the build servers which we were not able to reproduce locally. So we add some some additional debug output to help pinpoint the cause. Bug: 30627598 Bug: 33231647 Test: m test-art-host This reverts commit 171cf811a1cdf8b1cbc5151505d8630741ce4cf3. Change-Id: Id56a3f0e86e8212fd547e09c61794401bff47fb0
* Revert "Revert "Revert "Revert "Revert "Make sure that const-class linkage ↵Vladimir Marko2016-11-291-11/+2
| | | | | | | | | | is preserved.""""" Bug: 30627598 This reverts commit e47172b75b8b04a450d235cf72bdc4e223a29cb5. Change-Id: I038029c71195a80f041982e82ae556d3157db7b8
* Revert "Revert "Revert "Revert "Make sure that const-class linkage is ↵Vladimir Marko2016-11-291-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | preserved."""" Avoid class loading triggered by verification in the 626-const-class-linking test. Expect spurious wakeups. Add extra debugging output for a very strange failure image_writer.cc:1144] Check failed: !IsBootClassLoaderClass(as_klass) java.lang.Class<java.lang.NoSuchMethodError> That class is supposed to be in the boot image (core.art for tests), so the failing check should not be reached at all. Test: m test-art-host Test: m ART_TEST_OPTIMIZING=true \ ART_TEST_JIT=true \ ART_TEST_INTERPRETER=true \ ART_TEST_INTERPRETER_ACCESS_CHECKS=true \ test-art-host-run-test-626-const-class-linking Bug: 30627598 This reverts commit 09ded9201fbeec605b12741ae255663c14bda225. Change-Id: I65a68cb53f0707b8abb3555ac3dc44c82907aef5
* Revert "Revert "Revert "Make sure that const-class linkage is preserved."""Vladimir Marko2016-11-241-11/+2
| | | | | | | | | | | | | | 626-const-class-linking is failing (spurious wakeups?) 970-iface-super-resolution-gen is failing: dex2oatd F 11-24 10:57:16 6410 6410 image_writer.cc:1144] Check failed: !IsBootClassLoaderClass(as_klass) java.lang.Class<java.lang.NoSuchMethodError> Bug: 30627598 This reverts commit 25dcbad4462ea7279ee2bbe0884abc25bdfac77a. Change-Id: Ie010169bdde45e6ccf2e04a521da4682bd817114
* Revert "Revert "Make sure that const-class linkage is preserved.""Vladimir Marko2016-11-231-2/+11
| | | | | | | | | | | | | | | Fix jdwp getting multiple instances of the same class. Fix counting "zygote"/"non-zygote" classes in class table. Fix FindClass() to EnsureResolved() classes added by a racing thread to the class table. Test: m test-art-host Test: art/tools/run-jdwp-tests.sh --mode=host --variant=X64 --debug Bug: 30627598 This reverts commit ecffc67068a28d55d131553bf915fdb9fafbbc03. Change-Id: I15807949da4f163c2693fac2fbfc274f17685f8a
* Change iftable to never be nullMathieu Chartier2016-11-161-1/+1
| | | | | | | | | | | | | | | Simplifies code generation by removing a null check. The null case is rare. Ritzperf code size: 13107624 -> 13095336 Also addressed comments from previous CL. Bug: 32577579 Test: test-art-host, run ritzperf both with CC Change-Id: I2b31e800867112869d7f0643e16c08826296979e
* Revert "Disable kBssEntry LoadString sharpening."Vladimir Marko2016-10-251-0/+10
| | | | | | | | | | | | | Fix .bss GC root walking by registering the oat file with the class loader's class table. Also fix potentially outdated ObjPtr<> use in debug build. This reverts commit b55fdbb30b3bc4e334c241153b98c0a6ea4a4a2b. Test: m test-art-host Bug: 32124939 Change-Id: I0b7e3b93cb53c7b22408aa10a04eaf5582c69ee8
* Move most of class linker to ObjPtrMathieu Chartier2016-10-191-5/+5
| | | | | | | | | | | Return values are still mirror pointer. Fix some failing asserts in compiler driver and tests. Bug: 31113334 Test: test-art-host Change-Id: I4450bf9dfb2541749496b8388616e8aae8488919
* Move art/native to ObjPtrMathieu Chartier2016-10-171-1/+2
| | | | | | | | Bug: 31113334 Test: test-art-host Change-Id: I67eb89cf042c762c6dcd5eb8b008b9a28e9b3319
* Revert "Revert "Store resolved Strings for AOT code in .bss.""Vladimir Marko2016-10-041-0/+4
| | | | | | | | | | | | | | | | Fixed oat_test to keep dex files alive. Fixed mips build. Rewritten the .bss GC root visiting and added write barrier to the artResolveStringFromCode(). Test: build aosp_mips-eng Test: m ART_DEFAULT_GC_TYPE=SS test-art-target-host-gtest-oat_test Test: Run ART test suite on host and Nexus 9. Bug: 20323084 Bug: 30627598 This reverts commit 5f926055cb88089d8ca27243f35a9dfd89d981f0. Change-Id: I07fa2278d82b8eb64964c9a4b66cb93726ccda6b
* Smarter image layoutMathieu Chartier2016-09-231-0/+4
| | | | | | | | | | | | | | | | | | | Put strings in the dex file that resolves them. Depth first traversal with overrides for class and dex cache. The work list keeps track of what oat_index with each pushed item. This means the static fields of a class will usually be in the same image. Added layout test to image_test to make sure things are somewhat reasonably attributed. Bug: 28640955 Test: test-art-host (cherry picked from commit 4e9c4e746617bad6a012d799d2f5cf9e01d24ea2) Change-Id: I67a536c33aeed603b252d8e0f75622c9efbf2559
* ART: SHARED_REQUIRES to REQUIRES_SHAREDAndreas Gampe2016-08-301-16/+16
| | | | | | | | | 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
* Revert "Revert "Hold dex caches live in class table""Mathieu Chartier2016-06-061-5/+11
| | | | | | | | Bug: 29083330 This reverts commit f102faf1bcbdb2149e3e7bf27b1819f621b7894b. Change-Id: Ibc6d260247b3113beec7d33552061512a36c9ce8
* Revert "Hold dex caches live in class table"Brian Carlstrom2016-06-041-6/+5
| | | | | | | This reverts commit d6d49e56c2b7b11f474acb80cb02bb1fe9b7861e. Bug: 29083330 Change-Id: Ie209b27897b8079f2d13fd0837fe5f83a7e61afc
* Hold dex caches live in class tableMathieu Chartier2016-06-031-5/+6
| | | | | | | | | | | | | | Prevents temporary dex caches being unloaded for the same dex file. Usually this is OK, but if someone resolved a string in that dex cache, it could leave stale pointers in BSS. Also it can use extra memory in linear alloc if we allocate dex cache arrays multiple times. Bug: 29083330 (cherry picked from commit f284d448e3edd428b6ade473d0993028638b2064) Change-Id: Ie1b0b0cf835a998e19227cbb90014011a6cd40c4
* Prevent ArtMethod clearing raceMathieu Chartier2016-05-111-0/+4
| | | | | | | | | | | | | | | There was race condition where the GC would be visiting the methods of a class while the class linker overwrote the contents with 0xFE when copying to a new array. Since the GC is holding the class table lock at this time, we can use this lock in the class linker to prevent the race. Bug: 28699001 (cherry picked from commit 10c5f56423feaf3eadb3d4c09c61d2b998404162) Change-Id: I5ddca93106cb8e48962cf44e5ce434c45e05cd0c
* Shard classloader classes lockMathieu Chartier2016-04-051-20/+29
| | | | | | | | | | | | | Used to guard adding and removing classes. Previously we used the class linker classes lock, but this had a deadlock issue since the reference processor may need to acquire the lock to mark the classes of a class loader. Another thread could be blocked trying to access weak globals while also holding the class linker classes lock. Bug: 27946564 Change-Id: If7c13e8775f0912e104d1382eacdba7e7edf6818
* Only visit app image classes in class loaderMathieu Chartier2016-03-041-28/+33
| | | | | | | | | | | | | | | Only update dex cache arrays of added classes since the declaring class is in image DCHECK fails for other classes in the class loader. Also some cleanup to prevent app images leaving invalid state if they get rejected. Bug: 22858531 Bug: 27431418 (cherry picked from commit 6973100705716bffce3768a8a0908d7ca1d02ec1) Change-Id: Ib05364c44f2b943e3341ef2b1dd43337833de143
* Fix up dex cache strings stored in classesMathieu Chartier2016-02-011-14/+3
| | | | | | | | | | | | | | | | Previously we left the image pointer instead of fixing up the pointer to the one in the BSS. This only showed up because JIT does the same as boot image, bypassing null check. Fixed a bug where oat files without embedded dex cache arrays would get their dex cache arrays corrupted. Added a non virtual class visitor for performance. Bug: 26846419 Bug: 22858531 Change-Id: I8cd0d61e440f753b4628ddb8c932eb23a0a81027
* Revert "Revert "Load app images""Mathieu Chartier2016-01-251-0/+12
| | | | | | | | This reverts commit 1bc977cf2f8199311a97f2ba9431a184540e3e9c. Bug: 22858531 Change-Id: Ide00bf3a73a02cba3bb364177204ad1b13f70295
* Revert "Load app images"Nicolas Geoffray2016-01-231-12/+0
| | | | | | | | | | Fails when a method is duplicated (see test 097-duplicate-method) Bug: 22858531 This reverts commit f7fd970244f143b1abb956e29794c446e4d57f46. Change-Id: Ib30ae5be00cc568e799290be6b3c8f29cbbe4c20
* Load app imagesMathieu Chartier2016-01-221-0/+12
| | | | | | | | | | | | | | | | | | | 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
* Re-enable class table for image writerMathieu Chartier2016-01-071-2/+1
| | | | | | | | | Changes, create one temporary class table per ImageInfo. Don't keep track of class loaders. Bug: 26317072 Change-Id: I4f9121194f39031fb8629d60b6feeb2747a77870
* Combine class sets when writing a class tableMathieu Chartier2015-12-041-0/+1
| | | | | | | | | | | | | | | | | | Reduces the boot.art size since we allocate a new class set with the default load factor. The load factor in the combined class table is higher to pruning classes, this reduces the size of the boot image. Also fixes the hypothetical case where the class table being written has multiple class sets. Boot.art size Before: 8122368 After: 8044544 Slight cleanup in patchoat.cc. Bug: 22858531 Change-Id: I31b3ea2004ece6f6c853ee906074bb2792dee958
* Store class tables in the imageMathieu Chartier2015-12-031-2/+11
| | | | | | | | | | | | | | | | | | Reduces how long it takes to load an application image. N5 boot.art size Before: 8007680 After: 8122368 Also reduces boot time by how long AddImageClassesToClassTable used to take (~20ms). Changed class hashes to be uint32_t to fix cross compilation. We need serialized hash tables to be valid with different pointer sizes. Bug: 22858531 Change-Id: I463fc83f499ff75f509e80c253a55b9116ee5b89
* Keep dex files live in class tableMathieu Chartier2015-10-191-10/+24
| | | | | | | | | | | | The DexFile.loadClass API allows callers to load classes using a dex file without having that dex file owned by the specified class loader. We now add the dex file to the class table to make sure it stays live until the class loader is unreachable. Fixes interpreter gcstress test 087 with 64 bit. Bug: 22720414 Change-Id: Ia4341149f45b6293312f8b275c7a68cea179f718
* Make class loaders weak rootsMathieu Chartier2015-09-041-3/+3
| | | | | | | | | | | Making the class loaders weak roots in the class linker prevents them from keeping the classes as live. However we currently do mark them as strong roots to make sure no accidental class unloading occurs until the logic to free from linear alloc is complete. Bug: 22720414 Change-Id: I57466236d9ce6fd064dda9a30ce8ab68094fb8b0
* Visit class roots from ClassLoader::VisitReferencesMathieu Chartier2015-08-121-2/+9
| | | | | | | | | This causes the classes of a class loader to get marked when that class loader gets marked instead of during class root visiting. Bug: 22720414 Change-Id: If53f042aff1d9f7bf94ecbe6886601edda029b7d
* Address some comments and clean upMathieu Chartier2015-08-041-1/+2
| | | | Change-Id: I538cf204f1c89d5fc81f8fc5e5800fcf1cf87359