summaryrefslogtreecommitdiff
path: root/compiler/optimizing/builder.cc
AgeCommit message (Collapse)Author
2015-09-15Revert "Revert "ART: Register allocation and runtime support for try/catch"" David Brazdil
The original CL triggered b/24084144 which has been fixed by Ib72e12a018437c404e82f7ad414554c66a4c6f8c. This reverts commit 659562aaf133c41b8d90ec9216c07646f0f14362. Change-Id: Id8980436172457d0fcb276349c4405f7c4110a55
2015-09-14Revert "ART: Register allocation and runtime support for try/catch" David Brazdil
Breaks libcore test org.apache.harmony.security.tests.java.security.KeyStorePrivateKeyEntryTest#testGetCertificateChain. Need to investigate. This reverts commit b022fa1300e6d78639b3b910af0cf85c43df44bb. Change-Id: Ib24d3a80064d963d273e557a93469c95f37b1f6f
2015-09-14ART: Register allocation and runtime support for try/catch David Brazdil
This patch completes a series of CLs that add support for try/catch in the Optimizing compiler. With it, Optimizing can compile all methods containing try/catch, provided they don't contain catch loops. Future work will focus on improving performance of the generated code. SsaLivenessAnalysis was updated to propagate liveness information of instructions live at catch blocks, and to keep location information on instructions which may be caught by catch phis. RegisterAllocator was extended to spill values used after catch, and to allocate spill slots for catch phis. Catch phis generated for the same vreg share a spill slot as the raw value must be the same. Location builders and slow paths were updated to reflect the fact that throwing an exception may not lead to escaping the method. Instruction code generators are forbidden from using of implicit null checks in try blocks as live registers need to be saved before handing over to the runtime. CodeGenerator emits a stack map for each catch block, storing locations of catch phis. CodeInfo and StackMapStream recognize this new type of stack map and store them separate from other stack maps to avoid dex_pc conflicts. After having found the target catch block to deliver an exception to, QuickExceptionHandler looks up the dex register maps at the throwing instruction and the catch block and copies the values over to their respective locations. The runtime-support approach was selected because it allows for the best performance in the normal control-flow path, since no propagation of catch phi values is necessary until the exception is thrown. In addition, it also greatly simplifies the register allocation phase. ConstantHoisting was removed from LICMTest because it instantiated (now abstract) HConstant and was bogus anyway (constants are always in the entry block). Change-Id: Ie31038ad8e3ee0c13a5bbbbaf5f0b3e532310e4e
2015-09-14Merge "Optimizing: Tag basic block allocations with their source." Vladimir Marko
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-08Optimizing: Tag basic block allocations with their source. Vladimir Marko
Replace GrowableArray with ArenaVector in HBasicBlock and, to track the source of allocations, assign one new and two Quick's arena allocation types to these vectors. Rename kArenaAllocSuccessor to kArenaAllocSuccessors. Bug: 23736311 Change-Id: Ib52e51698890675bde61f007fe6039338cf1a025
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-31Revert "Revert "Change dex caches to be weak roots"" Mathieu Chartier
This reverts commit 81a9087f0df0518c39405b7d18ba5858a6d8b77b. Boot.oat creation time goes from 4.7s to 4.9s on host due to extra locking. Will try to improve this in another CL. Bug: 23602225 Bug: 22720414 Change-Id: I7e25b75cfb63faa196c7b0f60e46cce50bf12021
2015-08-20Fix extra parantheses Calin Juravle
:( Change-Id: Ie48a54de1276fb9e478cb5927d714b2ff14ae6c6
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-19Merge "Revert "Revert "Optimizing: Better invoke-static/-direct dispatch.""" Vladimir Marko
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-19ART: Refactor try/catch block info, store exception type David Brazdil
This patch replaces HBasicBlock fields storing try/catch info with a single TryCatchInformation data structure, saving memory for the majority of non-try/catch blocks. It also changes builder to store the exception type for catch blocks. Change-Id: Ib3e43f7db247e6915d67c267fc62410420e230c9
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-08-04ART: Move exception clearing into own instruction David Brazdil
Runtime delivers exceptions only to catch blocks which begin with a MOVE_EXCEPTION instruction (in DEX). In that case, the catch block is expected to clear the thread-local exception storage after having read the exception reference. This patch changes Optimizing to represent MOVE_EXCEPTION with two instructions - HLoadException and HClearException - instead of one. If the exception reference is not used, HLoadException can be safely removed, saving a memory load without breaking the runtime behaviour. Change-Id: Idad8a714467bf9d9d5fccefbc43c0bd8ae13ddba
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-13Merge "[optimizing] Don't rely on the verifier for String.<init>." Nicolas Geoffray
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-10Merge "Fuse long and FP compare & condition on ARM in Optimizing." Roland Levillain
2015-07-09ART: Fix bug in GraphBuilder David Brazdil
This fixes a bug where the GraphBuilder would split a throwing catch block but would not update info about which blocks throw. Change-Id: If5415f0c320aa488e06eb042e8fea6f03e30246a
2015-07-08Address small comments in HGraphBuilder David Brazdil
Change-Id: Ife0a19f6e07146c8e03922f1330527d092f5e236
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-08Fuse long and FP compare & condition on ARM in Optimizing. Roland Levillain
Also: - Stylistic changes in corresponding parts on the x86 and x86-64 code generators. - Update and improve the documentation of art::arm::Condition. Bug: 21120453 Change-Id: If144772046e7d21362c3c2086246cb7d011d49ce
2015-07-08Merge "Fuse long and FP compare & condition on x86/x86-64 in Optimizing." Roland Levillain
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-06ART: Fix graph for switch leaving a try block David Brazdil
Blocks that GraphBuilder creates for switch-case logic are given a dex_pc of the branch targets they serve, while in fact they should be considered part of the switch instruction itself and get its pc. This caused the try/catch algorithm to either miss try boundaries or create bogus edges. This patch fixed the dex_pc of the switch-case blocks and modifies the try/catch logic to iterate over all blocks as opposed to just branch targets since multiple blocks can now cover the same dex_pc. Change-Id: I30fe4f8db0647b869979197a3bc847cf212a7315
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-24Merge "ART: Stop creating a fallthrough block for Goto" David Brazdil
2015-06-24ART: Stop creating a fallthrough block for Goto David Brazdil
Optimizing's Builder used to create a basic block after a Goto under the assumption that control flow can fall through. Bug: 19084197 Change-Id: Id85f31df98a4177466750d3cd0bc8bb74782ca2d
2015-06-24Fix another case of un-verified dead code. Nicolas Geoffray
bug:22042796 https://code.google.com/p/android/issues/detail?id=178008 Change-Id: Ie77ccf17ce2a69c86b2278f7920aa4ad39bf142b
2015-06-22Revert "Revert "Use IsAssignableFrom instead of IsSubclass for robustness."" Nicolas Geoffray
Don't use IsAssignableFrom, but check beforehand if the referrer is an interface. Otherwise, we are being too aggressive on removing clinit checks on interfaces (being a subclass doesn't imply the interface has been initialized). bug:21870666 This reverts commit 463580ca5a1e75e27ad0207537ffc6252091326a. Change-Id: I2a13974d28477ee3e5224142cc260cbf46d19aa9
2015-06-22Merge "Use compiling class instead of outer class for access checks." Nicolas Geoffray
2015-06-22Merge "Revert "Use IsAssignableFrom instead of IsSubclass for robustness."" Nicolas Geoffray
2015-06-22Revert "Use IsAssignableFrom instead of IsSubclass for robustness." Nicolas Geoffray
Not correct for Quick. Bug:21870666 This reverts commit af268bbc4fbd0b9847acf1f7b79c038806118467. Change-Id: Id44849cc877a42495619fd71bfd2db75159b6868
2015-06-22Use compiling class instead of outer class for access checks. Nicolas Geoffray
bug:21869678 Change-Id: Ica6ecc759adc76950dcfe9d4d859dd593a742c62
2015-06-22Merge "Use IsAssignableFrom instead of IsSubclass for robustness." Nicolas Geoffray
2015-06-21Fix String Change baseline compiler errors. Nicolas Geoffray
The String Change adds multiple move results if the uninitialized string is in multiple registers. This adds StoreLocals on the same instruction, which isn't allowed. Now, a LoadLocal is added for each extra move needed. Change-Id: I49f676cb85de051e737e0653138cbb947a73e48b
2015-06-19Use IsAssignableFrom instead of IsSubclass for robustness. Nicolas Geoffray
We can get interface methods as referrer. Instead of crashing, just use IsAssignableFrom. bug:21870666 Change-Id: I7978e36fb981d44611635fbaf3899138bae60672
2015-06-19Merge "Fix StringChange for optimizing compiler." Jeff Hao
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>