summaryrefslogtreecommitdiff
path: root/runtime/class_linker.cc
AgeCommit message (Collapse)Author
2023-05-09Cleanup logic on madvising vdex/dex files. Nicolas Geoffray
- Be consistent between dex in .vdex file and uncompressed dex file in APK - Remove old and duplicated madvise logic for low ram. Test: test.py Bug: 278785544 Bug: 196052575 Bug: 178853586 Change-Id: I0b9cbf3273091cf7cbd8add9966ba21f6ac93d45
2023-05-04Simplify deleting startup dex cache arrays. Nicolas Geoffray
- No need to be in a GC critical section. - Make sure the dex cache is in the expected state before registering it. Also remove now unused ScopedInterruptibleGCCriticalSection Test: test.py Change-Id: I27b1209c7a21b811f9e17677e5e2bf70456aad8c
2023-05-02Add debugging logs for b/279117765. Nicolas Geoffray
Test: test.py Bug: 279117765 Change-Id: I187fe7e196a10f50baec2e078175dac3a3412db8
2023-04-25Throw ClassFormatError for invalid @Record annotation Victor Chang
ART has 2 ways to deal with invalid record class. For example, non-final j.l.Record subclass is not treated as a record class, i.e. Class.isRecord() returns false. The second way is to throw ClassFormatError if the dex format doesn't follow the spec. This CL implements this part. Record class is a new feature in Android U. Bug: 272698028 Test: CtsLibcoreOjTestCases:test.java.io.Serializable.records Test: CtsLibcoreTestCases:crossvmtest Test: CtsLibcoreTestCases:libcore.java.lang.ClassTest Test: CtsLibcoreTestCases:libcore.java.lang.RecordTest Test: CtsLibcoreOjTestCases:test.java.lang.reflect.records Change-Id: I3eacc9b4fcef47596704e7f1c386368041db0bf0
2023-04-14Revert "Add trace points for class loading." Nicolas Geoffray
This reverts commit 88b9d89098a2556f39a104ffe389f38d2ecfc3a6. Reason for revert: Regression on crystalball. Change-Id: I2b8a2b30043e9e4e630b56ecce001fec205e8757
2023-04-04Use @Record annotation to implement the record type Victor Chang
Bug: 272698028 Test: atest CtsLibcoreTestCases:crossvmtest Change-Id: Ia7a7ff66634b3fae40b029ee51d5e6bf8513a461
2023-04-04Add trace points for class loading. Nicolas Geoffray
To augment traces and debug potential class loading hotspots. Test: m Change-Id: Iefb33e90e21ee1c597f6e4accd4cca83245fbd6e
2023-03-27Set Record flag during class linking Victor Chang
It's needed for adding new record-specific behavior in ART. For example, fields are still immutable and un-modifiable via java.lang.reflect.Field#set*() API. See http://b/272698028 Bug: 272698028 Test: atest CtsLibcoreTestCases:RecordTest Change-Id: I6805fc4a8b8966b913eaba9f7c4dfdd1ab5886c4
2023-03-13Rename arrays in `ClassLinker::RunRootClinits()`. Vladimir Marko
Remove misleading "static" from their names. Test: Presubmit Change-Id: I5b155570bdfe043f2822e0c8b50ea9acdd2f162e
2023-03-11Re-enable app image loader for userfaultfd. Nicolas Geoffray
Just disable dex cache generation for now, and make sure the image works with the right GC. Test: test.py Bug: 260557058 Bug: 270936884 Change-Id: Iceae4f8a615d2f1e740936c05b121d91915b2519
2023-03-11Update thread-roots concurrently during uffd compaction Lokesh Gidra
Currently we let gc-thread update all mutator stacks in the pause, which adds significant pause time. We can use ThreadList::FlipThreadRoots instead. Bug: 268482646 Bug: 263452747 Bug: 160737021 Test: manual Change-Id: Ic3cf5038244ac23d849c00cf5b8f7295565f3281
2023-03-08Address review comments in runtime image code. Nicolas Geoffray
Address review comments from: https://android-review.git.corp.google.com/c/platform/art/+/2449536 Also fix a braino when updating the string array: use the local variable instead of fetching the (potentially null) array from the dex cache. Test: test.py Bug: 260557058 Change-Id: I961c973d9ffc51da590818dba925e93bda042478
2023-03-08Fix races related to dex caches in runtime app images. Nicolas Geoffray
- Make sure dex cache arrays are properly aligned. - Handle dex cache arrays being concurrently cleared when loading an image. - Don't use memcpy but update entries one by one when generating the image. Test: test.py Bug: 260557058 Change-Id: I5ef72a7363fe5e108f62d03caa399e5300cf7a55
2023-03-03Initialize all dex caches before adding images spaces to class linker. Jiakai Zhang
Bug: 271309840 Test: boot Test: atest art_standalone_dexpreopt_tests Change-Id: I35bb5ba23f04ede4feddf2b44ee1f5898a8becea
2023-02-23Emit string dex cache arrays in runtime app image. Nicolas Geoffray
Test: 845-data-image Bug: 260557058 Change-Id: Icb8e6258a65698794a722e881947478d651b399e
2023-02-14Sort the dex caches in the runtime-generated app image. Nicolas Geoffray
This is required for checking dex checksums when loading the image. Test: start a multidex app and see it loads the image Bug: 260557058 Change-Id: Icb9d5280f25d54d945c1991a3570fd232394aab4
2023-02-13Fix and re-enable runtime image loading. Nicolas Geoffray
We need to store the dex checksums of the dex files being loaded at runtime, which can be different from the vdex checksums due to compact dex. We also need to store the boot classpath and boot classpath checksums, in the extremely unlikely case the boot image checksum isn't enough. Test: 845-data-image Bug: 260557058 Change-Id: I39ca19451ef7a2376f24e631e1867c683f361e3d
2023-02-08Reland "Walk up the super chain to find an IMT to share." Nicolas Geoffray
This reverts commit ef0b1544519f91fc5663b06d433da474115feb5a. Bug: 266937358 Reason for revert: Fix wrong assumption: an IMT being shared can be updated for subclasses, but we need to use the right allocator. Change-Id: I0055a81d30199e5cba53f21a5b759fe530a0dfa2
2023-02-01Reland "Write classes in runtime-generated app image." Nicolas Geoffray
This reverts commit 24b3d648ff6c2c200003f55ac63fc910d7bfd40f. Bug: 260557058 Reason for revert: - Encode class loader context in image, and check it at load time. - Set nterp entrypoint to methods that can. Test: test.py Test: atest com.android.bluetooth.opp.BluetoothOppObexServerSessionTest#onPut_withUnsupportedMimeTypeInHeader_returnsHttpBadRequest Change-Id: Ibf4a8604c4a226d1acc021103668e211446bb53c
2023-01-31Revert "Walk up the super chain to find an IMT to share." Nicolas Geoffray
This reverts commit fa26b96f2f56ea2380d96922f3c859a2c3b417e8. Bug: 266937358 Reason for revert: Breaks libcore tests Change-Id: I4a889029203ffbc6ecdd09c4d5e4dea163da0ffc
2023-01-31Walk up the super chain to find an IMT to share. Nicolas Geoffray
Don't limit to the super class, and walk up the super chain. Add a check that when populating the IMT, we're not accidentally using the super one. Test: test.py Bug: 266937358 Change-Id: I50cc70a1d819e40bab6238a9b0120b3399c082d1
2023-01-30Use kPointerSize when cross-compiling. Nicolas Geoffray
ArtMethod::At should be passed the kPointerSize for cross-compilation. Unfortunately, we don't have a good setup for testing cross-compilation, so rely on APK scanner for testing. Test: APK scanner Test: manually compiling an APK that used to crash. Bug: 264002996 Bug: 263386862 Bug: 230684246 Change-Id: I85cee2ef594a4c6fd107b32ee5a10d02b4edfa77
2023-01-29Revert "Write classes in runtime-generated app image." Sam Saccone
This reverts commit df68c0a6f0d36728fa728049e5bcec20de2d0d5e. Reason for revert: b/267084527 Change-Id: I2eacf89c23db00c46d56e78009efa11bed31af60
2023-01-28Write classes in runtime-generated app image. Nicolas Geoffray
Test: 845-data-image Bug: 260557058 Change-Id: I640b78942984ac3d3f8d24abda619d78154acd86
2023-01-17Cleanup instrumentation_levels and instrumentation_stubs_installed Mythri Alle
We had instrumentation_levels and instrumentation_stubs_installed which were kind of similar but slightly different in what they actually represent. Their meaning also changed with the recent changes to avoid instrumentation stubs. They were used sometimes incorrectly in the code. This CL: 1. Renames instrumentation_stubs_installed to run_exit_hooks 2. Renames the instrumentation level to not refer instrumentation stubs 3. Fixes a few places that should have checked for the instrumentation level but checked for instrumention_stubs_installed. Bug: 206029744 Test: art/test.py Change-Id: I20a6e9442661a6465c92321904c846d35ebb1e53
2023-01-17Keep classes alive for stack traces with copied methods. Vladimir Marko
Test: Additional test in 141-class-unload. Test: testrunner.py --host --optimizing Bug: 263254495 Change-Id: Iea925ab96fb7c8d1b825c0b100e689ab722d3159
2023-01-16Refactor code aroud method resolution. Nicolas Geoffray
- Make unresolved AOT entrypoints use the tls cache - Remove duplicate code - Inline method access checks logic in its only use. - Fix in ClassLinker::ResolveMethodWithoutInvokeType() by calling shared helper. Test: test.py Change-Id: I1f42b5d0ac1dcd9c5eb483db9c5c5eefc9b2f4d1
2023-01-16We no longer use instrumentation stubs remove the support code Mythri Alle
Remove the code to handle instrumentation stubs. We no longer use them. Bug: 206029744 Test: art/test.py Change-Id: I2b7eabf80bd34989314c0d2b299d7b1b35de0b85
2023-01-09Report value metrics as increments / deltas Stefano Cianciulli
This CL changes value metrics to be represented as increment / deltas rather than absolute values, which will be aggregated on device by summing them instead of taking the maximum value produced. This should make the value metrics representative of all processes across restarts, rather than reporting only the process producing the maximum value (for which numerator and denominator could have been produced by different processes). Bug: 246330418 Test: atest ArtGtestsTargetChroot (in particular art_standalone_libartbase_tests) Merged-In: I9b6e67143fbbf4e93748746491ac23b02543cd28 Merged-In: I660d3b4b3bd4a3cbcfb3a69263956b96cb248f3e Change-Id: Ibc69f68b52b792f8844cab36c6a340efdfbfa380
2023-01-09Make classes visibly initialized in bigger batches. Vladimir Marko
Change the batch size from 16 to 48. This should make app startup faster for apps that initialize a lot of classes. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 38383823 Change-Id: If6387dab27887b7380e30ee6e8b3376158ff04de
2023-01-03StringBuilder append pattern for float/double. Vladimir Marko
Results for added benchmarks on blueline-userdebug with cpu frequencies fxed at 1420800 (cpus 0-3; little) and 1459200 (cpus 4-7; big): 32-bit little (--variant=X32 --invoke-with 'taskset 0f') timeAppendStringAndDouble: ~1260ns -> ~970ns timeAppendStringAndFloat: ~1250ns -> ~940ns timeAppendStringAndHugeDouble: ~4700ns -> ~4690ns (noise) timeAppendStringAndHugeFloat: ~3400ns -> ~3300ns (noise) timeAppendStringDoubleStringAndFloat: ~1980ns -> ~1550ns 64-bit little (--variant=X64 --invoke-with 'taskset 0f') timeAppendStringAndDouble: ~1260ns -> ~970ns timeAppendStringAndFloat: ~1260ns -> ~940ns timeAppendStringAndHugeDouble: ~4700ns -> ~4800ns (noise) timeAppendStringAndHugeFloat: ~3300ns -> ~3400ns (noise) timeAppendStringDoubleStringAndFloat: ~1970ns -> ~1550ns 32-bit big (--variant=X32 --invoke-with 'taskset f0') timeAppendStringAndDouble: ~580ns -> ~450ns timeAppendStringAndFloat: ~590ns -> ~430ns timeAppendStringAndHugeDouble: ~2500ns -> ~2100ns (noise) timeAppendStringAndHugeFloat: ~1500ns -> ~1300ns (noise) timeAppendStringDoubleStringAndFloat: ~880ns -> ~730ns 64-bit big (--variant=X64 --invoke-with 'taskset f0') timeAppendStringAndDouble: ~590ns -> ~450ns timeAppendStringAndFloat: ~590ns -> ~430ns timeAppendStringAndHugeDouble: ~2300ns -> ~2300ns (noise) timeAppendStringAndHugeFloat: ~1500ns -> ~1300ns (noise) timeAppendStringDoubleStringAndFloat: ~870ns -> ~730ns The `timeAppendStringAnd{Double,Float)` benchmarks show very nice improvements, roughly 25% on both little and big cores. The `timeAppendStringDoubleStringAndFloat` also shows decent improvements, over 20% on little and over 15% on big cores. (These benchmarks test the best-case scenario for "before" as the StringBuilder's internal buffer is not reallocated.) The `testAppendStringAndHuge{Double,Float}` results are too noisy to draw any conclusions (especially on little cores but there is still too much noise on big cores as well). There are also small regressions for existing benchmarks `timeAppend{LongStrings,StringAndInt,Strings}` but these non-FP regressions may be mitigated after updating the ThinLTO profile. There is also an opportunity to optimize the calls back to managed code for known shorty (in this change we use "LD" and "LF") by using a dedicated stub instead of going through the generic invoke stub. Boot image size changes are insignificant (few matches). Test: Added tests to 697-checker-string-append Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: testrunner.py --target --optimizing Bug: 19575890 Change-Id: I9cf38c2d615a0a2b14255d18588a694d8870aae5
2022-12-15Reland^2 "ART: Rewrite compiled code check in FaultHandler." Vladimír Marko
This reverts commit 0110e952e488bc41429f6f33f36e8884f41a26d8. Reason for revert: Reland with a fix: Release the mutator lock before requesting an empty checkpoint. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing --jit Test: run-gtests.sh Test: testrunner.py --target --optimizing Bug: 38383823 Change-Id: Idf82d3b77465453b8e70b40e32af193f266b357b
2022-12-14CC GC: Clean up class loaders in reclaim phase. Vladimir Marko
Test: m test-art-host-gtest Test: testrunner.py --host --optimizing --jit Bug: 38383823 Change-Id: I82f6cdd78592260c7bd82dd83d3f898ed6ebcafe
2022-12-12Fix clinit debug check in instrumentation. Vladimir Marko
Test: m test-art-host-gtest Test: testrunner.py --host --optimizing --jit --interpreter Change-Id: Idae620b0b8f9ed67574f5b785fdac3efcb534cfd
2022-12-12Reland "Generate app image at runtime." Nicolas Geoffray
This reverts commit 63a4d52cc3b940ac70140d64e1a66c5457aab89b. Bug: 260557058 Reason for revert: Fixed selinux issue: https://android-review.git.corp.google.com/c/device/google/gs201-sepolicy/+/2335385 Change-Id: I2853dd600022fe80918dfeb190d038d6acaee8aa
2022-12-07Revert "Generate app image at runtime." am: 63a4d52cc3 Jeffrey Vander Stoep
Original change: https://android-review.googlesource.com/c/platform/art/+/2332308 Change-Id: I13bcbc4da8a50d7b7cbdf67742a8815150c02907 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-12-07Revert "Generate app image at runtime." Jeffrey Vander Stoep
This reverts commit 1ebfebc865ef6661b16e38011ea8fbb6d8608e61. Reason for revert: b/261576631 Change-Id: I3f2b9c97cab2e4178ec8dc7bf9447d69481b907d
2022-12-06Generate app image at runtime. am: 1ebfebc865 Nicolas Geoffray
Original change: https://android-review.googlesource.com/c/platform/art/+/2317255 Change-Id: I71a76fa5551f7edab3bbae79a559fd98dba0d8f1 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-12-06Generate app image at runtime. Nicolas Geoffray
Generate an image only containing image_roots for now. Test: 845-data-image, 846-multidex-data-image, test.py Change-Id: Ic4186785065f7ae65600e33dab608cb91bdc633d
2022-12-05Make native GC-root updation concurrent with userfaultfd am: 485a714cbf Lokesh Gidra
Original change: https://android-review.googlesource.com/c/platform/art/+/2252614 Change-Id: I6c8460217acbe6b1e133fc48f7481087e9272170 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-12-05Make native GC-root updation concurrent with userfaultfd Lokesh Gidra
Additionally also uses userfaultfd's minor-fault feature for moving space. Bug: 160737021 Test: ART_USE_READ_BARRIER=false art/test/testrunner/testrunner.py and module install Change-Id: I98b0c69fba4aec1263b1f38cc9f31494fd5c8cf5
2022-12-02Remove class root duplicates from well known classes. am: 7b97aebac8 Vladimir Marko
Original change: https://android-review.googlesource.com/c/platform/art/+/2323316 Change-Id: If02af5af06cc62f228b209ce347fb88676d8be0e Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
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-12-02Change remaining well known methods to `ArtMethod*`. am: addc2d1538 Vladimir Marko
Original change: https://android-review.googlesource.com/c/platform/art/+/2323293 Change-Id: I74608f60ad79b9b619129641f35a1113ea16854e Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-12-02Change remaining well known methods to `ArtMethod*`. Vladimir Marko
Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: I9cfef2a2c302f70826ac762202421388213e60e6
2022-11-30Revert "Reland "ART: Rewrite compiled code check in FaultHandler."" am: ↵ Vladimír Marko
0110e952e4 Original change: https://android-review.googlesource.com/c/platform/art/+/2318802 Change-Id: Ibd65dab8a7f2069b68a92d320a718ce23f773776 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-11-30Revert "Reland "ART: Rewrite compiled code check in FaultHandler."" Vladimír Marko
This reverts commit 64fdbedd880bda36215e6e680d23bc2c361d2bfb. Reason for revert: Buildbot breakages: `Check failed: !bad_mutexes_held`. Bug: 38383823 Change-Id: I33d41c764c130cef05171de1eed82b778740704f
2022-11-30Reland "ART: Rewrite compiled code check in FaultHandler." am: 64fdbedd88 Vladimír Marko
Original change: https://android-review.googlesource.com/c/platform/art/+/2319930 Change-Id: Iec67b4ce2be860f9e4a93aca4e5fc1337b0b68c3 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-11-30Reland "ART: Rewrite compiled code check in FaultHandler." Vladimír Marko
This reverts commit 263883a3d710c6cb3d683defb5c5da340ee5f88d. Reason for revert: Reland with a fix for semi-space GC which holds the mutator lock exclusively when calling `ClassLinker::CleanupClassLoaders()`. Change-Id: I262f4d317f42250b7a4c0594e45c4b496747a91f Test: m test-art-host-gtest Test: testrunner.py --host --optimizing --jit Test: run-gtests.sh Test: testrunner.py --target --optimizing Bug: 38383823
2022-11-29Change well known class loader methods to `ArtMethod*`. am: b6f965d296 Vladimir Marko
Original change: https://android-review.googlesource.com/c/platform/art/+/2317252 Change-Id: I944aa10b7314b068ab56262675def27d2b2b9e50 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>