summaryrefslogtreecommitdiff
path: root/compiler/optimizing/code_generator_arm.cc
AgeCommit message (Collapse)Author
2016-06-29Revert "Refactor GetIMTIndex"Nicolas Geoffray
I need to revert this to get https://android-review.googlesource.com/#/c/244190/ to cleanly revert. Matthew, do you mind rewriting it? This reverts commit 50706437d8216e41f0fea1e413cda7891324d397. Change-Id: I5c1435f5dffb46dbb5b613b22adb88c7770304f2
2016-06-24Merge changes I4d8da7ce,I4da5be01,Idfbead82Roland Levillain
* changes: Re-enable most intrinsics with read barriers. Fix ARM & ARM64 UnsafeGetObject intrinsics with read barriers. Fix x86 & x86-64 UnsafeGetObject intrinsics with read barriers.
2016-06-23Re-enable most intrinsics with read barriers.Roland Levillain
Also extend sun.misc.Unsafe test coverage to exercise sun.misc.Unsafe.{get,put}{Int,Long,Object}Volatile. Bug: 26205973 Bug: 29516905 Change-Id: I4d8da7cee5c8a310c8825c1631f71e5cb2b80b30 Test: Covered by ART's run-tests.
2016-06-23Fix ARM & ARM64 UnsafeGetObject intrinsics with read barriers.Roland Levillain
The implementation was incorrectly interpreting the 'offset' input as an index in a (4-byte) object reference array, whereas it is a (1-byte) offset to an object reference field within the 'base' (object) input. Bug: 29516905 Change-Id: I4da5be0193217965f25e5d141c242592dea6ffe8 Test: Covered by test/004-UnsafeTest.
2016-06-21Merge "Replace String.charAt() with HIR."Vladimir Marko
2016-06-21Replace String.charAt() with HIR.Vladimir Marko
Replace String.charAt() with HArrayLength, HBoundsCheck and HArrayGet. This allows GVN on the HArrayLength and BCE on the HBoundsCheck as well as using the infrastructure for HArrayGet, i.e. better handling of constant indexes than the old intrinsic and using the HArm64IntermediateAddress. Bug: 28330359 Change-Id: I32bf1da7eeafe82537a60416abf6ac412baa80dc
2016-06-21Improve HLoadClass code generation.Vladimir Marko
For classes in the boot image, use either direct pointers or PC-relative addresses. For other classes, use PC-relative access to the dex cache arrays for AOT and direct address of the type's dex cache slot for JIT. For aosp_flounder-userdebug: - 32-bit boot.oat: -252KiB (-0.3%) - 64-bit boot.oat: -412KiB (-0.4%) - 32-bit dalvik cache total: -392KiB (-0.4%) - 64-bit dalvik-cache total: -2312KiB (-1.0%) (contains more files than the 32-bit dalvik cache) For aosp_flounder-userdebug forced to compile PIC: - 32-bit boot.oat: -124KiB (-0.2%) - 64-bit boot.oat: -420KiB (-0.5%) - 32-bit dalvik cache total: -136KiB (-0.1%) - 64-bit dalvik-cache total: -1136KiB (-0.5%) (contains more files than the 32-bit dalvik cache) Bug: 27950288 Change-Id: I4da991a4b7e53c63c92558b97923d18092acf139
2016-06-15Refactor GetIMTIndexMatthew Gharrity
This allows us to more easily maintain and experiment with interface method table indexing and hashing. Change-Id: I719920fae7490dcedcda7c1c36db225c2b8b16df
2016-06-14Optimize IMTNelli Kim
* Remove IMT for classes which do not implement interfaces * Remove IMT for array classes * Share same IMT Saved memory (measured on hammerhead): boot.art: Total number of classes: 3854 Number of affected classes: 1637 Saved memory: 409kB Chrome (excluding classes in boot.art): Total number of classes: 2409 Number of affected classes: 1259 Saved memory: 314kB Google Maps (excluding classes in boot.art): Total number of classes: 6988 Number of affected classes: 2574 Saved memory: 643kB Performance regression on benchmarks/InvokeInterface.java benchmark (measured timeCall10Interface) 1st launch: 9.6% 2nd launch: 6.8% Change-Id: If07e45390014a6ee8f3c1c4ca095b43046f0871f
2016-06-02Refactor handling of input records.Vladimir Marko
Introduce HInstruction::GetInputRecords(), a new virtual function that returns an ArrayRef<> to all input records. Implement all other functions dealing with input records as wrappers around GetInputRecords(). Rewrite functions that previously used multiple virtual calls to deal with input records, especially in loops, to prefetch the ArrayRef<> only once for each instruction. Besides avoiding all the extra calls, this also allows the compiler (clang++) to perform additional optimizations. This speeds up the Nexus 5 boot image compilation by ~0.5s (4% of "Compile Dex File", 2% of dex2oat time) on AOSP ToT. Change-Id: Id8ebe0fb9405e38d918972a11bd724146e4ca578
2016-05-13Fix misc-macro-parentheses warnings.Chih-Hung Hsieh
* Add parentheses to fix warnings. * Use NOLINT to suppress wrong clang-tidy warnings. Bug: 28705665 Change-Id: Icc8bc9b59583dee0ea17ab83e0ff0383b8599c3e
2016-05-09Intrinsify String.length() and String.isEmpty() as HIR.Vladimir Marko
Use HArrayLength for String.length() in anticipation of changing the String.charAt() to HBoundsCheck+HArrayGet to allow the existing BCE to seamlessly work for strings. Use HArrayLength+HEqual for String.isEmpty(). We previously relied on inlining but we now want to apply the new intrinsics even when we do not inline, i.e. when compiling debuggable (as is currently the case for boot image) or when we hit inlining limits, i.e. depth, size, or the number of accumulated dex registers. Bug: 28330359 Change-Id: Iab9d2f6d2967bdd930a72eb461f27efe8f37c103
2016-04-28Split profile recording from jit compilationCalin Juravle
We still use ProfileInfo objects to record profile information. That gives us the flexibility to add the inline caches in the future and the convenience of the already implemented GC. If UseJIT is false and SaveProfilingInfo true, we will only record the ProfileInfo and never launch compilation tasks. Bug: 27916886 (cherry picked from commit e5de54cfab5f14ba0b8ff25d8d60901c7021943f) Change-Id: I68afc181d71447895fb12346c1806e99bcab1de2
2016-04-13Move Assemblers to the Arena.Vladimir Marko
And clean up some APIs to return std::unique_ptr<> instead of raw pointers that don't communicate ownership. Change-Id: I3017302307a0253d661240750298802fb0d9585e
2016-04-07Revert "Revert "Refactor HGraphBuilder and SsaBuilder to remove HLocals""David Brazdil
This patch merges the instruction-building phases from HGraphBuilder and SsaBuilder into a single HInstructionBuilder class. As a result, it is not necessary to generate HLocal, HLoadLocal and HStoreLocal instructions any more, as the builder produces SSA form directly. Saves 5-15% of arena-allocated memory (see bug for more data): GMS 20.46MB => 19.26MB (-5.86%) Maps 24.12MB => 21.47MB (-10.98%) YouTube 28.60MB => 26.01MB (-9.05%) This CL fixed an issue with parsing quickened instructions. Bug: 27894376 Bug: 27998571 Bug: 27995065 Change-Id: I20dbe1bf2d0fe296377478db98cb86cba695e694
2016-04-06Optimizing: Fix codegens for MethodLoadKind::kDexCacheViaMethod.Vladimir Marko
Use the original method index instead of the target method index because the target method may point to a different dex file. No regression test: this currently happens only if the codegen uses the kDexCacheViaMethod as a fallback for another load kind and we aim to avoid that fallback, so it would be difficult to write a reliable regression test. We could try and exploit current fallbacks for irreducible loops on x86 and arm but those fallbacks will eventually disappear anyway. Bug: 28036230 Change-Id: I4cc9e046480d3d60a7fb521f0ca6a98914625cdc
2016-04-04Revert "Refactor HGraphBuilder and SsaBuilder to remove HLocals"David Brazdil
Bug: 27995065 This reverts commit e3ff7b293be2a6791fe9d135d660c0cffe4bd73f. Change-Id: I5363c7ce18f47fd422c15eed5423a345a57249d8
2016-04-04Refactor HGraphBuilder and SsaBuilder to remove HLocalsDavid Brazdil
This patch merges the instruction-building phases from HGraphBuilder and SsaBuilder into a single HInstructionBuilder class. As a result, it is not necessary to generate HLocal, HLoadLocal and HStoreLocal instructions any more, as the builder produces SSA form directly. Saves 5-15% of arena-allocated memory (see bug for more data): GMS 20.46MB => 19.26MB (-5.86%) Maps 24.12MB => 21.47MB (-10.98%) YouTube 28.60MB => 26.01MB (-9.05%) Bug: 27894376 Change-Id: Iefe28d40600c169c5d306fd2c77034ae19476d90
2016-03-29Optimizing: Improve const-string code generation.Vladimir Marko
For strings in the boot image, use either direct pointers or pc-relative addresses. For other strings, use PC-relative access to the dex cache arrays for AOT and direct address of the string's dex cache slot for JIT. For aosp_flounder-userdebug: - 32-bit boot.oat: -692KiB (-0.9%) - 64-bit boot.oat: -948KiB (-1.1%) - 32-bit dalvik cache total: -900KiB (-0.9%) - 64-bit dalvik cache total: -3672KiB (-1.5%) (contains more files than the 32-bit dalvik cache) For aosp_flounder-userdebug forced to compile PIC: - 32-bit boot.oat: -380KiB (-0.5%) - 64-bit boot.oat: -928KiB (-1.0%) - 32-bit dalvik cache total: -468KiB (-0.4%) - 64-bit dalvik cache total: -1928KiB (-0.8%) (contains more files than the 32-bit dalvik cache) Bug: 26884697 Change-Id: Iec7266ce67e6fedc107be78fab2e742a8dab2696
2016-03-24Merge "Clean up art::HConstant predicates."Roland Levillain
2016-03-22Fix and improve shift and rotate operations.Roland Levillain
- Define maximum int and long shift & rotate distances as int32_t constants, as shift & rotate distances are 32-bit integer values. - Consider the (long, long) inputs case as invalid for static evaluation of shift & rotate rotations. - Add more checks in shift & rotate operations constructors as well as in art::GraphChecker. Change-Id: I754b326c3a341c9cc567d1720b327dad6fcbf9d6
2016-03-18Clean up art::HConstant predicates.Roland Levillain
- Make the difference between arithmetic zero and zero-bit pattern non ambiguous. - Introduce Boolean predicates in art::HIntConstant for when they are used as Booleans. - Introduce aritmetic positive and negative zero predicates for floating-point constants. Bug: 27639313 Change-Id: Ia04ecc6f6aa7450136028c5362ed429760c883bd
2016-03-18Merge "Ensure art::HRor support boolean, byte, short and char inputs."Roland Levillain
2016-03-18Ensure art::HRor support boolean, byte, short and char inputs.Roland Levillain
Also extend tests covering the IntegerRotateLeft, LongRotateLeft, IntegerRotateRight and LongRotateRight intrinsics and their translation into an art::HRor instruction. Bug: 27682579 Change-Id: I89f6ea6a7315659a172482bf09875cfb7e7422a1
2016-03-18Merge "Generate native debug stackmaps before calls as well."David Srbecky
2016-03-17Generate native debug stackmaps before calls as well.David Srbecky
The debugger looks up PC of the call instruction, so the runtime's stackmap is not sufficient since it is at PC after the instruction. Change-Id: I0dd06c0b52e8079ea5d064ea10beb12c93584092
2016-03-16Make art::HCompare support boolean, byte, short and char inputs.Roland Levillain
Also extend tests covering the IntegerSignum, LongSignum, IntegerCompare and LongCompare intrinsics and their translation into an art::HCompare instruction. Bug: 27629913 Change-Id: I0afc75ee6e82602b01ec348bbb36a08e8abb8bb8
2016-03-16Merge "Clean up NullCheck generation and record stats about it."Calin Juravle
2016-03-16Clean up NullCheck generation and record stats about it.Calin Juravle
This removes redundant code from the generators and allows for easier stat recording. Change-Id: Iccd4368f9e9d87a6fecb863dee4e2145c97851c4
2016-03-16Accept boolean as an input of HDivZeroCheck.Nicolas Geoffray
All our arithmetic operations accept it. bug:27624718 Change-Id: I1f6bb95dc77ecb3fb2fcabb35a93b31c524bfa0a
2016-03-11Integrate BitwiseNegated into shared framework.Artem Serov
Share implementation between arm and arm64. Change-Id: I0dd12e772cb23b4c181fd0b1e2a447470b1d8702
2016-02-26Optimizing: Reduce memory usage of HInstructions.Vladimir Marko
Pack narrow fields and flags into a single 32-bit field. Change-Id: Ib2f7abf987caee0339018d21f0d498f8db63542d
2016-02-25Revert "Revert "ARM/ARM64: Extend support of instruction combining.""Artem Udovichenko
This reverts commit 6b5afdd144d2bb3bf994240797834b5666b2cf98. Change-Id: Ic27a10f02e21109503edd64e6d73d1bb0c6a8ac6
2016-02-24Associate slow paths with the instruction that they belong to.David Srbecky
Almost all slow paths already know the instruction they belong to, this CL just moves the knowledge to the base class as well. This is needed to be be able to get the corresponding dex pc for slow path, which allows us generate better native line numbers, which in turn fixes some native debugging stepping issues. Change-Id: I568dbe78a7cea6a43a4a71a014b3ad135782c270
2016-02-24Remove HNativeDebugInfo from start of basic blocks.David Srbecky
We do not require full environment at the start of basic block. The dex pc contained in basic block is sufficient for line mapping. Change-Id: I5ba9e5f5acbc4a783ad544769f9a73bb33e2bafa
2016-02-15Optimizing: Simplify consecutive type conversions.Vladimir Marko
Merge two consecutive type conversions to one if the result of such merged conversion is guaranteed to be the same and remove all implicit conversions, not just conversions to the same type. Improve codegens to handle conversions from long to integral types smaller than int. This will make it easier to simplify `(byte) (x & 0xffL)` to `(byte) x` where the conversion from long to byte is done by two dex instructions, long-to-int and in int-to-byte. Bug: 23965701 Change-Id: I833f193556671136ad2cd3f5b31cdfbc2d99c19d
2016-02-12ART: Remove HTemporaryDavid Brazdil
Change-Id: I21b984224370a9ce7a4a13a9652503cfb03c5f03
2016-02-05Implemented compare/signum intrinsics as HCompareAart Bik
(with all code generation for all) Rationale: At HIR level, many more optimizations are possible, while ultimately generated code can take advantage of full semantics. Change-Id: I6e2ee0311784e5e336847346f7f3c4faef4fd17e
2016-01-28Merge "Implement first kind of polymorphic inlining."Nicolas Geoffray
2016-01-28Implement first kind of polymorphic inlining.Nicolas Geoffray
Add HClassTableGet to fetch an ArtMethod from the vtable or imt, and compare it to the only method the profiling saw. Change-Id: I76afd3689178f10e3be048aa3ac9a97c6f63295d
2016-01-28ART: Implement HSelectDavid Brazdil
This patch adds a new HIR instruction to Optimizing. HSelect returns one of two inputs based on the outcome of a condition. This is only initial implementation which: - defines the new instruction, - repurposes BooleanSimplifier to emit it, - extends InstructionSimplifier to statically resolve it, - updates existing code and tests accordingly. Code generators currently emit fallback if/then/else code and will be updated in follow-up CLs to use platform-specific conditional moves when possible. Change-Id: Ib61b17146487ebe6b55350c2b589f0b971dcaaee
2016-01-28ART: Implement support for instruction inliningDavid Brazdil
Optimizing HIR contains 'non-materialized' instructions which are emitted at their use sites rather than their defining sites. This was not properly handled by the liveness analysis which did not adjust the use positions of the inputs of such instructions. Despite the analysis being incorrect, the current use cases never produce incorrect code. This patch generalizes the concept of inlined instructions and updates liveness analysis to set the compute use positions correctly. Change-Id: Id703c154b20ab861241ae5c715a150385d3ff621
2016-01-22Improve documentation and assertions of read barrier instrumentation.Roland Levillain
For ARM, x86, x86-64 back ends. The case of the ARM64 back end is already handled in https://android-review.googlesource.com/#/c/197870/. Bug: 12687968 Change-Id: I6df1128cc100cbdb89020876e1a54de719508be3
2016-01-22Revert "ARM/ARM64: Extend support of instruction combining."Nicolas Geoffray
The test fails its checker parts. This reverts commit debeb98aaa8950caf1a19df490f2ac9bf563075b. Change-Id: I49929e15950c7814da6c411ecd2b640d12de80df
2016-01-21ARM/ARM64: Extend support of instruction combining.Ilmir Usmanov
Combine multiply instructions in the following way: ARM64: MUL/NEG -> MNEG ARM32 (32-bit integers only): MUL/ADD -> MLA MUL/SUB -> MLS Change-Id: If20f2d8fb060145ab6fbceeb5a8f1a3d02e0ecdb
2016-01-19Some read barrier clean-up in Optimizing.Roland Levillain
These changes make the read barrier compiler instrumentation code more uniform among the ARM, ARM64, x86 and x86-64 back ends. Bug: 12687968 Change-Id: I6b1c0cf2bc22ed6cd6b14754136bef4a2a036ea5
2016-01-18Merge "ART: Remove Baseline compiler"David Brazdil
2016-01-18ART: Remove Baseline compilerDavid Brazdil
We don't need Baseline any more and it hasn't been maintained for a while anyway. Let's remove it. Change-Id: I442ed26855527be2df3c79935403a25b1ee55df6
2016-01-18Optimizing: Improve floating point comparisons on arm and arm64.Vladimir Marko
Avoid the extra check for unordered inputs by using the appropriate arm/arm64 condition. Change-Id: Ib5e775a90428db7a2cf377ad9fd6a3192d670617
2016-01-15Merge "ART: Remove incorrect HFakeString optimization"David Brazdil