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
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index 95d08b3..9585a15 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -2157,10 +2157,9 @@
// 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 @@
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 @@
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();
}
}