summaryrefslogtreecommitdiff
path: root/compiler/driver/compiler_driver-inl.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-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-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-07ART: Small compiler-driver cleanupAndreas Gampe
Remove some unused or unimplemented methods and typedefs. Move some code. Bug: 115837065 Test: mmma art Change-Id: I96070444007d4f67b14bb563c1b7252a5a012523
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-11Do not pass DexFile to ClassLinker::Lookup/ResolveMethod().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: I2e47280e7cb8b84595130c4abfb5ece18d7f5c75
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-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-07-05Small refactoring of field/method access checks.Vladimir Marko
And some cleanup to reduce the size of the upcoming method resolution rewrite CL. Test: m test-art-host Test: testrunner.py --host Test: testrunner.py --host --interp-ac Bug: 62855082 Change-Id: I5bbf0a92d75fe9de6982b80280cd5877fcc37700
2017-07-04Remove obsolete helpers from CompilerDriver.Vladimir Marko
Test: Rely on TreeHugger. Change-Id: Id177ed422353a8606c3e57d34e1519e6b17e5c48
2017-05-30ART: More header cleanup - runtime.hAndreas Gampe
Remove unnecessary runtime.h includes. Refactor other headers (move to forward declarations) to make this possible. Test: mmma art Change-Id: I297f0ad444ba92169edd16d8c7cbe95bb6dbb800
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-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-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-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-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
2016-11-21ART: Add dex::TypeIndexAndreas Gampe
Add abstraction for uint16_t type index. Test: m test-art-host Change-Id: I47708741c7c579cbbe59ab723c1e31c5fe71f83a
2016-10-13Move mirror::ObjectArray to ObjPtrMathieu Chartier
Also reduce calls to ObjPtr::Ptr. Bug: 31113334 Test: test-art-host -j32 Change-Id: I73e1b356972bb079b66332f00f7f07451601044e
2016-10-12Revert "Revert "Remove dead code from compiler driver.""Nicolas Geoffray
This reverts commit 38f250fd3cb36fac27bad7cac8eefacdf8a6e41e. Change-Id: I491891c9108a0646145553241aa04a9cbba7d29b
2016-10-04Fix build break from merge conflictMathieu Chartier
Bug: 31113334 Test: mm -j32 Change-Id: I5643a0ec22cf03a54671a5c7fa0ebda41cc9a8c3
2016-10-05Merge "Rename ObjPtr::Decode to ObjPtr::Ptr"Mathieu Chartier
2016-10-04Revert "Remove dead code from compiler driver."Nicolas Geoffray
This reverts commit 44b3da25191052acc18528d8ade9cf3038505180. Change-Id: I0cf049ed967bcaf8dfd89fc88288d992c63a4939
2016-10-04Rename ObjPtr::Decode to ObjPtr::PtrMathieu Chartier
Done to prevent ambiguity with ScopedObjectAccess::Decode. Bug: 31113334 Test: test-art-host Change-Id: I07a2497cc9cf66386311798933547471987fc316
2016-10-04Remove dead code from compiler driver.Nicolas Geoffray
test: m test-art-host Change-Id: Ie4b6a4c371fff6c9c213d8d6604eb09a5e71d595
2016-10-03Move ArtField to ObjPtrMathieu Chartier
Added EXPECT_OBJ_PTR_EQ and variants to gtests. Fixed moving GC bugs in: ClassLinker::CreatePathClassLoader ClassLinkerTest: StaticFields ObjPtr Decode call sites: 186 -> 181. Some tests fail due to ResolvedFieldAccessTest, will fix in follow up CL. Bug: 31113334 Test: test-art-host CC baker Change-Id: I8b266ad00f3c20c8cbe7cfdf280d175083df0b88
2016-09-29Clean up ScopedThreadStateChange to use ObjPtrMathieu Chartier
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
2016-09-23Clean-up sharpening and compiler driver.Nicolas Geoffray
Remove dependency on compiler driver for sharpening and dex2dex (the methods called on the compiler driver were doing unnecessary work), and remove the now unused methods in compiler driver. Also remove test that is now invalid, as sharpening always succeeds. test: m test-art-host m test-art-target Change-Id: I54e91c6839bd5b0b86182f2f43ba5d2c112ef908
2016-08-01ART: Convert pointer size to enumAndreas Gampe
Move away from size_t to dedicated enum (class). Bug: 30373134 Bug: 30419309 Test: m test-art-host Change-Id: Id453c330f1065012e7d4f9fc24ac477cc9bb9269
2016-06-02Hold dex caches live in class tableMathieu Chartier
Prevents temporary dex caches being unloaded for the same dex file. Usually this is OK, but if someone resolved a string in that dex cache, it could leave stale pointers in BSS. Also it can use extra memory in linear alloc if we allocate dex cache arrays multiple times. Bug: 29083330 Change-Id: Ia44668f013ceef1f5eb80f653a48d0f8004548c9
2016-02-18Small inlining improvements.Nicolas Geoffray
- Use the type_index in the current dex file for classes not defined in the current dex file. - Make the loading of the vtable field of a class have no side effects to enable gvn'ing it. Note that those improvements only affect the JIT, where we don't have checker support. Change-Id: I519f52bd8270f2b828f0920a1214da33cf788f41
2016-01-28Optimizing compiler support for directly calling interface methodsAlex Light
This teaches the optimizing compiler how to perform invoke-super on interfaces. This should make the invokes generally faster. Bug: 24618811 Change-Id: I7f9b0fb1209775c1c8837ab5d21f8acba3cc72a5
2015-12-10ART: Stash a resolved method late in the verifierAndreas Gampe
Invoke-interface should only be called on an interface method. We cannot move the check earlier, as there are other checks that must be done that can fail a class hard. So postpone a push to the dex cache. Clean up the test a bit. Also templatize ResolveMethod with a version always checking the invoke type, and on a cache miss check whether type target type is an interface when an interface invoke type was given. Bug: 21869691 Change-Id: I94cbb23339cbbb3cb6be9995775e4dcefacce7fd
2015-12-10Revert "ART: Check invoke-interface earlier in verifier"Andreas Gampe
This reverts commit dae24142127c64551142a50423085aabdb0a6060. It is important to check the name of the method being called. Bug: 21869691
2015-12-08ART: Check invoke-interface earlier in verifierAndreas Gampe
Invoke-interface should only be called on an interface method. Move the check earlier, as otherwise we'll try to resolve and potentially inject a method into the dex cache. Also templatize ResolveMethod with a version always checking the invoke type, and on a cache miss check whether type target type is an interface when an interface invoke type was given. Bug: 21869691 Change-Id: Ica27158f675b5aa223d9229248189612f4706832
2015-11-10Correct exception behavior for default methodsAlex Light
Default methods are defined to throw an IncompatibleClassChangeError (ICCE) when they are called and there is no "best" implementation. Previously we would simply throw an ICCE during class loading as soon as we noticed that this would happen if called. This makes us wait until we actually attempt to execute the method. Furthermore, this allows us to use other, non-conflicting, methods on the object as normal. Furthermore, this makes us correctly throw AbstractMethodErrors in cases where all default implementations of a method are overridden by abstract declarations. Adds 3 tests for this new behavior. Bug: 24618811 Change-Id: Id891958a81f9b3862b2ce5919636aabef7d3422e
2015-10-29Change a few places to use string version of GetTypeIdMathieu Chartier
GetTypeId is about 20% faster than GetStringId + integer GetTypeID since it does less binary searches. Change-Id: I876c4ac89ab206acca217b2287b0197ef2e408c2
2015-10-15Allocate dex cache arrays in their class loader's linear allocMathieu Chartier
Fixes memory leak for class unloading where the dex cache arrays used to be in the runtime linear alloc which never got freed. TODO: Some of the callers like the compiler just use the runtime linear alloc. We could clean this up if we want to have class unloading during compilation for some reason. Added regression test. Bug: 22720414 Change-Id: Ia50333a06a339efbdaedb5ad94b7a1ae841124ec
2015-09-03Reduce how often we call FindDexCacheMathieu Chartier
Before host boot.oat -j4 optimizing compile: real 1m17.792s user 3m26.140s sys 0m8.340s After: real 1m12.324s user 3m22.718s sys 0m8.320s Change-Id: If18e9e79e06cdf1676692e5efacb682bf93889c3
2015-08-31Revert "Revert "Change dex caches to be weak roots""Mathieu Chartier
This reverts commit 81a9087f0df0518c39405b7d18ba5858a6d8b77b. Boot.oat creation time goes from 4.7s to 4.9s on host due to extra locking. Will try to improve this in another CL. Bug: 23602225 Bug: 22720414 Change-Id: I7e25b75cfb63faa196c7b0f60e46cce50bf12021
2015-08-28Revert "Change dex caches to be weak roots"Brian Carlstrom
This reverts commit 3ae6b1d42523bb2a0ddb5edff1aaf05b592f28f4.
2015-08-25Change dex caches to be weak rootsMathieu Chartier
Changed dex caches to be weak roots. This is necessary for class unloading since the resolved types arrays would keep classes live when they should be unloaded. Currently the dex caches still don't get freed due to the class loader roots. Also deleted some unused functionality in image writer. Bug: 22720414 Change-Id: If22cb3cad7e3baabc8158a77d7f20799faf4c341
2015-08-19Revert "Revert "Optimizing: Better invoke-static/-direct dispatch.""Vladimir Marko
Fixed kCallArtMethod to use correct callee location for kRecursive. This combination is used when compiling with debuggable flag set. This reverts commit b2c431e80e92eb6437788cc544cee6c88c3156df. Change-Id: Idee0f2a794199ebdf24892c60f8a5dcf057db01c
2015-08-19Revert "Optimizing: Better invoke-static/-direct dispatch."Vladimir Marko
Reverting due to failing ndebug tests. This reverts commit 9b688a095afbae21112df5d495487ac5231b12d0. Change-Id: Ie4f69da6609df3b7c8443412b6cf7f5c43c2c5d9
2015-08-19Optimizing: Better invoke-static/-direct dispatch.Vladimir Marko
Add framework for different types of loading ArtMethod* and code pointer retrieval. Implement invoke-static and invoke-direct calls the same way as Quick. Document the dispatch kinds in HInvokeStaticOrDirect's new enumerations MethodLoadKind and CodePtrLocation. PC-relative loads from dex cache arrays are used only for x86-64 and arm64. The implementation for other architectures will be done in separate CLs. Change-Id: I468ca4d422dbd14748e1ba6b45289f0d31734d94
2015-06-22Revert "Revert "Use IsAssignableFrom instead of IsSubclass for robustness.""Nicolas Geoffray
Don't use IsAssignableFrom, but check beforehand if the referrer is an interface. Otherwise, we are being too aggressive on removing clinit checks on interfaces (being a subclass doesn't imply the interface has been initialized). bug:21870666 This reverts commit 463580ca5a1e75e27ad0207537ffc6252091326a. Change-Id: I2a13974d28477ee3e5224142cc260cbf46d19aa9
2015-06-22Revert "Use IsAssignableFrom instead of IsSubclass for robustness."Nicolas Geoffray
Not correct for Quick. Bug:21870666 This reverts commit af268bbc4fbd0b9847acf1f7b79c038806118467. Change-Id: Id44849cc877a42495619fd71bfd2db75159b6868