Remove unused image space order argument
Bug: 160683548
Test: Treehugger
Change-Id: I249d2891b645fa103106ee946f014b9ce362cbda
diff --git a/dex2oat/dex2oat_image_test.cc b/dex2oat/dex2oat_image_test.cc
index 093d01d..62d0e83 100644
--- a/dex2oat/dex2oat_image_test.cc
+++ b/dex2oat/dex2oat_image_test.cc
@@ -424,7 +424,6 @@
/*boot_class_path_locations=*/ libcore_dex_files,
image_location,
kRuntimeISA,
- gc::space::ImageSpaceLoadingOrder::kSystemFirst,
relocate,
/*executable=*/ true,
/*is_zygote=*/ false,
diff --git a/runtime/dexopt_test.cc b/runtime/dexopt_test.cc
index 8ba6f3e..cfd7f91 100644
--- a/runtime/dexopt_test.cc
+++ b/runtime/dexopt_test.cc
@@ -156,7 +156,6 @@
ArrayRef<const std::string>(Runtime::Current()->GetBootClassPathLocations()),
ArrayRef<const std::string>(Runtime::Current()->GetBootClassPath()),
kRuntimeISA,
- gc::space::ImageSpaceLoadingOrder::kSystemFirst,
&error_msg);
ASSERT_EQ(!with_alternate_image, match) << error_msg;
}
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index 84d0351..d83cdaf 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -244,8 +244,7 @@
bool use_generational_cc,
uint64_t min_interval_homogeneous_space_compaction_by_oom,
bool dump_region_info_before_gc,
- bool dump_region_info_after_gc,
- space::ImageSpaceLoadingOrder image_space_loading_order)
+ bool dump_region_info_after_gc)
: non_moving_space_(nullptr),
rosalloc_space_(nullptr),
dlmalloc_space_(nullptr),
@@ -419,7 +418,6 @@
boot_class_path_locations,
image_file_name,
image_instruction_set,
- image_space_loading_order,
runtime->ShouldRelocate(),
/*executable=*/ !runtime->IsAotCompiler(),
is_zygote,
diff --git a/runtime/gc/heap.h b/runtime/gc/heap.h
index 65d0837..7aff143 100644
--- a/runtime/gc/heap.h
+++ b/runtime/gc/heap.h
@@ -35,7 +35,6 @@
#include "gc/collector/iteration.h"
#include "gc/collector_type.h"
#include "gc/gc_cause.h"
-#include "gc/space/image_space_loading_order.h"
#include "gc/space/large_object_space.h"
#include "handle.h"
#include "obj_ptr.h"
@@ -225,8 +224,7 @@
bool use_generational_cc,
uint64_t min_interval_homogeneous_space_compaction_by_oom,
bool dump_region_info_before_gc,
- bool dump_region_info_after_gc,
- space::ImageSpaceLoadingOrder image_space_loading_order);
+ bool dump_region_info_after_gc);
~Heap();
diff --git a/runtime/gc/space/image_space.cc b/runtime/gc/space/image_space.cc
index a91a6ec..a76e366 100644
--- a/runtime/gc/space/image_space.cc
+++ b/runtime/gc/space/image_space.cc
@@ -2425,18 +2425,15 @@
return cache_filename_;
}
- bool LoadFromSystem(bool validate_oat_file,
- size_t extra_reservation_size,
+ bool LoadFromSystem(size_t extra_reservation_size,
/*out*/std::vector<std::unique_ptr<ImageSpace>>* boot_image_spaces,
/*out*/MemMap* extra_reservation,
/*out*/std::string* error_msg) REQUIRES_SHARED(Locks::mutator_lock_);
- bool LoadFromDalvikCache(
- bool validate_oat_file,
- size_t extra_reservation_size,
- /*out*/std::vector<std::unique_ptr<ImageSpace>>* boot_image_spaces,
- /*out*/MemMap* extra_reservation,
- /*out*/std::string* error_msg) REQUIRES_SHARED(Locks::mutator_lock_);
+ bool LoadFromDalvikCache(size_t extra_reservation_size,
+ /*out*/std::vector<std::unique_ptr<ImageSpace>>* boot_image_spaces,
+ /*out*/MemMap* extra_reservation,
+ /*out*/std::string* error_msg) REQUIRES_SHARED(Locks::mutator_lock_);
private:
bool LoadImage(
@@ -3305,7 +3302,6 @@
};
bool ImageSpace::BootImageLoader::LoadFromSystem(
- bool validate_oat_file,
size_t extra_reservation_size,
/*out*/std::vector<std::unique_ptr<ImageSpace>>* boot_image_spaces,
/*out*/MemMap* extra_reservation,
@@ -3318,7 +3314,7 @@
}
if (!LoadImage(layout,
- validate_oat_file,
+ /*validate_oat_file=*/ false,
extra_reservation_size,
&logger,
boot_image_spaces,
@@ -3336,7 +3332,6 @@
}
bool ImageSpace::BootImageLoader::LoadFromDalvikCache(
- bool validate_oat_file,
size_t extra_reservation_size,
/*out*/std::vector<std::unique_ptr<ImageSpace>>* boot_image_spaces,
/*out*/MemMap* extra_reservation,
@@ -3349,7 +3344,7 @@
return false;
}
if (!LoadImage(layout,
- validate_oat_file,
+ /*validate_oat_file=*/ true,
extra_reservation_size,
&logger,
boot_image_spaces,
@@ -3372,7 +3367,6 @@
ArrayRef<const std::string>(runtime->GetBootClassPath()),
ArrayRef<const std::string>(runtime->GetBootClassPathLocations()));
const std::string image_location = layout.GetPrimaryImageLocation();
- ImageSpaceLoadingOrder order = runtime->GetImageSpaceLoadingOrder();
std::unique_ptr<ImageHeader> image_header;
std::string error_msg;
@@ -3391,9 +3385,7 @@
&has_cache,
&is_global_cache)) {
DCHECK(has_system || has_cache);
- const std::string& filename = (order == ImageSpaceLoadingOrder::kSystemFirst)
- ? (has_system ? system_filename : cache_filename)
- : (has_cache ? cache_filename : system_filename);
+ const std::string& filename = (has_system ? system_filename : cache_filename);
image_header = ReadSpecificImageHeader(filename.c_str(), &error_msg);
}
@@ -3405,7 +3397,6 @@
const std::vector<std::string>& boot_class_path_locations,
const std::string& image_location,
const InstructionSet image_isa,
- ImageSpaceLoadingOrder order,
bool relocate,
bool executable,
bool is_zygote,
@@ -3436,48 +3427,25 @@
// Collect all the errors.
std::vector<std::string> error_msgs;
- auto try_load_from = [&](auto has_fn, auto load_fn, bool validate_oat_file) {
- if ((loader.*has_fn)()) {
- std::string local_error_msg;
- if ((loader.*load_fn)(validate_oat_file,
- extra_reservation_size,
- boot_image_spaces,
- extra_reservation,
- &local_error_msg)) {
- return true;
- }
- error_msgs.push_back(local_error_msg);
- }
- return false;
- };
-
- auto try_load_from_system = [&]() {
- // Validate the oat files if the loading order checks data first. Otherwise assume system
- // integrity.
- return try_load_from(&BootImageLoader::HasSystem,
- &BootImageLoader::LoadFromSystem,
- /*validate_oat_file=*/ order != ImageSpaceLoadingOrder::kSystemFirst);
- };
- auto try_load_from_cache = [&]() {
- // Always validate oat files from the dalvik cache.
- return try_load_from(&BootImageLoader::HasCache,
- &BootImageLoader::LoadFromDalvikCache,
- /*validate_oat_file=*/ true);
- };
-
- auto invoke_sequentially = [](auto first, auto second) {
- return first() || second();
- };
-
- // Step 1+2: Check system and cache images in the asked-for order.
- if (order == ImageSpaceLoadingOrder::kSystemFirst) {
- if (invoke_sequentially(try_load_from_system, try_load_from_cache)) {
+ std::string error_msg;
+ if (loader.HasSystem()) {
+ if (loader.LoadFromSystem(extra_reservation_size,
+ boot_image_spaces,
+ extra_reservation,
+ &error_msg)) {
return true;
}
- } else {
- if (invoke_sequentially(try_load_from_cache, try_load_from_system)) {
+ error_msgs.push_back(error_msg);
+ }
+
+ if (loader.HasCache()) {
+ if (loader.LoadFromDalvikCache(extra_reservation_size,
+ boot_image_spaces,
+ extra_reservation,
+ &error_msg)) {
return true;
}
+ error_msgs.push_back(error_msg);
}
std::ostringstream oss;
@@ -3693,7 +3661,6 @@
ArrayRef<const std::string> boot_class_path_locations,
ArrayRef<const std::string> boot_class_path,
InstructionSet image_isa,
- ImageSpaceLoadingOrder order,
/*out*/std::string* error_msg) {
if (oat_checksums.empty() || oat_boot_class_path.empty()) {
*error_msg = oat_checksums.empty() ? "Empty checksums." : "Empty boot class path.";
@@ -3736,8 +3703,7 @@
}
DCHECK(has_system || has_cache);
- bool use_system = (order == ImageSpaceLoadingOrder::kSystemFirst) ? has_system : !has_cache;
- bool image_checksums_ok = use_system
+ bool image_checksums_ok = has_system
? layout.ValidateFromSystem(image_isa, &oat_checksums, error_msg)
: layout.ValidateFromDalvikCache(cache_filename, &oat_checksums, error_msg);
if (!image_checksums_ok) {
diff --git a/runtime/gc/space/image_space.h b/runtime/gc/space/image_space.h
index 4ddc519..81ae724 100644
--- a/runtime/gc/space/image_space.h
+++ b/runtime/gc/space/image_space.h
@@ -19,7 +19,6 @@
#include "gc/accounting/space_bitmap.h"
#include "image.h"
-#include "image_space_loading_order.h"
#include "space.h"
namespace art {
@@ -83,8 +82,7 @@
// <search-path>/*
// *
// where the second form means that the path of a particular BCP component
- // should be used to search for that component's boot image extension. These
- // paths will be searched in the specifed order.
+ // should be used to search for that component's boot image extension.
//
// The actual filename shall be derived from the specified locations using
// `GetSystemImageFilename()` or `GetDalvikCacheFilename()`.
@@ -128,7 +126,6 @@
const std::vector<std::string>& boot_class_path_locations,
const std::string& image_location,
const InstructionSet image_isa,
- ImageSpaceLoadingOrder order,
bool relocate,
bool executable,
bool is_zygote,
@@ -237,7 +234,6 @@
ArrayRef<const std::string> boot_class_path_locations,
ArrayRef<const std::string> boot_class_path,
InstructionSet image_isa,
- ImageSpaceLoadingOrder order,
/*out*/std::string* error_msg);
// Returns whether the oat checksums and boot class path description are valid
diff --git a/runtime/gc/space/image_space_loading_order.h b/runtime/gc/space/image_space_loading_order.h
deleted file mode 100644
index d8b0be4..0000000
--- a/runtime/gc/space/image_space_loading_order.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ART_RUNTIME_GC_SPACE_IMAGE_SPACE_LOADING_ORDER_H_
-#define ART_RUNTIME_GC_SPACE_IMAGE_SPACE_LOADING_ORDER_H_
-
-namespace art {
-namespace gc {
-namespace space {
-
-enum class ImageSpaceLoadingOrder : char {
- kSystemFirst,
- kDataFirst,
-};
-
-} // namespace space
-} // namespace gc
-} // namespace art
-
-#endif // ART_RUNTIME_GC_SPACE_IMAGE_SPACE_LOADING_ORDER_H_
diff --git a/runtime/gc/space/image_space_test.cc b/runtime/gc/space/image_space_test.cc
index 02b959c..25f2198 100644
--- a/runtime/gc/space/image_space_test.cc
+++ b/runtime/gc/space/image_space_test.cc
@@ -138,7 +138,6 @@
bcp_locations,
full_image_locations,
kRuntimeISA,
- ImageSpaceLoadingOrder::kSystemFirst,
/*relocate=*/ false,
/*executable=*/ true,
/*is_zygote=*/ false,
@@ -340,7 +339,6 @@
ArrayRef<const std::string>(bcp_locations),
ArrayRef<const std::string>(bcp),
kRuntimeISA,
- gc::space::ImageSpaceLoadingOrder::kSystemFirst,
&error_msg);
};
diff --git a/runtime/oat_file_assistant.cc b/runtime/oat_file_assistant.cc
index 017b102..8e8dc89 100644
--- a/runtime/oat_file_assistant.cc
+++ b/runtime/oat_file_assistant.cc
@@ -621,7 +621,6 @@
ArrayRef<const std::string>(runtime->GetBootClassPathLocations()),
ArrayRef<const std::string>(runtime->GetBootClassPath()),
isa_,
- runtime->GetImageSpaceLoadingOrder(),
&error_msg);
if (!result) {
VLOG(oat) << "Failed to verify checksums of oat file " << oat_file.GetLocation()
diff --git a/runtime/parsed_options.cc b/runtime/parsed_options.cc
index a148854..8af4f4f 100644
--- a/runtime/parsed_options.cc
+++ b/runtime/parsed_options.cc
@@ -173,11 +173,6 @@
.Define("-Xbootclasspath-locations:_")
.WithType<ParseStringList<':'>>() // std::vector<std::string>, split by :
.IntoKey(M::BootClassPathLocations)
- .Define("-Ximage-load-order:_")
- .WithType<gc::space::ImageSpaceLoadingOrder>()
- .WithValueMap({{"system", gc::space::ImageSpaceLoadingOrder::kSystemFirst},
- {"data", gc::space::ImageSpaceLoadingOrder::kDataFirst}})
- .IntoKey(M::ImageSpaceLoadingOrder)
.Define("-Xjniopts:forcecopy")
.IntoKey(M::JniOptsForceCopy)
.Define("-XjdwpProvider:_")
diff --git a/runtime/parsed_options.h b/runtime/parsed_options.h
index f489b07..608805b 100644
--- a/runtime/parsed_options.h
+++ b/runtime/parsed_options.h
@@ -25,7 +25,6 @@
#include "arch/instruction_set.h"
#include "gc/collector_type.h"
-#include "gc/space/image_space_loading_order.h"
#include "gc/space/large_object_space.h"
// #include "jit/profile_saver_options.h"
#include "runtime_globals.h"
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 95c40b4..70e3ae3 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -1380,8 +1380,6 @@
// Generational CC collection is currently only compatible with Baker read barriers.
bool use_generational_cc = kUseBakerReadBarrier && xgc_option.generational_cc;
- image_space_loading_order_ = runtime_options.GetOrDefault(Opt::ImageSpaceLoadingOrder);
-
heap_ = new gc::Heap(runtime_options.GetOrDefault(Opt::MemoryInitialSize),
runtime_options.GetOrDefault(Opt::HeapGrowthLimit),
runtime_options.GetOrDefault(Opt::HeapMinFree),
@@ -1421,8 +1419,7 @@
use_generational_cc,
runtime_options.GetOrDefault(Opt::HSpaceCompactForOOMMinIntervalsMs),
runtime_options.Exists(Opt::DumpRegionInfoBeforeGC),
- runtime_options.Exists(Opt::DumpRegionInfoAfterGC),
- image_space_loading_order_);
+ runtime_options.Exists(Opt::DumpRegionInfoAfterGC));
dump_gc_performance_on_shutdown_ = runtime_options.Exists(Opt::DumpGCPerformanceOnShutdown);
diff --git a/runtime/runtime.h b/runtime/runtime.h
index 9eef7a2..0746130 100644
--- a/runtime/runtime.h
+++ b/runtime/runtime.h
@@ -35,7 +35,6 @@
#include "deoptimization_kind.h"
#include "dex/dex_file_types.h"
#include "experimental_flags.h"
-#include "gc/space/image_space_loading_order.h"
#include "gc_root.h"
#include "instrumentation.h"
#include "jdwp_provider.h"
@@ -965,10 +964,6 @@
// Return true if startup is already completed.
bool GetStartupCompleted() const;
- gc::space::ImageSpaceLoadingOrder GetImageSpaceLoadingOrder() const {
- return image_space_loading_order_;
- }
-
bool IsVerifierMissingKThrowFatal() const {
return verifier_missing_kthrow_fatal_;
}
@@ -1331,9 +1326,6 @@
// If startup has completed, must happen at most once.
std::atomic<bool> startup_completed_ = false;
- gc::space::ImageSpaceLoadingOrder image_space_loading_order_ =
- gc::space::ImageSpaceLoadingOrder::kSystemFirst;
-
bool verifier_missing_kthrow_fatal_;
bool perfetto_hprof_enabled_;
diff --git a/runtime/runtime_options.def b/runtime/runtime_options.def
index 53d15bf..28d4744 100644
--- a/runtime/runtime_options.def
+++ b/runtime/runtime_options.def
@@ -165,10 +165,6 @@
RUNTIME_OPTIONS_KEY (Unit, OnlyUseSystemOatFiles)
RUNTIME_OPTIONS_KEY (unsigned int, VerifierLoggingThreshold, 100)
-RUNTIME_OPTIONS_KEY (gc::space::ImageSpaceLoadingOrder, \
- ImageSpaceLoadingOrder, \
- gc::space::ImageSpaceLoadingOrder::kSystemFirst)
-
RUNTIME_OPTIONS_KEY (bool, FastClassNotFoundException, true)
RUNTIME_OPTIONS_KEY (bool, VerifierMissingKThrowFatal, true)
diff --git a/runtime/runtime_options.h b/runtime/runtime_options.h
index abc1fc0..8fec9ea 100644
--- a/runtime/runtime_options.h
+++ b/runtime/runtime_options.h
@@ -26,7 +26,6 @@
#include "base/variant_map.h"
#include "cmdline_types.h" // TODO: don't need to include this file here
#include "gc/collector_type.h"
-#include "gc/space/image_space_loading_order.h"
#include "gc/space/large_object_space.h"
#include "hidden_api.h"
#include "jit/jit.h"