summaryrefslogtreecommitdiff
path: root/compiler/optimizing/code_generator.cc
AgeCommit message (Collapse)Author
2021-03-05Add code size to CodeInfo.David Srbecky
This is in preparation of removing it from OatQuickMethodHeader. Bug: 123510633 Test: m test-art-host-gtest Test: ./art/test.py -b -r --host Change-Id: I5c5adb4c040e329b81c1393aa1b80ee017729c8a
2021-01-25Revert^4 "Partial Load Store Elimination"Alex Light
This reverts commit 791df7a161ecfa28eb69862a4bc285282463b960. This unreverts commit fc1ce4e8be0d977e3d41699f5ec746d68f63c024. This unreverts commit b8686ce4c93eba7192ed7ef89e7ffd9f3aa6cd07. We incorrectly failed to include PredicatedInstanceFieldGet in a few conditions, including a DCHECK. This caused tests to fail under the read-barrier-table-lookup configuration. Reason for revert: Fixed 2 incorrect checks Bug: 67037140 Test: ./art/test/testrunner/run_build_test_target.py -j70 art-gtest-read-barrier-table-lookup Change-Id: I32b01b29fb32077fb5074e7c77a0226bd1fcaab4
2021-01-24Revert "Revert^2 "Partial Load Store Elimination""Nicolas Geoffray
This reverts commit fc1ce4e8be0d977e3d41699f5ec746d68f63c024. Bug: 67037140 Reason for revert: Fails read-barrier-table-lookup tests. Change-Id: I373867c728789bc14a4370b93a045481167d5f76
2021-01-22Revert^2 "Partial Load Store Elimination"Alex Light
This reverts commit 47ac53100303e7e864b7f6d65f17b23088ccf1d6. There was a bug in LSE where we would incorrectly record the shadow$_monitor_ field as not having a default initial value. This caused partial LSE to be unable to compile the Object.identityHashCode function, causing crashes. This issue was fixed in a parent CL. Also updated all Offsets in LSE_test to be outside of the object header regardless of configuration. Test: ./test.py --host Bug: 67037140 Reason for revert: Fixed issue with shadow$_monitor_ field and offsets Change-Id: I4fb2afff4d410da818db38ed833927dfc0f6be33
2021-01-22Revert "Partial Load Store Elimination"Nicolas Geoffray
This reverts commit b8686ce4c93eba7192ed7ef89e7ffd9f3aa6cd07. Bug: 67037140 Reason for revert: Fails a few tests. Change-Id: Icf0635bffbfbba93bf0a5b854a9582c418198136
2021-01-21Partial Load Store EliminationAlex Light
Add partial load-store elimination to the LSE pass. Partial LSE will move object allocations which only escape along certain execution paths closer to the escape point and allow more values to be eliminated. It does this by creating new predicated load and store instructions that are used when an object has only escaped some of the time. In cases where the object has not escaped a default value will be used. Test: ./test.py --host Test: ./test.py --target Bug: 67037140 Change-Id: Idde67eb59ec90de79747cde17b552eec05b58497
2021-01-08arm64: Implement VarHandle intrinsics for byte array views.Vladimir Marko
Using benchmarks provided by https://android-review.googlesource.com/1420959 on blueline little cores with fixed frequency 1420800: before after GetByteArrayViewInt 27.093 0.024 SetByteArrayViewInt 28.067 0.024 GetByteArrayViewBigEndianInt 27.142 0.026 SetByteArrayViewBigEndianInt 28.040 0.025 Test: testrunner.py --target --64 --optimizing Bug: 71781600 Change-Id: I604326675042bd63dce8ec15075714003ca9915d
2020-10-29Refactor Integer.valueOf() intrinsic implementation.Vladimir Marko
Prepare for Reference.getReferent() intrinsic implementation by a refactoring to separate the retrieval of an intrinsic method's declaring class to its own helper function, rather than being a part of a larger one. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing --jit Test: aosp_blueline-userdebug boots. Test: run-gtests.sh Test: testrunner.py --target --optimizing --jit Bug: 170286013 Change-Id: Ib6c0e55d0c6fcc932999428f21c51afe32ab7ef2
2020-10-07Change interface conflict stub to take the interface method.Nicolas Geoffray
To avoid doing dex cache lookup, pass the interface method instead. This costs a few hundred KBs on speed compiled APKs (< 0.5% code size), but improves performance when hitting a conflict (as seen on dogfood data). For nterp, we currently pass the conflict method instead of the interface method. We need to handle default methods before optimizing it. This removes our last use of dex cache in compiled code. A follow-up CL will remove the NeedsDexCacheOfDeclaringClass from HInvokeInterface. Test: test.py Change-Id: I3cdd4543ad7d904b3e81950af46a48a48af6991a
2020-09-23Move MethodLoadKind out of HInvokeStaticOrDirect.Nicolas Geoffray
To prepare for using it in HInvokeInterface. For consistency, also move CodePtrLocation. Test: test.py Change-Id: I84f973764275002e2adb71080ebc833b2bafb975
2020-09-08Pass a full MethodReference of the invoke in HInvoke nodes.Nicolas Geoffray
Cleanup to ensure we don't make mistakes when passing a dex method index to the HInvoke constructor, and we know which dex file it relates to. Test: test.py Change-Id: I625949add88a6b97e1dafeb7aed37961e105d6aa
2020-08-13Revert^2 "Revert^2 "X86: VarHandle.Get() intrinsic for static primitive ↵Andra Danciu
fields."" This reverts commit 0e5e1772fb6ed3dcbd1cdaf09e3c8cd2020091d5. Reason for revert: Relanding the change. It was reverted because it seemed to be the source of a test failure, but it turned out to be a known flaky test (Bug: 147572335). Change-Id: I572d2d1951b0909641a73df0b3ef2fd453f62d8b
2020-08-12Revert "Revert^2 "X86: VarHandle.Get() intrinsic for static primitive fields.""Igor Murashkin
This reverts commit ed0acfdaffdbf3c76fa57b15150390dabb4c69aa. Reason for revert: Failing buildbot test Change-Id: Ib43f526de492f9a09075c6c57658b7a14d05b168
2020-08-11Revert^2 "X86: VarHandle.Get() intrinsic for static primitive fields."Andra Danciu
Test: art/test.py --host --32 -r -t 712-varhandle-invocations Test: ART_READ_BARRIER_TYPE=TABLELOOKUP ART_HEAP_POISONING=true SOONG_ALLOW_MISSING_DEPENDENCIES=true TARGET_BUILD_UNBUNDLED=true art/test/testrunner/testrunner.py --interpreter --optimizing --host --dex2oat-jobs 4 -b --dist --verbose -t 712-varhandle-invocations Bug: 65872996 This reverts commit e74df4c3f269f2f624fa6f093c48f901fe971002. Reason for revert: Relanding the change. Support only Baker-style read barriers for VarHandleGet. Change-Id: Id02ff69350fb2a2f701a96a591b7efd52f1060e7
2020-08-10Revert "X86: VarHandle.Get() intrinsic for static primitive fields."Andra Danciu
This reverts commit d9af38a3b76fc54909148456da2701666bade6e0. Reason for revert: Broken build git_master-art-host/art-read-barrier-table-lookup @ 6749888 Change-Id: I17f5717e3a9a204568526fc72bce5d56a383e38d
2020-08-07X86: VarHandle.Get() intrinsic for static primitive fields.Andra Danciu
Test: art/test.py --host --32 -r -t 712-varhandle-invocations Bug: 65872996 Change-Id: I8f1eeb1c9041ae55b3a159a6eb1e356687e574e9
2020-08-03Check if VarHandle access mode is supported.Andra Danciu
This commit checks if a VarHandle access mode is supported. If not, an UnsupportedOperationException is raised by calling the runtime to handle it. I added the polymorphic intrinsics case in the IntrinsicSlowPath code generation to handle all the eventual exceptions. For now, none of the operations are actually compiled. If the slow path is not called, the runtime handles the operation. Bug: b/65872996 Test: art/test.py --host -r -t 712-varhandle-invocations --32 Test: art/test.py --host --all-compiler -r Change-Id: I5a637561549b3fdd64fa53e2d7dbf835d3ae0d64
2020-06-22Optimizing: Introduce {Increase,Decrease}Frame().Vladimir Marko
And use it to clean up code generators. Also fix CFI in MaybeIncrementHotness() for arm/arm64/x86. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: testrunner.py --host --debuggable --ndebuggable \ --optimizing --jit --jit-on-first-use -t 178 Test: aosp_cf_x86_phone-userdebug boots. Test: aosp_cf_x86_phone-userdebug/jitzygote boots. Test: # On blueline: testrunner.py --target --debuggable --ndebuggable \ --optimizing --jit --jit-on-first-use -t 178 Bug: 112189621 Change-Id: I524e6c3054ffe1b05e2860fd7988cd9995df2963
2020-06-19Direct calls to @CriticalNative methods.Vladimir Marko
Emit direct calls from compiled managed code to the native code registered with the method, avoiding the JNI stub. Golem results: art-opt-cc x86 x86-64 arm arm64 NativeDowncallStaticCritical +12.5% +62.5% +75.9% +41.7% NativeDowncallStaticCritical6 +55.6% +87.5% +72.1% +35.3% art-opt x86 x86-64 arm arm64 NativeDowncallStaticCritical +28.6% +85.6% +76.4% +38.4% NativeDowncallStaticCritical6 +44.6% +44.6% +74.6% +32.2% Test: Covered by 178-app-image-native-method. Test: m test-art-host-gtest Test: testrunner.py --host --debuggable --ndebuggable \ --optimizing --jit --jit-on-first-use Test: run-gtests.sh Test: testrunner.py --target --optimizing Test: testrunner.py --target --debuggable --ndebuggable \ --optimizing --jit --jit-on-first-use -t 178 Test: aosp_cf_x86_phone-userdebug boots. Test: aosp_cf_x86_phone-userdebug/jitzygote boots. Bug: 112189621 Change-Id: I8b37da51e8fe0b7bc513bb81b127fe0416068866
2020-02-13Remove MIPS support from Optimizing.Vladimir Marko
Test: aosp_taimen-userdebug boots. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 147346243 Change-Id: I97fdc15e568ae3fe390efb1da690343025f84944
2019-12-17Refactor OSR related code to prepare for "true" OSR.Nicolas Geoffray
- Make the compiler restore all callee-save registers. - Make the compiler return any value in a core register: this simplifies the current stub, and will also avoid having to look at the return type (and reading the shorty) when returning to an nterp frame. - Add OsrData and offsets of its members to be used by nterp. Test: test.py Bug: 27094810 Change-Id: Ifa4f4877ab8b1f0c6a96feccea30c909942eb2fa
2019-12-03JIT baseline: trigger optimized compilation on hotness threshold.Nicolas Geoffray
- Add a new hotness count in the ProfilingInfo to not conflict with interpreter hotness which may use it for OSR. - Add a baseline flag in the OatQuickMethodHeader to identify baseline compiled methods. - Add a -Xusetieredjit flag to experiment and test. Bug: 119800099 Test: test.py with Xusetieredjit to true Change-Id: I8512853f869f1312e3edc60bf64413dee9143c52
2019-10-14Revert "Make compiler/optimizing/ symbols hidden."Vladimir Marko
This reverts commit e2727154f25e0db9a5bb92af494d8e47b181dfcf. Reason for revert: Breaks ASAN tests (ODR violation). Bug: 142365358 Change-Id: I38103d74a1297256c81d90872b6902ff1e9ef7a4
2019-10-14Make compiler/optimizing/ symbols hidden.Vladimir Marko
Make symbols in compiler/optimizing hidden by a namespace attribute. The unit intrinsic_objects.{h,cc} is excluded as it is needed by dex2oat. As the symbols are no longer exported, gtests are now linked with the static version of the libartd-compiler library. libart-compiler.so size: - before: arm: 2396152 arm64: 3345280 - after: arm: 2016176 (-371KiB, -15.9%) arm64: 2874480 (-460KiB, -14.1%) Test: m test-art-host-gtest Test: testrunner.py --host --optimizing --jit Bug: 142365358 Change-Id: I1fb04a33351f53f00b389a1642e81a68e40912a8
2019-10-10Fix uses of MaybeRecordImplicitNullCheck without special scopesEvgeny Astigeevich
MaybeRecordImplicitNullCheck is a function which uses CodeGenerator::RecordPcInfo() and requires an exact PC. However for ARM32/ARM64, when CodeGenerator::RecordPcInfo() is used without VIXL special scopes (EmissionCheckScope, ExactAssemblyScope) there is no guarantee of an exact PC. Without the special scopes VIXL might emit veneer/literal pools affecting a PC. The ARM32 code generator has uses of MaybeRecordImplicitNullCheck without the special scopes. This CL fixes missing special scopes in the ARM32/ARM64 code generators. It also changes API to prevent such cases: 1. A variant of CodeGenerator::RecordPcInfo with native_pc as a parameter is added. The old variant (where Assembler::CodePosition is used) is kept and documented that Assembler::CodePosition is target-dependent and might be imprecise. 2. CodeGenerator::MaybeRecordImplicitNullCheck is made virtual. Checks are added to ARM32/ARM64 code generators that MaybeRecordImplicitNullCheck is invoked within VIXL special scopes. Test: test.py --host --optimizing --jit --gtest Test: test.py --target --optimizing --jit Test: run-gtests.sh Change-Id: Ic66c16e7bdf4751cbc19a9de05846fba005b7f55
2019-07-15ART: Introduce stackmap with no DexRegInfo.Artem Serov
Some of safepoints don't need to have DexRegisterMap info; this will decrease the stackmap size. .oat file size reduction: - boot.oat: -233 kb (-5.4%) - boot-framework.oat: -704 kb (-4.9%) Test: 461-get-reference-vreg, 466-get-live-vreg. Test: 543-env-long-ref, 616-cha*. Test: test-art-target, +gc-stress. Change-Id: Idbad355770e30a30dcf14127642e03ee666878b8
2019-05-16ART: Optimize StringBuilder append pattern.Vladimir Marko
Recognize appending with StringBuilder and replace the entire expression with a runtime call that perfoms the append in a more efficient manner. For now, require the entire pattern to be in a single block and be very strict about the StringBuilder environment uses. Also, do not accept StringBuilder/char[]/Object/float/double arguments as they throw non-OOME exceptions and/or require a call from the entrypoint back to a helper function in Java; these shall be implemented later. Boot image size for aosp_taimen-userdebug: - before: arm/boot*.oat: 19653872 arm64/boot*.oat: 23292784 oat/arm64/services.odex: 22408664 - after: arm/boot*.oat: 19432184 (-216KiB) arm64/boot*.oat: 22992488 (-293KiB) oat/arm64/services.odex: 22376776 (-31KiB) Note that const-string in compiled boot image methods cannot throw, but for apps it can and therefore its environment can prevent the optimization for apps. We could implement either a simple carve-out for const-string or generic environment pruning to allow this pattern to be applied more often. Results for the new StringBuilderAppendBenchmark on taimen: timeAppendLongStrings: ~700ns -> ~200ns timeAppendStringAndInt: ~220ns -> ~140ns timeAppendStrings: ~200ns -> 130ns Bug: 19575890 Test: 697-checker-string-append Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: aosp_taimen-userdebug boots. Test: run-gtests.sh Test: testrunner.py --target --optimizing Test: vogar --benchmark art/benchmark/stringbuilder-append/src/StringBuilderAppendBenchmark.java Change-Id: I51789bf299f5219f68ada4c077b6a1d3fe083964
2019-03-06Revert "Revert^2 "Add code size to CodeInfo""Nicolas Geoffray
This reverts commit e1412dacbf1d2a809bd1fca658cc8cb8f61f8ee6. Bug: 123510633 Bug: 127305289 Reason for revert: b/127305289 Change-Id: I54557b05a44777f1fa2c15bde4fa648980f42eed
2019-02-20ART: Reduce dependencies on CompilerDriver.Vladimir Marko
Preparation for moving CompilerDriver and other stuff from libart-compiler.so to dex2oat. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: Ic221ebca4b8c79dd1549316921ace655f2e3f0fe
2019-02-14Revert^2 "Add code size to CodeInfo"David Srbecky
This temporarily adds 0.25% to oat file size. The space will be reclaimed back in follow-up CL. This reverts commit 8f20a23a35fa6fbe4dcb4ff70268a24dc7fb2a24. Reason for revert: Reland as-is after CL/903819 Bug: 123510633 Test: DCHECK compare the two stored code sizes. Change-Id: Ia3ab31c208948f4996188764fcdcba13d9977d19
2019-02-12Revert "Add code size to CodeInfo"David Srbecky
This reverts commit 68efa7b1128486e08ae60cd27181645b27bbd2e4. Reason for revert: Breaks tests Change-Id: I28fb143990f58e0d5f0b106bea9d9a159f19297e
2019-02-11Add code size to CodeInfoDavid Srbecky
This temporarily adds 0.25% to oat file size. The space will be reclaimed back in follow-up CL. Bug: 123510633 Test: DCHECK compare the two stored code sizes. Change-Id: I15340824ca637fd075a4cef87771b06cb96bb9f4
2019-01-02ART: Move dex structs into own headerAndreas Gampe
Separating out the structs from DexFile allows them to be forward- declared, which reduces the need to include the dex_file header. Bug: 119869270 Test: m Change-Id: I32dde5a632884bca7435cd584b4a81883de2e7b4
2018-12-27ART: Refactor for bugprone-argument-commentAndreas Gampe
Handles compiler. Bug: 116054210 Test: WITH_TIDY=1 mmma art Change-Id: I5cdfe73c31ac39144838a2736146b71de037425e
2018-11-29C++17 compatibility: make WITH_TIDY=1 happy again.Elliott Hughes
Bug: http://b/111067277 Test: builds Change-Id: I8b69ea3815e14bb6eb27f40c0dd01a85b340a355
2018-11-20ART: Avoid some tidy nullptr warningsAndreas Gampe
Sprinkle some (D)CHECKs to tell tidy our expectations. Bug: 32619234 Test: m test-art-host Change-Id: I315b1602b20475402dd8383e1accc49e5a63eb5c
2018-10-16Fix HNewArray with unresolved primitive array type.Vladimir Marko
And enable test 920-objects that was crashing because of this bug. Test: testrunner.py --host --jit-on-first-use -t 920 Test: testrunner.py --host --optimizing Test: m test-art-host-gtest Bug: 117638896 Change-Id: I47dc893b121c82de537b3147c86d37a6eecf2d62
2018-09-20Pass JIT roots as a vector<Handle<>> to JIT cache.Vladimir Marko
This avoids creating an object on the heap and thus prevents issues for the 904-object-allocation in the JIT-at-first-use configuration. Test: run_build_test_target.py -j48 art-jit-on-first-use (test 904 passes; test 1935 still failing). Bug: 116189667 Change-Id: I58c0c8cb2d78edc63dab7d72e69b882abbfb79fd
2018-09-03Merge "ART: Remove unneeded SideEffects for fatal instructions."Treehugger Robot
2018-08-31ART: Remove unneeded SideEffects for fatal instructions.Artem Serov
Remove "CanTriggerGC" side effect for NullCheck, BoundsCheck and DivZeroCheck - instructions which have fatal slow paths. Even though GC might happen after going through those instructions' slow path execution doesn't return to the next instruction after the exceptional one so side effects can be relaxed. Performance improvement (angler, arm64, little core): - Geomean: 2.8% - Particular benchmarks - algorithm/Sort.SystemSort: 13.0% - stanford/IntMM: 12.7% - stanford/Puzzle: 9.5% - benchmarksgame/revcomp: 8.9% - reversigame/Reversi: 3.5% Test: 510-checker-try-catch. Test: 706-checker-scheduler. Test: 527-checker-array-access-split. Test: test-art-host, test-art-target. Change-Id: I55ac011822e5dbac82c828a700213dbea87329c8
2018-08-20Fix longstanding bug around implicit NPEs and GC, version 2.Nicolas Geoffray
The TODO has been there since M (so forever :)): https://android-review.googlesource.com/c/platform/art/+/122794/13//COMMIT_MSG#13 We hardly see the issue in our tests as we need to have: 1) A GC happening while creating the NPE object. 2) ParallelMoves between the NullCheck and implicit null check operation that moves references. The CL piggy backs on the "IsEmittedAtUseSite" flag, to set implicit null checks with it. The liveness analysis then special cases implicit null checks to record environment uses at the location of the actual instruction that will do the implicit null check. Test: test.py --gcstress Test: run-libcore-tests --gcstress bug: 111545159 Change-Id: I3ecea4fe0d7e483e93db83281ca10db47da228c5
2018-08-03Merge "Simplify StackMapStream encoding."Treehugger Robot
2018-08-03Simplify StackMapStream encoding.David Srbecky
Test: test-art-host-gtest-stack_map_test Change-Id: Ife021d03e4e486043ec609f9af8673ace7bde497
2018-08-03Rename type resolution entrypoints.Vladimir Marko
Rename the InitializeType and InitializeTypeAndVerifyAccess entrypoints to Resolve* to better match their semantics. Keep the InitializeStaticStorage name for now as the most appropriate name InitializeType would clash with the old name of the ResolveType entrypoint. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: Ide55b58c490d085ab37d8536f90699f7ed571d59
2018-08-02Rewrite Class init entrypoint to take a Class arg.Vladimir Marko
Fixes invalid type index being passed to the entrypoint for class init check across dex files when the target type does not have a TypeId in the compilation unit's DexFile. The size of the aosp_taimen-userdebug prebuilts: - before: arm/boot*.oat: 16782748 arm64/boot*.oat: 19764400 oat/arm64/services.odex: 20162432 - after: arm/boot*.oat: 16811692 (+28.3KiB, +0.17%) arm64/boot*.oat: 19801032 (+35.8KiB, +0.19%) oat/arm64/services.odex: 20232208 (+68.1KiB, +0.35%) This increase comes from doing two runtime calls instead of one for HLoadClass/kBssEntry that MustGenerateClinitCheck(). Test: Additional test in 476-clinit-inline-static-invoke Test: m test-art-host-gtest Test: testrunner.py --host --optimizing --jit Test: Pixel 2 XL boots. Test: testrunner.py --target --optimizing --jit Test: testrunner.py --jvm Bug: 111433619 Change-Id: I2fccd6944480ab4dac514f60d38e72c1014ae7b2
2018-08-01Move MethodInfo to CodeInfo.David Srbecky
There is no need to treat it specially any more, because of the de-duplication at BitTable level. This saves 0.6% of oat file size. Test: test-art-host-gtest Change-Id: Ife7927d736243879a41d6f325d49ebf6930a63f6
2018-07-13Remove unused InvokeInfo from stack maps and the runtime.David Srbecky
Test: test-art-host-gtest Change-Id: I5ce28973042f9241e72ceb52fc5db472ca571563
2018-06-27Merge "Move instruction_set_ to CompilerOptions."Vladimir Marko
2018-06-26Add method frame info to CodeInfo.David Srbecky
The stored information will be used in follow-up CLs. This temporarily increases .oat file size by 0.7%. Test: test-art-host-gtest Change-Id: Ie7d898b06398ae44287bb1e8153861ab112a216c
2018-06-25Move instruction_set_ to CompilerOptions.Vladimir Marko
Removes CompilerDriver dependency from ImageWriter and several other classes. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: Pixel 2 XL boots. Test: m test-art-target-gtest Test: testrunner.py --target --optimizing Change-Id: I3c5b8ff73732128b9c4fad9405231a216ea72465