summaryrefslogtreecommitdiff
path: root/compiler/optimizing/optimizing_compiler.cc
diff options
context:
space:
mode:
author Mathieu Chartier <mathieuc@google.com> 2015-08-28 11:16:54 -0700
committer Mathieu Chartier <mathieuc@google.com> 2015-08-28 13:31:51 -0700
commited15000a5099f5e230c8ded5ac75692bae272650 (patch)
treebe78bce04c0c9611abc221fd71d9251d05e35d2b /compiler/optimizing/optimizing_compiler.cc
parent12b7025d0393a2ce15410df6019844e59b77314d (diff)
Fix some HandleScope bugs and add corresponding checks
Some places were creating or destroying handle scopes without holding the mutator lock. This can cause GC crashes if thread roots are being marked or hprof dumps to also fail. Also added checks to catch some of these errors. Bug: 23468617 Change-Id: I1a2d615923484cfc25014967656775c445aa3f1f
Diffstat (limited to 'compiler/optimizing/optimizing_compiler.cc')
-rw-r--r--compiler/optimizing/optimizing_compiler.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc
index 2a7699105c..1db3063aec 100644
--- a/compiler/optimizing/optimizing_compiler.cc
+++ b/compiler/optimizing/optimizing_compiler.cc
@@ -540,11 +540,14 @@ CompiledMethod* OptimizingCompiler::CompileOptimized(HGraph* graph,
CompilerDriver* compiler_driver,
const DexCompilationUnit& dex_compilation_unit,
PassObserver* pass_observer) const {
- StackHandleScopeCollection handles(Thread::Current());
+ ScopedObjectAccess soa(Thread::Current());
+ StackHandleScopeCollection handles(soa.Self());
+ soa.Self()->TransitionFromRunnableToSuspended(kNative);
RunOptimizations(graph, compiler_driver, compilation_stats_.get(),
dex_compilation_unit, pass_observer, &handles);
if (graph->HasTryCatch()) {
+ soa.Self()->TransitionFromSuspendedToRunnable();
return nullptr;
}
@@ -582,6 +585,8 @@ CompiledMethod* OptimizingCompiler::CompileOptimized(HGraph* graph,
ArrayRef<const uint8_t>(*codegen->GetAssembler()->cfi().data()),
ArrayRef<const LinkerPatch>(linker_patches));
pass_observer->DumpDisassembly();
+
+ soa.Self()->TransitionFromSuspendedToRunnable();
return compiled_method;
}