Revert "Add support for booting with a boot classpath not fully AOTed."
This reverts commit 7417ce97c4dcabbd7423d46ff9b7cdaf95c1e0f9.
Reason for revert: Breaks debug mode
Bug: 119800099
Bug: 126239181
Change-Id: I2d4a79f957a020cc6404a130536a416daebc94e3
diff --git a/runtime/jit/jit.cc b/runtime/jit/jit.cc
index 69139cd..d44bd59 100644
--- a/runtime/jit/jit.cc
+++ b/runtime/jit/jit.cc
@@ -20,11 +20,9 @@
#include "art_method-inl.h"
#include "base/enums.h"
-#include "base/file_utils.h"
#include "base/logging.h" // For VLOG.
#include "base/memory_tool.h"
#include "base/runtime_debug.h"
-#include "base/scoped_flock.h"
#include "base/utils.h"
#include "class_root.h"
#include "debugger.h"
@@ -561,7 +559,7 @@
kCompileOsr,
};
- JitCompileTask(ArtMethod* method, TaskKind kind) : method_(method), kind_(kind), klass_(nullptr) {
+ JitCompileTask(ArtMethod* method, TaskKind kind) : method_(method), kind_(kind) {
ScopedObjectAccess soa(Thread::Current());
// Add a global ref to the class to prevent class unloading until compilation is done.
klass_ = soa.Vm()->AddGlobalRef(soa.Self(), method_->GetDeclaringClass());
@@ -608,18 +606,6 @@
DISALLOW_IMPLICIT_CONSTRUCTORS(JitCompileTask);
};
-class ZygoteTask final : public Task {
- public:
- ZygoteTask() {}
-
- void Run(Thread* self) override {
- Runtime::Current()->GetJit()->AddNonAotBootMethodsToQueue(self);
- }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(ZygoteTask);
-};
-
void Jit::CreateThreadPool() {
// There is a DCHECK in the 'AddSamples' method to ensure the tread pool
// is not null when we instrument.
@@ -630,91 +616,6 @@
thread_pool_->SetPthreadPriority(options_->GetThreadPoolPthreadPriority());
Start();
-
- // If we're not using the default boot image location, request a JIT task to
- // compile all methods in the boot image profile.
- Runtime* runtime = Runtime::Current();
- if (runtime->IsZygote() && !runtime->IsUsingDefaultBootImageLocation()) {
- thread_pool_->AddTask(Thread::Current(), new ZygoteTask());
- }
-}
-
-void Jit::AddNonAotBootMethodsToQueue(Thread* self) {
- Runtime* runtime = Runtime::Current();
- std::string profile_location;
- for (const std::string& option : runtime->GetImageCompilerOptions()) {
- if (android::base::StartsWith(option, "--profile-file=")) {
- profile_location = option.substr(strlen("--profile-file="));
- break;
- }
- }
- if (profile_location.empty()) {
- LOG(WARNING) << "Expected a profile location in JIT zygote mode";
- return;
- }
-
- std::string error_msg;
- ScopedFlock profile_file = LockedFile::Open(
- profile_location.c_str(), O_RDONLY, true, &error_msg);
-
- // Return early if we're unable to obtain a lock on the profile.
- if (profile_file.get() == nullptr) {
- LOG(ERROR) << "Cannot lock profile: " << error_msg;
- return;
- }
-
- ProfileCompilationInfo profile_info;
- if (!profile_info.Load(profile_file->Fd())) {
- LOG(ERROR) << "Could not load profile file";
- return;
- }
-
- const std::vector<const DexFile*>& boot_class_path =
- runtime->GetClassLinker()->GetBootClassPath();
- ScopedObjectAccess soa(self);
- StackHandleScope<1> hs(self);
- MutableHandle<mirror::DexCache> dex_cache = hs.NewHandle<mirror::DexCache>(nullptr);
- ScopedNullHandle<mirror::ClassLoader> null_handle;
- ClassLinker* class_linker = runtime->GetClassLinker();
-
- for (const DexFile* dex_file : boot_class_path) {
- std::set<dex::TypeIndex> class_types;
- std::set<uint16_t> hot_methods;
- std::set<uint16_t> startup_methods;
- std::set<uint16_t> post_startup_methods;
- std::set<uint16_t> combined_methods;
- if (!profile_info.GetClassesAndMethods(*dex_file,
- &class_types,
- &hot_methods,
- &startup_methods,
- &post_startup_methods)) {
- LOG(ERROR) << "Unable to get classes and methods for " << dex_file->GetLocation();
- continue;
- }
- dex_cache.Assign(class_linker->FindDexCache(self, *dex_file));
- CHECK(dex_cache != nullptr) << "Could not find dex cache for " << dex_file->GetLocation();
- for (uint16_t method_idx : startup_methods) {
- ArtMethod* method = class_linker->ResolveMethodWithoutInvokeType(
- method_idx, dex_cache, null_handle);
- if (method == nullptr) {
- self->ClearException();
- continue;
- }
- if (!method->IsCompilable() || !method->IsInvokable()) {
- continue;
- }
- const void* entry_point = method->GetEntryPointFromQuickCompiledCode();
- if (class_linker->IsQuickToInterpreterBridge(entry_point) ||
- class_linker->IsQuickGenericJniStub(entry_point)) {
- if (!method->IsNative()) {
- // The compiler requires a ProfilingInfo object for non-native methods.
- ProfilingInfo::Create(self, method, /* retry_allocation= */ true);
- }
- thread_pool_->AddTask(self,
- new JitCompileTask(method, JitCompileTask::TaskKind::kCompile));
- }
- }
- }
}
static bool IgnoreSamplesForMethod(ArtMethod* method) REQUIRES_SHARED(Locks::mutator_lock_) {