summaryrefslogtreecommitdiff
path: root/compiler/optimizing/nodes.h
AgeCommit message (Collapse)Author
2025-03-19Introduce abstract instruction `HFieldAccess`. Vladimir Marko
Change-Id: Iaccc3a000f53a4b7198a45f04142983897f194f4
2025-03-05Remove `HInstruction::IsFieldAccess()`. Vladimir Marko
Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: I697263c647d76a13b9de56a2134a6e8554c20929
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-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-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-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-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-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-27Add a one-pass baseline compiler for arm64. Nicolas Geoffray
Currently handles 50% of methods by supporting methods that: - don't branch - don't have try/catch - don't have float/double - <= 8 registers - opcodes are const/invokes/iget/iput/const-string/new-instance/checkcast. Cost of compilation is 10 times less than current baseline compiler. Performance of generated code: jit-baseline-cc configuration shows no impact on go/lem Test: test.py Change-Id: I8c99b8a8a7552c09c900c5c3e831e8897aef73e5
2025-01-20Set no write barrier for primitive types. Nicolas Geoffray
Initialize the value properly, to not rely on an optimization to do it. Helps investigating performance when disabling optimizations in baseline compiler. Test: test.py Change-Id: If3c5d7cd85dd905a10d29081f571c78baae2888c
2025-01-09Optimizing: Unary and binary operations are movable. Vladimir Marko
Mark `H{Unary,Binary}Operation::CanBeMoved()` as `final` and remove unnecessary overrides. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: Ic375513e942b18c3244017f19a020e5bad7901cf
2024-11-21Allow the inliner to devirtualize intrinsics Santiago Aboy Solanes
To do so update: * TryReplaceStringBuilderAppend * Code paths relevant to previously InvokeVirtual that are now InvokeStaticOrDirect * checker tests. Bug: 369206455 Test: art/test/testrunner/testrunner.py --host --64 -b --optimizing Change-Id: I4d40980e416f3130d3c344c5f07b7b331deb5c97
2024-11-06Support all conditions in predicated vectorization Chris Jones
Support all condition types inside the condition when performing diamond loop auto-vectorization. This allows diamond loop auto-vectorization to be performed on a greater variety of loops. To support this change, new vector condition nodes are added to mirror the scalar condition nodes. Also add a new gtest class to test whether predicated vectorization can be performed on different combinations of condition types and data types. Authors: Chris Jones <christopher.jones@arm.com>, Konstantin Baladurin <konstantin.baladurin@arm.com> Test: export ART_FORCE_TRY_PREDICATED_SIMD=true && \ art/test.py --target --optimizing Test: art/test.py --target --host --optimizing Test: 661-checker-simd-cf-loops Test: art/test.py --gtest art_compiler_tests Change-Id: Ic9c925f1a58ada13d9031de3b445dcd4f77764b7
2024-11-05Use .data.img.rel.ro for app image methods. Vladimir Marko
This should improve app startup as we can skip the target method resolution on the first call. For `invoke-direct` we should never go to the resolution trampoline for app image methods and for `invoke-static` we go to the trampoline only if the class is not yet visibly initialized and in that case we still save time as the target method is already known. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing --speed-profile Test: run-gtests.sh Test: testrunner.py --target --optimizing --speed-profile Bug: 38313278 Change-Id: I1fea5485264b433fe642c9d0092a5411813eb996
2024-10-11Refactor `HandleCache` out of `nodes.{h,cc}`. Vladimir Marko
Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: I4989657309b46c1e8fec3e9eb4024f1fc329fbe0
2024-10-11Move `HCondition` creation function to `HCondition`. Vladimir Marko
Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: Ibf7d27af872bf0bc9a91d1698d66047947b513f3
2024-10-11Do not record dex PC in constant HIR. Vladimir Marko
Due to the dedplication of constants, the dex PC can be useless or even misleading. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: I501abc3cca920415b3118e92b06a01b173b2406a
2024-10-11Refactor `ReferenceTypeInfo` out of `nodes.{h,cc}`. Vladimir Marko
Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: I0c2f310606bb03f264038534c23f15dd0fee5662
2024-10-07Reland "Calculate the number of out vregs." Vladimír Marko
This reverts commit 434a327234f74eed3ef4072314d2e2bdb73e4dda. Reason for revert: Relanding with no change. The regressions that were the reason for the revert may reappear. However, these regressions are probably caused by subtle effects that are not directly related to this change. For example, a code size improvement can regress performance simply by moving the start of a loop from an aligned address to an unaligned address, or by splitting a loop across two cache lines. Bug: 358519867 Bug: 359722268 Change-Id: I997b8a4219418f79b3a5fc4e7e50817911f0a737
2024-10-04Reduce memory used by `HEnvironment`. Vladimir Marko
Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 181943478 Change-Id: Ie05d4001e411a669e11b8edda375414e5da52ae2
2024-09-24x86_64: Handle invoke-static in invokeExact fast path. Almaz Mingaleev
Bug: 297147201 Test: ./art/test/testrunner/testrunner.py --host --64 --optimizing -b Test: ./art/test.py --host -g Change-Id: Ia49285c116e4abfc3da2d78495f85d9131f111b5
2024-09-13riscv64: Add node Rol, fix InstructionBuilder Anton Romanov
This reverts commit 744830cb242c82c4637e6fb303b36d0371c84979. Reason for revert: updated CHECKer test to use rolw instead of rol. Change-Id: I50e34c6ac69488a9c083f04c6382df4302e8e7d3
2024-09-11Revert "riscv64: Add node Rol, fix InstructionBuilder" Nicolas Geoffray
This reverts commit 39927bc359ccbe65371213c4559126b05dcfb117. Reason for revert: Failure on bot with: error: Statement could not be matched starting from line 1089612 TestRotate.java:95: rol {{a\d+}}, {{a\d+}}, {{a\d+}} ISA_FEATURES = {'rv64gcv_zba_zbb_zbs': True} READ_BARRIER_TYPE = baker 567-checker-builder-intrinsics FAILED: [run-test:1074] CFG checker failed $ ssh -q -F /b/s/w/ir/cache/builder/art/test/testrunner/ssh_config -p 10001 ubuntu@localhost "rm -rf /home/ubuntu/art-test-chroot/data/run-test/test-343039" 567-checker-builder-intrinsics files deleted from host and from target ---------- test-art-target-run-test-ndebug-prebuild-optimizing-no-relocate-ntrace-cms-checkjni-picimage-ndebuggable-no-jvmti-567-checker-builder-intrinsics64 Change-Id: Ic1fd87c331c9eba315af6c98c3ad393766327417
2024-09-10riscv64: Add node Rol, fix InstructionBuilder Anton Romanov
Add new IR node Rol (rotate left). This allows to generate 1 (one) risc-v instruction from Integer(Long).rotateLeft intrinsic instead of 2 instructions (Ror+Neg). Fix InstructionBuilder: build Rol from rotateLeft instead of Ror+Neg. Add unfolding of Rol node in InstructionSimplifier(Arm, Arm64 and X86 Int64 type) to Neg+Ror. By compiling with dex2oat all the methods of applications below I got: in Facebook 1 Ror+Neg pattern, in Minecraft 5 Ror+Neg patterns. Test: art/test/testrunner/testrunner.py --target --64 --ndebug --optimizing Change-Id: Ic28610c6fab4f66386f2fbc0f7223ef2c0e644b6
2024-09-02Address follow-up comments from aosp/2721077. Almaz Mingaleev
Bug: 297147201 Test: ./art/test/testrunner/testrunner.py --host --64 -b --optimizing Change-Id: Ie89d310633339b785de5d9f3daf653abfbff875c
2024-08-28x86_64: Add instrinsic for MethodHandle::invokeExact... Almaz Mingaleev
... which targets invoke-virtual methods. New entrypoint changes deliverException's offset, hence arm test change. Bug: 297147201 Test: ./art/test/testrunner/testrunner.py --host --64 -b --optimizing Test: ./art/test.py --host -g Change-Id: I636fc60c088bfdf9b695c92de47f1c539e3956f1
2024-08-28Add LSE gtests for inserting type conversions. Vladimir Marko
Add tests for the cases where the LSE correctly inserts the required type conversion instructions as needed, as well as tests for currently broken cases. The latter are guarded by `GTEST_SKIP()` until we fix them in a separate change. Test: m test-art-host-gtest Bug: 341476044 Change-Id: Id6002bc31cef542564b84258defcab45b06e6445
2024-08-21Revert "Calculate the number of out vregs." Vladimír Marko
This reverts commit 3e75615ad25b6af1842b194e78b429b0f585b46a. Reason for revert: Regressed some micro-benchmarks, see bug 359722268. Bug: 358519867 Bug: 359722268 Change-Id: I207cc78c88193564e90c98eda2c96a5ba354a588
2024-08-14Clean up condition simplification. Vladimir Marko
Leave condition construction in the `HGraph` but move the rest of the condition simplification code to the simplifier where it belongs. Also clean up simplifier tests and a few other gtests. Note that `SuperblockClonerTest.IndividualInstrCloner` now clones an additional `HGoto` from the entry block. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: I73ee8c227c1c100ac7eb9d4a3813c61ad928b6dd
2024-08-14Revert^2 "Implement transform from signed to unsigned compare" Roman Artemev
This reverts commit 275cf7423efdb36e441b7bceb2e678944f8fa34b. Reason for revert: Fix HEquals and HNotEquals cases Change-Id: I47559e0b0d6625370e392119fd005bc10167aa87
2024-08-13Revert "Implement transform from signed to unsigned compare" Vladimír Marko
This reverts commit 7496a81f4298257a5c6ce25271873b0c12e69f96. Reason for revert: Broke some builds because of wrong handling of HCompare(unsigned)+{HEqual,HNotEqual}. Change-Id: Ic233740c3997d449777207d15243c8a4786df238
2024-08-13Implement transform from signed to unsigned compare Roman Artemev
Support unsigned comparison in HCompare IR node Implement instruction simplifier pass Implement code generation of HCompare node for all supported CPU targets Performance gain on RISC-V: Integer.compareUnsigned: +7.17% Long.compareUnsigned: +7.17% Add test cases to check simplification from HCompare to HCondition Test: testrunner.py --target --64 --ndebug --optimizing Change-Id: I591016e9aa4d094dc5e6f8b0128ac91f842cf25e
2024-08-13Calculate the number of out vregs. Vladimir Marko
Determine the number of out vregs needed by invokes that actually make a call, and by `HStringBuilderAppend`s. This can yield smaller frame sizes of compiled methods when some calls are inlined or fully intrinsified. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 358519867 Change-Id: I4930a9bd811b1de14658f5ef44e65eadea6a7961
2024-07-02Revert^4 "x86_64: Add JIT support for LoadMethodType." Almaz Mingaleev
This reverts commit b63adc919ba9a53f4fbad476356c702845821149. Bringing back map from ArtMethod to code pointers. Bug: 297147201 Test: CtsPerfettoTestCases Test: ./art/test/testrunner/testrunner.py --host --64 --jit -b Test: ./art/test/testrunner/testrunner.py --host --64 --jit --cms -b Test: ./art/test/testrunner/testrunner.py --host --64 -b Test: ./art/test.py --host -b Change-Id: I6a1c50598ec878393edf8ef895274da79d4ab42d
2024-06-24Revert^3 "x86_64: Add JIT support for LoadMethodType." Santiago Aboy Solanes
This reverts commit d92a43f4310e2d634d6e8f24103fc1e27557d784. Reason for revert: Failing 979-const-method-handle https://ci.chromium.org/ui/p/art/builders/ci/host-x86_64-cms/10095/overview Change-Id: I9b44d8cc66e98db074edfa90ce2ebab087e4b115
2024-06-21Revert^2 "x86_64: Add JIT support for LoadMethodType." Almaz Mingaleev
This reverts commit 69c9ea4f93a688ff50e08060be37bcfd3f3e9910. Instead of storing reversed method_code_map_, now just keep MethodType-s associated with a compiled code. Increasing constant in 979/Main.java to trigger jit more reliably. Bug: 297147201 Test: CtsPerfettoTestCases Test: ./art/test/testrunner/testrunner.py --host --64 --jit -b Test: ./art/test/testrunner/testrunner.py --host --64 -b Test: ./art/test.py --host -b Change-Id: I5ece80b63cd0d6dac2805c94649726dc62fe85db
2024-06-12riscv: Expand BitwiseNegatedRight to riscv64, optimize Anton Romanov
Add BitwiseNegatedRight optimization for riscv: And + Not -> AndNot Or + Not -> OrNot Xor + Not -> XorNot By compiling facebook app using dex2oat I got: 169 cases of And + Not pattern 9 cases of Or + Not pattern 1 case of Xor + Not pattern. Test: art/test/testrunner/testrunner.py --target --64 --ndebug --optimizing Change-Id: Icc2db96770378005d2fb01176298a067e1a0e4ad
2024-06-12Reland "Rewrite how we identify hot methods." Nicolas Geoffray
This reverts commit e5d59342bcfdb7f6d2e7d7b4a4ce8dd97ca39091. With this CL, startup methods which do not reach the JIT threshold will just be marked as startup. The compiler driver now decides whether they should be compiled. Reason for revert: Move the decision of compiling startup methods in the compiler driver. Change-Id: Iba8ac7f092e1ce0f412a579a93da57e82fdea4a6
2024-06-07Revert "Rewrite how we identify hot methods." Nicolas Geoffray
This reverts commit 85ee2c92239fbafc22c2c47b22faa817a0a4b034. Bug: 345267352 Reason for revert: b/345267352 Change-Id: If5b5057e86493aea97ed3ffd02d7069da0187ce7
2024-06-03Rewrite how we identify hot methods. Nicolas Geoffray
Use the kAccPreviouslyWarm as soon as a method gets scheduled for JITting. The profile saver now only uses that flag. For benefiting simplicity, deprecate the -Xps-hot-startup-method-samples flag (unused in the code base). Test: second run after speed-profile contains less JITting Bug: 333614471 Bug: 333701031 Change-Id: I2b846026f7d74d20ea761421b857db3834b3011c
2024-05-07Faster `HLoadClass` for app image classes. Vladimir Marko
Add app image relocations for classes in the app image, similar to the existing relocations for boot image. This new load kind lets the compiled code avoid the null check and slow path. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing --speed-profile Test: run-test.sh Test: testrunner.py --target --optimizing --speed-profile Bug: 38313278 Change-Id: Iffd76fe9ac6b95c37c2781fd6257e1d5cd0790d0
2024-04-22Optimizing: Treat app image objects as non-movable. Vladimir Marko
Treat app image objects similar to boot image objects and avoid unnecessary read barriers for app image `HLoadClass` and `HInstanceOf` checks with app image `HLoadClass` input. Extend other optimizations to treat app image classes the same way as boot image classes even though this remains mostly dormant because we currently do not initialize app image classes with class initializers; the experimental flag `--initialize-app-image-classes` is false by default. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing --speed-profile Bug: 38313278 Change-Id: I359dd8897f6d128213602f5731d40edace298ab8
2024-04-16Rename `.data.bimg.rel.ro` to `.data.img.rel.ro`. Vladimir Marko
Prepare for adding app image patches to the same section. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 38313278 Change-Id: Ib552f005b3a2859152d0de9fa6b2fcd48a0f3feb
2024-04-11Revert "x86_64: Add JIT support for LoadMethodType." Nicolas Geoffray
This reverts commit 53ca944020bb86199f6f80d8594d5deb1b1d46dd. Bug: 297147201 Reason for revert: Crash on bot Change-Id: Ibf3b53a8fe67aa633686990881a96acb783af9a3
2024-04-11x86_64: Add JIT support for LoadMethodType. Almaz Mingaleev
In aosp/2876518 JIT code made runtime calls. Bug: 297147201 Test: ./art/test/testrunner/testrunner.py --host --64 --jit -b Test: ./art/test/testrunner/testrunner.py --host --64 -b Test: ./art/test.py --host -b Change-Id: Ifdfd3ace9419b34f8079c9ec4b1b2de31cb50ef7
2024-04-04riscv64: Create InstructionSimplifierRiscv64, ShiftAdd Anton Romanov
Create InstructionSimplifierRiscv64 optimization. Replace Shl (1|2|3) and Add with Riscv64ShiftAdd IR instruction. By compiling with dex2oat all the methods of applications below I got: Facebook: 45 cases TikTok: 26 cases YouTube: 19 cases of the pattern. Test: art/test/testrunner/testrunner.py --target --64 --ndebug --optimizing Change-Id: I88903450d998983bb2a628942112d7518099c3f5
2024-03-26Optimizing: Clean up unreachable `Evaluate()` functions. Vladimir Marko
Move the `LOG(FATAL)` code to the `HUnaryOperation` and `HBinaryOperation` classes to avoid duplication in derived classes. For consistency, implement an unreachable function `HUnaryOperation::Evaluate(HIntConstant*)` even though all currently existing subclasses override it. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: I908c494b125e370ce9fe253c97ebacdd54ed1d96
2024-03-19Remove the environment from ArraySets which can't throw Santiago Aboy Solanes
When clearing the NeedsTypeCheck flag in ArraySet instructions, we can remove the environment as it is no longer needed. Also add a check in GraphChecker that instructions have an environment iff they need one. Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Change-Id: I698d9d88bc7c6c8569caf6397cbebf29b34585d5
2024-02-13Reland "Only compile optimized if it is useful." Nicolas Geoffray
This reverts commit 35a1479ab434257e9db629fda5f4ca96bfbef3fc. Reason for revert: Disable failing test on debuggable Change-Id: Icd012ac9e3b37c1187adf5e915ba7c1ffc415805