summaryrefslogtreecommitdiff
path: root/compiler/optimizing/optimizing_compiler.cc
AgeCommit message (Collapse)Author
2019-02-14Revert^2 "Add code size to CodeInfo"David Srbecky
This temporarily adds 0.25% to oat file size. The space will be reclaimed back in follow-up CL. This reverts commit 8f20a23a35fa6fbe4dcb4ff70268a24dc7fb2a24. Reason for revert: Reland as-is after CL/903819 Bug: 123510633 Test: DCHECK compare the two stored code sizes. Change-Id: Ia3ab31c208948f4996188764fcdcba13d9977d19
2019-02-12Revert "Add code size to CodeInfo"David Srbecky
This reverts commit 68efa7b1128486e08ae60cd27181645b27bbd2e4. Reason for revert: Breaks tests Change-Id: I28fb143990f58e0d5f0b106bea9d9a159f19297e
2019-02-11Add code size to CodeInfoDavid Srbecky
This temporarily adds 0.25% to oat file size. The space will be reclaimed back in follow-up CL. Bug: 123510633 Test: DCHECK compare the two stored code sizes. Change-Id: I15340824ca637fd075a4cef87771b06cb96bb9f4
2019-01-28Selectively allow dead reference eliminationHans Boehm
Allow dead reference elimination in methods not containing @ReachabilitySensitive accesses or calls, when the class is marked @DeadReferenceSafe. Add 1339-dead-reference-safe to aggressively check that everything works as intended. Bug: 111453875 Test: art/test/testrunner/testrunner.py --host --64 -t 1339-dead-reference-safe Detect ReachabilitySensitive annotations. Change-Id: I70c20431fdbcfcfd2692b2255d12ad59e37cb669
2019-01-22Add timing logger for mini-debug-info generation.David Srbecky
Test: Check ANR report. Change-Id: I7e1b67bf8e1b950d5f67937fd29645b570d0465a
2019-01-02ART: Move dex structs into own headerAndreas Gampe
Separating out the structs from DexFile allows them to be forward- declared, which reduces the need to include the dex_file header. Bug: 119869270 Test: m Change-Id: I32dde5a632884bca7435cd584b4a81883de2e7b4
2018-12-27ART: Refactor for bugprone-argument-commentAndreas Gampe
Handles compiler. Bug: 116054210 Test: WITH_TIDY=1 mmma art Change-Id: I5cdfe73c31ac39144838a2736146b71de037425e
2018-12-14Pack JIT mini-debug-infos together.David Srbecky
We currently produce one in-memory ELF file per JITed method, which has significant overheads due to the ELF file headers. Pack several of those files together regularly to save space. Similarly, prune information about methods which were GCed. This reduces the size of JIT mini-debug-info by factor of 10. The final overhead is 5% to 10% relative to the JIT code size. Test: ./art/test.py -b -r -t 137 Change-Id: Idfaff8ed9a209e871e815e527f24f36c63a57bbf
2018-12-11Cleanup native debug interface api.David Srbecky
Strongly type the DEX file arguments. Remove the need for callers to worry about locks. Use std::map instead of std::unordered_map internally. Test: ./art/test.py -b -r -t 137 Change-Id: I8bd79b796b5c7da265afc43a07ed227f550116c7
2018-12-07Merge "Refactor CompilerDriver::CompileAll()."Vladimir Marko
2018-12-06Refactor CompilerDriver::CompileAll().Vladimir Marko
Treat verification results and image classes as mutable only in CompilerDriver::PreCompile(), and treat them as immutable during compilation, accessed through the CompilerOptions. This severs the dependency of the inliner on the CompilerDriver. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: I594a0213ca6a5003c19b4bd488af98db4358d51d
2018-12-05Simplify MakeElfFileForJITDavid Srbecky
We only ever pass single method info to the method and I don't plan to use the method for anything more complex. The JIT-related methods also know the relevant ElfTypes at compile time, so some of the helpers are not needed. Test: ./art/test.py -b -r -t 137 Change-Id: Ie7815a6427ac05be15a79adeb05dccc9150441d2
2018-11-21ART: Some iwyu for logging.hAndreas Gampe
Remove over-broad use in headers. Fix up transitive includes. Bug: 119869270 Test: mmma art Change-Id: I518fa7c8bee014b260818fca1fbde6ec47d126da
2018-11-19Remove CompiledMethod dependency on CompilerDriver.Vladimir Marko
Test: m test-art-host-gtest Change-Id: Ibee78d5c54d3ff8162258963fde25065b579a000
2018-11-14ART: Rewrite core image detection.Vladimir Marko
Remove unused compiler option `core_image_` and cache the IsCompilingWithCoreImage in the CompilerOptions instead. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: Idcf3b6c96dab9a39f823a16778e7698589442cd8
2018-11-08Emit bit manipulation instructions for x86 and x86_64Shalini Salomi Bodapati
This patch performs instruction simplification to generate instructions andn, blsmsk and blsr on cpus that have avx2. Test: test.py --host --64, test-art-host-gtest Change-Id: Ie41a1b99ac2980f1e9f6a831a7d639bc3e248f0f Signed-off-by: Shalini Salomi Bodapati <shalini.salomi.bodapati@intel.com>
2018-11-01Do not cache RequiresConstructorBarrier() results.Vladimir Marko
Avoid caching the results. Caching was broken for JIT in the presence of class unloading; entries for unloaded dex files were leaked and potentially used erroneously with a newly loaded dex file. Test: m test-art-host-gtest Test: testrunner.py --host Test: Pixel 2 XL boots. Test: m test-art-target-gtest Test: testrunner.py --target Bug: 118808764 Change-Id: Ic1163601170364e060c2e3009752f543c9bb37b7
2018-11-01Add compiling class to the DexCompilationUnit.Vladimir Marko
Use it to simplify HInstructionBuilder and reduce the number of class resolution calls. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: Pixel 2 XL boots. Change-Id: Ib4f9b4ea61235841e653a03a40755a39c7de7504
2018-10-10Introduce a 'baseline' variant for the compiler.Nicolas Geoffray
Implemented as a stripped down version of the optimizing compiler, not running any optimization. Adjust code to still work with expectations in code generators. bug: 111397239 Test: test.py --baseline Change-Id: I4328283825f9a890616e7496ed4c1e77d6bcc5dd
2018-10-03Fix ReplaceUninitializedStringPhis.Nicolas Geoffray
Move the analysis after redundant phi and dead phi elimination, knowing that only graphs with irreducible loops may still have a phi as input of the invoke. In such a case, we bail. bug: 112537407 Test: 563-checker-fake-string Change-Id: Ib9eefa4ce905b7fb418ca9b2a3c26ea4df74ce8f
2018-09-28Merge "Remove need for intrinsic recognizer to be a pass."Nicolas Geoffray
2018-09-28Remove need for intrinsic recognizer to be a pass.Nicolas Geoffray
Instead just recognize the intrinsic when creating an invoke instruction. Also remove some old code related to compiler driver sharpening. Test: test.py Change-Id: Iecb668f30e95034970fcf57160ca12092c9c610d
2018-09-24Fix some performance-unnecessary-value-param tidy and performance-for-range ↵Stephen Hines
warnings. art/profman/profile_assistant_test.cc:119:54: error: the const qualified parameter 'hot_methods' is copied for each invocation; consider making it a reference [performance-unnecessary-value-param,-warnings-as-errors] const std::vector<uint32_t> hot_methods, ^ & art/profman/profile_assistant_test.cc:120:54: error: the const qualified parameter 'startup_methods' is copied for each invocation; consider making it a reference [performance-unnecessary-value-param,-warnings-as-errors] const std::vector<uint32_t> startup_methods, ^ & art/profman/profile_assistant_test.cc:121:54: error: the const qualified parameter 'post_startup_methods' is copied for each invocation; consider making it a reference [performance-unnecessary-value-param,-warnings-as-errors] const std::vector<uint32_t> post_startup_methods, ^ & art/runtime/subtype_check_info_test.cc:134:56: error: the parameter 'sc' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param,-warnings-as-errors] static SubtypeCheckInfo CopyCleared(SubtypeCheckInfo sc) { ~~~~~~~~~~~~~~~~ ^ const & art/runtime/class_linker.cc:6451:62: error: the parameter 'to_process' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param,-warnings-as-errors] std::vector<ObjPtr<mirror::Class>> to_process) ~~~ ^ const & art/runtime/trace.cc:1127:13: error: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy,-warnings-as-errors] for (auto it : exited_threads_) { ~~~~ ^ const & art/runtime/oat_file_manager.cc:154:41: error: the parameter 'spaces' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param,-warnings-as-errors] std::vector<gc::space::ImageSpace*> spaces) { ~~~ ^ const & art/test/004-JniTest/jni_test.cc:707:72: error: the parameter 'methods' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param,-warnings-as-errors] void TestCalls(const char* declaring_class, std::vector<const char*> methods) { ~~~ ^ const & art/compiler/optimizing/optimizing_compiler.cc:1409:89: error: the parameter 'info' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param,-warnings-as-errors] void OptimizingCompiler::GenerateJitDebugInfo(ArtMethod* method, debug::MethodDebugInfo info) { ~~~~~ ^ const & Bug: http://b/32619234 Bug: http://b/110779387 Test: Build using WITH_TIDY=1 Change-Id: I911d838b8c26ddab3d6a64024f3220000f078cba
2018-09-20Pass JIT roots as a vector<Handle<>> to JIT cache.Vladimir Marko
This avoids creating an object on the heap and thus prevents issues for the 904-object-allocation in the JIT-at-first-use configuration. Test: run_build_test_target.py -j48 art-jit-on-first-use (test 904 passes; test 1935 still failing). Bug: 116189667 Change-Id: I58c0c8cb2d78edc63dab7d72e69b882abbfb79fd
2018-09-19Remove sharpening as an optimization pass.Nicolas Geoffray
Make the last sharpening helper (methods) like the other helpers: being invoked by the instruction builder. Test: test.py Change-Id: Ic80a454f9b59b0b4ef7825590b24402500ba851c
2018-09-07ART: Continue adding override annotationsAndreas Gampe
Use Clang-tidy's modernize-use-override to add more annotations. Ignore inferred annotations on destructors. Bug: 32619234 Test: mmma art Change-Id: Ic432c928e398d44df9171e42db04ee19946e6887
2018-08-28Use 'final' and 'override' specifiers directly in ART.Roland Levillain
Remove all uses of macros 'FINAL' and 'OVERRIDE' and replace them with 'final' and 'override' specifiers. Remove all definitions of these macros as well, which were located in these files: - libartbase/base/macros.h - test/913-heaps/heaps.cc - test/ti-agent/ti_macros.h ART is now using C++14; the 'final' and 'override' specifiers have been introduced in C++11. Test: mmma art Change-Id: I256c7758155a71a2940ef2574925a44076feeebf
2018-08-20Fix longstanding bug around implicit NPEs and GC, version 2.Nicolas Geoffray
The TODO has been there since M (so forever :)): https://android-review.googlesource.com/c/platform/art/+/122794/13//COMMIT_MSG#13 We hardly see the issue in our tests as we need to have: 1) A GC happening while creating the NPE object. 2) ParallelMoves between the NullCheck and implicit null check operation that moves references. The CL piggy backs on the "IsEmittedAtUseSite" flag, to set implicit null checks with it. The liveness analysis then special cases implicit null checks to record environment uses at the location of the actual instruction that will do the implicit null check. Test: test.py --gcstress Test: run-libcore-tests --gcstress bug: 111545159 Change-Id: I3ecea4fe0d7e483e93db83281ca10db47da228c5
2018-08-03Simplify StackMapStream encoding.David Srbecky
Test: test-art-host-gtest-stack_map_test Change-Id: Ife021d03e4e486043ec609f9af8673ace7bde497
2018-08-02Reuse arena memory for each block in scheduler.Vladimir Marko
This reduces the peak memory used for large methods with multiple blocks to schedule. Compiling the aosp_taimen-userdebug boot image, the most memory hungry method BatteryStats.dumpLocked has the Scheduler memory allocations in ArenaStack hidden by the register allocator: - before: MEM: used: 8300224, allocated: 9175040, lost: 197360 Scheduler 8300224 - after: MEM: used: 5914296, allocated: 7864320, lost: 78200 SsaLiveness 5532840 RegAllocator 144968 RegAllocVldt 236488 The total arena memory used, including the ArenaAllocator not listed above, goes from 44333648 to 41950324 (-5.4%). (Measured with kArenaAllocatorCountAllocations=true, kArenaAllocatorPreciseTracking=false.) Also remove one unnecessary -Wframe-larger-than= workaround and add one workaround for large frame with the above arena alloc tracking flags. Test: m test-art-host-gtest Test: testrunner.py --host Bug: 34053922 Change-Id: I7fd8d90dcc13b184b1e5bd0bcac072388710a129
2018-08-01Move MethodInfo to CodeInfo.David Srbecky
There is no need to treat it specially any more, because of the de-duplication at BitTable level. This saves 0.6% of oat file size. Test: test-art-host-gtest Change-Id: Ife7927d736243879a41d6f325d49ebf6930a63f6
2018-07-27Remove frame info from OatQuickMethodHeader.David Srbecky
The information has been moved to CodeInfo, where it is stored in much more compact way. The old CL which added the data to CodeInfo cost 0.7%. This CL saves 2.5% of .oat file size so a win overall. Test: test-art-host-gtest Change-Id: I07fcf6f2776c96218f995ba3b57a1e6ccbf5e317
2018-07-13Merge "Revert "Emit vector mulitply and accumulate instructions for x86.""Hans Boehm
2018-07-13Revert "Emit vector mulitply and accumulate instructions for x86."Hans Boehm
This reverts commit 61908880e6565acfadbafe93fa64de000014f1a6. Reason for revert: By failing to round multiply results, it does not follow Java rounding rules. Change-Id: Ic0ef08691bef266c9f8d91973e596e09ff3307c6
2018-07-05Revert^2 "Add CodeInfo to JNI methods."David Srbecky
It has no stack maps. We only store the frame info there. As a consequence of having CodeInfo, the JNI methods are now classified as IsOptimized(). This does not have any real effect on .oat file size. This reverts commit 564fa8a1f3e3c39793c9b146ed5f21650617dc3f. Test: test-art-host-gtest Test: test-art-target-gtest-jni_compiler_test32 Change-Id: Ic7a1949027d89ba97cfedfc8ea453f041193b6a7
2018-07-05Revert "Add CodeInfo to JNI methods."David Srbecky
This reverts commit 85f3934f364e1674bfd2a6813274918576acdf60. Reason for revert: breaks gtests on target Change-Id: I9f97fe4e7557027677824974568120f658bbd53a
2018-07-04Add CodeInfo to JNI methods.David Srbecky
It has no stack maps. We only store the frame info there. As a consequence of having CodeInfo, the JNI methods are now classified as IsOptimized(). This does not have any real effect on .oat file size. Test: test-art-host-gtest Change-Id: I8d03a3af347dc7239719bb3c39ecf84c6eaece80
2018-07-04Merge "Handle String.<init> with a phi input."Nicolas Geoffray
2018-07-03Handle String.<init> with a phi input.Nicolas Geoffray
We wrongly assumed only irreducible loops could lead to this situation, but any loop can actually be in between a String NewInstance and a String.<init>. bug: 109666561 Test: 563-checker-fakestring Change-Id: I018a22f7e22c15e140252544415f51d544f7cc13
2018-07-02Emit vector mulitply and accumulate instructions for x86.Gupta Kumar, Sanjiv
This patch adds a new cpu vaiant named kabylake and performs instruction simplification to generate VectorMulitplyAccumulate. Test: ./test.py --host --64 Change-Id: Ie6cc882dadf1322dd4d3ae49bfdb600b0c447765 Signed-off-by: Gupta Kumar, Sanjiv <sanjiv.kumar.gupta@intel.com>
2018-06-25Move instruction_set_ to CompilerOptions.Vladimir Marko
Removes CompilerDriver dependency from ImageWriter and several other classes. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: Pixel 2 XL boots. Test: m test-art-target-gtest Test: testrunner.py --target --optimizing Change-Id: I3c5b8ff73732128b9c4fad9405231a216ea72465
2018-05-25Refactor ClassRoot/GetClassRoot().Vladimir Marko
Move it outside the ClassLinker, into its own header file, and add retrieval based on a mirror class template argument. Keep the SetClassRoot() as a private member of ClassLinker. Make the new GetClassRoot()s return ObjPtr<>. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 31113334 Change-Id: Icbc6b62b41f6ffd65b437297a21eadbb0454e2b7
2018-05-08ART: Add --dump-pass-timings compiler option.Vladimir Marko
This replaces the old --dump-passes option removed in https://android-review.googlesource.com/549200 . Using --dump-timing for timing optimization passes makes the high level timings useless, so return to using two different options for these. Test: Manually run dex2oat with --dump-timings, --dump-pass-timings and both. Change-Id: Iddc4cfee35652fb493656e7d6081a898c2894f72
2018-05-03Perform rudimentary check on graph size for no-change assertions.Aart Bik
Rationale: This will find blatant violations of asserting a no-change pass change if the graph size changed nevertheless. Bug: 78171933 Test: test-art-host,target Change-Id: I07b38e71c75dd6f728246d096976c8333b363329
2018-04-30Step 2 of 2: conditional passes.Aart Bik
Rationale: The change introduces actual conditional passes (dependence on inliner). This ensures more cases are optimized downstream without needlessly introducing compile-time. NOTE: Some checker tests needed to be rewritten due to subtle changes in the phase ordering. No optimizations were harmed in the process, though. Bug: b/78171933, b/74026074 Test: test-art-host,target Change-Id: I335260df780e14ba1f22499ad74d79060c7be44d
2018-04-26Step 1 of 2: conditional passes.Aart Bik
Rationale: The change adds a return value to Run() in preparation of conditional pass execution. The value returned by Run() is best effort, returning false means no optimizations were applied or no useful information was obtained. I filled in a few cases with more exact information, others still just return true. In addition, it integrates inlining as a regular pass, avoiding the ugly "break" into optimizations1 and optimziations2. Bug: b/78171933, b/74026074 Test: test-art-host,target Change-Id: Ia39c5c83c01dcd79841e4b623917d61c754cf075
2018-04-17Run GVN earlier.Aart Bik
Rationale: Running GVN earlier allows for better subsequent instruction simplifation. For example, running GVN before select generation also finds the MIN in: if (x > a[i]) x = a[i]; Bug: b/74026074 Test: test-art-host,target Change-Id: I633046375637c7809a3603fdf7c5cf77e8f21167
2018-04-11Revert^2 "Compile link-time thunks in codegen."Vladimir Marko
The linker crash (the reason for revert) is flaky and maybe we shall not see it with this CL now that unrelated source code has changed. Test: Rely on TreeHugger Bug: 36141117 Bug: 77581732 This reverts commit 5806a9ec99b5494b511e84c74f494f0b3a8ebec5. Change-Id: I3a4a058847dff601681ba391abf45833424fa06d
2018-04-04Revert "Compile link-time thunks in codegen."Vladimir Marko
Reason for revert: This caused clang linker crash in several branches. Bug: 77581732 This reverts commit c9dd2207dfdab42586b1d6a5e7f11cf2fcea3a7a. Change-Id: I1923809083cf41c4f19e3e60df03ae80517aaedb
2018-04-04Compile link-time thunks in codegen.Vladimir Marko
Prepare for experimenting with Baker read barrier marking introspection entrypoints for JIT. Test: m test-art-host-gtest Test: Compare compiled boot*.oat before and after (no diff). Test: Pixel 2 XL boots. Bug: 36141117 Change-Id: Idb413a31b158db4bf89a8707ea46dd167a06f110