summaryrefslogtreecommitdiffstats
path: root/compiler/dex/mir_graph.h
Commit message (Collapse)AuthorAgeFilesLines
* art: Fix whitespace errors added by cafChristopher R. Palmer2015-11-091-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All of these errors break compilation with GCC 4.9 and based on a spot check appear to be all CAF introduced changes. Fix these to avoid future breakage. Conflicts: compiler/dex/mir_graph.h compiler/dex/quick/arm/assemble_arm.cc compiler/dex/quick/arm/codegen_arm.h compiler/dex/quick/arm/target_arm.cc compiler/dex/quick/arm64/codegen_arm64.h compiler/dex/quick/arm64/target_arm64.cc compiler/dex/quick/mir_to_lir.h compiler/utils/growable_array.h Changes: compiler/dex/mir_graph.h compiler/dex/mir_optimization.cc compiler/dex/quick/arm/codegen_arm.h compiler/dex/quick/arm/target_arm.cc compiler/dex/quick/mir_to_lir.h compiler/dex/quick/quick_compiler.cc compiler/driver/compiler_driver.cc compiler/optimizing/inliner.cc compiler/optimizing/nodes.cc compiler/optimizing/optimizing_compiler.cc Change-Id: I3e23e1449eea0565fbe6f91251190b1e153f16cf Signed-off-by: AdrianDC <radian.dc@gmail.com>
* ART: extensionWei Wang2015-10-061-2/+42
| | | | | | | 1. add hooks for further extension 2. minor code change Change-Id: I2615013b899f5f9b3495546e6001863fb054861a
* ART: Fix Quick/Optimizing suspend check assumption mismatch.Vladimir Marko2015-07-231-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | Quick's SuspendCheckElimination (SCE) expects that every method contains a suspend check and it eliminates suspend checks in loops containing an invoke. Optimizing eliminates the suspend check from leaf methods, so the combination of a Quick-compiled loop calling an Optimizing-compiled leaf method can lead to missing suspend checks and potentially leading to ANRs. Enable Quick's kLeafOptimization flag to remove suspend checks from leaf methods and disable Quick's SCE. This aligns the suspend check placement for the two backends and avoids the broken combination. Currently, all methods containing a try-catch are compiled with Quick, so it's relatively easy to create a regression test. However, this test will not be valid when Optimizing starts supporting try-catch. Bug: 22657404 (cherry picked from commit d29e8487ff1774b6eb5f0e18d854415c1ee8f6b0) Change-Id: I733c38bf68bfc2c618f2f2e6b59f8b0e015d7be1
* Quick: Fix optimizations for empty if blocks.Vladimir Marko2015-06-191-0/+15
| | | | | | | | | | | | | | | If a block ending with if-eqz or if-nez has the same "taken" and "fallthrough", we cannot assume that the value has been checked against zero in one of the succesors. This affects the null check elimination pass as well as GVN. Refactor all those checks to a single function in BasicBlock and check that the "taken" and "falthrough" are different when needed. Bug: 21614284 (cherry picked from commit f11c420c448baffac6a70ac0884d481ab347e257) Change-Id: I062e0042de3470ce8680b586487b9c7acbd206bc
* ART: Clean up arm64 kNumberOfXRegisters usage.Vladimir Marko2015-05-261-0/+1
| | | | | | | | | | | | | | | | | | | | | Avoid undefined behavior for arm64 stemming from 1u << 32 in loops with upper bound kNumberOfXRegisters. Create iterators for enumerating bits in an integer either from high to low or from low to high and use them for <arch>Context::FillCalleeSaves() on all architectures. Refactor runtime/utils.{h,cc} by moving all bit-fiddling functions to runtime/base/bit_utils.{h,cc} (together with the new bit iterators) and all time-related functions to runtime/base/time_utils.{h,cc}. Improve test coverage and fix some corner cases for the bit-fiddling functions. Bug: 13925192 (cherry picked from commit 80afd02024d20e60b197d3adfbb43cc303cf29e0) Change-Id: I905257a21de90b5860ebe1e39563758f721eab82
* Replace String CharArray with internal uint16_t array.Jeff Hao2015-04-271-0/+3
| | | | | | | | | | | | Summary of high level changes: - Adds compiler inliner support to identify string init methods - Adds compiler support (quick & optimizing) with new invoke code path that calls method off the thread pointer - Adds thread entrypoints for all string init methods - Adds map to verifier to log when receiver of string init has been copied to other registers. used by compiler and interpreter Change-Id: I797b992a8feb566f9ad73060011ab6f51eb7ce01
* ART: Fix addpd opcode, add Quick x86 assembler testChao-ying Fu2015-04-251-0/+1
| | | | | | | | | This patch fixes the addpd opcode that may be used by vectorizations, and adds an assembler test for the Quick x86 assembler, currently lightly testing addpd, subpd and mulpd. Change-Id: I29455a86212829c75fd75737679280f167da7b5b Signed-off-by: Chao-ying Fu <chao-ying.fu@intel.com>
* Quick: Fix and enable DCE and improve GVN/DCE cleanup.Vladimir Marko2015-04-231-0/+1
| | | | | | | | | | | | | When eliminating a move by renaming its source register, check that it doesn't conflict with vreg usage by insns between the defining insn and the move. Improve the GVN/DCE cleanup so that it can handle cases where GVN or DCE is individually disabled in the pass driver but not in the disable_opt flags. Bug: 19419671 Change-Id: I49bb67b81509f51fbaf90c6016c509962be43736
* Revert "Revert "Quick: Rewrite type inference pass.""Vladimir Marko2015-04-231-38/+29
| | | | | | | | | Fix the type of the ArtMethod* SSA register. Bug: 19419671 This reverts commit 1b717f63847de8762e7f7bdd6708fdfae9d24a67. Change-Id: Ie4da3c03a0e0334a39a24718f6dc31f9255cfb53
* Revert "Quick: Rewrite type inference pass."Andreas Gampe2015-04-221-29/+38
| | | | | | | | Breaks arm64, as the method register is not correctly flagged as ref and thus 32bit. Bug: 19419671 This reverts commit e490b01c12d33f3bd5c247b55b47e507cc9c8fab.
* Replace NULL with nullptrMathieu Chartier2015-04-221-1/+1
| | | | | | | Also fixed some lines that were too long, and a few other minor details. Change-Id: I6efba5fb6e03eb5d0a300fddb2a75bf8e2f175cb
* Quick: Rewrite type inference pass.Vladimir Marko2015-04-221-38/+29
| | | | | | | | | | | Use method signatures, field types and types embedded in dex insns for type inference. Perform the type inference in two phases, first a simple pass that records all types implied by individual insns, and then an iterative pass to propagate those types further via phi, move, if-cc and aget/aput insns. Bug: 19419671 Change-Id: Id38579d48a44fc5eadd13780afb6d370093056f9
* Merge "Implement CFI for Quick."David Srbecky2015-04-091-0/+1
|\
| * Implement CFI for Quick.David Srbecky2015-04-081-0/+1
| | | | | | | | | | | | CFI is necessary for stack unwinding in gdb, lldb, and libunwind. Change-Id: Ic3b84c9dc91c4bae80e27cda02190f3274e95ae8
* | Quick: Clean up temp use counting.Vladimir Marko2015-04-081-5/+0
|/ | | | | | | | | | | | | | | | | For the boot image on arm64 and x86-64 we're using true PC-relative addressing, so pc_rel_temp_ is nullptr and CanUsePcRelDexCacheArrayLoad() returns true, but we're not actually using the ArtMethod* so fix the AnalyzeMIR() to take it into account. Also don't count intrinsic invokes towards ArtMethod* uses. To avoid repeated method inliner inquiries about whether a method is intrinsic or special (requiring lock acquisition), cache that information in MirMethodLoweringInfo. As part of that cleanup, take quickened invokes into account for suspend check elimination. Change-Id: I5b4ec124221c0db1314c8e72675976c110ebe7ca
* Promote pointer to dex cache arrays on arm.Vladimir Marko2015-04-071-0/+12
| | | | | | | | | Do the use-count analysis on temps (ArtMethod* and the new PC-relative temp) in Mir2Lir, rather than MIRGraph. MIRGraph isn't really supposed to know how the ArtMethod* is used by the backend. Change-Id: Iaf56a46ae203eca86281b02b54f39a80fe5cc2dd
* Quick: Eliminate check-cast guaranteed by instance-of.Vladimir Marko2015-03-181-0/+1
| | | | | | | | | | | | | | Eliminate check-cast if the result of an instance-of with the very same type on the same value is used to branch to the check-cast's block or a dominator of it. Note that there already exists a verifier-based elimination of check-cast but it excludes check-cast on interfaces. This new optimization works for interface types and, since it's GVN-based, it can better recognize when the same reference is used for instance-of and check-cast. Change-Id: Ib315199805099d1cb0534bb4a90dc51baa409685
* Fall back to Quick when Optimizing cannot compile.Nicolas Geoffray2015-03-171-1/+2
| | | | | | | Currently applies when seeing unresolved types/methods/fields, and methods with try/catch. Change-Id: I93b12d440b39f0b9faf98f08f2bfddedfeff7182
* Revert "Revert "Add JIT""Mathieu Chartier2015-02-241-2/+2
| | | | | | | | Added missing EntryPointToCodePointer. This reverts commit a5ca888d715cd0c6c421313211caa1928be3e399. Change-Id: Ia74df0ef3a7babbdcb0466fd24da28e304e3f5af
* Revert "Add JIT"Nicolas Geoffray2015-02-241-2/+2
| | | | | | | | | | | | | | | Sorry, run-test crashes on target: 0-05 12:15:51.633 I/DEBUG (27995): Abort message: 'art/runtime/mirror/art_method.cc:349] Check failed: PcIsWithinQuickCode(reinterpret_cast<uintptr_t>(code), pc) java.lang.Throwable java.lang.Throwable.fillInStackTrace() pc=71e3366b code=0x71e3362d size=ad000000' 10-05 12:15:51.633 I/DEBUG (27995): r0 00000000 r1 0000542b r2 00000006 r3 00000000 10-05 12:15:51.633 I/DEBUG (27995): r4 00000006 r5 b6f9addc r6 00000002 r7 0000010c 10-05 12:15:51.633 I/DEBUG (27995): r8 b63fe1e8 r9 be8e1418 sl b6427400 fp b63fcce0 10-05 12:15:51.633 I/DEBUG (27995): ip 0000542b sp be8e1358 lr b6e9a27b pc b6e9c280 cpsr 40070010 10-05 12:15:51.633 I/DEBUG (27995): Bug: 17950037 This reverts commit 2535abe7d1fcdd0e6aca782b1f1932a703ed50a4. Change-Id: I6f88849bc6f2befed0c0aaa0b7b2a08c967a83c3
* Add JITMathieu Chartier2015-02-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently disabled by default unless -Xjit is passed in. The proposed JIT is a method JIT which works by utilizing interpreter instrumentation to request compilation of hot methods async during runtime. JIT options: -Xjit / -Xnojit -Xjitcodecachesize:N -Xjitthreshold:integervalue The JIT has a shared copy of a compiler driver which is accessed by worker threads to compile individual methods. Added JIT code cache and data cache, currently sized at 2 MB capacity by default. Most apps will only fill a small fraction of this cache however. Added support to the compiler for compiling interpreter quickened byte codes. Added test target ART_TEST_JIT=TRUE and --jit for run-test. TODO: Clean up code cache. Delete compiled methods after they are added to code cache. Add more optimizations related to runtime checks e.g. direct pointers for invokes. Add method recompilation. Move instrumentation to DexFile to improve performance and reduce memory usage. Bug: 17950037 Change-Id: Ifa5b2684a2d5059ec5a5210733900aafa3c51bca
* Merge "Move arenas into runtime"Mathieu Chartier2015-02-191-3/+3
|\
| * Move arenas into runtimeMathieu Chartier2015-02-191-3/+3
| | | | | | | | | | | | | | | | | | | | Moved arena pool into the runtime. Motivation: Allow GC to use arena allocators, recycle arena pool for linear alloc. Bug: 19264997 Change-Id: I8ddbb6d55ee923a980b28fb656c758c5d7697c2f
* | Add suspend checks to special methods.Vladimir Marko2015-02-191-6/+6
|/ | | | | | | | | | | | Generate suspend checks at the beginning of special methods. If we need to call to runtime, go to the slow path where we create a simplified but valid frame, spill all arguments, call art_quick_test_suspend, restore necessary arguments and return back to the fast path. This keeps the fast path overhead to a minimum. Bug: 19245639 Change-Id: I3de5aee783943941322a49c4cf2c4c94411dbaa2
* Dead code elimination based on GVN results.Vladimir Marko2015-02-171-11/+21
| | | | Change-Id: I5b77411a8f088f0b561da14b123cf6b0501c9db5
* Clean up Scoped-/ArenaAlocator array allocations.Vladimir Marko2015-02-131-3/+2
| | | | Change-Id: Id718f8a4450adf1608306286fa4e6b9194022532
* Quick: Rewrite Phi node insertion.Vladimir Marko2015-02-101-1/+2
| | | | | | | | Delay Phi node insertion to the SSAConversion pass to allow updating the vreg_to_ssa_map_ with INVALID_SREG when we omit a Phi in the pruned SSA form. Change-Id: I450dee21f7dc4353d25fc66f4d0ee01671de6e0e
* ART: Remove MIRGraph::dex_pc_to_block_map_Chao-ying Fu2015-02-091-8/+12
| | | | | | | | | | | | | | | This patch removes MIRGraph::dex_pc_to_block_map_, adds a local variable dex_pc_to_block_map inside MIRGraph::InlineMethod(), and updates several functions to pass dex_pc_to_block_map. The goal is to limit the scope of dex_pc_to_block_map and the usage of FindBlock, so that various compiler optimizations cannot rely on dex pc to look up basic blocks to avoid duplicated dex pc issues. Also, this patch changes quick targets to use successor blocks for switch case target generation at Mir2Lir::InstallSwitchTables(). Change-Id: I9f571efebd2706b4e1606279bd61f3b406ecd1c4 Signed-off-by: Chao-ying Fu <chao-ying.fu@intel.com>
* ART: Some Quick cleanupAndreas Gampe2015-01-261-6/+7
| | | | | | | | | | Make several fields const in CompilationUnit. May benefit some Mir2Lir code that repeats tests, and in general immutability is good. Remove compiler_internals.h and refactor some other headers to reduce overly broad imports (and thus forced recompiles on changes). Change-Id: I898405907c68923581373b5981d8a85d2e5d185a
* Move two members out of MIRGraph::temp_::ssa.Vladimir Marko2014-12-191-3/+3
| | | | | | | | | | It turns out they are used outside the SSA transformation by the x86 back-end. This is a partial revert of https://android-review.googlesource.com/120571 Change-Id: Ia5cb2988ab0625d8519901124bd4fc184d5f0886
* Clean up dead loops before suspend check elimination.Vladimir Marko2014-12-191-8/+2
| | | | | | | | Get rid of BasicBlock::KillUnreachable() and just Kill() unreachable blocks from the DFS order calculation. Bug: 18718277 Change-Id: Icaf7b9c2320530e950f87e1e2e2bd1fa5f53cb98
* Clean up post-opt passes, perform only those we need.Vladimir Marko2014-12-191-6/+21
| | | | Change-Id: If802074d780d91151d236ef52236b6f33ca47258
* ARM: Combine multiply accumulate operations.Ningsheng Jian2014-12-111-0/+28
| | | | | | | Try to combine integer multiply and add(sub) into a MAC operation. For AArch64, also try to combine long type multiply and add(sub). Change-Id: Ic85812e941eb5a66abc355cab81a4dd16de1b66e
* Merge "Quick: Redefine the notion of back-egdes."Vladimir Marko2014-12-091-23/+37
|\
| * Quick: Redefine the notion of back-egdes.Vladimir Marko2014-12-091-23/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Redefine a back-edge to really mean an edge to a loop head instead of comparing instruction offsets. Generate suspend checks also on fall-through to a loop head; insert an extra GOTO for these edges. Add suspend checks to fused cmp instructions. Rewrite suspend check elimination to track whether there is an invoke on each path from the loop head to a given back edge, instead of using domination info to look for a basic block with invoke that must be on each path. Ignore invokes to intrinsics and move the optimization to a its own pass. The new loops in 109-suspend-check should prevent intrinsics and fused cmp-related regressions. Bug: 18522004 Change-Id: I96ac818f76ccf9419a6e70e9ec00555f9d487a9e
* | Merge "Quick: Kill unreachable blocks instead of just hiding them."Vladimir Marko2014-12-081-6/+6
|\ \
| * | Quick: Kill unreachable blocks instead of just hiding them.Vladimir Marko2014-12-081-6/+6
| |/ | | | | | | | | | | | | | | This changes the block type from kDalvikByteCode to kDead and properly cleans up predecessors and MIRGraph::catches_. Bug: 18626174 Change-Id: I268bf68f7947604bcb82caf95ee79c6831ee6e2a
* / Re-factor Quick ABI supportSerguei Katkov2014-12-081-0/+1
|/ | | | | | | | | | | | | | | | | | | Now every architecture must provide a mapper between VRs parameters and physical registers. Additionally as a helper function architecture can provide a bulk copy helper for GenDalvikArgs utility. All other things becomes a common code stuff: GetArgMappingToPhysicalReg, GenDalvikArgsNoRange, GenDalvikArgsRange, FlushIns. Mapper now uses shorty representation of input parameters. This is required due to location are not enough to detect the type of parameter (fp or core). For the details see https://android-review.googlesource.com/#/c/113936/. Change-Id: Ie762b921e0acaa936518ee6b63c9a9d25f83e434 Signed-off-by: Serguei Katkov <serguei.i.katkov@intel.com>
* Skip null check in MarkGCCard() for known non-null values.Vladimir Marko2014-11-241-2/+1
| | | | | | | Use GVN's knowledge of non-null values to set a new MIR flag for IPUT/SPUT/APUT to skip the value null check. Change-Id: I97a8d1447acb530c9bbbf7b362add366d1486ee1
* Eliminate suspend checks on back-edges to return insn.Vladimir Marko2014-11-241-0/+5
| | | | | | This optimization seems to have been broken for a long time. Change-Id: I62ec85c71bb5253917ad9465a952911e917f6b52
* Rewrite GVN's field id and field type handling.Vladimir Marko2014-11-211-4/+37
| | | | | | | | | | | | | | | | Create a helper unit for dex insn classification and cache dex field type (as encoded in the insn) in the MirFieldInfo. Use this for cleanup and a few additional DCHECKs. Change the GVN's field id to match the field lowering info index (MIR::meta::{i,s}field_lowering_info), except where multiple indexes refer to the same field and we use the lowest of the applicable indexes. Use the MirMethodInfo from MIRGraph to retrieve field type for GVN using this index. This slightly reduces GVN compilation time and prepares for further compilation time improvements. Change-Id: I1b1247cdb8e8b6897254e2180f3230f10159bed5
* Clean up MIRGraph pass temporaries.Vladimir Marko2014-11-211-9/+32
| | | | | | | Create a union of pass-specific structs with temporaries instead of shared temporaries with common names. Change-Id: Id80d3b12c48139af1580b0839c21e07e7afd0ed5
* Merge "ART: Replace COMPILE_ASSERT with static_assert (compiler)"Andreas Gampe2014-11-041-1/+1
|\
| * ART: Replace COMPILE_ASSERT with static_assert (compiler)Andreas Gampe2014-11-031-1/+1
| | | | | | | | | | | | Replace all occurrences of COMPILE_ASSERT in the compiler tree. Change-Id: Icc40a38c8bdeaaf7305ab3352a838a2cd7e7d840
* | Remove -Wno-unused-parameter and -Wno-sign-promo from base cflags.Ian Rogers2014-11-031-18/+12
|/ | | | | | | | | | | Fix associated errors about unused paramenters and implict sign conversions. For sign conversion this was largely in the area of enums, so add ostream operators for the effected enums and fix tools/generate-operator-out.py. Tidy arena allocation code and arena allocated data types, rather than fixing new and delete operators. Remove dead code. Change-Id: I5b433e722d2f75baacfacae4d32aef4a828bfe1b
* Rewrite class initialization check elimination.Vladimir Marko2014-10-271-1/+4
| | | | | | | | Split the notion of type being in dex cache away from the class being initialized. Include static invokes in the class initialization elimination pass. Change-Id: Ie3760d8fd55b987f9507f32ef51456a57d79e3fb
* Merge "ART: Add div/rem zero check elimination flag"Ian Rogers2014-10-241-0/+1
|\
| * ART: Add div/rem zero check elimination flagRazvan A Lupusoru2014-10-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Just as with other throwing bytecodes, it is possible to prove in some cases that a divide/remainder won't throw ArithmeticException. For example, in case two divides with same denominator are in order, then provably the second one cannot throw if the first one did not. This patch adds the elimination flag and updates the signature of several Mir2Lir methods to take the instruction optimization flags into account. Change-Id: I0b078cf7f29899f0f059db1f14b65a37444b84e8 Signed-off-by: Razvan A Lupusoru <razvan.a.lupusoru@intel.com>
* | Quick: In GVN, apply modifications early if outside loop.Vladimir Marko2014-10-171-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | To improve GVN performance, apply modifications to blocks outside loops during the initial convergence phase. During the post processing phase, apply modifications only to the blocks belonging to loops. Also clean up the check whether to run the LVN and add the capability to limit the maximum number of nested loops we allow the GVN to process. Change-Id: Ie7f1254f91a442397c06a325d5d314d8f58e5012
* | Quick: Improve the BBCombine pass.Vladimir Marko2014-10-151-1/+15
| | | | | | | | | | | | | | | | | | Eliminate exception edges for insns that cannot throw even when inside a try-block. Run the BBCombine pass before the SSA transformation to reduce the compilation time. Bug: 16398693 Change-Id: I8e91df593e316c994679b9d482b0ae20700b9499