summaryrefslogtreecommitdiff
path: root/compiler/optimizing/optimizing_compiler.cc
AgeCommit message (Collapse)Author
2017-07-24ART: Include cleanupAndreas Gampe
Let clang-format reorder the header includes. Derived with: * .clang-format: BasedOnStyle: Google IncludeIsMainRegex: '(_test|-inl)?$' * Steps: find . -name '*.cc' -o -name '*.h' | xargs sed -i.bak -e 's/^#include/ #include/' ; git commit -a -m 'ART: Include cleanup' git-clang-format -style=file HEAD^ manual inspection git commit -a --amend Test: mmma art Change-Id: Ia963a8ce3ce5f96b5e78acd587e26908c7a70d02
2017-07-24Jit Code Cache instruction pipeline flushingOrion Hodson
Restores instruction pipeline flushing on all cores following crashes on ARMv7 with dual JIT code page mappings. We were inadvertantly toggling permission on a non-executable page rather than executable. Removes the data cache flush for roots data and replaces it with a sequentially consistent barrier. Fix MemMap::RemapAtEnd() when all pages are given out. To meet invariants checked in the destructor, the base pointer needs to be assigned as nullptr when this happens. Bug: 63833411 Bug: 62332932 Test: art/test.py --target Change-Id: I705cf5a3c80e78c4e912ea3d2c3c4aa89dee26bb
2017-07-19Pass the logger to the JIT compiler.Nicolas Geoffray
To avoid effects of concurrent method entrypoints update, just pass the logger to the JIT compiler, which will invoke it directly with the pointer to the newly allocated code. Test: test.py --trace Change-Id: I5fbcd7cbc948b7d46c98c1545d6e530fb1190602
2017-06-07Use ArtMethod* .bss entries for HInvokeStaticOrDirect.Vladimir Marko
Test: m test-art-host-gtest Test: testrunner.py --host Test: testrunner.py --target Test: Nexus 6P boots. Test: Build aosp_mips64-userdebug. Bug: 30627598 Change-Id: I0e54fdd2e91e983d475b7a04d40815ba89ae3d4f
2017-05-23Merge "Use PC-relative pointer to boot image methods."Treehugger Robot
2017-05-22Use PC-relative pointer to boot image methods.Vladimir Marko
In preparation for adding ArtMethod entries to the .bss section, add direct PC-relative pointers to methods so that the number of needed .bss entries for boot image is small. Test: m test-art-host-gtest Test: testrunner.py --host Test: testrunner.py --target on Nexus 6P Test: Nexus 6P boots. Test: Build aosp_mips64-userdebug Bug: 30627598 Change-Id: Ia89f5f9975b741ddac2816e1570077ba4b4c020f
2017-05-19Create load store analysis passxueliang.zhong
This CL separates load store analysis from LSE pass. The load and store analysis in LSE pass records information about heap memory accesses for arrays and fields. Such information can also be used in the other optimizations like instruction scheduling pass which can eliminate side-effect dependencies between memory accesses to different locations. Test: m test-art-host Test: m test-art-target Test: m test-art-host-gtest-load_store_analysis_test Test: 530-checker-lse Change-Id: I353a2b9a03b19bfa0e7ef07716d60bd4254c7ea7
2017-05-08Instruction scheduling for ARM.xueliang.zhong
Performance improvements on various benchmarks with this CL: benchmarks improvements --------------------------- algorithm 1% benchmarksgame 2% caffeinemark 2% math 3% stanford 4% Tested on ARM Cortex-A53 CPU. The code size impact is negligible. Test: m test-art-host Test: m test-art-target Change-Id: I314c90c09ce27e3d224fc686ef73c7d94a6b5a2c
2017-04-24ART: More header cleanup - method_verifier.hAndreas Gampe
Move enumerations to own header. Move the compiler interface (of what the compiler can tolerate) into its own header. Replace or remove method_verifier.h where possible. Test: mmma art Change-Id: I075fcb10b02b6c1c760daad31cb18eaa42067b6d
2017-04-10optimizing: do not illegally remove constructor barriers after inliningIgor Murashkin
Remove the illegal optimization that destroyed constructor barriers after inlining invoke-super constructor calls. --- According to JLS 7.5.1, "Note that if one constructor invokes another constructor, and the invoked constructor sets a final field, the freeze for the final field takes place at the end of the invoked constructor." This means if an object is published (stored to a location potentially visible to another thread) inside of an outer constructor, all final field stores from any inner constructors must be visible to other threads. Test: art/test.py Bug: 37001605 Change-Id: I3b55f6c628ff1773dab88022a6475d50a1a6f906
2017-04-06Clean up after MIPS got read barriers supportGoran Jakovljevic
This enables checker tests, as well as compiler_driver_test and reflection_test for MIPS32 and MIPS64. Test: mma test-art-host-gtest Test: mma test-art-target-gtest in QEMU (MIPS64) Test: ./testrunner.py --optimizing --target in QEMU (MIPS64) Change-Id: Ic6fe5b17f7f2cd7e38e12fef25afccf9358b80e0
2017-03-28MIPS: Implement read barriers.Alexey Frunze
This is the core functionality. Further improvements will be done separately. This also adds/moves memory barriers where they belong and removes the UnsafeGetLongVolatile and UnsafePutLongVolatile MIPS32 intrinsics as they need to load/store a pair of registers atomically, which is not supported directly by the CPU. Test: booted MIPS32R2 in QEMU Test: test-art-target-run-test Test: booted MIPS64 (with 2nd arch MIPS32R6) in QEMU Test: "testrunner.py --target --optimizing -j1" Test: same MIPS64 boot/test with ART_READ_BARRIER_TYPE=TABLELOOKUP Test: "testrunner.py --target --optimizing --32 -j2" on CI20 Test: same CI20 test with ART_READ_BARRIER_TYPE=TABLELOOKUP Change-Id: I0ff91525fefba3ec1cc019f50316478a888acced
2017-03-24Improvements in the Inliner.Nicolas Geoffray
- Change from a depth limit to a total number of HInstructions inlined limit. Remove the dex2oat depth limit argument. - Add more stats to diagnose reasons for not inlining. - Clean up logging to easily parse output. Individual Ritz benchmarks improve from 3 to 10%. No change in other heuristics. There was already an instruction budget. Note that the instruction budget is rarely hit in the "apps" I've tried with. Compile-times improve from 5 to 15%. Code size go from 4% increase (Gms) to 1% decrease (Docs). bug:35724239 test: test-art-host test-art-target Change-Id: I5a35c4bd826cf21fead77859709553c5b57608d6
2017-03-16Delete SrcMapMathieu Chartier
No longer used. SrcMapElem is still used by elf_debug_line_writer.h. Address previous comments from aog/351387. Test: make Change-Id: Ib1525168b14889abbdc78ba20c64f3223b140a51
2017-03-16Add method info to oat filesMathieu Chartier
The method info data is stored separately from the code info to reduce oat size by improving deduplication of stack maps. To reduce code size, this moves the invoke info and inline info method indices to this table. Oat size for a large app (arm64): 77746816 -> 74023552 (-4.8%) Average oat size reduction for golem (arm64): 2% Repurposed unused SrcMapElem deduping to be for MethodInfo. TODO: Delete SrcMapElem in a follow up CL. Bug: 36124906 Test: clean-oat-host && test-art-host-run-test Change-Id: I2241362e728389030b959f42161ce817cf6e2009
2017-03-14Revert^6 "Hash-based dex cache type array."Vladimir Marko
Fixed ImageWriter to write class table also if it contains only boot class loader classes. Added a regression test and added extra checks for debug-build to verify that dex cache types from app image are also in the class table. Removed some unnecessary debug output. Test: 158-app-image-class-table Bug: 34839984 Bug: 30627598 Bug: 34659969 This reverts commit 0b66d6174bf1f6023f9d36dda8538490b79c2e9f. Change-Id: I6a747904940c6ebc297f4946feef99dc0adf930c
2017-03-13Revert^5 "Hash-based dex cache type array."Vladimir Marko
For app images, ImageWriter does not add boot image classes to the app image class table even though it keeps them in the dex caches. The reason for that is unknown, the code looks OK. Bug: 34839984 Bug: 30627598 Bug: 34659969 Also reverts "Improve debugging output for a crash." This reverts commits bfb80d25eaeb7a604d5dd25a370e3869e96a33ab, 8dd56fcb3196f466ecaffd445397cb11ef85f89f. Test: testrunner.py --host Change-Id: Ic8db128207c07588c7f11563208ae1e85c8b0e84
2017-03-08Merge "Invoke typed arraycopy for primitive arrays."Nicolas Geoffray
2017-03-07Invoke typed arraycopy for primitive arrays.Nicolas Geoffray
Apps will always call the Object version of arraycopy. When we can infer the types of the passed arrays, replace the method being called to be the typed System.arraycopy one. 10% improvement on ExoPlayerBench. Test: 641-checker-arraycopy bug: 7103825 Change-Id: I872d7a6e163a4614510ef04ae582eb90ec48b5fa
2017-03-06Pass driver to loop opt. Add new side_effects phase.Aart Bik
Rationale: Break-out CL of ART Vectorizer: number 3. The purpose is making the original CL smaller and easier to review. Bug: 34083438 Test: test-art-host Change-Id: I7cece807ee4f5fcaeae41f1deed33ac263447b77
2017-02-27Implement code sinking.Nicolas Geoffray
Small example of what the optimization does: Object o = new Object(); if (test) { throw new Error(o.toString()); } will be turned into (note that the first user of 'o' is the 'new Error' allocation which has 'o' in its environment): if (test) { Object o = new Obect(); throw new Error(o.toString()); } There are other examples in 639-checker-code-sinking. Ritz individual benchmarks improve on art-jit-cc from 5% (EvaluateComplexFormulas) to 23% (MoveFunctionColumn) on all platforms. Test: 639-checker-code-sinking Test: test-art-host Test: borg job run Test: libcore + jdwp bug:35634932 bug:30933338 Change-Id: Ib99c00c93fe76ffffb17afffb5a0e30a14310652
2017-02-20Revert^4 "Hash-based dex cache type array."Vladimir Marko
Added extra output to the abort message to collect more data when we hit the crash. Added extra check when loading an app image to verify that the class table isn't already broken. Test: testrunner.py --host Bug: 34839984 Bug: 30627598 Bug: 34659969 This reverts commit 5812e20ff7cbc8efa0b8d7486ada2f58840a6ad5. Change-Id: I9bb442a184c236dcb75b3e42a095f39cd6bee59d
2017-02-14ART: Add operator == and != with nullptr to HandleAndreas Gampe
Get it in line with ObjPtr and prettify our code. Test: m Change-Id: I1322e2a9bc7a85d7f2441034a19bf4d807b81a0e
2017-02-13Revert^3 "Hash-based dex cache type array."Mathieu Chartier
Assert failing for "earchbox:search": F zygote64: class_linker.cc:4612] Check failed: handle_scope_iface.Get() != nullptr Test: m test-art-host Bug: 34839984 Bug: 30627598 Bug: 34659969 This reverts commit 85c0f2ac03417f5125bc2ff1dab8109859c67d5c. Change-Id: I39846c20295af5875b0f945be7035c73ded23135
2017-02-10Revert^2 "Hash-based dex cache type array."Vladimir Marko
The reason for the revert was fixed by https://android-review.googlesource.com/332666 . We now enable clearing dex cache types in test 155 from that CL. Also avoid an unnecessary store in LookupResolvedTypes() and prevent verifier from messing up the dex cache types. Test: m test-art-host Bug: 34839984 Bug: 30627598 Bug: 34659969 This reverts commit d16363a93053de0f32252c7897d839a46aff14ae. Change-Id: Ie8603cfa772e78e648d005b0b6eae59062ae729d
2017-02-06Merge "Revert "Revert "Inline across dex files for JIT."""Nicolas Geoffray
2017-02-06Merge "Code refactoring around sharpening HLoadClass."Nicolas Geoffray
2017-02-06Revert "Revert "Inline across dex files for JIT.""Nicolas Geoffray
bug:30933338 This reverts commit d16da8bd8106452eea82408748dc6b3fd64bcb80. Change-Id: I6a30354d6d00442cb1a542af063c7769865e369d
2017-02-03Code refactoring around sharpening HLoadClass.Nicolas Geoffray
Even if the class is not accessible through the dex cache, we can access it by other means (eg boot class, jit table). So rewrite static field access instruction builder to not bail out if a class cannot be accessed through the dex cache. bug:34966607 test: test-art-host test-art-target Change-Id: I88e4e09951a002b480eb8f271726b56f981291bd
2017-02-03Merge "Revert "Inline across dex files for JIT.""Nicolas Geoffray
2017-02-03Revert "Inline across dex files for JIT."Nicolas Geoffray
Broke hikey build. bug:30933338 This reverts commit f290c01c61f8a2979efa74ffcd2f54c5e426a3d0. Change-Id: I3363d703c54d0f9b69197a29395cc08f60c8b2ac
2017-02-03Merge "Inline across dex files for JIT."Nicolas Geoffray
2017-02-02Inline across dex files for JIT.Nicolas Geoffray
bug:30933338 test: ART_TEST_JIT=true test-art-host test-art-target Change-Id: I4ac708d70d90c2db4139d99a75bf4665a810c206
2017-02-01Revert "Hash-based dex cache type array."Vladimir Marko
Reverting to work around some programs crashing with Check failed: handle_scope_iface.Get() != nullptr. though the reason for the failure not yet understood. Test: m test-art-host Bug: 34839984 Bug: 30627598 Bug: 34659969 Bug: 30419309 This reverts commit ec7862283dd49f5a58d0ac45960ce27c2f7671b8. Change-Id: Ifded663633082f1e59e5b6ff2e026dc559bd6b82
2017-01-30Hash-based dex cache type array.Vladimir Marko
Test: m test-art-host (Interpreter, Optimizing, JIT) Test: m test-art-target on Nexus 6P (Interpreter, Optimizing, JIT) Test: Nexus 6P boots Test: m valgrind-test-art-host Bug: 30627598 Bug: 34659969 Bug: 30419309 Change-Id: Ic00eda89e58088a3573fc9ec0ad04c0e69e161d1
2017-01-25AArch64: Add HInstruction scheduling support.Alexandre Rames
This commit adds a new `HInstructionScheduling` pass that performs basic scheduling on the `HGraph`. Currently, scheduling is performed at the block level, so no `HInstruction` ever leaves its block in this pass. The scheduling process iterates through blocks in the graph. For blocks that we can and want to schedule: 1) Build a dependency graph for instructions. It includes data dependencies (inputs/uses), but also environment dependencies and side-effect dependencies. 2) Schedule the dependency graph. This is a topological sort of the dependency graph, using heuristics to decide what node to schedule first when there are multiple candidates. Currently the heuristics only consider instruction latencies and schedule first the instructions that are on the critical path. Test: m test-art-host Test: m test-art-target Change-Id: Iec103177d4f059666d7c9626e5770531fbc5ccdc
2017-01-10Keep resolved String in HLoadString.Nicolas Geoffray
For the following reasons: - Avoids needing to do a lookup again in CodeGenerator::EmitJitRoots. - Fixes races where we the string was GC'ed before CodeGenerator::EmitJitRoots. - Makes it possible to do GVN on the same string but defined in different dex files. Test: test-art-host, test-art-target Change-Id: If2b5d3079f7555427b1b96ab04546b3373fcf921
2016-12-19CHA guard optimization (elimination/hoisting).Mingyao Yang
Test: manual by checking the dump-cfg output. Change-Id: I254e168b9a85d2d3d23e02eea7e129c1bc9ab920
2016-12-15Flush JIT data cache when committing code.Nicolas Geoffray
Otherwise, executing compiled code may see old data from the data cache. Test: ART_TEST_JIT=true test-art-target on arm/arm64 Test: run-libcore-tests.sh (especially jsr166) on arm/arm64 Change-Id: Id037c68897aa0e9ccacd4c5121f3743fb722c6f3
2016-12-13ART: Clean up utils.hAndreas Gampe
Remove functionality provided by libbase. Move some single-use functions to their respective users. Test: m test-art-host Change-Id: I75594035fa975200d638cc29bb9f31bc6e6cb29f
2016-12-12Revert "Revert "Add kJitTableAddress for HLoadClass.""Nicolas Geoffray
This reverts commit d2d5262c8370309e1f2a009f00aafc24f1cf00a0. Change-Id: I6149d5c7d5df0b0fc5cb646a802a2eea8d01ac08
2016-12-12Revert "Add kJitTableAddress for HLoadClass."Nicolas Geoffray
One test failure after merge. This reverts commit 5b12f7973636bfea29da3956a9baa7a6bbe2b666. Change-Id: I120c49e53274471fc1c82a10d52e99c83f5f85cc
2016-12-12Add kJitTableAddress for HLoadClass.Nicolas Geoffray
This new kind loads classes from the root table associated with JIT compiled code. Also remove kDexCacheAddress, which is replaced by kJitTableAddress. test: ART_TEST_JIT=true test-art-host-jit test-art-target-jit Change-Id: Ia23029688d1a60c178bf2ffa7463927c5d5de4d0
2016-12-05ARM: VIXL32: Implement Invoke, LoadClass, LoadString dispatch.Artem Serov
Implemented dispatch optimizations for InvokeStaticOrDirect, LoadClass, LoadString (excluding cases that use Literals). Performed a cleanup of VIXL backend. Test: export ART_USE_VIXL_ARM_BACKEND=true && \ mma test-art-host dist && mma test-art-target dist Change-Id: Ib37a6b7e7657196b13caec999d190be747857c1d
2016-12-01Class Hierarchy Analysis (CHA)Mingyao Yang
The class linker now tracks whether a method has a single implementation and if so, the JIT compiler will try to devirtualize a virtual call for the method into a direct call. If the single-implementation assumption is violated due to additional class linking, compiled code that makes the assumption is invalidated. Deoptimization is triggered for compiled code live on stack. Instead of patching return pc's on stack, a CHA guard is added which checks a hidden should_deoptimize flag for deoptimization. This approach limits the number of deoptimization points. This CL does not devirtualize abstract/interface method invocation. Slides on CHA: https://docs.google.com/a/google.com/presentation/d/1Ax6cabP1vM44aLOaJU3B26n5fTE9w5YU-1CRevIDsBc/edit?usp=sharing Change-Id: I18bf716a601b6413b46312e925a6ad9e4008efa4 Test: ART_TEST_JIT=true m test-art-host/target-run-test test-art-host-gtest
2016-11-22Clear the right data pointer.Nicolas Geoffray
Internally, stack_map_data is an offset of the roots_data allocation. Pass both to the ClearData method, which will use the right pointer to deallocate. Test: test-art-host in debug mode Change-Id: Ibfe38e7f1853870076048427f2efe7121c11c136
2016-11-21ART: Add dex::TypeIndexAndreas Gampe
Add abstraction for uint16_t type index. Test: m test-art-host Change-Id: I47708741c7c579cbbe59ab723c1e31c5fe71f83a
2016-11-21Merge "Revert "Revert "Revert "Revert "JIT root tables."""""Nicolas Geoffray
2016-11-18Revert "Revert "Revert "Revert "JIT root tables.""""Nicolas Geoffray
Test: 626-set-resolved-string, test-art-host, test-art-target Test: run-libcore-tests.sh Test: phone boots and runs This reverts commit 3395fbc20bcd20948bec8958db91b304c17cacd8. Change-Id: I104b73d093e3eb6a271d564cfdb9ab09c1c8cf24
2016-11-16ARM: VIXL32: Arch specific operations.Artem Serov
Tests which now start to pass: 550-checker-multiply-accumulate 564-checker-negbitwise Test: export ART_USE_VIXL_ARM_BACKEND=true && \ mma test-art-host dist && mma test-art-target dist Change-Id: I0b057486a8e0e48afbc52dd18b61ea16c671bec2