From 0c61be4f9f7b4baaa6ea7c12ba1c8492a7bc14f5 Mon Sep 17 00:00:00 2001 From: Chris Wailes Date: Wed, 26 Sep 2018 17:27:34 -0700 Subject: Implemented a new method for walking string references in AppImages. * Defined a new section in the AppImage binary format. * Verify heap invariants having to do with native string references. * Collect managed and native references to managed strings. * Record the location of these references as offsets into the image. * Writes offsets into new image section. * Walk this list of offsets at load time to intern strings from the AppImage. * Verify that strings have been interned correctly. Test: art/test/testrunner/testrunner.py -b --host Test: m test-art-host-gtest Test: Built and ran Keep, Docs, Chrome, YouTube, and Facebook. Bug: 70734839 Change-Id: Ib5235abdebca018e8920d12318c31b9c0efb0ede --- compiler/driver/compiler_driver.cc | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'compiler/driver/compiler_driver.cc') diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc index 95d08b3c64..9585a15c8c 100644 --- a/compiler/driver/compiler_driver.cc +++ b/compiler/driver/compiler_driver.cc @@ -2157,10 +2157,9 @@ class InitializeClassVisitor : public CompilationVisitor { // Otherwise it's in app image but superclasses can't be initialized, no need to proceed. old_status = klass->GetStatus(); - bool too_many_encoded_fields = false; - if (!is_boot_image && klass->NumStaticFields() > kMaxEncodedFields) { - too_many_encoded_fields = true; - } + bool too_many_encoded_fields = !is_boot_image && + klass->NumStaticFields() > kMaxEncodedFields; + // If the class was not initialized, we can proceed to see if we can initialize static // fields. Limit the max number of encoded fields. if (!klass->IsInitialized() && @@ -2210,9 +2209,13 @@ class InitializeClassVisitor : public CompilationVisitor { if (success) { runtime->ExitTransactionMode(); DCHECK(!runtime->IsActiveTransaction()); - } - if (!success) { + if (is_boot_image) { + // For boot image, we want to put the updated status in the oat class since we + // can't reject the image anyways. + old_status = klass->GetStatus(); + } + } else { CHECK(soa.Self()->IsExceptionPending()); mirror::Throwable* exception = soa.Self()->GetException(); VLOG(compiler) << "Initialization of " << descriptor << " aborted because of " @@ -2226,10 +2229,6 @@ class InitializeClassVisitor : public CompilationVisitor { soa.Self()->ClearException(); runtime->RollbackAllTransactions(); 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 - // reject the image anyways. - old_status = klass->GetStatus(); } } -- cgit v1.2.3-59-g8ed1b