summaryrefslogtreecommitdiffstats
path: root/compiler/optimizing/optimizing_compiler.cc
Commit message (Collapse)AuthorAgeFilesLines
* Merge "Add implicit null checks for the optimizing compiler"Calin Juravle2015-01-201-5/+8
|\
| * Add implicit null checks for the optimizing compilerCalin Juravle2015-01-161-5/+8
| | | | | | | | | | | | | | | | | | - for backends: arm, arm64, x86, x86_64 - fixed parameter passing for CodeGenerator - 003-omnibus-opcodes test verifies that NullPointerExceptions work as expected Change-Id: I1b302acd353342504716c9169a80706cf3aba2c8
* | Constant fold after inlining.Nicolas Geoffray2015-01-191-2/+4
|/ | | | | | | | | - Inlining opens up new opportunities for constant folding. - Fix a bug in constant folder where the result type was not correctly set for the folding of a HCompare. - Improve graph checker's coverage. Change-Id: I0943bf8ff65505c4addc4a555a526b55e00b5268
* ART: Optimizing compiler intrinsicsAndreas Gampe2015-01-151-0/+5
| | | | | | | | | Add intrinsics infrastructure to the optimizing compiler. Add almost all intrinsics supported by Quick to the x86-64 backend. Further intrinsics require more assembler support. Change-Id: I48de9b44c82886bb298d16e74e12a9506b8e8807
* ART: dex2oat flag for HGraphVisualizer dump fileDavid Brazdil2015-01-131-2/+3
| | | | | | | | | | This patch adds a new '--dump-cfg=<file>' flag to dex2oat which specifies the file that HGraphVisualizer will store its output into. Until now the graph was dumped to 'art.cfg' in the current working directory. To make Checker work with run-test, the output directory needs to be customizable. Change-Id: I4a940f7708b88deea5a0e51d13aed13e52199349
* Revert "ART: dex2oat flag for HGraphVisualizer dump file"Andreas Gampe2015-01-131-3/+2
| | | | | | | | Breaks compilation of tests. This reverts commit 54953dfdcb3bb8896d8af2d20adef84fb740ce77. Change-Id: I868b876c3130be61f1169c5fccdffc0368bee11e
* ART: dex2oat flag for HGraphVisualizer dump fileDavid Brazdil2015-01-131-2/+3
| | | | | | | | | | This patch adds a new flag to dex2oat which allows to specify the name of the file that HGraphVisualizer will store its output into. Until now the graph was dumped to "art.cfg" in the current working directory. To make Checker work with run-test, the output directory needs to be customizable. Change-Id: I395c518b987e594e89e5e80f202a96befa41ac20
* Move code around in OptimizingCompiler::Compile to reduce stack space.Nicolas Geoffray2015-01-121-56/+88
| | | | | | | | | | Also fix an (intentional) memory leak, by allocating the CodeGenerator on the heap instead of the arena: they construct an Assembler object that requires destruction. BUG:18787334 Change-Id: I8cf0667cb70ce5b14d4ac334bd4487a562635f1b
* Look at instruction set features when generating volatiles codeCalin Juravle2015-01-051-7/+8
| | | | Change-Id: Ia882405719fdd60b63e4102af7e085f7cbe0bb2a
* ART: Swap-space in the compilerAndreas Gampe2014-12-221-21/+22
| | | | | | | | | | | Introduce a swap-space and corresponding allocator to transparently switch native allocations to memory backed by a file. Bug: 18596910 (cherry picked from commit 62746d8d9c4400e4764f162b22bfb1a32be287a9) Change-Id: I131448f3907115054a592af73db86d2b9257ea33
* ART: Added Checker, a pattern matching test engineDavid Brazdil2014-12-171-10/+14
| | | | | | | | | | | | | | | | | | | | | | | This patch adds a Python script which implements a domain-specific mini-language similar to that of LLVM's FileCheck. It is primarily intended for writing tests for the optimizing compiler but could be configured for other use cases too. It is implemented from scratch in order to avoid dependency on LLVM. Checker tests are written in Java and dex2oat is invoked with a flag which dumps the CFG before and after each pass of the optimizing compiler. The output is then compared against assertions in the test's comments parsed by Checker. See comments in tools/checker.py for more details about the currently supported language features. This initial CL implements only one type of assertion - whether the output contains lines matching a desired pattern in the given order - but supports both plain text and regex matching and allows for equivalency testing by matching for the outcome of a previous match. See the tests in compiler/optimizing/test/ConstantFolding.java for examples. Change-Id: I1ad7431b399c38dc0391ccee74d2c643ba0b0675
* Inlining support in optimizing.Nicolas Geoffray2014-12-151-39/+39
| | | | | | | | | | 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
* Merge "Add more compilation stats to optimizing"Calin Juravle2014-12-151-22/+27
|\
| * Add more compilation stats to optimizingCalin Juravle2014-12-101-22/+27
| | | | | | | | | | | | | | | | | | 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
* | Ensure stack maps are 4 byte aligned.Nicolas Geoffray2014-12-091-10/+14
|/ | | | | | | | | | | | With the recent move to gcc 4.9, we are hitting alignment SIGBUS on ARM. The reason is that gcc will optimize two consecutive 32bits loads into one 64bits load, and the instruction (ldrd) will fail if the data is not aligned. Also removed the emission of mapping table when a method is optimized. The information can be found in the StackMap itself. Change-Id: Icf79406c18a3f4db3c05d52fc2c0dd2e35bf0f8f
* Bounds check elimination.Mingyao Yang2014-12-031-2/+5
| | | | Change-Id: Ia0d6a4226c1f9f1ff1dd35347a38db1dc4265319
* Merge "Add some heursitics for compiling, close to Quick's."Nicolas Geoffray2014-12-021-0/+2
|\
| * Add some heursitics for compiling, close to Quick's.Nicolas Geoffray2014-12-021-0/+2
| | | | | | | | | | | | | | Quick has more machinery to give up/not give up, but we can backport them later. Change-Id: I5eb62c664246f4ce46f0400cf24ec34a72afb51e
* | Treat SSA transformation special, as we may have to bailout.Nicolas Geoffray2014-12-021-2/+21
| | | | | | | | | | | | | | We forgot to bailout when we found a non-natural loop (on which our optimizations don't work). Change-Id: I11976b5af4c98f4f29267a74c74d34b5ad81e20c
* | Don't run optimizations after baseline.Nicolas Geoffray2014-12-011-14/+0
|/ | | | | | | | | We have enough coverage now. This was also motivated by having to call RunOptimizations instead, which does invoke InstructionSimplifier, required by the code generators (for, e.g. removing useless HTypeConversion nodes). Change-Id: I4e616dae771b8ced60e1f418e3da834f44edb717
* Fix a bug in the type analysis phase of optimizing.Nicolas Geoffray2014-11-251-9/+15
| | | | | | | | | | | Dex code can lead to the creation of a phi with one float input and one integer input. Since the SSA builder trusts the verifier, it assumes that the integer input must be converted to float. However, when the register is not used afterwards, the verifier hasn't ensured that. Therefore, the compiler must remove the phi prior to doing type propagation. Change-Id: Idcd51c4dccce827c59d1f2b253bc1c919bc07df5
* Merge "Use HOptimization abstraction for running optimizations."Nicolas Geoffray2014-11-191-9/+20
|\
| * Use HOptimization abstraction for running optimizations.Nicolas Geoffray2014-11-191-9/+20
| | | | | | | | | | | | Move existing optimizations to it. Change-Id: I3b43f9997faf4ed8875162e3a3abdf99375478dd
* | Use cross-compilation helper.Nicolas Geoffray2014-11-191-1/+2
|/ | | | | | | The default method uses the current pointer size. We should use the pointer size given to the compiler. Change-Id: I4d6bacad6c17ac715455cabfc89cc651368d07a5
* Don't fall back to Quick in optimizing.Nicolas Geoffray2014-11-171-65/+26
| | | | | | The compiler can now have a life of its own. Change-Id: I804638c574d1a37299fa8427a3fd10d627d2844e
* Minor object store optimizations.Nicolas Geoffray2014-11-141-0/+1
| | | | | | | | - Avoid emitting write barrier when the value is null. - Do not do a typecheck on an arraystore when storing something that was loaded from the same array. Change-Id: I902492928692e4553b5af0fc99cce3c2186c442a
* Implement try/catch/throw in optimizing.Nicolas Geoffray2014-11-061-12/+21
| | | | | | | | - We currently don't run optimizations in the presence of a try/catch. - We therefore implement Quick's mapping table. - Also fix a missing null check on array-length. Change-Id: I6917dfcb868e75c1cf6eff32b7cbb60b6cfbd68f
* Remove -Wno-unused-parameter and -Wno-sign-promo from base cflags.Ian Rogers2014-11-031-0/+1
| | | | | | | | | | | 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
* Support for CONST_STRING in optimizing compiler.Nicolas Geoffray2014-10-311-0/+4
| | | | Change-Id: Iab8517bdadd1d15ffbe570010f093660be7c51aa
* Support hard float on arm in optimizing compiler.Nicolas Geoffray2014-10-271-15/+8
| | | | | | Also bump oat version, needed after latest hard float switch. Change-Id: Idf5acfb36c07e74acff00edab998419a3c6b2965
* ARM: Use hardfp calling convention between java to java call.Zheng Xu2014-10-241-7/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch default to use hardfp calling convention. Softfp can be enabled by setting kArm32QuickCodeUseSoftFloat to true. We get about -1 ~ +5% performance improvement with different benchmark tests. Hopefully, we should be able to get more performance by address the left TODOs, as some part of the code takes the original assumption which is not optimal. DONE: 1. Interpreter to quick code 2. Quick code to interpreter 3. Transition assembly and callee-saves 4. Trampoline(generic jni, resolution, invoke with access check and etc.) 5. Pass fp arg reg following aapcs(gpr and stack do not follow aapcs) 6. Quick helper assembly routines to handle ABI differences 7. Quick code method entry 8. Quick code method invocation 9. JNI compiler TODO: 10. Rework ArgMap, FlushIn, GenDalvikArgs and affected common code. 11. Rework CallRuntimeHelperXXX(). Change-Id: I9965d8a007f4829f2560b63bcbbde271bdcf6ec2
* ART: optimizing compiler: initial support for ARM64.Alexandre Rames2014-10-231-1/+4
| | | | | | | | | | The ARM64 port uses VIXL for code generation, to which it defers work like label binding and branch resolving, register type coherency checking, and immediate values handling. Change-Id: I0a44508c0c991f472a63e67b3469cdd878fe1a68 Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com> Signed-off-by: Alexandre Rames <alexandre.rames@arm.com>
* Revert "Revert "Introduce a class to implement optimization passes.""Roland Levillain2014-10-171-0/+5
| | | | | | This reverts commit 1ddbf6d4b37979a9f11a203c12befd5ae8b65df4. Change-Id: I110a14668d1564ee0604dc958b91394b40da89fc
* Add a prepare for register allocation pass.Nicolas Geoffray2014-10-061-0/+2
| | | | | | | | | | - Currently the pass just changes the uses of checks to the actual values. - Also optimize array access, now that inputs can be constants. - And fix another bug in the register allocator reveiled by this change. Change-Id: I43be0dbde9330ee5c8f9d678de11361292d8bd98
* Revert "Introduce a class to implement optimization passes."Nicolas Geoffray2014-10-011-5/+0
| | | | | | This reverts commit bf9cd7ba2118a75f5aa9b56241c4d5fa00dedeb8. Change-Id: I0a483446666c9c24c45925a5fc199debdefd8b3e
* Introduce a class to implement optimization passes.Roland Levillain2014-10-011-0/+5
| | | | | | | | | | | | | | | | - Add art::HOptimization. - Rename art::ConstantPropagation to art::HConstantFolding in compiler/optimizing/constant_folding.h to avoid name clashes with a class of the same name in compiler/dex/post_opt_passes.h. - Rename art::DeadCodeElimination to art::HDeadCodeElimination for consistency reasons. - Have art::HDeadCodeElimination and art::HConstantFolding derive from art::HOptimization. - Start to use these optimizations in art:OptimizingCompiler::TryCompile. Change-Id: Iaab350c122d87b2333b3760312b15c0592d7e010
* Optimize suspend checks in optimizing compiler.Nicolas Geoffray2014-09-251-0/+2
| | | | | | | | | | - Remove the ones added during graph build (they were added for the baseline code generator). - Emit them at loop back edges after phi moves, so that the test can directly jump to the loop header. - Fix x86 and x86_64 suspend check by using cmpw instead of cmpl. Change-Id: I6fad5795a55705d86c9e1cb85bf5d63dadfafa2a
* First optimization in new compiler: simple GVN.Nicolas Geoffray2014-09-191-0/+6
| | | | Change-Id: Ibe0efa4e84fd020a53ded310a92e0b4363f91b12
* It can be that no method has been compiled.Nicolas Geoffray2014-09-181-5/+9
| | | | | | Therefore do not divide by 0, but log it. Change-Id: Iee7760ab7f31c73e90d62387e5fb6fb7aa2c56e2
* Add the "time" compilation filter and output compilation stats.Nicolas Geoffray2014-09-171-4/+31
| | | | | | | A "time" compiler filter means the compiler optimizes for compile time. Change-Id: Id1a207ceb2d95f3548aae5e45d51b80695da2029
* Runtime support for the new stack maps for the opt compiler.Nicolas Geoffray2014-09-081-22/+41
| | | | | | | Now most of the methods supported by the compiler can be optimized, instead of using the baseline. Change-Id: I80ab36a34913fa4e7dd576c7bf55af63594dc1fa
* ART: Clean up compilerAndreas Gampe2014-08-221-2/+118
| | | | | | | Clean up the compiler: less extern functions, dis-entangle compilers, hide some compiler specifics, lower global includes. Change-Id: Ibaf88d02505d86994d7845cf0075be5041cc8438
* ART source line debug info in OAT filesYevgeny Rouban2014-08-151-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | OAT files have source line information enough for ART runtime needs like jump to/from interpreter and thread suspension. But this information is not enough for finer grained source level debugging and low-level profiling (VTune or perf). This patch adds to OAT files two additional sections: .debug_line - DWARF formatted Elf32 section with detailed source line information (mapping from native PC to Java source lines). In addition to the debugging symbols added using the dex2oat option --include-debug-symbols, the source line information is added to the section .debug_line. The source line info can be read by many Elf reading tools like objdump, readelf, dwarfdump, gdb, perf, VTune, ... gdb can use this debug line information in x86. In 64-bit mode the information can be used if the oat file is mapped in the lower address space (address has higher 32 bits zeroed). Relocation works. Testing: 1. art/test/run-test --host --gdb [--64] 001-HelloWorld 2. in gdb: break Main.java:19 3. in gdb: break Runtime.java:111 4. in gdb: run - stops at void java.lang.Runtime.<init>() 5. in gdb: backtrace - shows call stack down to main() 6. in gdb: continue - stops at void Main.main() (only in 32-bit mode) 7. in gdb: backtrace - shows call stack down to main() 8. objdump -W <oat-file> - addresses are from VMA range of .text section reported by objdump -h <file> 9. dwarfdump -ka <oat-file> - no errors expected Size of aosp-x86-eng boot.oat increased by 11% from 80.5Mb to 89.2Mb with two sections added .debug_line (7.2Mb) and .rel.debug (1.5Mb). Change-Id: Ib8828832686e49782a63d5529008ff4814ed9cda Signed-off-by: Yevgeny Rouban <yevgeny.y.rouban@intel.com>
* Use the thumb2 assembler for the optimizing compiler.Nicolas Geoffray2014-07-161-4/+5
| | | | Change-Id: I2b058f4433504dc3299c06f5cb0b5ab12f34aa82
* Add two phi pruning phases.Nicolas Geoffray2014-07-141-1/+5
| | | | Change-Id: Ic4f05e3df96970d78a6938b27cdf9b58ef3849b9
* Support fields in optimizing compiler.Nicolas Geoffray2014-07-141-1/+1
| | | | | | | | - Required support for temporaries, to be only used by baseline compiler. - Also fixed a few invalid assumptions around locations and instructions that don't need materialization. These instructions should not have an Out. Change-Id: Idc4a30dd95dd18015137300d36bec55fc024cf62
* Do not attempt to compile on architectures we do not support.Nicolas Geoffray2014-07-041-5/+11
| | | | Change-Id: I431edff0a753a7fa37c79bdf7ab918d6747667a4
* Re-enable tests with the optimizing compiler.Nicolas Geoffray2014-06-261-0/+4
| | | | | | | | | | | Tests run ok on my host/target. I reverted the move to using thumb2, because tests were crashing. But I could not reproduce file limits issues. Make SignalTest as crashing for optimizing. We need to implement stack overflow checks. Change-Id: Ieda575501eaf30af7aaa2c44e71544c9c467c24f
* Revert "Re-enable tests with the optimizing compiler."Nicolas Geoffray2014-06-251-4/+0
| | | | | | This reverts commit 20550910e608ed7d86db97927d2ce9d2191061a4. Change-Id: Ic28b719946c795378838a18162a2a2b2cf41a0e8
* Re-enable tests with the optimizing compiler.Nicolas Geoffray2014-06-251-0/+4
| | | | | | | | Tests run ok on my host/target. I reverted the move to using thumb2, because tests were crashing. But I could not reproduce file limits issues. Change-Id: I26bc4ec1eb6c227750d11210e012d9d3b1d824af