summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Calin Juravle <calin@google.com> 2019-09-13 18:31:59 -0700
committer Calin Juravle <calin@google.com> 2019-09-17 19:21:03 +0000
commit973f8c48154526f1211d8be3f95855bce753f76c (patch)
tree2965072335ad22d5f2ee94abbefc4fd07d919600
parent8d8a98c8cdff564962b49e6b4c297477d5fbfb30 (diff)
Create boot image profiles with the appropriate version
Bug: 139884006 Test: m test-art-host Change-Id: I89227d980121d548ed4b9b1e8f3c6e2c78b5ef97
-rw-r--r--runtime/jit/profile_saver.cc6
-rw-r--r--test/595-profile-saving/expected.txt1
-rw-r--r--test/595-profile-saving/profile-saving.cc11
-rw-r--r--test/595-profile-saving/src/Main.java5
4 files changed, 20 insertions, 3 deletions
diff --git a/runtime/jit/profile_saver.cc b/runtime/jit/profile_saver.cc
index 9399470a3e..a560dff295 100644
--- a/runtime/jit/profile_saver.cc
+++ b/runtime/jit/profile_saver.cc
@@ -447,7 +447,8 @@ void ProfileSaver::FetchAndCacheResolvedClassesAndMethods(bool startup) {
if (info_it == profile_cache_.end()) {
info_it = profile_cache_.Put(
filename,
- new ProfileCompilationInfo(Runtime::Current()->GetArenaPool()));
+ new ProfileCompilationInfo(
+ Runtime::Current()->GetArenaPool(), options_.GetProfileBootClassPath()));
}
ProfileCompilationInfo* cached_info = info_it->second;
@@ -552,7 +553,8 @@ bool ProfileSaver::ProcessProfilingInfo(bool force_save, /*out*/uint16_t* number
total_number_of_code_cache_queries_++;
}
{
- ProfileCompilationInfo info(Runtime::Current()->GetArenaPool());
+ ProfileCompilationInfo info(
+ Runtime::Current()->GetArenaPool(), options_.GetProfileBootClassPath());
if (!info.Load(filename, /*clear_if_invalid=*/ true)) {
LOG(WARNING) << "Could not forcefully load profile " << filename;
continue;
diff --git a/test/595-profile-saving/expected.txt b/test/595-profile-saving/expected.txt
index 6a5618ebc6..9e28e07261 100644
--- a/test/595-profile-saving/expected.txt
+++ b/test/595-profile-saving/expected.txt
@@ -1 +1,2 @@
JNI_OnLoad called
+IsForBootImage: true
diff --git a/test/595-profile-saving/profile-saving.cc b/test/595-profile-saving/profile-saving.cc
index b22d61e38d..d6ca447dc4 100644
--- a/test/595-profile-saving/profile-saving.cc
+++ b/test/595-profile-saving/profile-saving.cc
@@ -63,5 +63,16 @@ extern "C" JNIEXPORT jboolean JNICALL Java_Main_presentInProfile(JNIEnv* env,
art_method->GetDexMethodIndex()));
}
+extern "C" JNIEXPORT jboolean JNICALL Java_Main_isForBootImage(JNIEnv* env,
+ jclass,
+ jstring filename) {
+ ScopedUtfChars filename_chars(env, filename);
+ CHECK(filename_chars.c_str() != nullptr);
+
+ ProfileCompilationInfo info;
+ info.Load(std::string(filename_chars.c_str()), /*clear_if_invalid=*/ false);
+ return info.IsForBootImage();
+}
+
} // namespace
} // namespace art
diff --git a/test/595-profile-saving/src/Main.java b/test/595-profile-saving/src/Main.java
index 18c0598bef..e0952e1424 100644
--- a/test/595-profile-saving/src/Main.java
+++ b/test/595-profile-saving/src/Main.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Method;
@@ -42,6 +41,8 @@ public class Main {
System.out.println("Class loader does not match boot class");
}
testAddMethodToProfile(file, bootMethod);
+
+ System.out.println("IsForBootImage: " + isForBootImage(file.getPath()));
} finally {
if (file != null) {
file.delete();
@@ -66,6 +67,8 @@ public class Main {
public static native void ensureProfileProcessing();
// Checks if the profiles saver knows about the method.
public static native boolean presentInProfile(String profile, Method method);
+ // Returns true if the profile is for the boot image.
+ public static native boolean isForBootImage(String profile);
private static final String TEMP_FILE_NAME_PREFIX = "dummy";
private static final String TEMP_FILE_NAME_SUFFIX = "-file";