summaryrefslogtreecommitdiff
path: root/runtime/runtime.cc
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2019-01-10 14:22:23 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2019-01-10 14:22:23 +0000
commitfe2886de2a9f06f286fe905ce8417981b9089c5c (patch)
tree060025813c4ab6d3bfd98aaafa54a97be342a0c0 /runtime/runtime.cc
parentd7d3f6fa1870b9e9b8f58ab7854e5eeee071ba2e (diff)
parent226805d9b81ba442251d0e2c4baedc36fcda6592 (diff)
Merge "Deoptimize zygote compiled methods in DeoptimizeBootImage."
Diffstat (limited to 'runtime/runtime.cc')
-rw-r--r--runtime/runtime.cc21
1 files changed, 16 insertions, 5 deletions
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index f30ba0c06b..15225a6d05 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -1472,6 +1472,8 @@ bool Runtime::Init(RuntimeArgumentMap&& runtime_options_in) {
if (IsJavaDebuggable()) {
// Now that we have loaded the boot image, deoptimize its methods if we are running
// debuggable, as the code may have been compiled non-debuggable.
+ ScopedThreadSuspension sts(self, ThreadState::kNative);
+ ScopedSuspendAll ssa(__FUNCTION__);
DeoptimizeBootImage();
}
} else {
@@ -1571,10 +1573,14 @@ bool Runtime::Init(RuntimeArgumentMap&& runtime_options_in) {
// Runtime initialization is largely done now.
// We load plugins first since that can modify the runtime state slightly.
// Load all plugins
- for (auto& plugin : plugins_) {
- std::string err;
- if (!plugin.Load(&err)) {
- LOG(FATAL) << plugin << " failed to load: " << err;
+ {
+ // The init method of plugins expect the state of the thread to be non runnable.
+ ScopedThreadSuspension sts(self, ThreadState::kNative);
+ for (auto& plugin : plugins_) {
+ std::string err;
+ if (!plugin.Load(&err)) {
+ LOG(FATAL) << plugin << " failed to load: " << err;
+ }
}
}
@@ -2647,6 +2653,7 @@ class UpdateEntryPointsClassVisitor : public ClassVisitor {
: instrumentation_(instrumentation) {}
bool operator()(ObjPtr<mirror::Class> klass) override REQUIRES(Locks::mutator_lock_) {
+ DCHECK(Locks::mutator_lock_->IsExclusiveHeld(Thread::Current()));
auto pointer_size = Runtime::Current()->GetClassLinker()->GetImagePointerSize();
for (auto& m : klass->GetMethods(pointer_size)) {
const void* code = m.GetEntryPointFromQuickCompiledCode();
@@ -2673,9 +2680,13 @@ void Runtime::DeoptimizeBootImage() {
// we patch entry points of methods in boot image to interpreter bridge, as
// boot image code may be AOT compiled as not debuggable.
if (!GetInstrumentation()->IsForcedInterpretOnly()) {
- ScopedObjectAccess soa(Thread::Current());
UpdateEntryPointsClassVisitor visitor(GetInstrumentation());
GetClassLinker()->VisitClasses(&visitor);
+ jit::Jit* jit = GetJit();
+ if (jit != nullptr) {
+ // Code JITted by the zygote is not compiled debuggable.
+ jit->GetCodeCache()->ClearEntryPointsInZygoteExecSpace();
+ }
}
}