summaryrefslogtreecommitdiff
path: root/compiler/optimizing/builder.h
AgeCommit message (Collapse)Author
2015-12-01Don't use the compiler driver for method resolution. Nicolas Geoffray
The compiler driver makes assumptions that don't hold for the optimizing compiler, and will for example always go to slow path for an invoke-super when there's no verified method. Also fix GenerateInvokeVirtual in the presence of intrinsics. Next change will address some of the TODOs in sharpening.cc. Change-Id: I2b0e543ee9b9bebcadb2d26de29e850c59ad58b9
2015-11-24A few more optimizations on avoiding HClinit. Nicolas Geoffray
Change-Id: I622a98b620e9d261cb654e2f5ab578bd8b3484b1
2015-11-20Explicitly add HLoadClass/HClinitCheck for HNewInstance. Nicolas Geoffray
bug:25735083 bug:25173758 Change-Id: Ie81cfa4fa9c47cc025edb291cdedd7af209a03db
2015-11-18Revert "Revert "Enable store elimination for singleton objects."" Mingyao Yang
This reverts commit 55d02cf056f993aeafebd54e7b7c68c7a48507c9, and makes the following change: Currently we leverage loop side effects to decide whether heap values are killed by the loop. Stores need to be kept if heap values may be killed by loops and the corresponding loads cannot be eliminated. Similar thing need to be done for each predecessor when we merge predecessor heap values. To do that, the HInstanceFieldSet instruction itself is put in the heap value array instead of the value of the store instruction. The store instruction may be added to possibly_removed_stores_ first, but can later be removed from possibly_removed_stores_ when it's found out that the store needs to be kept due to merging/loop side effects. Change-Id: I4f7bb1960f7b47240873e00ff1adac46fc102a02
2015-10-29Revert "Enable store elimination for singleton objects." Andreas Gampe
This reverts commit 7f43a3d48fc29045875d50e10bbc5d6ffc25d61e. Fails booting. Bug: 25357772 Change-Id: Ied19536f3ce8d81e76885cb6baed4853e2ed6714
2015-10-27Enable store elimination for singleton objects. Mingyao Yang
Enable store elimination for singleton objects. However for finalizable object, don't eliminate stores. Also added a testcase. Change-Id: Icf991e7ded5b490f55f580ef928ece5c45e89902
2015-10-23Optimizing: Determine invoke-static/-direct dispatch early. Vladimir Marko
Determine the dispatch type of invoke-static/-direct in a special pass right after the type inference. This allows the inliner to pass the "needs dex cache" check and inline more. It also allows the code generator to avoid requesting a register location for the ArtMethod* for kDexCachePcRelative and direct methods. The supported dispatch check handles also situations that the CompilerDriver currently doesn't allow. The cleanup of the CompilerDriver and required changes to Quick will come in a separate change. Change-Id: I3f8e903a119949e95871d8ab0a995f4731a13a07
2015-10-06Add support for unresolved classes in optimizing. Calin Juravle
Change-Id: I0e299a81e560eb9cb0737ec46125dffc99333b54
2015-10-02Enable compilation of members with access check failures. Calin Juravle
Change-Id: I0de73099b53612072c3e6f1235c22f96339fe440
2015-09-25Merge "Optimizing: Tag more arena allocations." Vladimir Marko
2015-09-25Optimizing: Tag more arena allocations. Vladimir Marko
Replace GrowableArray with ArenaVector and tag arena allocations with new allocation types. As part of this, make the register allocator a bit more efficient, doing bulk insert/erase. Some loops are now O(n) instead of O(n^2). Change-Id: Ifac0871ffb34b121cc0447801a2d07eefd308c14
2015-09-25ART: Preserve loop headers with try/catch David Brazdil
Algorithm for inserting HTryBoundary instructions would generate a non-natural loop when a loop header block was covered by a TryItem. This patch changes the approach to fix the issue. Bug: 23895756 Change-Id: I0e1ee6cf135cea326a96c97954907d202c9793cc
2015-09-21[optimizing] Add basic PackedSwitch support Mark Mendell
Add HPackedSwitch, and generate it from the builder. Code generators convert this to a series of compare/branch tests. Better implementation in the code generators as a real jump table will follow as separate CLs. Change-Id: If14736fa4d62809b6ae95280148c55682e856911 Signed-off-by: Mark Mendell <mark.p.mendell@intel.com>
2015-09-17BuildInvoke refactor: extract String.init in its own code path Calin Juravle
This makes it clear that we special handle String init. Getting rid of all `if (is_string_init)` improves readability into what we actually do and expect for strings. Change-Id: I9b4fba4c3ea89e0003c0704335cbe80e874d0e15
2015-09-09Add dex_pc to all HInstructions in builder. Yevgeny Rouban
Optimizing compiler generates minimum debug line info that is built using the dex_pc information about suspend points. This is not enough for performance and debugging needs. This patch makes all HInstructions contain dex_pc and all allocations in the builder define this value. Change-Id: I1d14aefe075189b7b1b41b4384c3499474c19afc Signed-off-by: Yevgeny Rouban <yevgeny.y.rouban@intel.com> Signed-off-by: Serdjuk, Nikolay Y <nikolay.y.serdjuk@intel.com>
2015-09-03Reduce how often we call FindDexCache Mathieu Chartier
Before host boot.oat -j4 optimizing compile: real 1m17.792s user 3m26.140s sys 0m8.340s After: real 1m12.324s user 3m22.718s sys 0m8.320s Change-Id: If18e9e79e06cdf1676692e5efacb682bf93889c3
2015-08-25Add missing field init in constructors Sebastien Hertz
Adds missing field initializations detected by Eclipse IDE. Change-Id: I5f2f32bcccb12545fc9f0b42fcec74a23dc81376
2015-08-20Fix BuildInvoke Calin Juravle
The invoke should be added to the graph before PotentiallySimplifyFakeString. Change-Id: I2afc1d16e6dae60957e7d1386fd028e4f3a5b27a
2015-08-20Refactor BuildInvoke. Calin Juravle
BuildInvoke got to be too complex an unreadble. This breaks it down in smaller pieces. Change-Id: Ibda63f69f5a1be537ae13e18a5f67c361173f4a6
2015-08-19Revert "Revert "Optimizing: Better invoke-static/-direct dispatch."" Vladimir Marko
Fixed kCallArtMethod to use correct callee location for kRecursive. This combination is used when compiling with debuggable flag set. This reverts commit b2c431e80e92eb6437788cc544cee6c88c3156df. Change-Id: Idee0f2a794199ebdf24892c60f8a5dcf057db01c
2015-08-19Revert "Optimizing: Better invoke-static/-direct dispatch." Vladimir Marko
Reverting due to failing ndebug tests. This reverts commit 9b688a095afbae21112df5d495487ac5231b12d0. Change-Id: Ie4f69da6609df3b7c8443412b6cf7f5c43c2c5d9
2015-08-19Optimizing: Better invoke-static/-direct dispatch. Vladimir Marko
Add framework for different types of loading ArtMethod* and code pointer retrieval. Implement invoke-static and invoke-direct calls the same way as Quick. Document the dispatch kinds in HInvokeStaticOrDirect's new enumerations MethodLoadKind and CodePtrLocation. PC-relative loads from dex cache arrays are used only for x86-64 and arm64. The implementation for other architectures will be done in separate CLs. Change-Id: I468ca4d422dbd14748e1ba6b45289f0d31734d94
2015-07-17Revert "Revert "Use the quickened metadata to compile -QUICK opcodes."" Nicolas Geoffray
This reverts commit 8ab9a9010f3929acbb6c671008b8885b762b01e1. Change-Id: I1e654d5010ea2112982c3055fcb8c8f9c10e9ac8
2015-07-17Revert "Use the quickened metadata to compile -QUICK opcodes." Nicolas Geoffray
Broke sdk build. Investigating. This reverts commit 4515a67434c9e3e1627586629a1f2aba1a99aa6a. Change-Id: I6c1107ab626758570a59dc6bf3e4228c70a57196
2015-07-16Use the quickened metadata to compile -QUICK opcodes. Nicolas Geoffray
Change-Id: I28a8d68921698bea81f54c95cc6e4c6d2c03f2b4
2015-07-10[optimizing] Don't rely on the verifier for String.<init>. Nicolas Geoffray
Continue work on cutting the dependency on the verifier. Change-Id: I0f95b1eb2e10fd8f6bf54817f1202bdf6dfdb0fe
2015-07-08Revert "Revert "ART: Ignore try blocks with no throwing instructions"" David Brazdil
The original CL broke libcore tests because monitor-exit instructions did not have any side-effects and got removed by DCE once not labelled throwing any more. This reverts commit efe374d7c25c1d48945a9198d96469de99e0c1bd. Change-Id: I624c0f91676d9baaada6f33be9d7091f68d57535
2015-07-08Revert "ART: Ignore try blocks with no throwing instructions" David Brazdil
Turns out monitor-exit *can* throw... Need to investigate This reverts commit 8f8ee680bec71a28d9d7b7538e8c7ca100a18184. Change-Id: I8b42690918833c917b6a7fc3ceea932b7c1a6f15
2015-07-08ART: Ignore try blocks with no throwing instructions David Brazdil
In order to avoid complex removal of redundant exceptional edges in the SSA builder, this patch modified the graph builder to consider blocks without throwing instructions as not in a try block, even if covered by a TryItem. In some corner cases, this may generate more TryBoundaries than necessary, but those can be removed once the SSA form is built. Change-Id: I158c4542b2c1964a8dd532f82e921b9cb1997e1e
2015-07-07Fuse long and FP compare & condition on x86/x86-64 in Optimizing. Mark Mendell
This is a preliminary implementation of fusing long/float/double compares with conditions to avoid materializing the result from the compare and condition. The information from a HCompare is transferred to the HCondition if it is legal. There must be only a single use of the HCompare, the HCompare and HCondition must be in the same block, the HCondition must not need materialization. Added GetOppositeCondition() to HCondition to return the flipped condition. Bug: 21120453 Change-Id: I1f1db206e6dc336270cd71070ed3232dedc754d6 Signed-off-by: Mark Mendell <mark.p.mendell@intel.com>
2015-07-01Address additional comments on try-catch CL David Brazdil
Extra documentation of try-catch building. Change-Id: I5048c5fcb354c76fa4a60c3d8d21dd216bc9f6cd
2015-07-01ART: Changes to try-catch in GraphBuilder David Brazdil
This patch adds an additional case into the insertion algorithm for HTryBoundary inside HGraphBuilder in order to better handle catch blocks covered by a TryItem. Building SSA form also required to stop combining HTryBoundaries for neighbouring TryItems because it was not clear which exception handlers belong to which try block. Change-Id: Ic68bd6ef98fee784609fa593cb08dca1f00a15e0
2015-06-26Revert "Revert "ART: Implement try/catch blocks in Builder"" David Brazdil
This patch enables the GraphBuilder to generate blocks and edges which represent the exceptional control flow when try/catch blocks are present in the code. Actual compilation is still delegated to Quick and Baseline ignores the additional code. To represent the relationship between try and catch blocks, Builder splits the edges which enter/exit a try block and links the newly created blocks to the corresponding exception handlers. This layout will later enable the SsaBuilder to correctly infer the dominators of the catch blocks and to produce the appropriate reverse post ordering. It will not, however, allow for building the complete SSA form of the catch blocks and consequently optimizing such blocks. To this end, a new TryBoundary control-flow instruction is introduced. Codegen treats it the same as a Goto but it allows for additional successors (the handlers). This reverts commit 3e18738bd338e9f8363b26bc895f38c0ec682824. Change-Id: I4f5ea961848a0b83d8db3673763861633e9bfcfb
2015-06-26Revert "ART: Implement try/catch blocks in Builder" David Brazdil
Causes OutOfMemory issues, need to investigate. This reverts commit 0b5c7d1994b76090afcc825e737f2b8c546da2f8. Change-Id: I263e6cc4df5f9a56ad2ce44e18932ca51d7e349f
2015-06-25ART: Implement try/catch blocks in Builder David Brazdil
This patch enables the GraphBuilder to generate blocks and edges which represent the exceptional control flow when try/catch blocks are present in the code. Actual compilation is still delegated to Quick and Baseline ignores the additional code. To represent the relationship between try and catch blocks, Builder splits the edges which enter/exit a try block and links the newly created blocks to the corresponding exception handlers. This layout will later enable the SsaBuilder to correctly infer the dominators of the catch blocks and to produce the appropriate reverse post ordering. It will not, however, allow for building the complete SSA form of the catch blocks and consequently optimizing such blocks. To this end, a new TryBoundary control-flow instruction is introduced. Codegen treats it the same as a Goto but it allows for additional successors (the handlers). Change-Id: I415b985596d5bebb7b1bb358a46e08b7b04bb53a
2015-06-19MIPS: Initial version of optimizing compiler for MIPS64R6. Alexey Frunze
Bug: 21555893 Change-Id: I874dc356eee6ab061a32f8f3df5f8ac3a4ab7dcf Signed-off-by: Alexey Frunze <Alexey.Frunze@imgtec.com> Signed-off-by: Douglas Leung <douglas.leung@imgtec.com>
2015-06-19Use compiling class instead of referrer for access checks. Nicolas Geoffray
bug:21869670 Change-Id: Ief329247e90202835e27fa38803e02dd2e2ae8ca
2015-05-01Skip compilation when falling-through out of method code. Calin Juravle
Bug: 19988134 Change-Id: I68638ce9551848a67af587595f264b51f976df11
2015-03-31ART: Same skip-compilation heuristic in both backends David Brazdil
When deciding if a method should be compiled, Optimizing counts the DEX instructions while Quick approximates this figure as the size of the CodeItem. This patch modifies Optimizing to use the same logic so that the two backends reject the same set of methods. Change-Id: Icb12bf2977f948198df08d59f243532ec8c61783
2015-03-26ART: Force constants into the entry block David Brazdil
Optimizations such as GVN and BCE make the assumption that all constants are located in the entry block of the CFG, but not all passes adhere to this rule. This patch makes constructors of constants private and only accessible to friend classes - HGraph for int/long constants and SsaBuilder for float/double - which ensure that they are placed correctly and not duplicated. Note that the ArenaAllocatorAdapter was modified to not increment the ArenaAllocator's internal reference counter in order to allow for use of ArenaSafeMap inside an arena-allocated objects. Because their destructor is not called, the counter does not get decremented. Change-Id: I36a4fa29ae34fb905cdefd482ccbf386cff14166
2015-03-25Revert "Revert "Inline across dex files."" Nicolas Geoffray
This reverts commit 6a816cf624ba56bf2872916d7b65b18fd9a411ef. Change-Id: I36cb524108786dd7996f2aea0443675be1f1b859
2015-03-24ART: Boolean simplifier David Brazdil
The optimization recognizes the negation pattern generated by 'javac' and replaces it with a single condition. To this end, boolean values are now consistently assumed to be represented by an integer. This is a first optimization which deletes blocks from the HGraph and does so by replacing the corresponding entries with null. Hence, existing code can continue indexing the list of blocks with the block ID, but must check for null when iterating over the list. Change-Id: I7779da69cfa925c6521938ad0bcc11bc52335583
2015-02-24ART: Add -Wunused Andreas Gampe
Until the global CFLAGS are fixed, add Wunused. Fix declarations in the optimizing compiler. Change-Id: Ic4553f08e809dc54f3d82af57ac592622c98e000
2015-02-19Move arenas into runtime Mathieu Chartier
Moved arena pool into the runtime. Motivation: Allow GC to use arena allocators, recycle arena pool for linear alloc. Bug: 19264997 Change-Id: I8ddbb6d55ee923a980b28fb656c758c5d7697c2f
2015-02-04Create HGraph outside Builder, print timings David Brazdil
This patch refactors the way HGraph objects are created, moving the instantiation out of the Builder class and creating the CodeGenerator earlier. The patch uses this to build a single interface for printing timings info and dumping the CFG. Change-Id: I2eb63eabf28e2d0f5cdc7affaa690c3a4b1bdd21
2015-02-02No SuspendChecks when branching to return block David Brazdil
The return basic block is usually placed at the beginning of the DEX file, making the branches to it back edges where the Optimizing's graph builder places SuspendCheck instructions, only to be removed later by the instruction_simplifier pass. Since huge auto-generated methods tend to contain hundreds/thousands of these, this patch recognizes the pattern and prevents builder from generating the redundant check in the first place. Change-Id: I065a3c2f71964b8fc2e53dc20730ba42938b78a1
2015-01-30Use the non access check entrypoint when possible. Nicolas Geoffray
Change-Id: I0b53d63141395e26816d5d2ce3fa6a297bb39b54
2014-12-15Inlining support in optimizing. Nicolas Geoffray
Currently only inlines simple things that don't require an environment, such as: - Returning a constant. - Returning a parameter. - Returning an arithmetic operation. Change-Id: Ie844950cb44f69e104774a3cf7a8dea66bc85661
2014-12-10Add more compilation stats to optimizing Calin Juravle
Optimizing is getting closer to have full coverage and this provides a nice overview on why certain methods are not compiled/optimized. Also, clean up some of the builder methods. Change-Id: Id2f31441a788b797b0efea7ec78bee27bb654186
2014-12-04ART: Add SparseSwitch support to the optimizing compiler Andreas Gampe
Add simple sparse-switch support through chained IFs. Refactor a bit to better reuse code between switch types. Now enables compiled versions of 015-switch and 095-switch-MAX_INT. Bug: 18410979 Change-Id: Ib617e4b877f0b7fbc3bb289800f612f013480713