Revert "Revert "Store resolved Strings for AOT code in .bss.""
Fixed oat_test to keep dex files alive. Fixed mips build.
Rewritten the .bss GC root visiting and added write barrier
to the artResolveStringFromCode().
Test: build aosp_mips-eng
Test: m ART_DEFAULT_GC_TYPE=SS test-art-target-host-gtest-oat_test
Test: Run ART test suite on host and Nexus 9.
Bug: 20323084
Bug: 30627598
This reverts commit 5f926055cb88089d8ca27243f35a9dfd89d981f0.
Change-Id: I07fa2278d82b8eb64964c9a4b66cb93726ccda6b
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index 1ddf961..abdbbb5 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -523,8 +523,6 @@
compiled_methods_zip_filename_(nullptr),
compiled_methods_filename_(nullptr),
passes_to_run_filename_(nullptr),
- app_image_(false),
- boot_image_(false),
multi_image_(false),
is_host_(false),
class_loader_(nullptr),
@@ -691,8 +689,8 @@
}
void ProcessOptions(ParserOptions* parser_options) {
- boot_image_ = !image_filenames_.empty();
- app_image_ = app_image_fd_ != -1 || !app_image_file_name_.empty();
+ compiler_options_->boot_image_ = !image_filenames_.empty();
+ compiler_options_->app_image_ = app_image_fd_ != -1 || !app_image_file_name_.empty();
if (IsAppImage() && IsBootImage()) {
Usage("Can't have both --image and (--app-image-fd or --app-image-file)");
@@ -744,7 +742,7 @@
android_root_ += android_root_env_var;
}
- if (!boot_image_ && parser_options->boot_image_filename.empty()) {
+ if (!IsBootImage() && parser_options->boot_image_filename.empty()) {
parser_options->boot_image_filename += android_root_;
parser_options->boot_image_filename += "/framework/boot.art";
}
@@ -1327,7 +1325,7 @@
}
void LoadClassProfileDescriptors() {
- if (profile_compilation_info_ != nullptr && app_image_) {
+ if (profile_compilation_info_ != nullptr && IsAppImage()) {
Runtime* runtime = Runtime::Current();
CHECK(runtime != nullptr);
std::set<DexCacheResolvedClasses> resolved_classes(
@@ -1634,8 +1632,6 @@
compiler_kind_,
instruction_set_,
instruction_set_features_.get(),
- IsBootImage(),
- IsAppImage(),
image_classes_.release(),
compiled_classes_.release(),
compiled_methods_.release(),
@@ -1726,7 +1722,7 @@
}
if (IsImage()) {
- if (app_image_ && image_base_ == 0) {
+ if (IsAppImage() && image_base_ == 0) {
gc::Heap* const heap = Runtime::Current()->GetHeap();
for (gc::space::ImageSpace* image_space : heap->GetBootImageSpaces()) {
image_base_ = std::max(image_base_, RoundUp(
@@ -1794,7 +1790,10 @@
size_t rodata_size = oat_writer->GetOatHeader().GetExecutableOffset();
size_t text_size = oat_writer->GetOatSize() - rodata_size;
- elf_writer->SetLoadedSectionSizes(rodata_size, text_size, oat_writer->GetBssSize());
+ elf_writer->PrepareDynamicSection(rodata_size,
+ text_size,
+ oat_writer->GetBssSize(),
+ oat_writer->GetBssRootsOffset());
if (IsImage()) {
// Update oat layout.
@@ -1977,11 +1976,11 @@
}
bool IsAppImage() const {
- return app_image_;
+ return compiler_options_->IsAppImage();
}
bool IsBootImage() const {
- return boot_image_;
+ return compiler_options_->IsBootImage();
}
bool IsHost() const {
@@ -2575,8 +2574,6 @@
std::unique_ptr<std::unordered_set<std::string>> compiled_classes_;
std::unique_ptr<std::unordered_set<std::string>> compiled_methods_;
std::unique_ptr<std::vector<std::string>> passes_to_run_;
- bool app_image_;
- bool boot_image_;
bool multi_image_;
bool is_host_;
std::string android_root_;