summaryrefslogtreecommitdiff
path: root/compiler/common_compiler_test.cc
AgeCommit message (Collapse)Author
2021-03-09Move code size from OatQuickMethodHeader to CodeInfo.David Srbecky
This saves 0.5% of oat file size. (0.8% saving from this CL minus 0.3% due to go/aog/1614482) Bug: 123510633 Test: m dump-oat Test: m test-art-host-gtest Test: ./art/test.py -b -r --host Change-Id: I035b54a47b300a5808aa8c2992f87eae009fd245
2021-02-05Use memfd_create_compat() in gtests.Vladimir Marko
The memfd_create() call fails on fugu. Test: Rely on TH. Bug: 177816575 Change-Id: I013742aba0c9b41aaf5aa333ddc635fe0ad58e02
2021-02-03Use mmap for compiled code for gtest.Vladimir Marko
Avoid executing code in memory allocated with malloc() as pointers to that memory can be tagged which interferes with managed stack walk. Test: m test-art-host-gtest. Bug: 177816575 Change-Id: Id376091f82d5686adf3ab18d2980a42e78de57ce
2021-02-01Remove HWASan tag from method entrypoint in tests.Vladimir Marko
Test: run-gtests.sh Bug: 177816575 Change-Id: If76f186d69ac9311a81e025960c13d9b99be6e56
2020-12-10Make RTP::Visit robust against input orderAlex Light
ReferenceTypePropogation::Visit(ArrayRef) relied on the input having a particular order with known values at the front then topological. This could cause issues if the list was not properly sorted, causing the RTP to silently fail. This makes RTP robust against the ordering of inputs for this function. Test: ./test.py --host Bug: 67037140 Change-Id: I03c522ea745f271ce438c82f7c6f3ab476c8249a
2020-05-20HWASan fixes for ART testsDavid Srbecky
Bug: 156593692 Test: SANITIZE_TARGET=hwaddress art/tools/run-gtests.sh Test: SANITIZE_TARGET=hwaddress art/test.py -r --target --64 Change-Id: I24c5afdb4fed5ac94ce3a7b54a10c592f529191f
2020-05-15Optimizing: Run gtests without creating the Runtime.Vladimir Marko
The only Optimizing test that actually needs a Runtime is the ReferenceTypePropagationTest, so we make it subclass CommonCompilerTest explicitly and change OptimizingUnitTest to subclass CommonArtTest for the other tests. On host, each test that initializes the Runtime takes ~220ms more than without initializing the Runtime. For example, the ConstantFoldingTest that has 10 individual tests previously took over 2.2s to run but without the Runtime initialization it takes around 3-5ms. On target, running 32-bit gtests on taimen with run-gtests.sh (single-threaded) goes from ~28m47s to ~26m13s, a reduction of ~9%. Test: m test-art-host-gtest Test: run-gtests.sh Change-Id: I43e50ed58e52cc0ad04cdb4d39801bfbae840a3d
2019-06-26Retry cache flushes on ARMv7 devicesOrion Hodson
On ARMv7, CPU cache flushing requires a system call. This system call can fail and return an error. This change moves to using the system call directly (cacheflush) so flush failures can be detected and flushing can be re-attempted. For other platforms we continue using __builtin___clear_cache which is an intrinsic with a void return type. The strategy for ARMv7 is to attempt to flush the entire range required. If this fails (a rare occurance), we visit the pages in the flush range sequentially, first reading a byte from the page to maximize it's chance of being resident and then flushing the cache lines. We repeat this up to 4 times per page if there are failures. As a final fallback, when neither approach to flushing the JIT code cache pages succeeds, the code is not committed to the JIT code cache as the cache lines for the new code are in an unknown state. This complexity is necessary for the dual view JIT because the executable range is not writable so the kernel logic does not (appear to) anticipate the need to flush (or invalidate) cache lines there. Previously the failing cache flush operations went undetected and result in bad i-cache state and cause crashes. These issues have only been reported on devices with 32-bit kernels. Bug: 132205399 Test: art/test.py --host --jit -j32 Test: Manual (described in bug) Change-Id: I63b56beaac610ea973def0a57118be9a2647da23
2019-03-06Fix memory leak in CommonCompilerTest::CompileMethod().Vladimir Marko
And enforce that we successfully compile the method. This fixes ASAN tests broken by https://android-review.googlesource.com/919053 Test: run_build_test_target.py art-gtest-heap-poisoning Change-Id: I98b6c11e097bd9aea6605f3b77b1bcbb2206dbd0
2019-03-05Revert "Remove code size from OatQuickMethodHeader"Nicolas Geoffray
This reverts commit 131f23a4c2c34b689c07e6efd05cea74190f0113. Bug: 123510633 Bug: 127305289 Reason for revert: b/127305289 Change-Id: I59905779fe8c7d7551c0fa6c8693fb64eb6760b2
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-14Remove code size from OatQuickMethodHeaderDavid Srbecky
This saves from 0.75% from oat file size. Bug: 123510633 Change-Id: Ibf0d45d5d84057ee45a3584a4b69a7c0487443bf
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-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-15Rewrite image type in CompilerOptions.Vladimir Marko
Prepare for introduction of boot image extension. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: Pixel 2 XL boots. Change-Id: Id007c4aeb4ada84fe65c1148fdf67e8a412e5b74
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-10-30Refactor MemMap::MapAnonymous().Vladimir Marko
Remove the address argument from the shortcut overload and introduce one more shortcut overload. This makes it easier to find all uses where we pass non-null address hint. Remove `requested_begin` parameter from some constructors where we were always passing null. Rewrite some tests to use the reservation API. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 118408378 Change-Id: Ibbbb96667e7cc11cf7fea119892463d8dbc9a8b5
2018-09-07ART: Simplify cache flush callsOrion Hodson
Remove need to cast to char* for Flush{Data,Instruction}Cache. Test: Treehugger Change-Id: I880c327d59624a04bc2a44a741bc40756a0fd3eb
2018-08-24Add an overload for MemMap::MapAnonymous().Vladimir Marko
Add an overload that does not take `reuse` or `use_ashmem` parameters but uses default values (`reuse = false` and `use_ashmem = true`) to simplify callers. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: Iaa44f770dee7e043c3a1d6867dfb0416dec83b25
2018-08-21Remove unnecessary indirection from MemMap.Vladimir Marko
Avoid plain MemMap pointers being passed around by changing the MemMap to moveable and return MemMap objects by value. Previously we could have a valid zero-size MemMap but this is now forbidden. MemMap::RemapAtEnd() is changed to avoid the explicit call to munmap(); mmap() with MAP_FIXED automatically removes old mappings for overlapping regions. 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: I12bd453c26a396edc20eb141bfd4dad20923f170
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-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-06-20ART: Ensure OatQuickMethodHeader is trivially copyableAndreas Gampe
Remove empty constructor. Test: mmma art Change-Id: Ie58721299a6675797e9a525f4eb7e6df82abed50
2018-05-23ObjPtr<>-ify tests using ClassLinker::FindClass().Vladimir Marko
ClassLinker::FindClass() returns a non-ObjPtr<> reference but it has a lot of uses, so we shall change the uses in a few steps. This change deals with several tests. Test: Rely on TreeHugger. Bug: 31113334 Change-Id: Ib75e20e7ebaff01fb607a09f96675f8cf397ae52
2018-04-13ART: Remove support for compiled-methods and compiled-classesAndreas 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-03-05Move most of runtime/base to libartbase/baseDavid 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-21Remove duplication, split testsDavid Sehr
The code move to libdexfile/dex/descriptors_names.cc apparently did not remove the original code from runtime/utils.cc. Fix that duplication and all the header mentions needed. Also, split the test files to go along with the new locations for the code to be tested. Bug: 22322814 Test: make -j 50 checkbuild make -j 50 test-art-host-gtest flash & boot marlin Change-Id: Ie734672c4bca2c647d8016291f910b5608674545
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
2017-09-20Refactor compiled_method.h .Vladimir Marko
Move LinkerPatch to compiler/linker/linker_patch.h . Move SrcMapElem to compiler/debug/src_map_elem.h . Introduce compiled_method-inl.h to reduce the number of `#include`s in compiled_method.h . Test: m test-art-host-gtest Test: testrunner.py --host Change-Id: Id211cdf94a63ad265bf4709f1a5e06dffbe30f64
2017-07-27Remove ClassLinker::SetEntryPointsToCompiledCode().Vladimir Marko
This function was used only for tests and it was essentially just calling ArtMethod::SetEntryPointFromQuickCompiledCode() in a very obscure way and required the memory before the code pointer to contain a non-zero code size. This is a follow-up to https://android-review.googlesource.com/445648 that removed a problematic use of the function, calling it with a pointer to an entrypoint instead of a pointer to compiled managed code, i.e. without the pre-header that should contain the non-zero code size. Test: m test-art-host-gtest Change-Id: I483450832443ea0589eb41c74491384bcd5d6ab8
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-20Merge "Move IsVeryLarge check before we create verification results"Mathieu Chartier
2017-07-20Move IsVeryLarge check before we create verification resultsMathieu Chartier
Otherwise we can end up creating verification results when they are not actually needed (if the compiler filter was >= quicken). Bug: 63467744 Test: test-art-host Change-Id: Ied2a12e0e4c2010f3f660e278c3a5111545ba251
2017-07-20ART: Change method lookup to be more consistent to JLS and the RI.Vladimir Marko
The method lookup for different invoke types was previously widely different and didn't work well with the dex cache method array where we have only a single slot for each MethodId. The new behavior is to perform the same lookup for all cases, distinguishing only between interface and non-interface referencing class, and to further align the behavior with the JLS and the RI. Where the JLS conflicts with the RI, we follow the JLS semantics. The new lookup for class methods first searches the methods declared in the superclass chain (ignoring "copied" methods) and only then looks in the "copied" methods. If the search in the superclass chain finds a method that has not been inherited (i.e. either a private method or a package-access method where one of the classes in the chain does not belong to the same package, see JLS 8.4.8), we still search the "copied" methods as there may actually be a method inherited from an interface. This follows the JLS semantics where inherited methods are included in the search (JLS 15.12.2.1) but conflicts with the RI where the private or package-access method takes precedence over methods inherited from interfaces. Note that this search can find an accessible method that is not inherited by the qualifying type, either for a package access method when the referrer is in the same package but the qualifying type is in another package, or for a private method where the referrer is in the same class but the qualifying type is actually a subclass. For the moment we allow such calls and we shall consider whether to throw an IncompatibleClassChangeError in this situation in future to comply with JLS 15.12.4.3. The new lookup for interface methods searches the interface class, then all the superinterfaces and then the java.lang.Object class, see implicitly declared methods in interfaces, JLS 9.2. The search for the maximally-specific non-abstract superinterface method is not yet implemented, but the difference should be difficult to observe as the usual subsequent call to FindVirtualMethodForInterface() should yield the same result for any matching method. The new test 162-method-idx-clash exposes several cases where we previously completely messed up due to the effects of the DexCache, or where we were out of line with the RI. It also tests a case where the JLS and the RI disagree and we follow the JLS. Test: art/test/run-test --host --jvm 162-method-resolution Test: m test-art-host-gtest Test: testrunner.py --host Test: testrunner.py --host --interp-ac Test: Nexus 6P boots. Test: testrunner.py --target Bug: 62855082 Bug: 30627598 Change-Id: If450c8cff2751369011d649c25d28a482a2c61a3
2017-06-08ART: Move CalleeSaveType to callee_save_type.hAndreas Gampe
Move the type out of runtime to decrease dependencies. Make it a proper enum class. Fix up usage. Test: m test-art-host Change-Id: Id84c44bf3c59f37c8a43548e720c5fb65707b198
2017-06-02ART: Introduce thread-current-inl.hAndreas Gampe
Factor out Thread::Current() code into its own -inl file to remove transitive includes. This requires at the same time correcting mutex.h, i.e., moving some functions into mutex-inl.h. Test: m test-art-host Change-Id: I88f888b604e0897368d9b483edce6ce4332dd9c9
2017-04-21ART: Clean up art_method.hAndreas Gampe
Clean up the header. Fix up other headers including the -inl file, in an effort to prune the include graph. Fix broken transitive includes by making includes explicit. Introduce new -inl files for method handles and reference visiting. Test: source build/envsetup.sh && lunch aosp_angler-userdebug && mmma art Test: source build/envsetup.sh && lunch aosp_mips64-userdebug && mmma art Change-Id: I8f60f1160c2a702fdf3598149dae38f6fa6bc851
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-03Extend profman to generate profiles with inline cachesCalin Juravle
Extend profman logic to generate profiles based on a simple textual respresentation. This will help writing tests for profile guided compilation. Before this CL, profman was able to generate profiles based on a list of classes like: java.lang.Comparable java.lang.Math java.lang.Object This CL, enables profman to understand methods and classes alike. The new format is: # Classes Ljava/lang/Comparable; Ljava/lang/Math; # Methods with inline caches LTestInline;->inlinePolymorhic(LSuper;)I+LSubA;,LSubB;,LSubC; LTestInline;->noInlineCache(LSuper;)I "LTestInline;->inlinePolymorhic(LSuper;)I+LSubA;,LSubB;,LSubC;" means that method `int inlineMonomorphicSubA(Super)` from class Main will be added to the profile with the inline cache (SubA,SubB) for its one and only invoke virtual. @Main#noInlineCache:(LSuper;)I+; meaning that method `int noInlineCache' from class Main will be added to the profile with no inline cache. Note that the methods are allowed to have a single invoke virtual in their dex bytecode. That is to keep the parsing the file format simple and easy to use. Also, add a few more tests for profiles and fix an issue caused by writing the dex files in a possibly wrong order. Test: m run-test-host-gtest-profile_assistant_test Bug: 32434870 Change-Id: I6b7340cf613007117d9818be206ccb3a27b815bf
2017-02-17Make dex2oat support profiles passed to non profile filtersMathieu Chartier
Using a non profile filter with an input profile should compile everything but generate an app image and optimize layout based on the profile. Change UseProfileGuidedCompilation to use the profile arguments. Using profile arguments instead of being based on the compiler filter lets us do full speed compile and layout based on profile. Fix ShouldCompileBasedOnProfile to use the compiler filter instead of the existence of a profile. Fixed gtests. Test: test-art-host Bug: 34927277 Change-Id: I325a10d2072ed427bb32f96e4efa54cf81e94ad3
2016-10-26ART: Change InstructionSetFeatures to return unique_ptrAndreas Gampe
This makes clear the ownership of the object. Test: m test-art-host Change-Id: I55fa734f04bc3046d370f4dcf98ce6b17c59e234
2016-10-18Remove mirror:: and ArtMethod deps in utils.{h,cc}David Sehr
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
2016-10-04Revert "Revert "Store resolved Strings for AOT code in .bss.""Vladimir Marko
Fixed oat_test to keep dex files alive. Fixed mips build. Rewritten the .bss GC root visiting and added write barrier to the artResolveStringFromCode(). Test: build aosp_mips-eng Test: m ART_DEFAULT_GC_TYPE=SS test-art-target-host-gtest-oat_test Test: Run ART test suite on host and Nexus 9. Bug: 20323084 Bug: 30627598 This reverts commit 5f926055cb88089d8ca27243f35a9dfd89d981f0. Change-Id: I07fa2278d82b8eb64964c9a4b66cb93726ccda6b
2016-09-30Revert "Store resolved Strings for AOT code in .bss."Vladimir Marko
There are some issues with oat_test64 on host and aosp_mips-eng. Also reverts "compiler_driver: Fix build." Bug: 20323084 Bug: 30627598 This reverts commit 63dccbbefef3014c99c22748d18befcc7bcb3b41. This reverts commit 04a44135ace10123f059373691594ae0f270a8a4. Change-Id: I568ba3e58cf103987fdd63c8a21521010a9f27c4