diff options
author | Sebastien Hertz <shertz@google.com> | 2015-04-02 11:11:19 +0200 |
---|---|---|
committer | Sebastien Hertz <shertz@google.com> | 2015-04-03 09:31:59 +0200 |
commit | 2fd7e69505195cda4caaa3161aaf37315552a698 (patch) | |
tree | 2bd681443ad36a8616f237a12e56ecbdb7054f8e /runtime/transaction.cc | |
parent | c6e949a6d93fae2351fc59ed825657adee8185dc (diff) | |
download | art-2fd7e69505195cda4caaa3161aaf37315552a698.zip art-2fd7e69505195cda4caaa3161aaf37315552a698.tar.gz art-2fd7e69505195cda4caaa3161aaf37315552a698.tar.bz2 |
Use specific exception class to abort transaction
We used to throw a java.lang.InternalError when aborting a
transaction (when preinitializing image classes at compilation time).
We now use dedicated class dalvik.system.TransactionAbortError that
is only thrown by the compiler to abort a transaction. This class has
constructors taking a java.lang.Throwable "cause" so we can wrap
exceptions causing the transaction to abort (for instance class
java.lang.ClassNotFoundException) and give more information about the
cause of the transaction abort.
Bug: 20019689
Change-Id: I019a72a1c754d8bba6a7ad6bb0f02e4fd6668622
Diffstat (limited to 'runtime/transaction.cc')
-rw-r--r-- | runtime/transaction.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/runtime/transaction.cc b/runtime/transaction.cc index 186cfea..5b8d23b 100644 --- a/runtime/transaction.cc +++ b/runtime/transaction.cc @@ -60,8 +60,8 @@ Transaction::~Transaction() { void Transaction::Abort(const std::string& abort_message) { MutexLock mu(Thread::Current(), log_lock_); - // We may abort more than once if the java.lang.InternalError thrown at the - // time of the abort has been caught during execution of a class initializer. + // We may abort more than once if the exception thrown at the time of the + // previous abort has been caught during execution of a class initializer. // We just keep the message of the first abort because it will cause the // transaction to be rolled back anyway. if (!aborted_) { @@ -70,16 +70,17 @@ void Transaction::Abort(const std::string& abort_message) { } } -void Transaction::ThrowInternalError(Thread* self, bool rethrow) { +void Transaction::ThrowAbortError(Thread* self, bool rethrow) { if (kIsDebugBuild && rethrow) { - CHECK(IsAborted()) << "Rethrow InternalError while transaction is not aborted"; + CHECK(IsAborted()) << "Rethrow " << Transaction::kAbortExceptionDescriptor + << " while transaction is not aborted"; } std::string abort_msg(GetAbortMessage()); // Temporary workaround for b/20019689. if (self->IsExceptionPending()) { self->ClearException(); } - self->ThrowNewException("Ljava/lang/InternalError;", abort_msg.c_str()); + self->ThrowNewException(Transaction::kAbortExceptionSignature, abort_msg.c_str()); } bool Transaction::IsAborted() { |