summaryrefslogtreecommitdiff
path: root/compiler/optimizing/optimizing_compiler.cc
Commit message (Collapse)AuthorAgeFilesLines
...
* Merge "Revert "Revert "Revert "JIT root tables.""""Nicolas Geoffray2016-11-141-26/+4
|\
| * Revert "Revert "Revert "JIT root tables."""Nicolas Geoffray2016-11-141-26/+4
| | | | | | | | | | | | | | | | | | libcore failures: dalvikvm32 F 11-14 03:04:06 14870 14870 jit_code_cache.cc:310] Check failed: new_string != nullptr This reverts commit 75afcdd3503a8a8518e5b23d21b6e73306ce39ce. Change-Id: I5a6b6b48aa79a763d1ff1ba4d85d63811254787d
* | Merge "Revert "Revert "JIT root tables."""Nicolas Geoffray2016-11-141-4/+26
|\|
| * Revert "Revert "JIT root tables.""Nicolas Geoffray2016-11-111-4/+26
| | | | | | | | | | | | | | | | | | | | | | Also contains Revert "Support kJitTableAddress in x86/arm/arm64." This reverts commit 4acd03638fcdb4e5d1666f8eec7eb3bf6d6be035. This reverts commit 997d1217830c0a18b70faeabd53c04700a87d7d9. Test: ART_USE_READ_BARRIER=true/false test-art-host test-art-target Change-Id: I77cb1e9bf8f1b4c58b72d3cf5ca31ced2aaa1ea3
* | Dump c1visualizer output before and after each pass.Nicolas Geoffray2016-11-101-16/+15
|/ | | | | | | In order to get the last state of a graph before a crash. Test: dex2oat --dump-cfg Change-Id: I461a26a47a170b95fadb9da21a443af26fe52181
* Merge "Revert "JIT root tables.""Nicolas Geoffray2016-11-091-26/+4
|\
| * Revert "JIT root tables."Nicolas Geoffray2016-11-091-26/+4
| | | | | | | | | | | | | | | | May be the offender for jit-gcstress failure of 902. This reverts commit ac3ebc3150760425ed00abd56da48f9a6e0666bc. Change-Id: I9ea6c9236fd1729fed7d1868dd8a111172932308
* | Merge "JIT root tables."Nicolas Geoffray2016-11-091-4/+26
|\|
| * JIT root tables.Nicolas Geoffray2016-11-081-4/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | Implement root tables for the JIT. Each JIT compiled method gets a table allocated before the stack maps. The table gets visited through Runtime::SweepSystemWeaks. Implement String roots for x86_64 as an example. Test: test-art-host test-art-target Change-Id: Id3d5bc67479e08b52dd4b253e970201203a0f0d2
* | ART: Fix tidy warningsAndreas Gampe2016-11-081-1/+1
|/ | | | | | | | | | | | | Switch to char versions of find variants. Add "explicit" constructor variants or refactor and remove defaults. Use const references. Bug: 32619234 Test: m test-art-host Change-Id: I970cc2f47d6cf8f0c74104b994b075b2fafb3d45
* New instruction simplifications. Extra dce pass. Allow more per block repeats.Aart Bik2016-11-021-1/+4
| | | | | | | | | | | | Rationale: We were missing some obvious simplifications, which left performance at the table for e.g. CaffeineLogic compiled with dx (4200us->2700us). The constant for allowing a repeat on a BB seemed very low, at the very least it should depend on the BB size. Test: test-art-host Change-Id: Ic234566e117593e12c936d556222e4cd4f928105
* Flush the CFG visualizer output after writing to it.Roland Levillain2016-11-011-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | This fixes test failures exposed by the ART Buildbot in 608-checker-unresolved-lse (AOT) on the hammerhead-ndebug configuration. The test used to fail because the CFG file dumped by second invocation of dex2oat on device would be truncated (at the beginning of the disassembly section of the second compiled Dex file's contents) because of dex2oat's fast exit. Interestingly enough, this is the only case where this failure has been observed, which seems to be due to a combination of: - targeting (32-bit) ARM; - using a secondary Dex file (used to create an unresolved access for that test); - compiling that secondary Dex file with dex2oat (ndebug mode) instead of dex2oatd; - supporting multithread CFG graph dumping (by having the write-to-file operation in a critical section) since https://android-review.googlesource.com/#/c/296224/. Test: art/test/run-test -O --debuggable 608-checker-unresolved-lse Change-Id: Ifc1a23a3708b8645fd36c148312074bb9fe00cfc
* ART: Make graph visualizer thread-safeAndreas Gampe2016-10-281-7/+22
| | | | | | | | | | | | | | | | Store visualizer to a temporary string stream during compilation. Print to the final output on destruction, and do so under a lock. Note: the order of methods in the output is only guaranteed to be deterministic with single-threaded compilation (-j1). Test: m Test: Compile multithread Test: Check output file that begin_compilation and end_compilation are interleaved Test: Check that names of compiled methods match Change-Id: I7eb3be2f88333cf1f116fe71b77cffa1ac702208
* Merge "Improve recognition of select-based period induction."Treehugger Robot2016-10-201-3/+6
|\
| * Improve recognition of select-based period induction.Aart Bik2016-10-201-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rationale: Similar to the previous CL, this helps to eliminate more dead induction. Now, CaffeineLogic, when compiled with dx (rather than jack) improves by a 1.5 speedup (9000us -> 6000us). Note: We need to run the simplifier before induction analysis to trigger the select simplification first. Although a bit of a compile-time hit, it seems a good idea to run a simplifier here again anyway. Test: test-art-host Change-Id: I93b91ca40a4d64385c64393028e8d213f0c904a8
* | Merge "ARM: VIXL32: Pass initial ART tests with new code generator."Roland Levillain2016-10-201-1/+6
|\ \ | |/ |/|
| * ARM: VIXL32: Pass initial ART tests with new code generator.Scott Wakeling2016-10-171-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | - Implement enough codegen to pass ~70 art/tests. - When ART_USE_VIXL_ARM_BACKEND is defined: - Blacklist known-to-fail target tests - interpret-only everything except the tests themselves - Set a flag to use the VIXL based ARM backend Test: export ART_USE_VIXL_ARM_BACKEND=true && mma test-art-target && mma test-art-host Change-Id: Ic8bc095e8449f10f97fa0511284790f36c20e276
* | Remove mirror:: and ArtMethod deps in utils.{h,cc}David Sehr2016-10-181-4/+4
|/ | | | | | | | | | | | | | | | | | | | | | The latest chapter in the ongoing saga of attempting to dump a DEX file without having to start a whole runtime instance. This episode finds us removing references to ArtMethod/ArtField/mirror. One aspect of this change that I would like to call out specfically is that the utils versions of the "Pretty*" functions all were written to accept nullptr as an argument. I have split these functions up as follows: 1) an instance method, such as PrettyClass that obviously requires this != nullptr. 2) a static method, that behaves the same way as the util method, but calls the instance method if p != nullptr. This requires using a full class qualifier for the static methods, which isn't exactly beautiful. I have tried to remove as many cases as possible where it was clear p != nullptr. Bug: 22322814 Test: test-art-host Change-Id: I21adee3614aa697aa580cd1b86b72d9206e1cb24
* Replace StackHandleScopeCollection with VariableSizedHandleScopeMathieu Chartier2016-10-121-7/+7
| | | | | | | | | | | | VariableSizedHandleScope's internal handle scopes are not pushed directly on the thread. This means that it is safe to intermix with other types of handle scopes. Added test. Test: clean-oat-host && test-art-host Change-Id: Id2fd1155788428f394d49615d337d9134824c8f0
* Merge "Remove #include "oat_file.h" from class_linker.h ."Vladimir Marko2016-10-051-2/+3
|\
| * Remove #include "oat_file.h" from class_linker.h .Vladimir Marko2016-10-051-2/+3
| | | | | | | | | | | | | | | | | | | | Refactor the OatClass and OatMethod related functions from ClassLinker to OatFile and ArtMethod, respectively. Refactor the remaining ClassLinker dependencies on OatFile to break the #include dependency and reduce incremental build times. Test: m test-art-host Change-Id: Iebc5b9f81b48fbcf79821cc827a5d7c4a0261bf6
* | Properly scope HLoopOptimization's allocator.Nicolas Geoffray2016-10-051-0/+2
| | | | | | | | | | | | | | | | | | | | | | HOptimization classes do not get their destructor called, as they are arena objects. So the scope for the optimization allocator needs to be the Run method. Also anticipate bisection search breakage by adding HLoopOptimization to the list of recognized optimizations. Change-Id: I7770989c39d5700a3b6b0a20af5d4b874dfde111
* | A first implementation of a loop optimization framework.Aart Bik2016-10-031-0/+3
|/ | | | | | | | | | | | | | | | | Rationale: We are planning to add more and more loop related optimizations and this framework provides the basis to do so. For starters, the framework optimizes dead induction, induction that can be replaced with a simpler closed-form, and eliminates dead loops completely (either pre-existing or as a result of induction removal). Speedup on e.g. Benchpress Loop is 73x (17.5us. -> 0.24us.) [with the potential for more exploiting outer loop too] Test: 618-checker-induction et al. Change-Id: If80a809acf943539bf6726b0030dcabd50c9babc
* Simplify our intrinsic recognizer.Nicolas Geoffray2016-09-301-3/+2
| | | | | | | | | | | | | | | - Use the modifiers for storing the intrinsic kind. - Delete dex_file_method_inliner and its associated map. This work was also motivated by the fact that the inline method analyzer leaks intrinsic tables, and even worse, might re-use a table from one dex file to another unrelated dex file in the presence of class unloading and the unlikely event of the dex files getting the same address. test: m test-art-host m test-art-target Change-Id: Ia653d2c72df13889dc85dd8c84997582c034ea4b
* Clean up ScopedThreadStateChange to use ObjPtrMathieu Chartier2016-09-291-1/+1
| | | | | | | | | | | | | | | Also fixed inclusion of -inl.h files in .h files by adding scoped_object_access-inl.h and scoped_fast_natvie_object_access-inl.h Changed AddLocalReference / Decode to use ObjPtr. Changed libartbenchmark to be debug to avoid linkage errors. Bug: 31113334 Test: test-art-host Change-Id: I4d2e160483a29d21e1e0e440585ed328b9811483
* ART: SHARED_REQUIRES to REQUIRES_SHAREDAndreas Gampe2016-08-301-2/+2
| | | | | | | | | This coincides with the actual attribute name and upstream usage. Preparation for deferring to libbase. Test: m Test: m test-art-host Change-Id: Ia8986b5dfd926ba772bf00b0a35eaf83596d8518
* ARM/MIPS: Avoid dead dex cache arrays base for intrinsics.Vladimir Marko2016-08-261-2/+3
| | | | | Test: Run ART test suite on host and Nexus 6. Change-Id: Ie2ad70f1e3f125eae5dad53a6384d405e0311505
* Merge "ARM: Purge Arm32Assembler."Roland Levillain2016-08-251-3/+1
|\
| * ARM: Purge Arm32Assembler.Artem Serov2016-08-191-3/+1
| | | | | | | | | | | | | | | | | | | | Use Thumb2Assembler always. This originated from finding out that the JNI tests are run using the Arm32Assembler however in real world Thumb2Assembler is used for JNI. Therefore Arm32Assembler code is dead except its own tests and the illegitimate use in JNI tests. Change-Id: I9ca6b83582bf97149a46690518ccb9312b1a3b68
* | Use full pass name when building optimizationsWojciech Staszkiewicz2016-08-231-10/+15
|/ | | | | | | | | | | | | | | | | | | If possible, use full pass name provided in --run-passes rather than its base version. Test: m test-art-host -j32 1. Prepare a run-passes file with content: dead_code_elimination$initial instruction_simplifier x86_memory_operand_generation 2. Run art for a dex file like: art -Xcompiler-option --run-passes=run-passes -Xcompiler-option --dump-passes -classpath classes.dex Test 3. Verify that dead_code_elimination$initial string is present in dump-passes output. Change-Id: I92d9ed0c8b919ea03f625f549123f546dffe546b
* Merge "Log optimization passes in verbose mode"Aart Bik2016-08-181-0/+1
|\
| * Log optimization passes in verbose modeWojciech Staszkiewicz2016-08-181-0/+1
| | | | | | | | | | | | | | | | | | | | Introduce verbose logging of optimization passes run during compilation. Test: m test-art-host -j32 art -Xcompiler-option --runtime-arg -Xcompiler-option -verbose:compiler -classpath classes.dex Test Change-Id: Iae98ce9dcafc252f2d0eec138aa05b34e424bd2a
* | Fix optimizing compiler not building for svelteWojciech Staszkiewicz2016-08-181-7/+18
|/ | | | | | | | | | | | Fixes compiler not building when some of the codegen paths are disabled. Test: mmma -j art ART_TARGET_CODEGEN_ARCHS=svelte m -j32 test-art-host BUG=30928847 Change-Id: I52c78e8a4e507f74b1f2a39352970079721b737e
* jni: Fast path for @FastNative annotated java methodsIgor Murashkin2016-08-161-2/+7
| | | | | | | | | | | | | | | | Adds a faster path for java methods annotated with dalvik.annotation.optimization.FastNative . Intended to replace usage of fast JNI (registering with "!(FOO)BAR" descriptors). Performance Microbenchmark Results (Angler): * Regular JNI cost in nanoseconds: 115 * Fast JNI cost in nanoseconds: 60 * @FastNative cost in nanoseconds: 36 Summary: Up to 67% faster (vs fast jni) JNI transition cost Change-Id: Ic23823ae0f232270c068ec999fd89aa993894b0e
* Implement running user defined list of passesWojciech Staszkiewicz2016-08-081-28/+157
| | | | | | | | | | | | | | | | | | This change introduces new dex2oat switch --run-passes=. This switch accepts path to a text file with names of passes to run. Compiler will run optimization passes specified in the file rather then the default ones. There is no verification implemented on the compiler side. It is user's responsibility to provide a list of passes that leads to successful generation of correct code. Care should be taken to prepare a list that satisfies all dependencies between optimizations. We only take control of the optional optimizations. Codegen (builder), and all passes required for register allocation will run unaffected by this mechanism. Change-Id: Ic3694e53515fefcc5ce6f28d9371776b5afcbb4f
* Add a register allocation strategy compiler optionMatthew Gharrity2016-08-061-3/+6
| | | | | | Test: manually, on device. Change-Id: If007a1657dd5769ddef03691e0a19dbbe6ba1a29
* MIPS32: Improve string and class loadsAlexey Frunze2016-07-271-1/+1
| | | | | | | | | | Tested: - MIPS32 Android boots in QEMU - test-art-host-gtest - test-art-target-run-test-optimizing in QEMU, on CI20 - test-art-target-gtest on CI20 Change-Id: I70fd5d5267f8594c3b29d5a4ccf66b8ca8b09df3
* Merge "Make static helper methods member functions of OptimizingCompiler class"Aart Bik2016-07-251-25/+48
|\
| * Make static helper methods member functions of OptimizingCompiler classWojciech Staszkiewicz2016-07-221-25/+48
| | | | | | | | | | | | | | | | | | | | Make RunOptimizations, MaybeRunInliner and RunArchOptimizations member functions of OptimizingCompiler class. Both versions of RunOptimizations are protected in preparation for bisection bug search CL. Change-Id: I596efa9ed3fccd1ed3798c6427cc166e2a5d28bd
* | Merge "ARM: Port instr simplification of array accesses."Vladimir Marko2016-07-211-0/+4
|\ \
| * | ARM: Port instr simplification of array accesses.Artem Serov2016-07-211-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After changing the addressing mode for array accesses (in https://android-review.googlesource.com/248406) the 'add' instruction that calculates the base address for the array can be shared across accesses to the same array. Before https://android-review.googlesource.com/248406: add IP, r[Array], r[Index0], LSL #2 ldr r0, [IP, #12] add IP, r[Array], r[Index1], LSL #2 ldr r0, [IP, #12] Before this CL: add IP. r[Array], #12 ldr r0, [IP, r[Index0], LSL #2] add IP. r[Array], #12 ldr r0, [IP, r[Index1], LSL #2] After this CL: add IP. r[Array], #12 ldr r0, [IP, r[Index0], LSL #2] ldr r0, [IP, r[Index1], LSL #2] Link to the original optimization: https://android-review.googlesource.com/#/c/127310/ Test: Run ART test suite on Nexus 6. Change-Id: Iee26f9a0a7ca46abb90e3f60d19d22dc8dee4d8f
* | | Refactor register allocation to be pluggableMatthew Gharrity2016-07-201-1/+1
|/ / | | | | | | | | | | | | | | | | Allow alternate register allocation strategies to be implemented in subclasses of a common register allocation base class. Test: m test-art-host Change-Id: I7c5866aa9ddff8f53fcaf721bad47654ab221b4f
* / Rename current register allocator implementationMatthew Gharrity2016-07-151-1/+1
|/ | | | | | | | | This will allow a cleaner commit in an upcoming refactoring of register allocation. Test: m test-art-host Change-Id: If420c97b088b3c934411ff83373e024003120746
* X86: Use memory to do array range checksMark Mendell2016-07-131-1/+19
| | | | | | | | | | | | | | | | | | | | | | | Currently, an HBoundsCheck is fed by an HArrayLength, causing a load of the array length, followed by a register compare. Avoid the load when we can by comparing directly with the array length in memory. Implement this by marking the HArrayLength as 'emitted at use site', and then generating the code in the HBoundsCheck. Only do this replacement when we are the only user of the ArrayLength and it isn't visible to the environment. Handle the special case where the array is 'null' and where an implicit null check can't be eliminated. This code moves the load of the length to the slow code for the failed check, which is what we want. Test: 609-checker-x86-bounds-check Change-Id: I9cdb183301e048234bb0ffeda940eedcf4a655bd Signed-off-by: Mark Mendell <mark.p.mendell@intel.com>
* MIPS32: Improve method invocationAlexey Frunze2016-07-011-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | Improvements include: - CodeGeneratorMIPS::GenerateStaticOrDirectCall() supports: - MethodLoadKind::kDirectAddressWithFixup (via literals) - CodePtrLocation::kCallDirectWithFixup (via literals) - MethodLoadKind::kDexCachePcRelative - 32-bit literals to support the above (not ready for general- purpose applications yet because RA is not saved in leaf methods, but is clobbered on MIPS32R2 when simulating PC-relative addressing (MIPS32R6 is OK because it has PC-relative addressing with the lwpc instruction)) - shorter instruction sequences for recursive static/direct calls Tested: - test-art-host-gtest - test-art-target-gtest and test-art-target-run-test-optimizing on: - MIPS32R2 QEMU - CI20 board - MIPS32R6 (2nd arch) QEMU Change-Id: Id5b137ad32d5590487fd154c9a01d3b3e7e044ff
* Revert "Revert "Fix ArtMethod::GetInvokeType for static methods on interfaces.""Nicolas Geoffray2016-06-071-6/+23
| | | | | | | | | | | | | | | bug:29089267 bug:27521545 We were hitting a compiler DCHECK that a class would never require to do access checks on itself. The reason was that the compiler driver was not trying to resolve a type, but instead relied on the verifier for pre-populating the dex cache. However, the verifier doesn't necessarily run in JIT mode. This reverts commit 12abcbd950bd0ff4528e2e0d27ca5e881c7b0467. Change-Id: I59204c16927084f6605a2a3f999ca529f949e1ad
* Revert "Fix ArtMethod::GetInvokeType for static methods on interfaces."Nicolas Geoffray2016-06-061-14/+7
| | | | | | | | | | | bug:29089267 bug:27521545 Fails some DHECKs. This reverts commit 808067335b228d7b50ad84123d3c8ecb7aeeb200. Change-Id: I0e768ce85be593e3f50fd02abc29aa34f2be3562
* Fix ArtMethod::GetInvokeType for static methods on interfaces.Nicolas Geoffray2016-06-061-7/+14
| | | | | | | | | | | | And avoid calling ResolveMethod in the JIT, since it already knows that method. bug:29089267 bug:27521545 (cherry picked from commit 2dc77ecf375882f51ff7c09712c05b80e58abb6b) Change-Id: I36084b1f207317452c42fdfc8ffa4d8c721d2f76
* Add flag to ArtMethod to skip compilation.Nicolas Geoffray2016-04-251-10/+3
| | | | | | | | | | To ensure even the JIT will not try to compile methods with soft failures a runtime_throw. bug:28293819 bug:28313047 Change-Id: Ie3fd71ded0b77de8dab1c3c825b867cb321b8873
* Move Assemblers to the Arena.Vladimir Marko2016-04-131-4/+2
| | | | | | | And clean up some APIs to return std::unique_ptr<> instead of raw pointers that don't communicate ownership. Change-Id: I3017302307a0253d661240750298802fb0d9585e