summaryrefslogtreecommitdiff
path: root/compiler/driver/compiler_driver.h
AgeCommit message (Collapse)Author
2019-03-11Move CompilerDriver to dex2oat/. Vladimir Marko
Also DexToDexCompiler, QuickCompilerCallbacks and tests. aosp_taimen-userdebug: - before: lib64/libart-compiler.so: 3112344 lib/libart-compiler.so: 2312908 bin/dex2oat: 563176 - after: lib64/libart-compiler.so: 2986720 (-123KiB) lib/libart-compiler.so: 2219852 (-91KiB) bin/dex2oat: 635832 (+71KiB) Test: m test-art-host-gtest Test: testrunner.py --host --optimizing --jit Change-Id: I36e63b83dff1d5c731d05de27d3663cfc81de6ad
2019-03-05Refactor compiler tests around CompilerDriver. Vladimir Marko
Introduce CommonCompilerDriverTest and inherit that in tests that need to use CompilerDriver. This is in preparation for moving the CompilerDriver to dex2oat/. Test: m test-art-host-gtest Change-Id: I46cf0bc1df4327569eef5526eeab0781473173a1
2019-02-20ART: Reduce dependencies on CompilerDriver. Vladimir Marko
Preparation for moving CompilerDriver and other stuff from libart-compiler.so to dex2oat. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: Ic221ebca4b8c79dd1549316921ace655f2e3f0fe
2019-01-02ART: Move dex structs into own header Andreas 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-27Add dumping for number of classes initialized Mathieu Chartier
For --dump-stats, dump how many classes are each status after attempting initialization. Test: <compile_apk> --instruction-set=arm64 --app-image-file=generated.art --dump-stats Sample output: dex2oat I 12-21 19:18:56 58439 58439 compiler_driver.cc:109] 100% of instance fields resolved for 1575 cases dex2oat I 12-21 19:18:56 58439 58439 compiler_driver.cc:109] 1.88679% of check-casts removed based on type information for 53 cases dex2oat I 12-21 19:18:56 58439 58439 compiler_driver.cc:109] 0% of classes with status NotReady for 32155 cases dex2oat I 12-21 19:18:56 58439 58439 compiler_driver.cc:109] 0% of classes with status Retired for 32155 cases dex2oat I 12-21 19:18:56 58439 58439 compiler_driver.cc:109] 0% of classes with status ErrorResolved for 32155 cases dex2oat I 12-21 19:18:56 58439 58439 compiler_driver.cc:109] 0% of classes with status ErrorUnresolved for 32155 cases dex2oat I 12-21 19:18:56 58439 58439 compiler_driver.cc:109] 0% of classes with status Idx for 32155 cases dex2oat I 12-21 19:18:56 58439 58439 compiler_driver.cc:109] 0% of classes with status Loaded for 32155 cases dex2oat I 12-21 19:18:56 58439 58439 compiler_driver.cc:109] 0% of classes with status Resolving for 32155 cases dex2oat I 12-21 19:18:56 58439 58439 compiler_driver.cc:109] 0% of classes with status Resolved for 32155 cases dex2oat I 12-21 19:18:56 58439 58439 compiler_driver.cc:109] 0% of classes with status Verifying for 32155 cases dex2oat I 12-21 19:18:56 58439 58439 compiler_driver.cc:109] 0.0186596% of classes with status RetryVerificationAtRuntime for 32155 cases dex2oat I 12-21 19:18:56 58439 58439 compiler_driver.cc:109] 0% of classes with status VerifyingAtRuntime for 32155 cases dex2oat I 12-21 19:18:56 58439 58439 compiler_driver.cc:109] 28.1916% of classes with status Verified for 32155 cases dex2oat I 12-21 19:18:56 58439 58439 compiler_driver.cc:109] 0% of classes with status SuperclassValidated for 32155 cases dex2oat I 12-21 19:18:56 58439 58439 compiler_driver.cc:109] 0% of classes with status Initializing for 32155 cases dex2oat I 12-21 19:18:56 58439 58439 compiler_driver.cc:109] 71.7898% of classes with status Initialized for 32155 cases Bug: 70735003 Test: test-art-host Change-Id: I57e8a977ee202c0ce85030208caa183344a5567a
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-11-08Delete IsClassToCompile Mathieu Chartier
Compiled classes filtering is no longer a thing. Bug: 26687569 Bug: 76145463 Test: test-art-host Change-Id: Iaf4b9dcea5d9fe1eae564fbd6d373af2fdc87b14
2018-11-08Merge "Move profile compilation info to CompilerOptions." Vladimir Marko
2018-11-08Move profile compilation info to CompilerOptions. Vladimir Marko
Remove one HInliner dependency on the CompilerDriver. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: If6f0ab864095641b5697c8c6f5100520f91d5e53
2018-11-07ART: Small compiler-driver cleanup Andreas Gampe
Remove some unused or unimplemented methods and typedefs. Move some code. Bug: 115837065 Test: mmma art Change-Id: I96070444007d4f67b14bb563c1b7252a5a012523
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-10-16Add logic to eagerly resolve const-string for startup methods Mathieu Chartier
Added dex2oat option --resolve-startup-const-strings=<true|false> If true, this option causes the compiler driver to resolve all const-strings that are referenced from methods marked as "startup" in the profile. Bug: 116059983 Test: test-art-host Change-Id: I61cf9e945c125671fc4ab4b50458a911318a837f
2018-07-16Always produce PIC code for AOT compilation. Vladimir Marko
Change sharpening to use PIC load kinds for AOT compilation and add "Jit" to the direct addressing load kind names. Use PIC code also for the Integer.valueOf() intrinsic codegen. Remove all support for non-PIC linker patches. The dex2oat --compile-pic option is retained for now but ignored by the compiler. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: Pixel 2 XL boots. Test: testrunner.py --target --optimizing Bug: 77856493 Change-Id: I54d666f6522f160a1b6ece4045a15d19363acbb6
2018-07-12Fix HClinitCheck elimination in instruction builder. Vladimir Marko
To handle escaping instances of erroneous classes correctly, we can omit the HClinitCheck only when using a class in the static method of the very same class. Even for superclasses we need to do the check. The new test exposes the cases where we were previously diverging from the RI. Also clean up the CompilerDriver by inlining one function directly to the HInstructionBuild::IsInitialized(.) and removing some related functions that are no longer used. The size of the aosp_taimen-userdebug prebuilts: - before: arm/boot*.oat: 16891788 arm64/boot*.oat: 19815520 oat/arm64/services.odex: 20071624 - after: arm/boot*.oat: 16949532 (+56.4KiB, +0.34%) arm64/boot*.oat: 19889752 (+72.5KiB, +0.37%) oat/arm64/services.odex: 20224328 (+149.1KiB, +0.76%) with minor changes to other app prebuilts. Note: Some of that could be reclaimed by reinstating the old optimization for classes where no bytecode can be executed during initialization (no <clinit> to execute in that class or superclasses). Test: 174-escaping-instance-of-bad-class Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: testrunner.py --jvm -t 174 Test: Pixel 2 XL boots. Test: testrunner.py --target --optimizing Bug: 62478025 Change-Id: I41f026ea7fecc615c06e87f3b6cb847de0ede8a6
2018-06-28Remove CompilerDriver::support_boot_image_fixup_. Vladimir Marko
Check for non-PIC boot image as a testing config instead. Honor the config for HInvokeStaticOrDirect sharpening. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: I3645f4fefe322f1fd64ea88a2b41a35ceccea688
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-06-25Move dex_files_for_oat_file_ to CompilerOptions. Vladimir Marko
A step toward removing the CompilerDriver dependency from several classes, including HSharpening and ImageWriter. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: I364ef66511fdf855cb11b12c818a40572b037727
2018-06-25Move image_classes_ to CompilerOptions. Vladimir Marko
Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: Ifb30e071d7b39ae939fc3f83d7eba82fd077c7e8
2018-06-21Use HashSet<std::string> instead of unordered_set<>. Vladimir Marko
Change the default parameters for HashSet<std::string> to allow passing StringPiece as a key, avoiding an unnecessary allocation. Use the HashSet<std::string> instead of std::unordered_set<std::string>. Rename HashSet<> functions that mirror std::unordered_multiset<> to lower-case. Fix CompilerDriver::LoadImageClasses() to avoid using invalidated iterator. Test: m test-art-host-gtest Test: testrunner.py --host Change-Id: I7f8b82ee0b07befc5a0ee1c420b08a2068ad931e
2018-04-13ART: Remove support for compiled-methods and compiled-classes Andreas Gampe
This has been superseded by profile support. This reverts commit 70bef0d8f6aa30b0da5c6ca56e1bc5729f74654b. This reverts commit 4bf3ae9930a155f238dfd471413c866912b2579e. Bug: 76145463 Test: mmma art Test: m test-art-host Change-Id: I5a368cd01812e16869352ec219eae095df4919c4
2018-04-12ART: Fix core image detection Andreas Gampe
Accept any .art name starting with "core-." Correctly detects images with multiple dashes. Bug: 64382372 Test: mmma art Test: art/test/testrunner/testrunner.py -b --host Test: Device boots Change-Id: I6c8006411b0ec16225b137dd349d53d9bc0ac03d
2018-03-19Merge "Move some remaining dex utilities" Treehugger Robot
2018-03-19Move some remaining dex utilities David Sehr
There were several utilities related to building/walking/testing dex files that were not in libdexfile. This change consolidates these. Bug: 22322814 Test: make -j 50 test-art-host Change-Id: Id76e9179d03b8ec7d67f7e0f267121f54f0ec2e0
2018-03-19Fix running some run-tests with -Xjitthreshold:0 Vladimir Marko
Do not JIT non-compilable methods. Honor the $noinline$ directive for JIT and fix core image recognition. Make sure the 597-deopt-invoke-stub that actually relies on its own -Xjitthreshold: overrides the threshold we pass, work around already running compiled code in 570-checker-osr (and drop obsolete "doThrow" pattern replaced by $noinline$) and add a few necessary $noinline$ directives. Test: for t in \ 461-get-reference-vreg \ 536-checker-needs-access-check \ 570-checker-osr \ 597-deopt-invoke-stub \ 655-jit-clinit \ ; do \ art/test/run-test --host --jit $t \ --runtime-option -Xjitthreshold:0; \ done Test: testrunner.py --host --jit Bug: 62611253 Change-Id: Ia0a05c93e3fc8d913fe8556d3d7f23e7e61076c2
2018-03-05Move most of runtime/base to libartbase/base David Sehr
Enforce the layering that code in runtime/base should not depend on runtime by separating it into libartbase. Some of the code in runtime/base depends on the Runtime class, so it cannot be moved yet. Also, some of the tests depend on CommonRuntimeTest, which itself needs to be factored (in a subsequent CL). Bug: 22322814 Test: make -j 50 checkbuild make -j 50 test-art-host Change-Id: I8b096c1e2542f829eb456b4b057c71421b77d7e2
2018-02-28Header library to remove dependence on runtime/ David Sehr
Add a new header library to remove libdexfile and others' dependence on runtime (typically runtime/base) includes in libdexfile. Also a small step to tease dexlayout and profman away from relying on these as well. Bug: 22322814 Test: make -j 50 checkbuild make -j 50 test-art-host-gtest Change-Id: I38e2fe399a75f4bc6318c77a71954c00ea73ec2b
2018-02-05Enable code item deduping Mathieu Chartier
Dedupe code items if they have the same contents, this is safe because of the fixed quickening logic. Removed duplicate code items in ManyMethods that caused the startup methods section to be empty in dex2oat_test. To avoid errors related to quickening and compilation of shared code items, quickening is currently disabled for shared code items. Bug: 63756964 Test: test-art-host Change-Id: I7c62eb746785d787c5269effd396f7be4859d3a6
2018-02-05Merge "ART: Refactor dex2dex compilation" Treehugger Robot
2018-01-25Revert "Compiler changes for bitstring based type checks." Nicolas Geoffray
Bug: 64692057 Bug: 71853552 Bug: 26687569 This reverts commit eb0ebed72432b3c6b8c7b38f8937d7ba736f4567. Change-Id: I7daeaa077960ba41b2ed42bc47f17501621be4be
2018-01-25Merge "Revert "ART: Use the bitstring type check for AOT app compilation."" Treehugger Robot
2018-01-25Revert "ART: Use the bitstring type check for AOT app compilation." Nicolas Geoffray
Test failures: http://build.chromium.org/p/client.art/builders/fugu-debug/builds/4875 01-25 02:05:28.357 23732 23732 F /data/local/tmp/system/bin/../bin/dalvikvm: quick_throw_entrypoints.cc:132] Check failed: !dest_type->IsAssignableFrom(src_type) This reverts commit 718e8319c728e9ee2ec15b1d56ca96baa4393028. Change-Id: I022f88cd81ae99143e5670ae29eae326ecc83cc2
2018-01-24Merge "ART: Use the bitstring type check for AOT app compilation." Mingyao Yang
2018-01-24Merge "Revert "Revert "Don't embed the dex code in the oat file if dex is ↵ Nicolas Geoffray
uncompressed."""
2018-01-23ART: Use the bitstring type check for AOT app compilation. Vladimir Marko
For boot image target classes that have their bitstring already assigned in the boot image. The size of the services.odex for aosp_taimen-userdebug: - before: - arm64: 20988640 - after: - arm64: 20968016 (-20KiB, -0.1%) (There is no arm version, only arm64.) Test: New test case in 552-checker-sharpening. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: Pixel 2 XL boots. Test: testrunner.py --target --optimizing Bug: 64692057 Change-Id: I9585efca8ba0df15400e7536e5e2cc76aca13e8d
2018-01-23Merge "Compiler changes for bitstring based type checks." Vladimir Marko
2018-01-23Revert "Revert "Don't embed the dex code in the oat file if dex is ↵ Nicolas Geoffray
uncompressed."" Bug: 63920015 Bug: 70854754 Test: oat_writer_test.cc, test.py Revert was due to userdebug/user differences, which is fixed with: https://googleplex-android-review.googlesource.com/#/c/platform/build/+/3434091/ This CL also fixes oatdump when the dex code is not in the .vdex file. This reverts commit e166e67666bf4b23e4ed0a98f5e2bb3cae9cee7d. Change-Id: Iec924be2ff8f03cf2ebe306e7a0018241f33beb0
2018-01-23Compiler changes for bitstring based type checks. Vladimir Marko
We guard the use of this feature with a compile-time flag, set to true in this CL. Boot image size for aosp_taimen-userdebug in AOSP master: - before: arm boot*.oat: 63604740 arm64 boot*.oat: 74237864 - after: arm boot*.oat: 63531172 (-72KiB, -0.1%) arm64 boot*.oat: 74135008 (-100KiB, -0.1%) The new TypeCheckBenchmark yields the following changes using the little cores of taimen fixed at 1.4016GHz: 32-bit 64-bit timeCheckCastLevel1ToLevel1 11.48->15.80 11.47->15.78 timeCheckCastLevel2ToLevel1 15.08->15.79 15.08->15.79 timeCheckCastLevel3ToLevel1 19.01->15.82 17.94->15.81 timeCheckCastLevel9ToLevel1 42.55->15.79 42.63->15.81 timeCheckCastLevel9ToLevel2 39.70->14.36 39.70->14.35 timeInstanceOfLevel1ToLevel1 13.74->17.93 13.76->17.95 timeInstanceOfLevel2ToLevel1 17.02->17.95 16.99->17.93 timeInstanceOfLevel3ToLevel1 24.03->17.95 24.45->17.95 timeInstanceOfLevel9ToLevel1 47.13->17.95 47.14->18.00 timeInstanceOfLevel9ToLevel2 44.19->16.52 44.27->16.51 This suggests that the bitstring typecheck should not be used for exact type checks which would be equivalent to the "Level1ToLevel1" benchmark. Whether the implementation is a beneficial replacement for the kClassHierarchyCheck and kAbstractClassCheck on average depends on how many levels from the target class (or Object for a negative result) is a typical object's class. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing --jit Test: testrunner.py --host -t 670-bitstring-type-check Test: Pixel 2 XL boots. Test: testrunner.py --target --optimizing --jit Test: testrunner.py --target -t 670-bitstring-type-check Bug: 64692057 Bug: 71853552 Bug: 26687569 Change-Id: I538d7e036b5a8ae2cc3fe77662a5903d74854562
2018-01-22ART: Refactor profile_compilation_info.h includes Andreas Gampe
Use forward declarations. Test: m Change-Id: Ife25be9e2eb5ba9224f082aaa935f821a3597963
2018-01-22ART: Refactor dex2dex compilation Andreas Gampe
Refactor the code to tease out the dex2dex compilation flow. Use templatized functions for common code. Bug: 29089975 Test: m test-art-host Change-Id: Ib31d491ed4676ae4cee9132ceb613a372fb06479
2018-01-22Fix quickening logic Mathieu Chartier
Fix varius bugs in the quickening logic where related to shared code items for different methods. Fixed the case where two methods quicken differently on the same code item by checking that the quicken info is the same for all methods that quicken the same code item. This is accomplished by requickening and reverifying the contents of the quicken info. Fixed the case where the dex to dex compiler would abort from a DCHECK that there was no already quickened instructions. Feature is tested by enabling deduping (aog/594315). Test: test-art-host Bug: 63756964 Change-Id: I52c2b89518f4e808594b450a5fcc373ab5a5863b
2018-01-05Create dex subdirectory David Sehr
Move all the DexFile related source to a common subdirectory dex/ of runtime. Bug: 71361973 Test: make -j 50 test-art-host Change-Id: I59e984ed660b93e0776556308be3d653722f5223
2018-01-05Change ClassStatus to fit into 4 bits. Vladimir Marko
In preparation for extending the type check bit string from 24 to 28 bits, rewrite ClassStatus to fit into 4 bits. Also perform a proper cleanup of the ClassStatus, i.e. change it to an enum class, remove the "Status" word from enumerator names, replace "Max" with "Last" in line with other enumerations and remove aliases from mirror::Class. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: Pixel 2 XL boots. Test: testrunner.py --target --optimizing Bug: 64692057 Bug: 65318848 Change-Id: Iec1610ba5dac2c527b36c12819f132e1a77f2d45
2017-12-19Merge "Revert "Don't embed the dex code in the oat file if dex is ↵ Treehugger Robot
uncompressed.""
2017-12-19Revert "Don't embed the dex code in the oat file if dex is uncompressed." Andreas Gampe
This reverts commit ae7e83817e546848ef6b2949dd9065b153e14316. Reason for revert: Broken wrt/ preopted apps and stripping Bug: 63920015 Bug: 70777774 Change-Id: I39580684d46fa57bd780d2d8bedd65a47d58cf5e Test: m
2017-12-15Merge "Don't embed the dex code in the oat file if dex is uncompressed." Nicolas Geoffray
2017-12-13Don't embed the dex code in the oat file if dex is uncompressed. Nicolas Geoffray
Take uncompressed dex code as a signal that the app wants to opt into b/63920015. bug: 63920015 Test: dex2oat_test, 071-dexfile-clean-map Change-Id: I878e7bb80fc895a2d9aafe81aa7666b86af1f808
2017-12-12Do not pass DexFile to ClassLinker::Lookup/ResolveType(). Vladimir Marko
The DexFile can be easily retrieved from the DexCache, so reduce the number of arguments that need to be passed. Also refactor the code to avoid doing the DexCache lookup twice and avoid unnecessary read barriers in the initial DexCache lookup (also for Lookup/ResolveField()). Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: Idea9aa42b6a5bade947e93e330b1abdb9d11b2da
2017-12-08Do not pass DexFile to ClassLinker::ResolveField*(). Vladimir Marko
The DexFile can be easily retrieved from the DexCache, so reduce the number of arguments that need to be passed. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: I0579db64c63afea789c7c9ad8db81e37c9248e97
2017-12-08Determine HLoadClass/String load kind early. Vladimir Marko
This helps save memory by avoiding the allocation of HEnvironment and related objects for AOT references to boot image strings and classes (kBootImage* load kinds) and also for JIT references (kJitTableAddress). Compiling aosp_taimen-userdebug boot image, the most memory hungry method BatteryStats.dumpLocked() needs - before: Used 55105384 bytes of arena memory... ... UseListNode 10009704 Environment 423248 EnvVRegs 20676560 ... - after: Used 50559176 bytes of arena memory... ... UseListNode 8568936 Environment 365680 EnvVRegs 17628704 ... Test: m test-art-host-gtest Test: testrunner.py --host --optimizing --jit Bug: 34053922 Change-Id: I68e73a438e6ac8e8908e6fccf53bbeea8a64a077
2017-11-28Clean some dex2oat options. Nicolas Geoffray
Remove dump-passes inherited from Quick days, and move dump-timings and dump-stats to CompilerStats. Test: test.py Change-Id: Ie79be858a141e59dc0b2a87d8cb5a5248a5bc7af