summaryrefslogtreecommitdiff
path: root/compiler
AgeCommit message (Collapse)Author
2025-03-24Fix two issues in fast baseline compiler. Nicolas Geoffray
- Add a missing fence after allocation. - Create a frame before fetching any register, otherwise, we may wrongly use a caller-saved register that can be overwritten by the hotness slow path. Test: 719-varhandle-concurrency Change-Id: I90278172e3d4f9a3561b269b35a59bd3e8ad1dfd
2025-03-24Address review comments from aosp/2671457. Nicolas Geoffray
Test: test.py Change-Id: I5b6b667847727d4de3944467885576a15f72846f
2025-03-22arm64: fix reference unpoisoning in invokeExact intrinsic. Almaz Mingaleev
As reference is read from heap it should be unpoisoned. Bug: 297147201 Test: ART_HEAP_POISONING=true art/test/testrunner/testrunner.py \ -b --target --64 -t 2277 Change-Id: I0d19af3b3b4326a443f6a80316cbc02c42092944
2025-03-20Move more path logic for tests to testing.cc, so it can be used without Martin Stjernholm
depending on CommonArtTest. Preparation to fix the libart-gtest dependency in art_standalone_libartpalette_tests. Due to a new #include, this necessitated fixing a bunch of `testing` namespace references that could become ambigious wrt `art::testing`. Test: m generate-boot-image Test: art/tools/buildbot-build.sh Bug: 404306250 Change-Id: Iafb3d73148125775c9c5ddbcbaef39dc61859118
2025-03-20Optimizing: Avoid unnecessary work in `LinearScan()`. Vladimir Marko
Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 181943478 Change-Id: Ied16ee27a8c6576c72c8d3dffc4b8e82031a8a38
2025-03-20riscv64: Support RISC-V in JitLogger Roman Artemev
Return correct constant value `EM_RISCV` for RISC-V to generate perf jit header Test: Compile. Change-Id: Ia92a656dd87e1a106c35564583e0600274233377
2025-03-20Fix LSE to track type conversions correctly. Vladimir Marko
Add a new state to LSE's `Value` class to mark loads that depend on loop Phi placeholders but may require a type conversion. We store the load in the `Value` and use the `loads_requiring_loop_phi_[load->GetId()]->value` to form a singly-linked list leading to the actual Phi placeholder. During `LSEVisitor::ProcessLoadsRequiringLoopPhis()`, we may replace these records, so a walk over the singly-linked list in that stage can terminate with a replacement instruction instead of the loop Phi placeholder. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 341476044 Change-Id: Id8f2edf4dfaa82dc3f25ddf47f3fe1da8f2fb3ea
2025-03-20Revert^2 "Call target method in accessor MHs when it is set." Almaz Mingaleev
Previous LUCI crashes were due to b/404465902, which was fixed in aosp/3551420. Bug: 297147201 Test: ART_HEAP_POISONING=true art/test/testrunner/testrunner.py -b \ --host --baseline --debug --gcstress --64 Test: art/test/testrunner/testrunner.py -b \ --host --baseline --debug --gcstress --64 Change-Id: If93b9c6559ac8ddbc3211df1cbc4dec192cb054a
2025-03-19Do not override register storing MethodType in invokeExact. Almaz Mingaleev
As it might be in a callee-saved register and also known by GC to have a reference. arm64 and riscv are fine as they load MethodHandle's field into a temp register and unpoison that register and not call site one. Bug: 404465902 Test: ART_HEAP_POISONING=true art/test/testrunner/testrunner.py -b --host --optimizing --64 Test: ART_HEAP_POISONING=true art/test/testrunner/testrunner.py -b --host --optimizing --gcstress --64 Test: art/test/testrunner/testrunner.py -b --host --optimizing --64 Test: art/test/testrunner/testrunner.py -b --host --optimizing --gcstress --64 Change-Id: Ib1e80ee106a30b282f6bf2725c460f9c24d20c0e
2025-03-19Introduce abstract instruction `HFieldAccess`. Vladimir Marko
Change-Id: Iaccc3a000f53a4b7198a45f04142983897f194f4
2025-03-17Reland "Implement if instructions in fast baseline compiler." Nicolas Geoffray
This reverts commit ee8ab3125768bbf60347c507103a910553acd158. Reason for revert: Fix logic around branching. Change-Id: Ifadcb75488fe25dd612451c5813ea797b9da3b5c
2025-03-11Remove memfd_create_compat(). Elliott Hughes
Multiple places were already unconditionally calling memfd_create(), and ART no longer runs tests on fugu (whose ancient kernel didn't have memfd_create()). Change-Id: I8ca96d75a9e6f4fe5395b210f60d9920808bb26c
2025-03-10Revert "Call target method in accessor MHs when it is set." Almaz Mingaleev
Revert submission 3382609-target-accessors Reason for revert: x86.poison.64 failures on LUCI Reverted changes: /q/submissionid:3382609-target-accessors Change-Id: I384945809bc18ac4dfc937af088c7dbe30ac5c5c
2025-03-10Revert "Implement if instructions in fast baseline compiler." Nicolas Geoffray
This reverts commit 31308e27c488a857d950c47148cdf783ea3a8447. Reason for revert: Though the code is flagged, potential regression in b/400516671 Change-Id: I8709ea1cbbd3ec59a9f6f8a6e79c28939d6566f5
2025-03-06Call target method in accessor MHs when it is set. Almaz Mingaleev
Bug: 297147201 Test: ./art/tools/run-libcore-tests.sh --mode host --variant X64 Test: ./art/test/testrunner/testrunner.py -b --host --64 Test: ./art/test/testrunner/testrunner.py -b --target --64 Change-Id: I5f8dc0761abbc1f5bb4f5727ae1e6966a4ebaf8a
2025-03-05Remove `HInstruction::IsFieldAccess()`. Vladimir Marko
Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: I697263c647d76a13b9de56a2134a6e8554c20929
2025-03-05riscv64: handle invoke-virtual and invoke-direct in invokeExact Anton Romanov
Test: art/test/testrunner/testrunner.py --target --64 Change-Id: I65b8a2e9f9cc361c044476a322218b6ec85647d3
2025-03-03Implement if instructions in fast baseline compiler. Nicolas Geoffray
Test: test.py Change-Id: I481535be7a2269eb2de1f7fdc837a5f9e41666db
2025-02-28Address follow-up comments from aosp/3409718. Almaz Mingaleev
Bug: 297147201 Test: art/test/testrunner/testrunner.py --target --64 Test: ART_HEAP_POISONING=1 art/test/testrunner/testrunner.py --target --64 Change-Id: Ib37c7e0e446c80394bf058462b40f9feeaabc33e
2025-02-28Optimizing: Reduce size of `LocationSummary`. Vladimir Marko
This reduces `sizeof(LocationSummary)` from 128B down to 88B on 64-bit architectures. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: I24a35fb433e89533727f6c786eb1253178cc05bf
2025-02-28Remove `HInstruction::GetAllocator()`. Vladimir Marko
And clean up some uses of instruction->GetBlock()->GetGraph()->GetAllocator() Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: Iae218056495a0b9cf94d2a3c1cebd6c8eb909096
2025-02-28Speed up `SsaRedundantPhiElimination`. Vladimir Marko
Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 331194861 Change-Id: I649107659bf7a741f0eee7443128c551a9deccad
2025-02-27Speed up DCE, CFRE and `ReplaceUsesDominatedBy()`... Vladimir Marko
... by using `BitViewVector<>`. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 331194861 Change-Id: If22934aeae82b21ebf9fc20e817d0958bd6edec8
2025-02-22Optimizing: Speed up SSA Liveness Analysis. Vladimir Marko
Add some functions from `BitVector` to `BitVectorView<>` and use this to speed up the `SsaLivenessAnalysis` pass. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 331194861 Change-Id: I5bca36da7b4d53a3d5e60f45530168cf20290120
2025-02-22Optimizing: Speed up GVN by using `BitVectorView<>`. Vladimir Marko
Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 331194861 Change-Id: If1b467579613864fd924fbb8776ccddaa9ad18c1
2025-02-21Speed up `HGraph::BuildDominatorTree()`. Vladimir Marko
Add some functions from `BitVector` to `BitVectorView<>` and use this to speed up `HGraph::BuildDominatorTree()`. Also clean up code sinking. This was a missed opportunity in https://android-review.googlesource.com/3500455 . Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 331194861 Change-Id: Iec03db8b44af38c549447ccfa0bf8dab731b550d
2025-02-20Introduce `BitVectorView<>`. Vladimir Marko
Initially implement only simple bit getter and setters and use the new class to avoid overheads of `ArenaBitVector` in a few places. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 331194861 Change-Id: Ie29dfcd02286770e07131e43b65e6e9fb044a924
2025-02-19[Sim] Add a restricted mode setup Chris Jones
This CL introduces a special ART setup for all modes (host, target), which is going to be a base for VIXL Simulator Stage 1 setup. This setup can be enabled by exporting ART_USE_RESTRICTED_MODE=true to the environment before building ART. The setup limits ART by doing the following: - Limits the GC to only non-concurent Mark&Sweep. - Turns off the Nterp (so only switch C++ intepreter to be used). - Turns off the JNI compiler (GenericJNITrampoline to be used). - Rejects the compilation of all method (except for the allow list). - Turns off compilation and support of intrinsics. - Turns off implicit null checks. - Turns off implicit suspend checks. - Turns off introspection entrypoints. - Turns off special behavior for critical native methods. - Turns off compiler CHECKER tool. With these limitations it will be easier to start off an initial Simulator Stage 1 setup. As the limitations are set for all the modes, it will be easy to compare/debug the workflow for the simulator mode and to compare it to host and target runs. The CL also adds sections in knownfailures.json for tests that fail in this special setup. Also cleanup some read barrier entrypoint declarations in entrypoints_init_arm64.cc to match the definitions in quick_entrypoints_arm64.S and slightly refactor Runtime::Init to stay below the 500 line limit. Author: Artem Serov <artem.serov@linaro.org> Artem Serov <artem.serov@arm.com> Chris Jones <christopher.jones@arm.com> Test: export ART_USE_RESTRICTED_MODE=true test.py --host --target Change-Id: I87319cf339646dc13b9086b00af08882b01603c8
2025-02-19Move some utils from `compiler/` to `dex2oat/`. Vladimir Marko
Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: If1cd12c358e22e678e425e2a1350cecf0a90a8bd
2025-02-18Optimizing: Remove dead Partial LSE test helpers. Vladimir Marko
Test: m test-art-host-gtest Bug: 298176183 Change-Id: I25a047e20dd4b0388c639c90634e74a5a626d2ac
2025-02-18Do not inline a method that was marked as un-compilable. Nicolas Geoffray
The compiler may have internally mark a method as not compilable. Do not clear the verification results from the compiler callbacks, we still need them during compilation. Test: 860-vdex-failure Bug: 395243275 Change-Id: I79ba61eb8a7ba6729b22c4c27fa83d8373fce03a
2025-02-18Optimizing: Add comments to `HInstruction::Add{,Env}UseAt()`. Vladimir Marko
This is a follow-up for https://android-review.googlesource.com/3497214 to add some explanatory comments. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 181943478 Change-Id: Ibe759e2851d3d6c6c92a41c33e30798f37687b9f
2025-02-18Only locking error and runtime throws should retrigger verification. Nicolas Geoffray
This ensures the stability of the vdex file. Test: 412-new-array Change-Id: I73a6be0a46b6eb184ea127de720bfaf7104f3777
2025-02-17Optimizing: Rename `GetNextInstructionId()`. Vladimir Marko
Rename to `AllocateInstructionId()` because it's clealy not a simple getter. Annotate it as `ALWAYS_INLINE`. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 181943478 Change-Id: I618181a05e8cf1e2d1808611af8bdb6ab4f55e3c
2025-02-17Optimizing: Speed up `HInstruction::Add{,Env}UseAt()`. Vladimir Marko
Avoid three dependent loads to fetch the allocator on the hot paths. Inline the `FixupUserRecordsAfter*UseInsertion()` loop and use the fact that it's known to execute exactly one or two iterations. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 181943478 Change-Id: I7fd4d48caebc6aeb13fb9a9f8146a06129c72b2e
2025-02-17Refactor `ArtMethod` entrypoint initialization. Vladimir Marko
Introduce `Instrumentation::ReinitializeMethodsCode()` for the cases where we want to reset the entrypoint after the method has already been initialized. Keep the old function `Instrumentation::InitializeMethodsCode()` exclusively for the initialization of a newly loaded method's entrypoint, split out the work that can be done in suspended state and remove any unnecessary work. For example, we do not use the Nterp entrypoint until the class has been verified, so all the Nterp checks can be removed. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 329196666 Change-Id: I1d0c195b0118fe50434d496f56346a9f744fbaf7
2025-02-17Optimizing: Do not crash on bad `filled-new-array` opcode. Vladimir Marko
Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: testrunner.py --host --jit --jit-on-first-use -t 412 Change-Id: I8b86c806492b9b3ff44a2e670650e5ed18749190
2025-02-14verifier: Reject `filled-new-array/-range` with `[J`/`[D`. Vladimir Marko
We were not enforcing the specified requirement from https://source.android.com/docs/core/runtime/dalvik-bytecode for `filled-new-array/-range`. We now reject the descriptors `[J` and `[D` in the verifier and defer arrays of primitive types other than `[I` to the interpreter. All these cases would have previously hit a `DCHECK()` in the compiler. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: Iaf91465faa8ed9599abe2504796a2d9bc5bd4678
2025-02-14Optimize HConstantFoldingVisitor::PropagateValue Santiago Aboy Solanes
We can avoid creating constants which were created with GetGraph()->GetIntConstant. In theory, we could still be creating a constant that ReplaceUsesDominatedBy doesn't use. In practice, we can eliminate most (95%+) of constants being created without impacting or refactoring ReplaceUsesDominatedBy. Bug: 240543764 Bug: 393108375 Test: art/test/testrunner/testrunner.py --host --64 -b --optimizing Change-Id: I91f93c373b9097d5598398cc92767ecde5d4aec7
2025-02-13Use HInstructionIteratorHandleChanges again in RTP Santiago Aboy Solanes
In http://r.android.com/2952876 we changed the RTP iterator to HInstructionIterator, but we want the HandleChanges one. Test: art/test/testrunner/testrunner.py --host --64 -b --optimizing Change-Id: I1e9e9cc84d45aa34c24a805f16798e86fd123fc3
2025-02-11Optimize FindVisitedBlockWithRecyclableSet Santiago Aboy Solanes
By adding extra bookkeeping, we can speed up the ValueSet reusable algorithm of GVN. A block's ValueSet is reused if it will not be used again in the future. This happens when said blocks last dominated block or successor is visited, since we visit blocks in RPO. This lets us create a list of free sets to be reused and skip iterating through all visited blocks. This optimization is better the bigger the graph. Based on local compiles, this speeds up GVN by 12-27% and overall compilation times by 0.6-1.6%. Bug: 393108375 Test: art/test/testrunner/testrunner.py --host --64 -b --optimizing Change-Id: I3731e67796a2055907b795656146aaea4f448614
2025-02-10SafeMul: avoid UB on signed overflow Ryan Prichard
Bug: http://b/395138850 Test: atest art-run-test-530-checker-loops4 Change-Id: Id7fb236cc4cbc7982de1a8e79f94814f9daf2bd1
2025-02-10cleanup: Remove never executed break Santiago Aboy Solanes
Test: art/test/testrunner/testrunner.py --host --64 -b --optimizing Change-Id: I469be66bc4f5efa9a70c5d86b9c04627cc9c5672
2025-02-10Optimize RemoveInstruction Santiago Aboy Solanes
We can skip two ifs as they are implied from previous ifs. Test: art/test/testrunner/testrunner.py --host --64 -b --optimizing Change-Id: Ia6088887832117791b82b07a2c31d2f9b8bf8b58
2025-02-04Optimize FindReferenceInfoOf Santiago Aboy Solanes
By having a vector indexed by instruction id, we can speed up LSA by 34-66% which in turns gives ~0.5-1.8% compile time improvement. Bug: 393108375 Test: art/test/testrunner/testrunner.py --host --64 -b --optimizing Change-Id: If67b10e9a3a6093452489da7c40d08e23f080874
2025-02-03Optimizing: Remove `kNotCompiledLargeMethodNoBranches`. Vladimir Marko
This statistic has been obsoleted by https://android-review.googlesource.com/2808063 . Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 316617683 Change-Id: Ice880753d0d4acaad53da15aa01937bd0548836a
2025-02-03Optimizing: New statistic for diamond removal. Vladimir Marko
Do not count diamond removal towards generated `HSelect` instruction. Introduce a separate statistic for this case. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: Ic397d21bf0e7ffec266be9536446646442a6320e
2025-02-03Optimizing: Remove Partial LSE statistics. Vladimir Marko
Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 298176183 Change-Id: Ib86953a17a5cd3db09f6107782f2ba6c0fecb07d
2025-01-30Avoid implicit conversion to bool in SideEffect's methods Santiago Aboy Solanes
Test: art/test/testrunner/testrunner.py --host --64 -b --optimizing Change-Id: I375edc2db3979e7080c0b9fe784fd2b5e2cfb4e4
2025-01-30Optimize ValueSet::Kill Santiago Aboy Solanes
Skip calling DeleteAllImpureWhich for side effects which MayDependOn will always return false, which happened 65-75% of the times. In fact, SideEffects::None() was passed on ~50% of the calls to Kill. Based on local compiles, this CL improves GVN runtime by ~15% and overall dex2oat runtime by ~1%. Bug: 393108375 Test: art/test/testrunner/testrunner.py --host --64 -b --optimizing Change-Id: Ib5cdb33c9caa5f2cfffbc1a650dabbda185a3c6d