summaryrefslogtreecommitdiff
path: root/compiler/optimizing/optimizing_compiler.cc
AgeCommit message (Collapse)Author
2015-01-27ART: Even more Quick cleanupAndreas Gampe
Remove Backend. Change-Id: I247cc65ccda6a362ba1a8f5e73e7f12ecd980a87
2015-01-26Move code around and address growable_array comment.Nicolas Geoffray
- Move SideEffectsAnalysis to its own file. - Move most of gvn.h to gvn.cc. - Don't call Resize in GrowableArray constructor, but just set num_used directly. Change-Id: I1f1291207945d678d3c99cc0ec1ec155bcae82f6
2015-01-26Introduce a SideEffectsAnalysis class.Nicolas Geoffray
LICM also needs the side effects information of loops, so move the GVN::ComputeSideEffects method into its own analysis class. Change-Id: I810c8230a0eb6b9b536e8f808e17a3a4ad72f7db
2015-01-23Support callee save floating point registers on x64.Nicolas Geoffray
- Share the computation of core_spill_mask and fpu_spill_mask between backends. - Remove explicit stack overflow check support: we need to adjust them and since they are not tested, they will easily bitrot. Change-Id: I0b619b8de4e1bdb169ea1ae7c6ede8df0d65837a
2015-01-20Merge "Add implicit null checks for the optimizing compiler"Calin Juravle
2015-01-19Constant fold after inlining.Nicolas Geoffray
- 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
2015-01-16Add implicit null checks for the optimizing compilerCalin Juravle
- 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
2015-01-15ART: Optimizing compiler intrinsicsAndreas Gampe
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
2015-01-13ART: dex2oat flag for HGraphVisualizer dump fileDavid Brazdil
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
2015-01-13Revert "ART: dex2oat flag for HGraphVisualizer dump file"Andreas Gampe
Breaks compilation of tests. This reverts commit 54953dfdcb3bb8896d8af2d20adef84fb740ce77. Change-Id: I868b876c3130be61f1169c5fccdffc0368bee11e
2015-01-13ART: dex2oat flag for HGraphVisualizer dump fileDavid Brazdil
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
2015-01-12Move code around in OptimizingCompiler::Compile to reduce stack space.Nicolas Geoffray
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
2015-01-05Look at instruction set features when generating volatiles codeCalin Juravle
Change-Id: Ia882405719fdd60b63e4102af7e085f7cbe0bb2a
2014-12-22ART: Swap-space in the compilerAndreas Gampe
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
2014-12-17ART: Added Checker, a pattern matching test engineDavid Brazdil
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
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-15Merge "Add more compilation stats to optimizing"Calin Juravle
2014-12-10Add more compilation stats to optimizingCalin 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-09Ensure stack maps are 4 byte aligned.Nicolas Geoffray
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
2014-12-03Bounds check elimination.Mingyao Yang
Change-Id: Ia0d6a4226c1f9f1ff1dd35347a38db1dc4265319
2014-12-02Merge "Add some heursitics for compiling, close to Quick's."Nicolas Geoffray
2014-12-02Treat SSA transformation special, as we may have to bailout.Nicolas Geoffray
We forgot to bailout when we found a non-natural loop (on which our optimizations don't work). Change-Id: I11976b5af4c98f4f29267a74c74d34b5ad81e20c
2014-12-02Add some heursitics for compiling, close to Quick's.Nicolas Geoffray
Quick has more machinery to give up/not give up, but we can backport them later. Change-Id: I5eb62c664246f4ce46f0400cf24ec34a72afb51e
2014-12-01Don't run optimizations after baseline.Nicolas Geoffray
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
2014-11-25Fix a bug in the type analysis phase of optimizing.Nicolas Geoffray
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
2014-11-19Merge "Use HOptimization abstraction for running optimizations."Nicolas Geoffray
2014-11-19Use HOptimization abstraction for running optimizations.Nicolas Geoffray
Move existing optimizations to it. Change-Id: I3b43f9997faf4ed8875162e3a3abdf99375478dd
2014-11-19Use cross-compilation helper.Nicolas Geoffray
The default method uses the current pointer size. We should use the pointer size given to the compiler. Change-Id: I4d6bacad6c17ac715455cabfc89cc651368d07a5
2014-11-17Don't fall back to Quick in optimizing.Nicolas Geoffray
The compiler can now have a life of its own. Change-Id: I804638c574d1a37299fa8427a3fd10d627d2844e
2014-11-14Minor object store optimizations.Nicolas Geoffray
- 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
2014-11-06Implement try/catch/throw in optimizing.Nicolas Geoffray
- 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
2014-11-03Remove -Wno-unused-parameter and -Wno-sign-promo from base cflags.Ian Rogers
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
2014-10-31Support for CONST_STRING in optimizing compiler.Nicolas Geoffray
Change-Id: Iab8517bdadd1d15ffbe570010f093660be7c51aa
2014-10-27Support hard float on arm in optimizing compiler.Nicolas Geoffray
Also bump oat version, needed after latest hard float switch. Change-Id: Idf5acfb36c07e74acff00edab998419a3c6b2965
2014-10-24ARM: Use hardfp calling convention between java to java call.Zheng Xu
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
2014-10-23ART: optimizing compiler: initial support for ARM64.Alexandre Rames
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>
2014-10-17Revert "Revert "Introduce a class to implement optimization passes.""Roland Levillain
This reverts commit 1ddbf6d4b37979a9f11a203c12befd5ae8b65df4. Change-Id: I110a14668d1564ee0604dc958b91394b40da89fc
2014-10-06Add a prepare for register allocation pass.Nicolas Geoffray
- 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
2014-10-01Revert "Introduce a class to implement optimization passes."Nicolas Geoffray
This reverts commit bf9cd7ba2118a75f5aa9b56241c4d5fa00dedeb8. Change-Id: I0a483446666c9c24c45925a5fc199debdefd8b3e
2014-10-01Introduce a class to implement optimization passes.Roland Levillain
- 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
2014-09-25Optimize suspend checks in optimizing compiler.Nicolas Geoffray
- 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
2014-09-19First optimization in new compiler: simple GVN.Nicolas Geoffray
Change-Id: Ibe0efa4e84fd020a53ded310a92e0b4363f91b12
2014-09-18It can be that no method has been compiled.Nicolas Geoffray
Therefore do not divide by 0, but log it. Change-Id: Iee7760ab7f31c73e90d62387e5fb6fb7aa2c56e2
2014-09-17Add the "time" compilation filter and output compilation stats.Nicolas Geoffray
A "time" compiler filter means the compiler optimizes for compile time. Change-Id: Id1a207ceb2d95f3548aae5e45d51b80695da2029
2014-09-08Runtime support for the new stack maps for the opt compiler.Nicolas Geoffray
Now most of the methods supported by the compiler can be optimized, instead of using the baseline. Change-Id: I80ab36a34913fa4e7dd576c7bf55af63594dc1fa
2014-08-22ART: Clean up compilerAndreas Gampe
Clean up the compiler: less extern functions, dis-entangle compilers, hide some compiler specifics, lower global includes. Change-Id: Ibaf88d02505d86994d7845cf0075be5041cc8438
2014-08-15ART source line debug info in OAT filesYevgeny Rouban
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>
2014-07-16Use the thumb2 assembler for the optimizing compiler.Nicolas Geoffray
Change-Id: I2b058f4433504dc3299c06f5cb0b5ab12f34aa82
2014-07-14Add two phi pruning phases.Nicolas Geoffray
Change-Id: Ic4f05e3df96970d78a6938b27cdf9b58ef3849b9
2014-07-14Support fields in optimizing compiler.Nicolas Geoffray
- 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