From bd9cf9f6bbf285ec7a5b74ce655a9e68e0f6e434 Mon Sep 17 00:00:00 2001 From: Sebastien Hertz Date: Tue, 3 Mar 2015 12:16:13 +0100 Subject: Follow-up 128393 Avoids false warning when initializing the exception's class by marking the transaction aborted after throwing the InternalError exception. Also uses VLOG(compiler) to print the warning since it's only useful when investigating ahead-of-time class initialization. Bug: 19202032 Change-Id: I3c53639cbb888086ad345d668d1e5b73c5aaf861 --- runtime/runtime.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'runtime/runtime.cc') diff --git a/runtime/runtime.cc b/runtime/runtime.cc index 8c5827c..824d65f 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -1560,15 +1560,17 @@ void Runtime::AbortTransactionAndThrowInternalError(Thread* self, const std::string& abort_message) { DCHECK(IsCompiler()); DCHECK(IsActiveTransaction()); + // Throwing an exception may cause its class initialization. If we mark the transaction + // aborted before that, we may warn with a false alarm. Throwing the exception before + // marking the transaction aborted avoids that. + preinitialization_transaction_->ThrowInternalError(self, false); preinitialization_transaction_->Abort(abort_message); - ThrowInternalErrorForAbortedTransaction(self); } void Runtime::ThrowInternalErrorForAbortedTransaction(Thread* self) { DCHECK(IsCompiler()); DCHECK(IsActiveTransaction()); - DCHECK(IsTransactionAborted()); - preinitialization_transaction_->ThrowInternalError(self); + preinitialization_transaction_->ThrowInternalError(self, true); } void Runtime::RecordWriteFieldBoolean(mirror::Object* obj, MemberOffset field_offset, -- cgit v1.1