summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler/Android.bp7
-rw-r--r--dex2oat/Android.bp12
-rw-r--r--dex2oat/dex2oat.cc6
-rw-r--r--dexlayout/Android.bp7
-rw-r--r--runtime/globals.h6
5 files changed, 35 insertions, 3 deletions
diff --git a/compiler/Android.bp b/compiler/Android.bp
index 164f9c1e8f..d4d72f380b 100644
--- a/compiler/Android.bp
+++ b/compiler/Android.bp
@@ -249,6 +249,13 @@ art_cc_library {
shared_libs: [
"libart",
],
+
+ pgo: {
+ instrumentation: true,
+ profile_file: "dex2oat.profdata",
+ benchmarks: ["dex2oat"],
+ enable_profile_use: false,
+ }
}
art_cc_library {
diff --git a/dex2oat/Android.bp b/dex2oat/Android.bp
index 6bebf7d2da..dc71b9ba3e 100644
--- a/dex2oat/Android.bp
+++ b/dex2oat/Android.bp
@@ -129,6 +129,18 @@ art_cc_binary {
static_libs: [
"libart-dex2oat",
],
+
+ pgo: {
+ instrumentation: true,
+ profile_file: "dex2oat.profdata",
+ benchmarks: ["dex2oat"],
+ enable_profile_use: false,
+ cflags: [
+ // Ignore frame-size increase resulting from instrumentation.
+ "-Wno-frame-larger-than=",
+ "-DART_PGO_INSTRUMENTATION",
+ ],
+ }
}
art_cc_binary {
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index 8d0d89ed5c..23af2ab6e3 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -3063,9 +3063,9 @@ static dex2oat::ReturnCode Dex2oat(int argc, char** argv) {
int main(int argc, char** argv) {
int result = static_cast<int>(art::Dex2oat(argc, argv));
// Everything was done, do an explicit exit here to avoid running Runtime destructors that take
- // time (bug 10645725) unless we're a debug build or running on valgrind. Note: The Dex2Oat class
- // should not destruct the runtime in this case.
- if (!art::kIsDebugBuild && (RUNNING_ON_MEMORY_TOOL == 0)) {
+ // time (bug 10645725) unless we're a debug or instrumented build or running on valgrind. Note:
+ // The Dex2Oat class should not destruct the runtime in this case.
+ if (!art::kIsDebugBuild && !art::kIsPGOInstrumentation && (RUNNING_ON_MEMORY_TOOL == 0)) {
_exit(result);
}
return result;
diff --git a/dexlayout/Android.bp b/dexlayout/Android.bp
index a02f75ad00..4f5d81095f 100644
--- a/dexlayout/Android.bp
+++ b/dexlayout/Android.bp
@@ -34,6 +34,13 @@ art_cc_library {
name: "libart-dexlayout",
defaults: ["libart-dexlayout-defaults"],
shared_libs: ["libart"],
+
+ pgo: {
+ instrumentation: true,
+ profile_file: "dex2oat.profdata",
+ benchmarks: ["dex2oat"],
+ enable_profile_use: false,
+ }
}
art_cc_library {
diff --git a/runtime/globals.h b/runtime/globals.h
index f14d6e95a6..ca4040d777 100644
--- a/runtime/globals.h
+++ b/runtime/globals.h
@@ -62,6 +62,12 @@ static constexpr bool kIsDebugBuild = GlobalsReturnSelf(false);
static constexpr bool kIsDebugBuild = GlobalsReturnSelf(true);
#endif
+#if defined(ART_PGO_INSTRUMENTATION)
+static constexpr bool kIsPGOInstrumentation = true;
+#else
+static constexpr bool kIsPGOInstrumentation = false;
+#endif
+
// ART_TARGET - Defined for target builds of ART.
// ART_TARGET_LINUX - Defined for target Linux builds of ART.
// ART_TARGET_ANDROID - Defined for target Android builds of ART.