summaryrefslogtreecommitdiff
path: root/compiler/optimizing/optimizing_compiler.cc
AgeCommit message (Collapse)Author
2015-09-15Use induction variable range analysis in BCE (statically).Aart Bik
Rationale: Finally! After lots of very large CLs, now a small CL that uses the new induction variable analysis in BCE (statically, using this dynamically with de-opt is TBD). Despite its relative small size, be aware though, since the CL introduces a new phase to the compiler. Change-Id: If5555a173fd5d55d147c63138ef51fc296fa1414
2015-09-15Add option to append to the cfg dump.Calin Juravle
This makes life easier when verifying tests with unresolved classes (which call dex2oat at rutime). Change-Id: I7985b2b7c0f343462e03a26b8395297c810b1d95
2015-09-15Merge "Revert "Revert "ART: Register allocation and runtime support for ↵David Brazdil
try/catch"""
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-15Temporarly disable SSA creation in try/catch/debuggable.Nicolas Geoffray
This is to enable optimizations when the debuggable flag is set. bug:24054676 Change-Id: I34eef2481ae44ad3550e04ec6f796d421d03adc0
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-08[optimizing] Add support for x86 constant areaMark Mendell
Use the Quick trick of finding the address of the method by calling the next instruction and popping the return address into a register. This trick is used because of the lack of PC-relative addressing in 32 bit mode on the X86. Add a HX86ComputeBaseMethodAddress instruction to trigger generation of the method address, which is referenced by instructions needing access to the constant area. Add a HX86LoadFromConstantTable instruction that takes a HX86ComputeBaseMethodAddress and a HConstant that will be used to load the value when needed. Change Add/Sub/Mul/Div to detect a HX86LoadFromConstantTable right hand side, and generate code that directly references the constant area. Other uses will be added later. Change the inputs to HReturn and HInvoke(s), replacing the FP constants with HX86LoadFromConstantTable instead. This allows values to be loaded from the constant area into the right location. Port the X86_64 assembler constant area handling to the X86. Use the new per-backend optimization framework to do this conversion. Change-Id: I6d235a72238262e4f9ec0f3c88319a187f865932 Signed-off-by: Mark Mendell <mark.p.mendell@intel.com>
2015-09-03Merge "Reduce how often we call FindDexCache"Mathieu Chartier
2015-09-03Reduce how often we call FindDexCacheMathieu 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-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-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-28Fix some HandleScope bugs and add corresponding checksMathieu Chartier
Some places were creating or destroying handle scopes without holding the mutator lock. This can cause GC crashes if thread roots are being marked or hprof dumps to also fail. Also added checks to catch some of these errors. Bug: 23468617 Change-Id: I1a2d615923484cfc25014967656775c445aa3f1f
2015-08-26ART: Propagate verifier failure types to the compilersAndreas Gampe
Add a bit-set encoding of seen failure types to the verifier and make it available. Store this in VerifiedMethod, so that compilers can inspect it and make choices based on failures. Rewrite the current punting of runtime-throw errors to be at the compiler-driver level. Bug: 23502994 Change-Id: I1cfc7cbdf2aec1f14ba18f0169e432ba4ae16883
2015-08-19Merge "ART: Enable basic optimizations for try/catch"David Brazdil
2015-08-19ART: Enable basic optimizations for try/catchDavid Brazdil
Generating code for try/catch methods requires having run at least the instruction simplifier to remove redundant suspend checks. This patch enables the first group of optimizations when try/catch is present. Enabled optimizations: 1) IntrinsicsRecognizer Does not modify the graph, only sets HInvoke::intrinsic_. 2) ConstantFolding Does not deal with throwing instructions. 3) InstructionSimplifier May remove a throwing instruction (e.g. LoadClass in VisitCheckCast), or may turn a throwing instruction into a non-throwing one (ArraySet). Their corresponding catch phi inputs are not removed but correctness is preserved. 4) ReferenceTypePropagation Does not modify the graph, only sets type properties. Typing of LoadException from catch handler information was added. 5) DeadCodeElimination Removing individual instructions is fine (same as 3). Removal of dead blocks was disabled for try/catch. Change-Id: I2722c3229eb8aaf326391e07f522dbf5186774b8
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-19Put in place the ARM64 instruction simplification framework.Alexandre Rames
This commit introduces and runs the empty InstructionSimplifierArm64 pass. Further commits will introduce arm64-specific transformations in that pass. Change-Id: I458f8a2b15470297b87fc1f7ff85bd52155d93ef
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-29Allow for fine tuning the inliner.Calin Juravle
Bug: 21868508 Change-Id: Ice7f1604ed65e3d4ed2a010ee431272b7d000cdb
2015-07-28Revert "Revert "Revert "Revert "Fixes and improvements in ↵Calin Juravle
ReferenceTypePropagation"""" This reverts commit e344a8070d4549d513413c06767abf8a2c5e9709. Change-Id: I400fab0e02ce3c11376cc1f3ae9c7cf2c82ffcc1
2015-07-28Revert "Revert "Revert "Fixes and improvements in ReferenceTypePropagation"""Calin Juravle
This reverts commit 00e3b38be4b280d6d7a7e843cd336ffbd2ba4365. Change-Id: I4dbadb2d7312a410f1c56283f063dd82156cf702
2015-07-27Revert "Revert "Fixes and improvements in ReferenceTypePropagation""Calin Juravle
This reverts commit 9b0096ba77e7e61bc2dcbbf954831dcae54a6c27. Change-Id: I824f16e800ca32e646577d5e1e0d593887ccead1
2015-07-22Move to newer clang annotationsMathieu Chartier
Also enable -Wthread-safety-negative. Changes: Switch to capabilities and negative capabilities. Future work: Use capabilities to implement uninterruptible annotations to work with AssertNoThreadSuspension. Bug: 20072211 Change-Id: I42fcbe0300d98a831c89d1eff3ecd5a7e99ebf33
2015-07-22ART: Add VerboseMethods to optimizing compilerAndreas Gampe
Bring the optimizing compiler up to Quick levels for debuggability. Change-Id: Ib2adce7a31cc6a60c37c63d0df5cb6a35a85e790
2015-07-17Revert "Revert "Use the quickened metadata to compile -QUICK opcodes.""Nicolas Geoffray
This reverts commit 8ab9a9010f3929acbb6c671008b8885b762b01e1. Change-Id: I1e654d5010ea2112982c3055fcb8c8f9c10e9ac8
2015-07-17Merge "Reduce space filter threshold to 128."Nicolas Geoffray
2015-07-17Reduce space filter threshold to 128.Nicolas Geoffray
In order to get closer to our code increase limit. Bug:21868508 Change-Id: I05f76bfd97f03bda3741eca4e6a678c536ad0702
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-15ART: Build SSA form when try/catch is presentDavid Brazdil
This patch implements support for try/catch in the SsaBuilder. Values of locals are propagated from throwing sites inside try blocks to their respective catch blocks and phis ("catch phis") are created when necessary. Change-Id: I0736565c2c4ff3f9f0924b6e3a785a50023f875a
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-06-25Only do some checks when compiling against the core image.Nicolas Geoffray
This will avoid false negatives when running dex2oatd on apks. bug:21865473 Change-Id: Id8eacaefae0bcf07a2ada8aedd7951854cdb5c4f
2015-06-24Use a flag from the verifier to know if we should compile.Nicolas Geoffray
Only used for the lack of bottom type in the aget-object case for now. Could be used for more. bug:21865466 Change-Id: I64c2c84dfa1c0d259631e65e5f44b94e4139e6a7
2015-06-24ART: Run GraphChecker after Builder and SsaBuilderDavid Brazdil
This patch refactors the way GraphChecker is invoked, utilizing the same scoping mechanism as pass timing and graph visualizer. Therefore, GraphChecker will now run not just after instances of HOptimization but after the builders and reg alloc, too. Change-Id: I8173b98b79afa95e1fcbf3ac9630a873d7f6c1d4
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-18Run a simplification pass before code generation.Nicolas Geoffray
The code generators assume things that only the instruction simplier ensures. So it has to be run last in case previous optimiziations broke those assumptions. bug:21865464 Change-Id: I1f84016017bf691c2a34982e202a505b269f609a
2015-06-17Fix a bug in optimizing when the null constant has been DCE.Nicolas Geoffray
If it has been DCE, we should create a new one, instead of using the old one. Also move the first DCE to a place where it could actually be useful. bug:21870788 Change-Id: I28fc52ae481ef92cba45fc1b5abcf07c995f524c
2015-06-12Optimizing: Move optimization objects to Arena.Vladimir Marko
This should reduce the stack size needed by the OptimizingCompiler::CompileOptimized() which was very close to our limits for clang builds, causing repeated build breakages on otherwise healthy changes: art/compiler/optimizing/optimizing_compiler.cc:395:37: error: stack frame size of 1760 bytes in function 'art::OptimizingCompiler::CompileOptimized' [-Werror,-Wframe-larger-than=] Change-Id: I2f4ab0235f4eac61823a4a320bb4fe78942a23c2
2015-06-10Revert "Revert "Support for inlining virtual and interface calls.""Nicolas Geoffray
It now works thanks to: - https://android-review.googlesource.com/#/c/154016/ where the invoke type is changed. - The new FindMethodIndexIn method in this change, that locates the right method index relative to the caller's dex file. This reverts commit 6e4758615308bb525b6350c30468e33a2e1f2274. Change-Id: Iddba11664a9241e210fec211cd2aed9f4b90d118
2015-06-08Revert "Support for inlining virtual and interface calls."Nicolas Geoffray
Fails for some apps. bug: 21674542 This reverts commit 1d5006c34d75758752bf3499892e3d5beb11d5dc. Change-Id: Ia74b5e54d59f8ffe9992591324a12f71efb67af4
2015-06-04Support for inlining virtual and interface calls.Nicolas Geoffray
Also had to change the pass order to get reference type propagation before the inliner. Change-Id: I4bf3bbb2d17c7d9cab632cfdd96adad8368bdfea
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-28Add --generate-debug-info flag and remove the other two flags.David Srbecky
Replace the flags --include-debug-symbols and --include-cfi with single flag called --generate-debug-info (with alias -g). The name "symbol" was not ideal, since depending on context it may be interpreted as "ELF symbols", or "debugging information". This CL also means that we have only the options to include either all debugging information or none. This should be fine, since we can use standard tools to strip anything we do not want. Change-Id: I721fded56d755d7eed0ef36aa84e841a1f5747f8
2015-05-22Do not use dex_compilation_unit after inlining.Nicolas Geoffray
It's incompatible with inlining, as inlined invokes/load class/new can be from another dex file. Change-Id: I8897b6a012942bc8e136f2bea70252d3fb3a7fa5
2015-05-21Also encode the InvokeType in an InlineInfo.Nicolas Geoffray
This will be needed to recover the call stack. Change-Id: I2fe10785eb1167939c8cce1862b2d7f4066e16ec