summaryrefslogtreecommitdiff
path: root/compiler/optimizing/code_generator.cc
AgeCommit message (Collapse)Author
2015-09-16Optimizing: Tag arena allocations in HGraph.Vladimir Marko
Replace GrowableArray with ArenaVector in HGraph and related classes HEnvironment, HLoopInformation, HInvoke and HPhi, and tag allocations with new arena allocation types. Change-Id: I3d79897af405b9a1a5b98bfc372e70fe0b3bc40d
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/catchDavid 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-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-04Merge "ART: Move DexCache arrays to native."Vladimir Marko
2015-09-03ART: Move DexCache arrays to native.Vladimir Marko
This CL has a companion CL in libcore/ https://android-review.googlesource.com/162985 Change-Id: Icbc9e20ad1b565e603195b12714762bb446515fa
2015-09-03Merge "Revert "Optimizing: Tag basic block allocations with their source.""Vladimir Marko
2015-09-03Revert "Optimizing: Tag basic block allocations with their source."Vladimir Marko
Reverting so that we can have more discussion about the STL API. This reverts commit 91e11c0c840193c6822e66846020b6647de243d5. Change-Id: I187fe52f2c16b6e7c5c9d49c42921eb6c7063dba
2015-09-03Merge "Optimizing: Tag basic block allocations with their source."Vladimir Marko
2015-09-03Optimizing: 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: I984aef6e615ae2380a532f5c6726af21015f43f5
2015-09-03Add more dwarf debug line info for Optimized methods.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 CL generates additional debug line information for instructions which have known dex_pc and it ensures that whole call sites are mapped (as opposed to suspend points which map only one instruction past the function call). Bug: 23157336 Change-Id: I9f2b1c2038e3560847c175b8121cf9496b8b58fa Signed-off-by: Yevgeny Rouban <yevgeny.y.rouban@intel.com>
2015-09-02Optimizing: Tag Arena allocations with their source.Vladimir Marko
This adds the ability to track where we allocate memory when the kArenaAllocatorCountAllocations flag is turned on. Also move some allocations from native heap to the Arena and remove some unnecessary utilities. Bug: 23736311 Change-Id: I1aaef3fd405d1de444fe9e618b1ce7ecef07ade3
2015-08-27Add OptimizingCompilerStats to the CodeGenerator class.Serban Constantinescu
Just refactoring, not yet used, but will be used by the incoming patch series and future CodeGen specific stats. Change-Id: I7d20489907b82678120518a77bdab9c4cc58f937 Signed-off-by: Serban Constantinescu <serban.constantinescu@linaro.org>
2015-08-27Use CodeGenerator::RecordPcInfo instead of SlowPathCode::RecordPcInfo.Serban Constantinescu
Part of a clean-up and refactoring series. SlowPathCode::RecordPcInfo is currently just a wrapper around CodGenerator::RecordPcInfo. Change-Id: Iffabef4ef37c365051130bf98a6aa6dc0a0fb254 Signed-off-by: Serban Constantinescu <serban.constantinescu@linaro.org>
2015-08-25ART: Add (Fpu)RegHigh stack map location kindsDavid Brazdil
When running Optimized code on 64-bit, high value of vreg pair may be stored in the high 32 bits of a CPU register. This is not reflected in stack maps which would encode both the low and high vreg as kInRegister with the same register number, making it indistinguishable from two non-wide vregs with the same value in the lower 32 bits. Deoptimization deals with this by running the verifier and thus obtaining vreg pair information, but this would be too slow for try/ catch. This patch therefore adds two new stack map location kinds: kInRegisterHigh and kInFpuRegisterHigh to differentiate between the two cases. Note that this also applies to floating-point registers on x86. Change-Id: I15092323e56a661673e77bee1f0fca4261374732
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-19Merge "Revert "Optimizing: Better invoke-static/-direct dispatch.""Vladimir Marko
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-19Merge "Optimizing: Better invoke-static/-direct dispatch."Vladimir Marko
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-18Merge "Svelter libart-compiler"Alex Light
2015-08-18Svelter libart-compilerAlex Light
Added new environment variable ART_{TARGET,HOST}_CODEGEN_ARCHS which may be set to 'all', 'svelte' or a space separated list of architectures. When compiled with ART_{TARGET,HOST}_CODEGEN_ARCHS='all' (the default value) dex2oat will be able to generate output for all supported architectures. When compiled with ART_TARGET_CODEGEN_ARCHS='svelte' only the architectures of the TARGET will be included. When ART_HOST_CODEGEN_ARCHS='svelte' all architectures the target includes and the host architectures will be included on the host dex2oat. If a list of architectures is given only those will be included. Change-Id: I87f4ad0131ab1b37544d8799e947ce4733b6daec
2015-08-13Adjust art::HTypeConversion's side effects for MIPS64.Roland Levillain
Also improve debugging information in art::CodeGenerator::ValidateInvokeRuntime. Change-Id: Icfcd1a5cfa5e5449a316251dc20547de6badecb5
2015-08-12Add a GVN dependency 'GC' for garbage collection.Alexandre Rames
This will be used by incoming architecture specific optimizations. The dependencies must be conservative. When an HInstruction is created we may not be sure whether it can trigger GC. In that case the 'ChangesGC' dependency must be set. We control at code-generation time that HInstructions that can call have the 'ChangesGC' dependency set. Change-Id: Iea6a7f430009f37a9599b0a0039207049906e45d
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 BuilderDavid 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-22Opt compiler: Add disassembly to the '.cfg' output.Alexandre Rames
This is automatically added to the '.cfg' output when using the usual `--dump-cfg` option. Change-Id: I864bfc3a8299c042e72e451cc7730ad8271e4deb
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-18ART: Remove old DCHECK that trips BaselineDavid Brazdil
Codegen verified that the entry block always falls through to the next block. While this is the case with Optimizing, it doesn't hold for Baseline but it doesn't need to since codegen handles it fine. Bug:21913514 Change-Id: I751ef227e6cf103af3e7fc35fca4b01c663385a1
2015-06-12Merge "Optimizing: Remove PcInfo, use the StackMapStream instead."Vladimir Marko
2015-06-12Optimizing: Remove PcInfo, use the StackMapStream instead.Vladimir Marko
Change-Id: I474f3a89f6c7ee5c7accd21791b1c1e311104158
2015-06-08Revert "Revert "Use HCurrentMethod in HInvokeStaticOrDirect.""Nicolas Geoffray
Fix was to special case baseline for x86, which does not have enough registers to allocate the current method. This reverts commit c345f141f11faad177aa9635a78088d00cf66086. Change-Id: I5997aa52f8d4df373ae5ff4d4150dac0c44c4c10
2015-06-04Revert "Use HCurrentMethod in HInvokeStaticOrDirect."Nicolas Geoffray
Fails on baseline/x86. This reverts commit 38207af82afb6f99c687f64b15601ed20d82220a. Change-Id: Ib71018367eb7c6046965494a7e996c22af3de403
2015-06-04Use HCurrentMethod in HInvokeStaticOrDirect.Nicolas Geoffray
Change-Id: I0d15244b6b44c8b10079398c55da5071a3e3af66
2015-06-03Fix lint error.Nicolas Geoffray
Change-Id: Ie485d52dc8c6670ab717f14081200572dab0357f
2015-06-03Factorize code for common LocationSummary of HInvoke.Nicolas Geoffray
This is one step forward, we could factorize more, but I wanted to get this out of the way first. Change-Id: I6ae411a737eebaecb64974f47af507ce0cfbae85
2015-05-31Fix some ArtMethod related bugsMathieu Chartier
Added root visiting for runtime methods, not currently required since the GcRoots in these methods are null. Added missing GetInterfaceMethodIfProxy in GetMethodLine, fixes --trace run-tests 005, 044. Fixed optimizing compiler bug where we used a normal stack location instead of double on ARM64, this fixes the debuggable tests. TODO: Fix JDWP tests. Bug: 19264997 Change-Id: I7c55f69c61d1b45351fd0dc7185ffe5efad82bd3
2015-05-29Move mirror::ArtMethod to nativeMathieu Chartier
Optimizing + quick tests are passing, devices boot. TODO: Test and fix bugs in mips64. Saves 16 bytes per most ArtMethod, 7.5MB reduction in system PSS. Some of the savings are from removal of virtual methods and direct methods object arrays. Bug: 19264997 Change-Id: I622469a0cfa0e7082a2119f3d6a9491eb61e3f3d
2015-05-21Also encode the InvokeType in an InlineInfo.Nicolas Geoffray
This will be needed to recover the call stack. Change-Id: I2fe10785eb1167939c8cce1862b2d7f4066e16ec
2015-05-18Support InlineInfo in StackMap.Nicolas Geoffray
Change-Id: I9956091775cedc609fdae7dec1433fcb8858a477
2015-05-11Add a parent environment to HEnvironment.Nicolas Geoffray
This code has no functionality change. It adds a placeholder for chaining inlined frames. Change-Id: I5ec57335af76ee406052345b947aad98a6a4423a
2015-04-28Have HInvoke instructions know their number of actual arguments.Roland Levillain
Add an art::HInvoke::GetNumberOfArguments routine so that art::HInvoke and its subclasses can return the number of actual arguments of the called method. Use it in code generators and intrinsics handlers. Consequently, no longer remove a clinit check as last input of a static invoke if it is still present during baseline code generation, but ensure that static invokes have no such check as last input in optimized compilations. Change-Id: Iaf9e07d1057a3b15b83d9638538c02b70211e476
2015-04-23Cleanup and improve stack map streamCalin Juravle
- transform AddStackMapEntry into BeginStackMapEntry/EndStackMapEntry. This allows for nicer code and less assumptions when searching for equal dex register maps. - store the components sizes and their start positions as fields to avoid re-computation. - store the current stack map entry as a field to avoid the copy semantic when updating its value in the stack maps array. - remove redundant methods and fix visibility for the remaining ones. Change-Id: Ica2d2969d7e15993bdbf8bc41d9df083cddafd24
2015-04-22[optimizing] Fix a bug in moving the null check to the user.Calin Juravle
When taking the decision to move a null check to the user we did not verify if the next instruction checks the same object. Change-Id: I2f4533a4bb18aa4b0b6d5e419f37dcccd60354d2
2015-04-20Opt compiler: Correctly require register or FPU register.Alexandre Rames
Also add a check that location summary are correctly typed with the HInstruction. Change-Id: I699762ff4e8f4e321c7db01ea005236ea1934af9
2015-04-15Type MoveOperands.Nicolas Geoffray
The ParallelMoveResolver implementation needs to know if a move is for 64bits or not, to handle swaps correctly. Bug found, and test case courtesy of Serguei I. Katkov. Change-Id: I9a0917a1cfed398c07e57ad6251aea8c9b0b8506
2015-04-09Implement CFI for Optimizing.David Srbecky
CFI is necessary for stack unwinding in gdb, lldb, and libunwind. Change-Id: I1a3480e3a4a99f48bf7e6e63c4e83a80cfee40a2