From 0b1c341d2d89a483142cd14bdeb4650ab00184f1 Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Fri, 14 Jul 2017 18:23:25 -0700 Subject: Support class unloading in dex2oat for quicken multidex Support class unloading for the quicken compilation filter. This will be enabled in a follow up CL. Added a test that compares with and without unloading. The way that it tests this is by adding an output app image. Having an app image disables the unloading. This test also covers that app images don't change the odex (currently). Added a test for the assumed verified logic. Bug: 63467744 Test: test-art-host Test: test/testrunner/testrunner.py --interpreter --host -j40 Change-Id: I1e8a862c6f089c06c58aa0c846797e4c24bd072c --- compiler/driver/compiler_driver_test.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'compiler/driver/compiler_driver_test.cc') diff --git a/compiler/driver/compiler_driver_test.cc b/compiler/driver/compiler_driver_test.cc index 4da3e0df39..392d57c0f2 100644 --- a/compiler/driver/compiler_driver_test.cc +++ b/compiler/driver/compiler_driver_test.cc @@ -23,6 +23,7 @@ #include "art_method-inl.h" #include "class_linker-inl.h" #include "common_compiler_test.h" +#include "compiler_callbacks.h" #include "dex_file.h" #include "dex_file_types.h" #include "gc/heap.h" @@ -368,7 +369,9 @@ TEST_F(CompilerDriverVerifyTest, VerifyCompilation) { // Test that a class of status kStatusRetryVerificationAtRuntime is indeed recorded that way in the // driver. -TEST_F(CompilerDriverVerifyTest, RetryVerifcationStatus) { +// Test that checks that classes can be assumed as verified if unloading mode is enabled and +// the class status is at least verified. +TEST_F(CompilerDriverVerifyTest, RetryVerifcationStatusCheckVerified) { Thread* const self = Thread::Current(); jobject class_loader; std::vector dex_files; @@ -382,6 +385,7 @@ TEST_F(CompilerDriverVerifyTest, RetryVerifcationStatus) { dex_file = dex_files.front(); } compiler_driver_->SetDexFilesForOatFile(dex_files); + callbacks_->SetDoesClassUnloading(true, compiler_driver_.get()); ClassReference ref(dex_file, 0u); // Test that the status is read from the compiler driver as expected. for (size_t i = mirror::Class::kStatusRetryVerificationAtRuntime; @@ -397,6 +401,12 @@ TEST_F(CompilerDriverVerifyTest, RetryVerifcationStatus) { mirror::Class::Status status = {}; ASSERT_TRUE(compiler_driver_->GetCompiledClass(ref, &status)); EXPECT_EQ(status, expected_status); + + // Check that we can assume verified if we are a status that is at least verified. + if (status >= mirror::Class::kStatusVerified) { + // Check that the class can be assumed as verified in the compiler driver. + EXPECT_TRUE(callbacks_->CanAssumeVerified(ref)) << status; + } } } -- cgit v1.2.3-59-g8ed1b