diff options
author | 2018-09-26 17:27:34 -0700 | |
---|---|---|
committer | 2018-10-04 12:47:40 -0700 | |
commit | 0c61be4f9f7b4baaa6ea7c12ba1c8492a7bc14f5 (patch) | |
tree | 2732f14759bfcd06bd8bf872c27a8c42b38e79ef /compiler/driver/compiler_driver.cc | |
parent | 2386636e0330051a96fe7d577524e929d81e9ba8 (diff) |
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
Diffstat (limited to 'compiler/driver/compiler_driver.cc')
-rw-r--r-- | compiler/driver/compiler_driver.cc | 19 |
1 files changed, 9 insertions, 10 deletions
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(); } } |