diff options
author | 2018-11-28 08:27:27 -0800 | |
---|---|---|
committer | 2018-12-06 11:37:19 -0800 | |
commit | 44f67607b33e36c118fe0f62c062865b2bc8bd8f (patch) | |
tree | a17f7b4a6f7affe866377ac5ee7924195ef8fbe5 /runtime/runtime_common.cc | |
parent | 7fbc4a59ba2e60d869313d7961662430df83b2cb (diff) |
ART: Rewrite Runtime fault message to be lock-free
To avoid the lock in a general header, rewrite the fault message
(that is almost unused) to be lock-free. Store the string as a
heap object owned by Runtime.
Bug: 119869270
Test: mmma art
Test: m test-art-host
Change-Id: Ib1e027a1543c46d25953119f05792f0e874d6a3d
Diffstat (limited to 'runtime/runtime_common.cc')
-rw-r--r-- | runtime/runtime_common.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/runtime/runtime_common.cc b/runtime/runtime_common.cc index eae2505ce9..5676577696 100644 --- a/runtime/runtime_common.cc +++ b/runtime/runtime_common.cc @@ -371,6 +371,11 @@ static bool IsTimeoutSignal(int signal_number) { #pragma GCC diagnostic ignored "-Wframe-larger-than=" #endif +std::string GetFaultMessageForAbortLogging() { + Runtime* runtime = Runtime::Current(); + return (runtime != nullptr) ? runtime->GetFaultMessage() : ""; +} + static void HandleUnexpectedSignalCommonDump(int signal_number, siginfo_t* info, void* raw_context, @@ -427,9 +432,9 @@ static void HandleUnexpectedSignalCommonDump(int signal_number, } if (dump_on_stderr) { - std::cerr << "Fault message: " << runtime->GetFaultMessage() << std::endl; + std::cerr << "Fault message: " << GetFaultMessageForAbortLogging() << std::endl; } else { - LOG(FATAL_WITHOUT_ABORT) << "Fault message: " << runtime->GetFaultMessage(); + LOG(FATAL_WITHOUT_ABORT) << "Fault message: " << GetFaultMessageForAbortLogging(); } } } |