summaryrefslogtreecommitdiff
path: root/dex2oat/driver/compiler_driver.cc
diff options
context:
space:
mode:
authorEvgeny Astigeevich <evgeny.astigeevich@linaro.org>2020-05-28 12:38:30 +0100
committerVladimir Marko <vmarko@google.com>2020-05-29 11:22:47 +0000
commitffffa9c4e18e233db7b0f5eb31d07d8a52d527e4 (patch)
tree562f5fa455f06e4f538645c4c6190f18d2715f41 /dex2oat/driver/compiler_driver.cc
parent62d33f78909f86b7eea22b9e982a93709c2b2c92 (diff)
downloadart-ffffa9c4e18e233db7b0f5eb31d07d8a52d527e4.tar.gz
ART: Add classes having intrinsics to boot image
Classes, which have intrinsics methods but are not in boot-image-profile.txt, are not included into the boot image. This causes the list of intrinsics to be a mix of methods from the boot image and the framework. Intrinsics methods from the boot image are already marked as intrinsics. Intrinsics methods from the framework are not marked. The current implementation of InitializeIntrinsics stops initializing intrinsics when it encounters an initialized intrinsic on the list. This means uninitialized intrinsics must be at the beginning of the list. Otherwise they won't be initialized. Instead of rearranging the list, the CL adds classes having intrinsics methods to the boot image. This guarantees all intrinsics to be marked. The CL also adds DCHECK to InitializeIntrinsics to check that all intrinsics have been initialized. Test: test.py --host --optimizing --jit --gtest --interpreter Test: test.py --target --optimizing --jit --interpreter Test: run-gtests.sh Change-Id: I82bc840bc2c07d3e4e527ee6e1f76c2015c59c21
Diffstat (limited to 'dex2oat/driver/compiler_driver.cc')
-rw-r--r--dex2oat/driver/compiler_driver.cc26
1 files changed, 20 insertions, 6 deletions
diff --git a/dex2oat/driver/compiler_driver.cc b/dex2oat/driver/compiler_driver.cc
index 31e78aa7d3..40b999b3c1 100644
--- a/dex2oat/driver/compiler_driver.cc
+++ b/dex2oat/driver/compiler_driver.cc
@@ -63,6 +63,7 @@
#include "gc/space/space.h"
#include "handle_scope-inl.h"
#include "intrinsics_enum.h"
+#include "intrinsics_list.h"
#include "jni/jni_internal.h"
#include "linker/linker_patch.h"
#include "mirror/class-inl.h"
@@ -331,12 +332,6 @@ void CompilerDriver::CompileAll(jobject class_loader,
CheckThreadPools();
- if (GetCompilerOptions().IsBootImage()) {
- // All intrinsics must be in the primary boot image, so we don't need to setup
- // the intrinsics for any other compilation, as those compilations will pick up
- // a boot image that have the ArtMethod already set with the intrinsics flag.
- InitializeIntrinsics();
- }
// Compile:
// 1) Compile all classes and methods enabled for compilation. May fall back to dex-to-dex
// compilation.
@@ -1069,6 +1064,15 @@ class RecordImageClassesVisitor : public ClassVisitor {
HashSet<std::string>* const image_classes_;
};
+// Add classes which contain intrinsics methods to the list of image classes.
+static void AddClassesContainingIntrinsics(/* out */ HashSet<std::string>* image_classes) {
+#define ADD_INTRINSIC_OWNER_CLASS(_, __, ___, ____, _____, ClassName, ______, _______) \
+ image_classes->insert(ClassName);
+
+ INTRINSICS_LIST(ADD_INTRINSIC_OWNER_CLASS)
+#undef ADD_INTRINSIC_OWNER_CLASS
+}
+
// Make a list of descriptors for classes to include in the image
void CompilerDriver::LoadImageClasses(TimingLogger* timings,
/*inout*/ HashSet<std::string>* image_classes) {
@@ -1093,6 +1097,16 @@ void CompilerDriver::LoadImageClasses(TimingLogger* timings,
}
TimingLogger::ScopedTiming t("LoadImageClasses", timings);
+
+ if (GetCompilerOptions().IsBootImage()) {
+ AddClassesContainingIntrinsics(image_classes);
+
+ // All intrinsics must be in the primary boot image, so we don't need to setup
+ // the intrinsics for any other compilation, as those compilations will pick up
+ // a boot image that have the ArtMethod already set with the intrinsics flag.
+ InitializeIntrinsics();
+ }
+
// Make a first pass to load all classes explicitly listed in the file
Thread* self = Thread::Current();
ScopedObjectAccess soa(self);