summaryrefslogtreecommitdiff
path: root/compiler/driver/compiler_driver.cc
diff options
context:
space:
mode:
author Mathieu Chartier <mathieuc@google.com> 2017-07-24 21:00:39 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2017-07-24 21:00:39 +0000
commitb67d0c0fcef5e76e579246d48ec005fe31e64f97 (patch)
tree343117b8181faeed565ff244c5dedc9d0a8d1775 /compiler/driver/compiler_driver.cc
parent2ae4bc9f5b620bc768e4ae2ecab641a06a488a70 (diff)
parentcade5c3c75588da6d873df727acdaf3378a66efa (diff)
Merge changes I87b3fcb3,I971edf31,I5218a57c
* changes: Track class initializing in transaction Move transaction creation to runtime Test case for clinit support in app image
Diffstat (limited to 'compiler/driver/compiler_driver.cc')
-rw-r--r--compiler/driver/compiler_driver.cc12
1 files changed, 7 insertions, 5 deletions
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index cf04e41d5c..dd58bc7d13 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -2331,10 +2331,8 @@ class InitializeClassVisitor : public CompilationVisitor {
// a ReaderWriterMutex but we're holding the mutator lock so we fail mutex sanity
// checks in Thread::AssertThreadSuspensionIsAllowable.
Runtime* const runtime = Runtime::Current();
- Transaction transaction;
-
// Run the class initializer in transaction mode.
- runtime->EnterTransactionMode(&transaction);
+ runtime->EnterTransactionMode(klass.Get());
bool success = manager_->GetClassLinker()->EnsureInitialized(soa.Self(), klass, true,
true);
// TODO we detach transaction from runtime to indicate we quit the transactional
@@ -2343,7 +2341,11 @@ class InitializeClassVisitor : public CompilationVisitor {
{
ScopedAssertNoThreadSuspension ants("Transaction end");
- runtime->ExitTransactionMode();
+
+ if (success) {
+ runtime->ExitTransactionMode();
+ DCHECK(!runtime->IsActiveTransaction());
+ }
if (!success) {
CHECK(soa.Self()->IsExceptionPending());
@@ -2357,7 +2359,7 @@ class InitializeClassVisitor : public CompilationVisitor {
*file_log << exception->Dump() << "\n";
}
soa.Self()->ClearException();
- transaction.Rollback();
+ runtime->RollbackAndExitTransactionMode();
CHECK_EQ(old_status, klass->GetStatus()) << "Previous class status not restored";
} else if (is_boot_image) {
// For boot image, we want to put the updated status in the oat class since we can't