Revert "Fix profile saver hotness for AOT code"
This reverts commit 4cb48c1bd359bee98a1a4c0cff475d76a3b5483a.
Bug: 139883463
Reason for revert: Test fails on target.
Change-Id: I1b3a7aec961b212d92e457d52da6ab921044f491
diff --git a/runtime/jit/jit.h b/runtime/jit/jit.h
index 59861c5..13a9c7b 100644
--- a/runtime/jit/jit.h
+++ b/runtime/jit/jit.h
@@ -124,6 +124,10 @@
profile_saver_options_.SetWaitForJitNotificationsToSave(value);
}
+ void SetProfileAOTCode(bool value) {
+ profile_saver_options_.SetProfileAOTCode(value);
+ }
+
void SetJitAtFirstUse() {
use_jit_compilation_ = true;
compile_threshold_ = 0;
diff --git a/runtime/jit/profile_saver.cc b/runtime/jit/profile_saver.cc
index 9399470..129a30a 100644
--- a/runtime/jit/profile_saver.cc
+++ b/runtime/jit/profile_saver.cc
@@ -37,7 +37,6 @@
#include "gc/collector_type.h"
#include "gc/gc_cause.h"
#include "gc/scoped_gc_critical_section.h"
-#include "jit/jit.h"
#include "jit/profiling_info.h"
#include "oat_file_manager.h"
#include "profile/profile_compilation_info.h"
@@ -422,12 +421,9 @@
MutexLock mu(self, *Locks::profiler_lock_);
profiler_pthread = profiler_pthread_;
}
- uint32_t hot_method_sample_threshold = std::numeric_limits<uint32_t>::max();
- if (startup) {
- hot_method_sample_threshold = options_.GetHotStartupMethodSamples(is_low_ram);
- } else if (Runtime::Current()->GetJit() != nullptr) {
- hot_method_sample_threshold = Runtime::Current()->GetJit()->WarmMethodThreshold();
- }
+ const uint32_t hot_method_sample_threshold = startup ?
+ options_.GetHotStartupMethodSamples(is_low_ram) :
+ std::numeric_limits<uint32_t>::max();
SampleClassesAndExecutedMethods(profiler_pthread,
options_.GetProfileBootClassPath(),
&allocator,
@@ -920,8 +916,11 @@
if (!info.Load(profile, /*clear_if_invalid=*/false)) {
return false;
}
- const ProfileCompilationInfo::MethodHotness hotness = info.GetMethodHotness(ref);
- return hot ? hotness.IsHot() : hotness.IsInProfile();
+ ProfileCompilationInfo::MethodHotness hotness = info.GetMethodHotness(ref);
+ // Ignore hot parameter for now since it was causing test 595 to be flaky. TODO: Investigate.
+ // b/63635729
+ UNUSED(hot);
+ return hotness.IsInProfile();
}
return false;
}
diff --git a/runtime/jit/profile_saver_options.h b/runtime/jit/profile_saver_options.h
index 1cff713..18f7899 100644
--- a/runtime/jit/profile_saver_options.h
+++ b/runtime/jit/profile_saver_options.h
@@ -112,6 +112,9 @@
bool GetProfileAOTCode() const {
return profile_aot_code_;
}
+ void SetProfileAOTCode(bool value) {
+ profile_aot_code_ = value;
+ }
bool GetWaitForJitNotificationsToSave() const {
return wait_for_jit_notifications_to_save_;
}
diff --git a/test/2230-profile-save-hotness/expected.txt b/test/2230-profile-save-hotness/expected.txt
deleted file mode 100644
index 6a5618e..0000000
--- a/test/2230-profile-save-hotness/expected.txt
+++ /dev/null
@@ -1 +0,0 @@
-JNI_OnLoad called
diff --git a/test/2230-profile-save-hotness/info.txt b/test/2230-profile-save-hotness/info.txt
deleted file mode 100644
index c230391..0000000
--- a/test/2230-profile-save-hotness/info.txt
+++ /dev/null
@@ -1 +0,0 @@
-Check that profile recording with AOT hotness.
diff --git a/test/2230-profile-save-hotness/run b/test/2230-profile-save-hotness/run
deleted file mode 100644
index 6725d3b..0000000
--- a/test/2230-profile-save-hotness/run
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-#
-# Copyright 2019 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Run quicken otherwise the profile saver won't start?
-${RUN} \
- -Xcompiler-option --count-hotness-in-compiled-code \
- -Xcompiler-option --compiler-filter=speed \
- --runtime-option -Xps-profile-aot-code \
- --runtime-option -Xjitsaveprofilinginfo \
- --runtime-option -Xusejit:true "${@}"
diff --git a/test/2230-profile-save-hotness/src-art/Main.java b/test/2230-profile-save-hotness/src-art/Main.java
deleted file mode 100644
index 41cb435..0000000
--- a/test/2230-profile-save-hotness/src-art/Main.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import dalvik.system.VMRuntime;
-import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.Method;
-
-public class Main {
- public static void $noinline$hotnessCount() {}
-
- public static void $noinline$hotnessCountWithLoop(int count) {
- for (int i = 0; i < count; i++) {
- $noinline$hotnessCount();
- }
- }
-
- public static void main(String[] args) throws Exception {
- System.loadLibrary(args[0]);
- if (!isAotCompiled(Main.class, "main")) {
- return;
- }
-
- File file = null;
- try {
- file = createTempFile();
- String codePath = System.getenv("DEX_LOCATION") + "/2230-profile-save-hotness.jar";
- VMRuntime.registerAppInfo(file.getPath(), new String[] {codePath});
-
- // Test that the profile saves an app method with a profiling info.
- $noinline$hotnessCountWithLoop(10000);
- ensureProfileProcessing();
- Method appMethod = Main.class.getDeclaredMethod("$noinline$hotnessCount");
- if (!presentInProfile(file.getPath(), appMethod)) {
- System.out.println("App method not hot in profile");
- }
- } finally {
- if (file != null) {
- file.delete();
- }
- }
- }
-
- // Checks if the profiles saver has the method as hot/warm.
- public static native boolean presentInProfile(String profile, Method method);
- // Ensures the profile saver does its usual processing.
- public static native void ensureProfileProcessing();
- public static native boolean isAotCompiled(Class<?> cls, String methodName);
- public static native int getHotnessCounter(Class<?> cls, String methodName);
-
- private static final String TEMP_FILE_NAME_PREFIX = "dummy";
- private static final String TEMP_FILE_NAME_SUFFIX = "-file";
-
- private static File createTempFile() throws Exception {
- try {
- return File.createTempFile(TEMP_FILE_NAME_PREFIX, TEMP_FILE_NAME_SUFFIX);
- } catch (IOException e) {
- System.setProperty("java.io.tmpdir", "/data/local/tmp");
- try {
- return File.createTempFile(TEMP_FILE_NAME_PREFIX, TEMP_FILE_NAME_SUFFIX);
- } catch (IOException e2) {
- System.setProperty("java.io.tmpdir", "/sdcard");
- return File.createTempFile(TEMP_FILE_NAME_PREFIX, TEMP_FILE_NAME_SUFFIX);
- }
- }
- }
-}
diff --git a/test/knownfailures.json b/test/knownfailures.json
index 2611077..4f119a8 100644
--- a/test/knownfailures.json
+++ b/test/knownfailures.json
@@ -502,8 +502,7 @@
"909-attach-agent",
"924-threads",
"981-dedup-original-dex",
- "1900-track-alloc",
- "2230-profile-save-hotness"
+ "1900-track-alloc"
],
"description": ["Tests that require exact knowledge of the deoptimization state, the ",
"number of plugins and agents, or breaks other openjdkjvmti assumptions."],
@@ -1094,8 +1093,7 @@
"1940-ddms-ext",
"1945-proxy-method-arguments",
"1946-list-descriptors",
- "1947-breakpoint-redefine-deopt",
- "2230-profile-save-hotness"
+ "1947-breakpoint-redefine-deopt"
],
"variant": "jvm",
"bug": "b/73888836",