summaryrefslogtreecommitdiff
path: root/compiler/optimizing
AgeCommit message (Collapse)Author
2023-11-13Constant fold Highest/LowestOneBit Santiago Aboy Solanes
Bug: 309886589 Test: art/test/testrunner/testrunner.py --host --64 -b --optimizing Change-Id: I64b8889bcef2e4c65d85bffec560f4078a17648c
2023-11-13Clean up `HandleScope`. Vladimir Marko
Implement `Size()` and rename `NumberOfReferences()` to `Capacity()`. Replace `Capacity()` with `Size()` where appropriate, for example to avoid visiting unused slots. Remove some obsolete dead code and move some functions from `FixedSizeHandleScope<.>` to `HandleScope`. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: I1e49fb6144f77692ff22c6fbd0578d995b5a01f1
2023-11-10Introduce boxed primitive caches in WellKnownClasses. Nicolas Geoffray
Test: test.py Change-Id: Ia8d2f03dea8dd01eeb337d4bc2e31c778b9543a2
2023-11-10Constant fold NumberOfTrailing/LeadingZeros Santiago Aboy Solanes
Recognize intrinsics in constant folding and optimize the invoke away if the value is known at compile time. Bug: 309886589 Test: art/test/testrunner/testrunner.py --host --64 -b --optimizing Change-Id: I989af53c17f018eb6b3f790ee7d9d9e8255dfd41
2023-11-10riscv64: Implement Math.round() instrinsic Lifang Xia
Test: testrunner.py --target --64 --ndebug --optimizing --jit -t 082-inline-execute Bug: 283082089 Change-Id: Ic2008ab7bfa999fec61095d87805e3cb79ba1ded
2023-11-10Improve linear loop optimization overflow checks Santiago Aboy Solanes
We can move the logic from GenerateLastValueLinear to GenerateCode, where we can: * be more granular, and * reuse that code for other methods. To do so we add an allow_potential_overflow variable. This is done because BCE does perform operations that might overflow, but it uses HDeoptimize instructions to guard against that. Loop optimization doesn't add HDeoptimize instructions so we must be more careful. Bug: 231415860 Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Change-Id: I1d689e5ddd87d96707673b6065ab0cc48b288617
2023-11-09riscv64: Implement Math.sqrt/ceil/floor/rint() instrinsics Lifang Xia
Test: testrunner.py --target --64 --ndebug --optimizing --jit -t 082-inline-execute Bug: 283082089 Change-Id: Ia6d0b116723bbcce25ec0aec5fd322790bfa858f
2023-11-09riscv64: Implement VarHandle.compareAndSet/-Exchange intrinsics. Vladimir Marko
Test: testrunner.py --target --64 --ndebug --optimizing Bug: 283082089 Change-Id: I8016cb046d1fbaa5ffe71917a4cce685dfc65f02
2023-11-09arm64: Rename some intrinsics helper functions. Vladimir Marko
Test: buildbot-build.sh --target Change-Id: Icbda8ce2548546d8b6189bdd843a3ad0584780c7
2023-11-08riscv64: Implement Math.* instrinsics. Lifang Xia
Test: testrunner.py --target --64 --ndebug --optimizing --jit -t 003 -t 123 -t 956 Bug: 283082089 Change-Id: Ice61bb1733d093829c94849dcf851361f5abf16a
2023-11-07riscv64: Implement Math.fma() instrinsic. Lifang Xia
Test: testrunner.py --target --64 --ndebug --optimizing --jit -t 082-inline-execute Bug: 283082089 Change-Id: I001d4e7108086cc1bea367ba25fb71723770e964
2023-11-07riscv64: Implement Integer/Long.divideUnsigned() instrinsics. Lifang Xia
Test: testrunner.py --target --64 --ndebug --optimizing --jit -t 082-inline-execute Bug: 283082089 Change-Id: Ic14a1a901269fe5e91fa2c426f384a9056d9f10f
2023-11-06riscv64: Implement reachability.Fence() instrinsic. Lifang Xia
Test: testrunner.py --target --64 --ndebug --optimizing --jit -t 1339-dead-reference-safe Bug: 283082089 Change-Id: I44767c24508f07ee8432b3e8b9e0afe05046971c
2023-11-06riscv64: Implement Thread.currentThread() instrinsic. Lifang Xia
Test: testrunner.py --target --64 --ndebug --optimizing --jit -t 924-threads Bug: 283082089 Change-Id: If0ac58ad214cea77bc1fe6a11531f2026aba3452
2023-11-06riscv64: [codegen] Add branch profiling. Vladimir Marko
Test: testrunner.py --target --64 --ndebug --optimizing --jit # Ignore pre-existing failures (optimizing: 3 -> 2, # jit: 4 -> 4) Bug: 283082089 Change-Id: Ia6d84d15f604fed2031d2a6f804606c740211c1b
2023-11-06Remove dead phis alongside dead instructions in DCE Santiago Aboy Solanes
A dead phi doesn't generate any code, but it may keep other instructions alive. Locally speed compiling, it improves generated code 0.01-0.1%. Test: art/test/testrunner/testrunner.py --host --64 -b --optimizing Change-Id: Ida024200baa7afeee8c5a729c95b573ed0c6e4e7
2023-11-02Set did_opt in HDeadCodeElimination::RemoveEmptyIfs Santiago Aboy Solanes
Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Change-Id: Ia4fcb260d2c3b7f2b0298857d0515939cf8ee17e
2023-11-02Clean up `gUseReadBarrier` uses in JNI compiler. Vladimir Marko
Also clean up `gUseReadBarrier` uses in dex2oat/ and move some host tests to `art_compiler_host_tests`. Test: m test-art-host-gtest Bug: 289805127 Change-Id: I0909480d3346a611e4b1dd066d7484a9656ec890
2023-11-01Fix bugprone-argument-comment clang-tidy issues Stefano Cianciulli
Bug: 264654008 Test: m tidy-art Change-Id: Iffe92e9f02137c966201511f5bbeb1690db57fe3
2023-10-31Remove empty ifs Santiago Aboy Solanes
If we had an HIf where both branches were empty, we wouldn't emit any code generation for the HIf. However, this still emits other instructions e.g. outer ifs, instructions used in the if guard. This CL detects when an HIf is empty and can be eliminated during DCE. Bug: 305225992 Fixes: 305225992 Test: art/test/testrunner/testrunner.py --host --64 -b --optimizing Change-Id: I81ff5ee1326b6a27480b1af88d41955f1ca2b823
2023-10-30Replace `gUseReadBarrier` with compiler option in compiler. Vladimir Marko
Leave a few `gUseReadBarrier` uses in JNI macro assemblers. We shall deaal with these later. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: run-gtests.sh Test: testrunner.py --target --optimizing Bug: 289805127 Change-Id: I9d2aa245cee4c650129f169a82beda7dc0dd6a35
2023-10-30riscv64: Implement VarHandle.get/set() intrinsics. Vladimir Marko
Test: testrunner.py --target --64 --ndebug --optimizing --jit # Ignore pre-existing failures (optimimizing: 3, # 137-cfi and 2x checker; jit: 4). Bug: 283082089 Change-Id: I22c095fbc38c4ce6d50968797514b78c56de78ae
2023-10-25riscv64: Add a "GVN$after_arch" pass. Vladimir Marko
This makes 3 previously failing checker tests pass. Test: testrunner.py --target --optimizing # Ignore 3 pre-existing failures (137-cfi and 2x checker). Bug: 283082089 Change-Id: Ie45a32fbdd5439e2abd123d83fc9992debae06f2
2023-10-25riscv64: Implement the String.indexOf(int) intrinsic. Vladimir Marko
Test: testrunner.py --target --optimizing # Ignore 6 pre-existing failures (137-cfi and 5x checker). Bug: 283082089 Change-Id: I3f62efb0278a318037339a0b1862ae108c11a310
2023-10-24riscv64: Fix type conversions, enable codegen. Vladimir Marko
Enable codegen for all remaining instructions. Test: m # aosp_cf_riscv64_phone-userdebug Test: # Edit `run-test` to disable checker, then testrunner.py --target --64 --ndebug --optimizing --jit # Ignore pre-existing failures (optimzing: 3 -> 1, # jit: 18 -> 4). Bug: 283082089 Change-Id: I4dab3cdc49b9c979c97096d14db16007715bd05e
2023-10-23riscv64: Expose instruction set features to the compiler Samuel Holland
This follows the pattern of the other supported architectures. Test: m Change-Id: I0f77d92961bd41149e51d0e26da106c9719e132a
2023-10-23riscv64: Add entrypoints for unresolved fields. Vladimir Marko
And enable `*Unresolved*` instructions in codegen. Test: m # aosp_cf_riscv64_phone-userdebug Test: # Edit `run-test` to disable checker, then testrunner.py --target --64 --ndebug --optimizing # Ignore 3 pre-existing failures. Bug: 283082089 Change-Id: I04f23161d96f9eefdbe1e3b17ed0f7ae695deb07
2023-10-19riscv64: [codegen] Fix and enable InvokeCustom/-Polymorphic. Vladimir Marko
Test: m # aosp_cf_riscv64_phone-userdebug Test: # Edit `run-test` to disable checker, then testrunner.py --target --64 --ndebug --optimizing # Ignore 3 pre-existing failures. Bug: 283082089 Change-Id: I9802386b32fe6b98142454748404105e5b345c3b
2023-10-19riscv64: Implement `art_quick_check_instance_of`... Vladimir Marko
... and two other entrypoints. Enable codegen for several instructions and fix exposed new-array and proxy bugs. Test: m # aosp_cf_riscv64_phone-userdebug Test: # Edit `run-test` to disable checker, then testrunner.py --target --64 --ndebug --optimizing # Ignore 3 pre-existing failures (down from 6). Bug: 283082089 Change-Id: I7764fa1b578639d4871c11a79c3980defada3e7d
2023-10-19Reland "riscv64: [codegen] Rewrite and enable Select." VladimĂ­r Marko
This reverts commit 98c15524d7da162dd2571fbeed0e3d7c713a6b75. Reason for revert: Reland with a fix - delay `AsCondition()` call to avoid triggering a DCHECK(). Test: m # aosp_cf_riscv64_phone-userdebug Test: # Edit `run-test` to disable checker, then testrunner.py --target --64 --ndebug --optimizing # Ignore 6 pre-existing failures. Bug: 283082089 Change-Id: I5a270f23d43786e0b422f8fb697a7113c423f1d6
2023-10-19Revert "riscv64: [codegen] Rewrite and enable Select." Sebastian Pickl
This reverts commit 7b01eef7a1bb1f02a4388a3e2a12066af0f0ce92. Reason for revert: this change is breaking builds b/306335122 Bug:306335122 Change-Id: I5d7427ecc26a74f548229874a0c26e1e1a647abe
2023-10-19riscv64: [codegen] Rewrite and enable Select. Vladimir Marko
Test: # Edit `run-test` to disable checker, then testrunner.py --target --64 --ndebug --optimizing # Ignore 6 pre-existing failures. Bug: 283082089 Change-Id: I0486b89116755990ca1de0955d4a913f9cd893e8
2023-10-18RISCV: [Codegen] Add VisitSelect Lifang Xia
Test: m test-art-host-gtest Bug: 283082089 Change-Id: Ia5d63c73413313f0dc9f328a949036ded450f7e0
2023-10-18Speed up graph checker by avoiding HInstructionList::Contains calls Santiago Aboy Solanes
With extra bookeeping we can look in a set, instead of a list. Bug: 304483915 Test: art/test/testrunner/testrunner.py --host --64 -b --optimizing Change-Id: Ia390a709b2d310590cd9296c56d9f586c72705df
2023-10-17riscv64: Implement `CriticalNativeAbiFixupRiscv64`. Vladimir Marko
And pass integral stack args sign-extended to 64 bits for direct @CriticalNative calls. Enable direct @CriticalNative call codegen unconditionally and also enable `HClinitCheck` codegen and extend the 178-app-image-native-method run-test to properly test these use cases. Test: # Edit `run-test` to disable checker, then testrunner.py --target --64 --ndebug --optimizing # Ignore 6 pre-existing failures (down from 7). Bug: 283082089 Change-Id: Ia514c62006c7079b04182cc39e413eb2deb089c1
2023-10-17Add branch profiling in baseline compiler. Nicolas Geoffray
Currently unused. Follow-up CLs will make use of the data. Test: test.py Bug: 304969871 Change-Id: I486faba3de030061715d06ab9fdb33970d319d9b
2023-10-17Revert^4 "Merge libart and libart-compiler into a single library" Dmitrii Ishcheikin
This reverts commit 61b1c151163a09ad49c0b74c19ee84caeb4d0345. Reason for revert: reland with dex2oat PGO removed. Previous attempts at merging libart-compiler into libart showed some performance regressions, which were caused by incompatibilities between AFDO and PGO optimization pipelines when used within a single library. This change removes dex2oat PGO and leaves only AFDO for libart.so. Change-Id: I75a844f53663385ef98351f60d3adb900157f5e5 Bug: 303042202 Bug: 186902856 Test: art/test.py -b --host Test: atest art_standalone_\*_tests Test: art/build/apex/runtests.sh Test: atest art-apex-update-rollback Test: (chroot) art/tools/run-gtests.sh -j4 Test: (chroot) art/test/testrunner/testrunner.py --target Test: (chroot) art/tools/run-libcore-tests.sh --mode=device Test: (chroot) art/tools/run-libjdwp-tests.sh --mode=device
2023-10-16Revert^2 "Remove size argument from DexFile constructors." David Srbecky
This reverts commit 26b99c916496abf14a2fd87290720742328462fa. Reason for revert: Reland Change-Id: Ifc9418a5c76d9d4252c661efe7c13d45ae8810a2
2023-10-16Add a new helper RecomputeDominatorTree Santiago Aboy Solanes
It clears loop and dominance information, and builds the dominator tree. It also dchecks that we are not calling this methods with irreducible loops, as it is not supported. When adding this helper we found a partial LSE bug as it was recomputing dominator tree for irreducible loops. Test: art/test/testrunner/testrunner.py --host --64 -b --optimizing Bug: 304749506 Change-Id: Ia4cc72cd19779ad881fa686e52b43679fe5a64d3
2023-10-13Revert "Remove size argument from DexFile constructors." Nicolas Geoffray
This reverts commit e49ab4d6d4f8226db09803458250f2b9f41abf43. Bug: 305203031 Reason for revert: b/305203031 Change-Id: I7109fcd07b691141f5a67a096688def3b2d6e57e
2023-10-13riscv64: Implement allocation entrypoints. Vladimir Marko
Test: # Edit `run-test` to disable checker, then testrunner.py --target --64 --ndebug --optimizing # Ignore 7 pre-existing failures. Bug: 283082089 Change-Id: Ie5a874c5d3e03cec828fdfb471f0f96470b6c7e1
2023-10-12riscv64: [codegen] Implement method entry/exit hooks. Vladimir Marko
Test: testrunner.py --target --64 --jit --debuggable # Ignore 28 pre-existing failures (down from 50). Bug: 283082089 Change-Id: I4c96c847b6d4d34b31cd5ec4b9ebced683dd42a2
2023-10-11riscv64: Implement `art_quick_aput_obj`. Vladimir Marko
And enable some instructions in codegen, mainly `*Set`. Test: # Edit `run-test` to disable checker, then testrunner.py --target --64 --ndebug --optimizing # Ignore 7 pre-existing failures. Bug: 283082089 Change-Id: I4bbc213874317239851c1a9e01b0f86eda7c9da5
2023-10-11riscv64: Add missing implicit null check stack maps. Vladimir Marko
Test: # Edit `run-test` to disable checker, then testrunner.py --target --64 --ndebug --optimizing # Ignore 7 pre-existing failures. Bug: 283082089 Change-Id: Ie49b1d925cbc84f7f080c9355e48aa3498ff7370
2023-10-11Remove size argument from DexFile constructors. David Srbecky
We know the DEX size from the DEX header, and we know the range of valid underlying memory from DexFileContainer, so it is redundant. Test: ./art/test.py -b --host 001 Change-Id: I0bd0fe25797ead4df864d97a2bfa8608f75bd694
2023-10-10Add optimization to simplify Select+Binary/Unary ops Santiago Aboy Solanes
We can simplify a Select + Binary/Unary Op if: * Both inputs to the Select instruction are constant, and * The Select instruction is not used in another instruction to avoid duplicating Selects. * In the case of Binary ops, both inputs can't be Select. Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Change-Id: Ic716155e9a8515126c2867bb1d54593fa63011ae
2023-10-09Cleanup method tracing code to make it easier to read Mythri Alle
Earlier we used negative offsets to fill in the method entry / exit record which is a bit confusing to read. This CL updates it so we increment the offsets when storing the entry. The earlier implementation also left one entry unused in the buffer which the new approach fixes. Bug: 259258187 Test: art/test.py -t 2246 Change-Id: I9f9411e12447c3ef51884dfcd57d91816fdf914c
2023-10-04GraphChecker/Arena container cleanups Santiago Aboy Solanes
While working in aosp/2769298 I saw these opportunities for cleanups. Change-Id: Ie6c95b5521c4a8cbd3963a034e210860fb0b4ef0
2023-10-04Speed up graph checker for graphs with instructions with many uses Santiago Aboy Solanes
As part of VisitInstruction, we verify that the instruction's input_record is present in the corresponding input's GetUses. If an instruction is used in many places (e.g. 200K+ uses), the linear search through GetUses is too slow. We can use bookkeeping to search in a set, instead of a list. This makes dex2oatd over an order of magnitude faster for such cases. Bug: 301264418 Test: Manually compile the app+profile in the bug Change-Id: I3dd6d1b9b2fd65a4bf5ee8324602a412e3f1715f
2023-10-03Clean up CheckCast codegens. Vladimir Marko
Remove comments from location builders which have the first half unnecessary and the second half wrong, maybe outdated. Change a "TwoRegisters" reference load call to "OneRegister" call because the arguments violate the documented API of the "TwoRegisters" version. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: run-gtests.sh Test: testrunner.py --target --optimizing Change-Id: Ide0980deffcf970eb76a9ff1fbadae83d4fabf82