diff options
author | 2021-11-12 12:45:23 +0000 | |
---|---|---|
committer | 2021-11-15 09:53:15 +0000 | |
commit | 483c41a99b8f0b63cbdcac9f1cd1f2dcb5756b0c (patch) | |
tree | 0607ab807d82679a1097a24461a955909ba61dfe | |
parent | 9575c124c3d77e9f07e8c101571776ac9270af83 (diff) |
ART: Use core image to speed up some gtests.
Host timing of
art_compiler_tests --no_isolate --gtest_filter='<pattern>'
for different patterns:
"ms total" before after
LoadStoreEliminationTest* 16945 4750
LoadStoreAnalysisTest* 2647 689
ReferenceTypePropagationTest* 13542 3929
InstructionSimplifierTest* 1452 406
Host timing of
art_runtime_tests --no_isolate --gtest_filter='<pattern>'
for different patterns:
"ms total" before after
RegType*Test* 2976 1675
DexCacheTest* 265 74
JavaVmExtTest* 785 230
Host timing of
art_libartbase_tests --no_isolate --gtest_filter='<pattern>'
for different patterns:
"ms total" before after
FlagsTests* 691 214
Host timing of
art_dex2oat_tests --no_isolate --gtest_filter='<pattern>'
for different patterns:
"ms total" before after
VerifierDepsTest* 3567 874
Test: m test-art-host-gtest
Change-Id: I20df90e3d38aaa286e22ba070c7845bcb09e3bca
-rw-r--r-- | compiler/optimizing/instruction_simplifier_test.cc | 4 | ||||
-rw-r--r-- | compiler/optimizing/load_store_analysis_test.cc | 4 | ||||
-rw-r--r-- | compiler/optimizing/load_store_elimination_test.cc | 4 | ||||
-rw-r--r-- | compiler/optimizing/reference_type_propagation_test.cc | 4 | ||||
-rw-r--r-- | dex2oat/verifier_deps_test.cc | 4 | ||||
-rw-r--r-- | libartbase/base/flags_test.cc | 4 | ||||
-rw-r--r-- | runtime/common_runtime_test.cc | 11 | ||||
-rw-r--r-- | runtime/common_runtime_test.h | 2 | ||||
-rw-r--r-- | runtime/jni/java_vm_ext_test.cc | 4 | ||||
-rw-r--r-- | runtime/mirror/dex_cache_test.cc | 7 | ||||
-rw-r--r-- | runtime/transaction_test.cc | 5 | ||||
-rw-r--r-- | runtime/verifier/reg_type_test.cc | 7 |
12 files changed, 51 insertions, 9 deletions
diff --git a/compiler/optimizing/instruction_simplifier_test.cc b/compiler/optimizing/instruction_simplifier_test.cc index 2063eedb28..c7c5b12e25 100644 --- a/compiler/optimizing/instruction_simplifier_test.cc +++ b/compiler/optimizing/instruction_simplifier_test.cc @@ -36,6 +36,10 @@ class Throwable; template<typename SuperClass> class InstructionSimplifierTestBase : public SuperClass, public OptimizingUnitTestHelper { public: + InstructionSimplifierTestBase() { + this->use_boot_image_ = true; // Make the Runtime creation cheaper. + } + void SetUp() override { SuperClass::SetUp(); gLogVerbosity.compiler = true; diff --git a/compiler/optimizing/load_store_analysis_test.cc b/compiler/optimizing/load_store_analysis_test.cc index c6d22087f7..3c26c8d6ce 100644 --- a/compiler/optimizing/load_store_analysis_test.cc +++ b/compiler/optimizing/load_store_analysis_test.cc @@ -40,7 +40,9 @@ namespace art { class LoadStoreAnalysisTest : public CommonCompilerTest, public OptimizingUnitTestHelper { public: - LoadStoreAnalysisTest() {} + LoadStoreAnalysisTest() { + use_boot_image_ = true; // Make the Runtime creation cheaper. + } AdjacencyListGraph SetupFromAdjacencyList( const std::string_view entry_name, diff --git a/compiler/optimizing/load_store_elimination_test.cc b/compiler/optimizing/load_store_elimination_test.cc index 812a32aeec..7d68c9fe11 100644 --- a/compiler/optimizing/load_store_elimination_test.cc +++ b/compiler/optimizing/load_store_elimination_test.cc @@ -48,6 +48,10 @@ namespace art { template <typename SuperTest> class LoadStoreEliminationTestBase : public SuperTest, public OptimizingUnitTestHelper { public: + LoadStoreEliminationTestBase() { + this->use_boot_image_ = true; // Make the Runtime creation cheaper. + } + void SetUp() override { SuperTest::SetUp(); gLogVerbosity.compiler = true; diff --git a/compiler/optimizing/reference_type_propagation_test.cc b/compiler/optimizing/reference_type_propagation_test.cc index d90567ae7e..d1bcab083c 100644 --- a/compiler/optimizing/reference_type_propagation_test.cc +++ b/compiler/optimizing/reference_type_propagation_test.cc @@ -39,7 +39,9 @@ constexpr bool kUseTrueRandomness = false; template<typename SuperTest> class ReferenceTypePropagationTestBase : public SuperTest, public OptimizingUnitTestHelper { public: - ReferenceTypePropagationTestBase() : graph_(nullptr), propagation_(nullptr) { } + ReferenceTypePropagationTestBase() : graph_(nullptr), propagation_(nullptr) { + this->use_boot_image_ = true; // Make the Runtime creation cheaper. + } ~ReferenceTypePropagationTestBase() { } diff --git a/dex2oat/verifier_deps_test.cc b/dex2oat/verifier_deps_test.cc index 62eae8a770..708af04390 100644 --- a/dex2oat/verifier_deps_test.cc +++ b/dex2oat/verifier_deps_test.cc @@ -58,6 +58,10 @@ class VerifierDepsCompilerCallbacks : public CompilerCallbacks { class VerifierDepsTest : public CommonCompilerDriverTest { public: + VerifierDepsTest() { + this->use_boot_image_ = true; // Make the Runtime creation cheaper. + } + void SetUpRuntimeOptions(RuntimeOptions* options) override { CommonCompilerTest::SetUpRuntimeOptions(options); callbacks_.reset(new VerifierDepsCompilerCallbacks()); diff --git a/libartbase/base/flags_test.cc b/libartbase/base/flags_test.cc index 7cc2890232..abc8f22e19 100644 --- a/libartbase/base/flags_test.cc +++ b/libartbase/base/flags_test.cc @@ -98,6 +98,10 @@ class TestFlag { class FlagsTests : public CommonRuntimeTest { protected: + FlagsTests() { + this->use_boot_image_ = true; // Make the Runtime creation cheaper. + } + // We need to initialize the flag after the ScratchDir is created // but before we configure the runtime options (so that we can get // the right name for the config). diff --git a/runtime/common_runtime_test.cc b/runtime/common_runtime_test.cc index 4eb34083d1..3f643e8db8 100644 --- a/runtime/common_runtime_test.cc +++ b/runtime/common_runtime_test.cc @@ -71,7 +71,11 @@ using android::base::StringPrintf; static bool unstarted_initialized_ = false; CommonRuntimeTestImpl::CommonRuntimeTestImpl() - : class_linker_(nullptr), java_lang_dex_file_(nullptr) { + : class_linker_(nullptr), + java_lang_dex_file_(nullptr), + boot_class_path_(), + callbacks_(), + use_boot_image_(false) { } CommonRuntimeTestImpl::~CommonRuntimeTestImpl() { @@ -94,6 +98,9 @@ void CommonRuntimeTestImpl::SetUp() { options.push_back(std::make_pair(boot_class_path_string, nullptr)); options.push_back(std::make_pair(boot_class_path_locations_string, nullptr)); + if (use_boot_image_) { + options.emplace_back("-Ximage:" + GetImageLocation(), nullptr); + } options.push_back(std::make_pair("-Xcheck:jni", nullptr)); options.push_back(std::make_pair(min_heap_string, nullptr)); options.push_back(std::make_pair(max_heap_string, nullptr)); @@ -107,7 +114,7 @@ void CommonRuntimeTestImpl::SetUp() { SetUpRuntimeOptions(&options); - // Install compiler-callbacks if SetupRuntimeOptions hasn't deleted them. + // Install compiler-callbacks if SetUpRuntimeOptions hasn't deleted them. if (callbacks_.get() != nullptr) { options.push_back(std::make_pair("compilercallbacks", callbacks_.get())); } diff --git a/runtime/common_runtime_test.h b/runtime/common_runtime_test.h index 7c11fd8fc5..9fa9c5d7e5 100644 --- a/runtime/common_runtime_test.h +++ b/runtime/common_runtime_test.h @@ -207,6 +207,8 @@ class CommonRuntimeTestImpl : public CommonArtTestImpl { std::unique_ptr<CompilerCallbacks> callbacks_; + bool use_boot_image_; + virtual void SetUp(); virtual void TearDown(); diff --git a/runtime/jni/java_vm_ext_test.cc b/runtime/jni/java_vm_ext_test.cc index 0363cdb345..cae33b5f9d 100644 --- a/runtime/jni/java_vm_ext_test.cc +++ b/runtime/jni/java_vm_ext_test.cc @@ -27,6 +27,10 @@ namespace art { class JavaVmExtTest : public CommonRuntimeTest { protected: + JavaVmExtTest() { + this->use_boot_image_ = true; // Make the Runtime creation cheaper. + } + void SetUp() override { CommonRuntimeTest::SetUp(); diff --git a/runtime/mirror/dex_cache_test.cc b/runtime/mirror/dex_cache_test.cc index b89b20d1ca..a0e8fda888 100644 --- a/runtime/mirror/dex_cache_test.cc +++ b/runtime/mirror/dex_cache_test.cc @@ -30,7 +30,12 @@ namespace art { namespace mirror { -class DexCacheTest : public CommonRuntimeTest {}; +class DexCacheTest : public CommonRuntimeTest { + protected: + DexCacheTest() { + this->use_boot_image_ = true; // Make the Runtime creation cheaper. + } +}; class DexCacheMethodHandlesTest : public DexCacheTest { protected: diff --git a/runtime/transaction_test.cc b/runtime/transaction_test.cc index 88e3f4fa46..04aa7cdb52 100644 --- a/runtime/transaction_test.cc +++ b/runtime/transaction_test.cc @@ -29,9 +29,8 @@ namespace art { class TransactionTest : public CommonRuntimeTest { protected: - void SetUpRuntimeOptions(/*out*/RuntimeOptions* options) override { - // Set up the image location. - options->emplace_back("-Ximage:" + GetImageLocation(), nullptr); + TransactionTest() { + this->use_boot_image_ = true; // We need the boot image for this test. } // Tests failing class initialization due to native call with transaction rollback. diff --git a/runtime/verifier/reg_type_test.cc b/runtime/verifier/reg_type_test.cc index 207bb5d685..a157464674 100644 --- a/runtime/verifier/reg_type_test.cc +++ b/runtime/verifier/reg_type_test.cc @@ -31,7 +31,12 @@ namespace art { namespace verifier { -class RegTypeTest : public CommonRuntimeTest {}; +class RegTypeTest : public CommonRuntimeTest { + public: + RegTypeTest() { + use_boot_image_ = true; // Make the Runtime creation cheaper. + } +}; TEST_F(RegTypeTest, ConstLoHi) { // Tests creating primitive types types. |