diff options
| author | 2016-01-27 16:15:56 +0000 | |
|---|---|---|
| committer | 2016-01-28 12:02:48 +0000 | |
| commit | f0615a3a8ca649a562e67219ab8b9c6a023f4928 (patch) | |
| tree | 1df47e018c474c1d8041ee906d9d479f26a84987 /compiler/jit/jit_compiler.cc | |
| parent | c3a02d2e9a12d1cd085c91cc6c876ae44daee805 (diff) | |
Don't crash if the perf map creation failed
The perf map file is used in the jit compiler to emit the symbol name
for the start address of each jitted function. The file is stored in
/data/misc/trace (previously /data) what is only accessible on
userdebug builds. This change modifies the code to work on user builds
with not using the perf map file if we failed to create it.
Change-Id: Icfecd4bdab94ffc528ec218f3ac2b872fbdacf37
Diffstat (limited to 'compiler/jit/jit_compiler.cc')
| -rw-r--r-- | compiler/jit/jit_compiler.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/jit/jit_compiler.cc b/compiler/jit/jit_compiler.cc index 3a3275a5f4..083ba8f343 100644 --- a/compiler/jit/jit_compiler.cc +++ b/compiler/jit/jit_compiler.cc @@ -178,7 +178,7 @@ JitCompiler::JitCompiler() : total_time_(0) { if (compiler_options_->GetGenerateDebugInfo()) { #ifdef __ANDROID__ - const char* prefix = GetAndroidData(); + const char* prefix = "/data/misc/trace"; #else const char* prefix = "/tmp"; #endif @@ -187,7 +187,8 @@ JitCompiler::JitCompiler() : total_time_(0) { std::string perf_filename = std::string(prefix) + "/perf-" + std::to_string(getpid()) + ".map"; perf_file_.reset(OS::CreateEmptyFileWriteOnly(perf_filename.c_str())); if (perf_file_ == nullptr) { - LOG(FATAL) << "Could not create perf file at " << perf_filename; + LOG(ERROR) << "Could not create perf file at " << perf_filename << + " Are you on a user build? Perf only works on userdebug/eng builds"; } } } @@ -222,7 +223,7 @@ bool JitCompiler::CompileMethod(Thread* self, ArtMethod* method) { ArtMethod* method_to_compile = method->GetInterfaceMethodIfProxy(sizeof(void*)); JitCodeCache* const code_cache = runtime->GetJit()->GetCodeCache(); success = compiler_driver_->GetCompiler()->JitCompile(self, code_cache, method_to_compile); - if (success && compiler_options_->GetGenerateDebugInfo()) { + if (success && perf_file_ != nullptr) { const void* ptr = method_to_compile->GetEntryPointFromQuickCompiledCode(); std::ostringstream stream; stream << std::hex |