summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler/Android.bp1
-rw-r--r--compiler/common_compiler_test.cc5
-rw-r--r--compiler/common_compiler_test.h2
-rw-r--r--compiler/driver/compiler_options.cc7
-rw-r--r--compiler/driver/compiler_options.h6
-rw-r--r--compiler/libart-compiler.map1
-rw-r--r--dex2oat/Android.bp1
-rw-r--r--dex2oat/common_compiler_driver_test.cc6
-rw-r--r--dex2oat/common_compiler_driver_test.h2
-rw-r--r--dex2oat/dex/verification_results.cc (renamed from compiler/dex/verification_results.cc)0
-rw-r--r--dex2oat/dex/verification_results.h (renamed from compiler/dex/verification_results.h)0
-rw-r--r--dex2oat/dex2oat.cc3
-rw-r--r--dex2oat/driver/compiler_driver.cc7
-rw-r--r--dex2oat/driver/compiler_driver.h6
-rw-r--r--dex2oat/linker/image_test.h5
-rw-r--r--dex2oat/linker/oat_writer.cc4
-rw-r--r--dex2oat/linker/oat_writer.h3
-rw-r--r--dex2oat/linker/oat_writer_test.cc3
18 files changed, 32 insertions, 30 deletions
diff --git a/compiler/Android.bp b/compiler/Android.bp
index 172af5ef01..5055554843 100644
--- a/compiler/Android.bp
+++ b/compiler/Android.bp
@@ -36,7 +36,6 @@ art_cc_defaults {
"compiled_method.cc",
"debug/elf_debug_writer.cc",
"dex/inline_method_analyser.cc",
- "dex/verification_results.cc",
"driver/compiled_method_storage.cc",
"driver/compiler_options.cc",
"driver/dex_compilation_unit.cc",
diff --git a/compiler/common_compiler_test.cc b/compiler/common_compiler_test.cc
index a63d21d4ca..7d7b70bb6d 100644
--- a/compiler/common_compiler_test.cc
+++ b/compiler/common_compiler_test.cc
@@ -30,7 +30,6 @@
#include "class_linker.h"
#include "compiled_method-inl.h"
#include "dex/descriptors_names.h"
-#include "dex/verification_results.h"
#include "driver/compiled_method_storage.h"
#include "driver/compiler_options.h"
#include "jni/java_vm_ext.h"
@@ -207,7 +206,6 @@ void CommonCompilerTestImpl::OverrideInstructionSetFeatures(InstructionSet instr
void CommonCompilerTestImpl::SetUpRuntimeOptionsImpl() {
compiler_options_.reset(new CompilerOptions);
- verification_results_.reset(new VerificationResults());
ApplyInstructionSet();
}
@@ -221,7 +219,6 @@ void CommonCompilerTestImpl::SetCompilerKind(Compiler::Kind compiler_kind) {
void CommonCompilerTestImpl::TearDown() {
code_and_metadata_.clear();
- verification_results_.reset();
compiler_options_.reset();
}
@@ -241,7 +238,6 @@ void CommonCompilerTestImpl::CompileMethod(ArtMethod* method) {
Handle<mirror::DexCache> dex_cache =
hs.NewHandle(GetClassLinker()->FindDexCache(self, dex_file));
Handle<mirror::ClassLoader> class_loader = hs.NewHandle(method->GetClassLoader());
- compiler_options_->verification_results_ = verification_results_.get();
if (method->IsNative()) {
compiled_method = compiler->JniCompile(method->GetAccessFlags(),
method->GetDexMethodIndex(),
@@ -257,7 +253,6 @@ void CommonCompilerTestImpl::CompileMethod(ArtMethod* method) {
dex_file,
dex_cache);
}
- compiler_options_->verification_results_ = nullptr;
}
CHECK(method != nullptr);
{
diff --git a/compiler/common_compiler_test.h b/compiler/common_compiler_test.h
index cc021b829e..cc74f8f6b4 100644
--- a/compiler/common_compiler_test.h
+++ b/compiler/common_compiler_test.h
@@ -38,7 +38,6 @@ class CompilerOptions;
class CumulativeLogger;
class DexFile;
class TimingLogger;
-class VerificationResults;
template<class T> class Handle;
@@ -88,7 +87,6 @@ class CommonCompilerTestImpl {
= InstructionSetFeatures::FromCppDefines();
std::unique_ptr<CompilerOptions> compiler_options_;
- std::unique_ptr<VerificationResults> verification_results_;
protected:
virtual ClassLinker* GetClassLinker() = 0;
diff --git a/compiler/driver/compiler_options.cc b/compiler/driver/compiler_options.cc
index a531bc91ff..8c2c8f30f9 100644
--- a/compiler/driver/compiler_options.cc
+++ b/compiler/driver/compiler_options.cc
@@ -31,7 +31,6 @@
#include "cmdline_parser.h"
#include "compiler_options_map-inl.h"
#include "dex/dex_file-inl.h"
-#include "dex/verification_results.h"
#include "runtime.h"
#include "scoped_thread_state_change-inl.h"
#include "simple_compiler_options_map.h"
@@ -49,7 +48,6 @@ CompilerOptions::CompilerOptions()
no_inline_from_(),
dex_files_for_oat_file_(),
image_classes_(),
- verification_results_(nullptr),
compiler_type_(CompilerType::kAotCompiler),
image_type_(ImageType::kNone),
multi_image_(false),
@@ -156,11 +154,6 @@ bool CompilerOptions::IsPreloadedClass(const char* pretty_descriptor) const {
return preloaded_classes_.find(std::string_view(pretty_descriptor)) != preloaded_classes_.end();
}
-const VerificationResults* CompilerOptions::GetVerificationResults() const {
- DCHECK(Runtime::Current()->IsAotCompiler());
- return verification_results_;
-}
-
bool CompilerOptions::ShouldCompileWithClinitCheck(ArtMethod* method) const {
if (method != nullptr &&
Runtime::Current()->IsAotCompiler() &&
diff --git a/compiler/driver/compiler_options.h b/compiler/driver/compiler_options.h
index 20f54bdecd..1afa2c5d34 100644
--- a/compiler/driver/compiler_options.h
+++ b/compiler/driver/compiler_options.h
@@ -49,7 +49,6 @@ class DexFile;
enum class InstructionSet;
class InstructionSetFeatures;
class ProfileCompilationInfo;
-class VerificationResults;
// Enum for CheckProfileMethodsCompiled. Outside CompilerOptions so it can be forward-declared.
enum class ProfileMethodsCheck : uint8_t {
@@ -305,8 +304,6 @@ class CompilerOptions final {
// classes. `pretty_descriptor` should be the result of calling `PrettyDescriptor`.
bool IsPreloadedClass(const char* pretty_descriptor) const;
- const VerificationResults* GetVerificationResults() const;
-
bool ParseCompilerOptions(const std::vector<std::string>& options,
bool ignore_unrecognized,
std::string* error_msg);
@@ -423,9 +420,6 @@ class CompilerOptions final {
// boot image extension compilation.
HashSet<std::string> preloaded_classes_;
- // Results of AOT verification.
- const VerificationResults* verification_results_;
-
CompilerType compiler_type_;
ImageType image_type_;
bool multi_image_;
diff --git a/compiler/libart-compiler.map b/compiler/libart-compiler.map
index 7e7841f995..b2ddd9eede 100644
--- a/compiler/libart-compiler.map
+++ b/compiler/libart-compiler.map
@@ -25,7 +25,6 @@ ART_COMPILER {
art::CompilerOptions::*;
art::CreateTrampoline*;
art::IntrinsicObjects::*;
- art::VerificationResults::*;
art::debug::MakeMiniDebugInfo*;
art::linker::operator*art::linker::LinkerPatch::Type*;
art::operator*art::Whence*;
diff --git a/dex2oat/Android.bp b/dex2oat/Android.bp
index d28ad9375d..3f8fd2a190 100644
--- a/dex2oat/Android.bp
+++ b/dex2oat/Android.bp
@@ -29,6 +29,7 @@ art_cc_defaults {
host_supported: true,
srcs: [
"dex/quick_compiler_callbacks.cc",
+ "dex/verification_results.cc",
"driver/compiler_driver.cc",
"linker/code_info_table_deduper.cc",
"linker/elf_writer.cc",
diff --git a/dex2oat/common_compiler_driver_test.cc b/dex2oat/common_compiler_driver_test.cc
index 7e71976729..7a1d11c298 100644
--- a/dex2oat/common_compiler_driver_test.cc
+++ b/dex2oat/common_compiler_driver_test.cc
@@ -21,6 +21,7 @@
#include "base/casts.h"
#include "base/timing_logger.h"
#include "dex/quick_compiler_callbacks.h"
+#include "dex/verification_results.h"
#include "driver/compiler_driver.h"
#include "driver/compiler_options.h"
#include "utils/atomic_dex_ref_map-inl.h"
@@ -46,9 +47,7 @@ void CommonCompilerDriverTest::CompileAll(jobject class_loader,
// Verification results in the `callback_` should not be used during compilation.
down_cast<QuickCompilerCallbacks*>(callbacks_.get())->SetVerificationResults(
reinterpret_cast<VerificationResults*>(inaccessible_page_));
- compiler_options_->verification_results_ = verification_results_.get();
compiler_driver_->CompileAll(class_loader, dex_files, timings);
- compiler_options_->verification_results_ = nullptr;
down_cast<QuickCompilerCallbacks*>(callbacks_.get())->SetVerificationResults(
verification_results_.get());
@@ -89,6 +88,7 @@ void CommonCompilerDriverTest::CreateCompilerDriver() {
compiler_options_->image_classes_.swap(*GetImageClasses());
compiler_options_->profile_compilation_info_ = GetProfileCompilationInfo();
compiler_driver_.reset(new CompilerDriver(compiler_options_.get(),
+ verification_results_.get(),
compiler_kind_,
number_of_threads_,
/* swap_fd= */ -1));
@@ -97,6 +97,7 @@ void CommonCompilerDriverTest::CreateCompilerDriver() {
void CommonCompilerDriverTest::SetUpRuntimeOptions(RuntimeOptions* options) {
CommonCompilerTest::SetUpRuntimeOptions(options);
+ verification_results_.reset(new VerificationResults());
QuickCompilerCallbacks* callbacks =
new QuickCompilerCallbacks(CompilerCallbacks::CallbackMode::kCompileApp);
callbacks->SetVerificationResults(verification_results_.get());
@@ -121,6 +122,7 @@ void CommonCompilerDriverTest::TearDown() {
}
image_reservation_.Reset();
compiler_driver_.reset();
+ verification_results_.reset();
CommonCompilerTest::TearDown();
}
diff --git a/dex2oat/common_compiler_driver_test.h b/dex2oat/common_compiler_driver_test.h
index 1ff88e5b61..b49d18fa10 100644
--- a/dex2oat/common_compiler_driver_test.h
+++ b/dex2oat/common_compiler_driver_test.h
@@ -31,6 +31,7 @@ class CompilerDriver;
class DexFile;
class ProfileCompilationInfo;
class TimingLogger;
+class VerificationResults;
class CommonCompilerDriverTest : public CommonCompilerTest {
public:
@@ -62,6 +63,7 @@ class CommonCompilerDriverTest : public CommonCompilerTest {
size_t number_of_threads_ = 2u;
+ std::unique_ptr<VerificationResults> verification_results_;
std::unique_ptr<CompilerDriver> compiler_driver_;
private:
diff --git a/compiler/dex/verification_results.cc b/dex2oat/dex/verification_results.cc
index bc0329a74e..bc0329a74e 100644
--- a/compiler/dex/verification_results.cc
+++ b/dex2oat/dex/verification_results.cc
diff --git a/compiler/dex/verification_results.h b/dex2oat/dex/verification_results.h
index 7c5595efef..7c5595efef 100644
--- a/compiler/dex/verification_results.h
+++ b/dex2oat/dex/verification_results.h
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index 681811f088..16f24be678 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -1884,6 +1884,7 @@ class Dex2Oat final {
compiler_options_->profile_compilation_info_ = profile_compilation_info_.get();
driver_.reset(new CompilerDriver(compiler_options_.get(),
+ verification_results_.get(),
compiler_kind_,
thread_count_,
swap_fd_));
@@ -1969,7 +1970,6 @@ class Dex2Oat final {
timings_,
&compiler_options_->image_classes_);
callbacks_->SetVerificationResults(nullptr); // Should not be needed anymore.
- compiler_options_->verification_results_ = verification_results_.get();
driver_->CompileAll(class_loader, dex_files, timings_);
driver_->FreeThreadPools();
return class_loader;
@@ -2638,6 +2638,7 @@ class Dex2Oat final {
bool do_oat_writer_layout = DoDexLayoutOptimizations() || DoOatLayoutOptimizations();
oat_writers_.emplace_back(new linker::OatWriter(
*compiler_options_,
+ verification_results_.get(),
timings_,
do_oat_writer_layout ? profile_compilation_info_.get() : nullptr,
compact_dex_level_));
diff --git a/dex2oat/driver/compiler_driver.cc b/dex2oat/driver/compiler_driver.cc
index 4d95248022..1cf7e2ffa8 100644
--- a/dex2oat/driver/compiler_driver.cc
+++ b/dex2oat/driver/compiler_driver.cc
@@ -252,10 +252,12 @@ class CompilerDriver::AOTCompilationStats {
CompilerDriver::CompilerDriver(
const CompilerOptions* compiler_options,
+ const VerificationResults* verification_results,
Compiler::Kind compiler_kind,
size_t thread_count,
int swap_fd)
: compiler_options_(compiler_options),
+ verification_results_(verification_results),
compiler_(),
compiler_kind_(compiler_kind),
number_of_soft_verifier_failures_(0),
@@ -493,7 +495,7 @@ static void CompileMethodQuick(
// Method is annotated with @NeverCompile and should not be compiled.
} else {
const CompilerOptions& compiler_options = driver->GetCompilerOptions();
- const VerificationResults* results = compiler_options.GetVerificationResults();
+ const VerificationResults* results = driver->GetVerificationResults();
DCHECK(results != nullptr);
MethodReference method_ref(&dex_file, method_idx);
// Don't compile class initializers unless kEverything.
@@ -2511,7 +2513,8 @@ static void CompileDexFile(CompilerDriver* driver,
ClassAccessor accessor(dex_file, class_def_index);
CompilerDriver* const driver = context.GetCompiler();
// Skip compiling classes with generic verifier failures since they will still fail at runtime
- if (driver->GetCompilerOptions().GetVerificationResults()->IsClassRejected(ref)) {
+ DCHECK(driver->GetVerificationResults() != nullptr);
+ if (driver->GetVerificationResults()->IsClassRejected(ref)) {
return;
}
// Use a scoped object access to perform to the quick SkipClass check.
diff --git a/dex2oat/driver/compiler_driver.h b/dex2oat/driver/compiler_driver.h
index ed8fc2f222..7985771246 100644
--- a/dex2oat/driver/compiler_driver.h
+++ b/dex2oat/driver/compiler_driver.h
@@ -85,6 +85,7 @@ class CompilerDriver {
// can assume will be in the image, with null implying all available
// classes.
CompilerDriver(const CompilerOptions* compiler_options,
+ const VerificationResults* verification_results,
Compiler::Kind compiler_kind,
size_t thread_count,
int swap_fd);
@@ -115,6 +116,10 @@ class CompilerDriver {
return *compiler_options_;
}
+ const VerificationResults* GetVerificationResults() const {
+ return verification_results_;
+ }
+
Compiler* GetCompiler() const {
return compiler_.get();
}
@@ -295,6 +300,7 @@ class CompilerDriver {
/*inout*/ TimingLogger* timings);
const CompilerOptions* const compiler_options_;
+ const VerificationResults* const verification_results_;
std::unique_ptr<Compiler> compiler_;
Compiler::Kind compiler_kind_;
diff --git a/dex2oat/linker/image_test.h b/dex2oat/linker/image_test.h
index 52e53e672e..12c6b21ce2 100644
--- a/dex2oat/linker/image_test.h
+++ b/dex2oat/linker/image_test.h
@@ -79,7 +79,7 @@ class ImageTest : public CommonCompilerDriverTest {
protected:
void SetUp() override {
ReserveImageSpace();
- CommonCompilerTest::SetUp();
+ CommonCompilerDriverTest::SetUp();
}
void Compile(ImageHeader::StorageMode storage_mode,
@@ -91,7 +91,7 @@ class ImageTest : public CommonCompilerDriverTest {
const std::initializer_list<std::string>& image_classes_failing_resolution = {});
void SetUpRuntimeOptions(RuntimeOptions* options) override {
- CommonCompilerTest::SetUpRuntimeOptions(options);
+ CommonCompilerDriverTest::SetUpRuntimeOptions(options);
QuickCompilerCallbacks* new_callbacks =
new QuickCompilerCallbacks(CompilerCallbacks::CallbackMode::kCompileBootImage);
new_callbacks->SetVerificationResults(verification_results_.get());
@@ -230,6 +230,7 @@ inline void ImageTest::DoCompile(ImageHeader::StorageMode storage_mode,
elf_writers.emplace_back(CreateElfWriterQuick(*compiler_options_, oat_file.GetFile()));
elf_writers.back()->Start();
oat_writers.emplace_back(new OatWriter(*compiler_options_,
+ verification_results_.get(),
&timings,
/*profile_compilation_info*/nullptr,
CompactDexLevel::kCompactDexLevelNone));
diff --git a/dex2oat/linker/oat_writer.cc b/dex2oat/linker/oat_writer.cc
index e40caaded4..fcec2e2ef6 100644
--- a/dex2oat/linker/oat_writer.cc
+++ b/dex2oat/linker/oat_writer.cc
@@ -384,6 +384,7 @@ class OatWriter::OatDexFile {
<< "file_offset=" << file_offset << " offset_=" << offset_
OatWriter::OatWriter(const CompilerOptions& compiler_options,
+ const VerificationResults* verification_results,
TimingLogger* timings,
ProfileCompilationInfo* info,
CompactDexLevel compact_dex_level)
@@ -395,6 +396,7 @@ OatWriter::OatWriter(const CompilerOptions& compiler_options,
zipped_dex_file_locations_(),
compiler_driver_(nullptr),
compiler_options_(compiler_options),
+ verification_results_(verification_results),
image_writer_(nullptr),
extract_dex_files_into_vdex_(true),
vdex_begin_(nullptr),
@@ -1013,7 +1015,7 @@ class OatWriter::InitOatClassesMethodVisitor : public DexMethodVisitor {
ClassStatus status;
bool found = writer_->compiler_driver_->GetCompiledClass(class_ref, &status);
if (!found) {
- const VerificationResults* results = writer_->compiler_options_.GetVerificationResults();
+ const VerificationResults* results = writer_->verification_results_;
if (results != nullptr && results->IsClassRejected(class_ref)) {
// The oat class status is used only for verification of resolved classes,
// so use ClassStatus::kErrorResolved whether the class was resolved or unresolved
diff --git a/dex2oat/linker/oat_writer.h b/dex2oat/linker/oat_writer.h
index ebff7a1b5e..bfacf60360 100644
--- a/dex2oat/linker/oat_writer.h
+++ b/dex2oat/linker/oat_writer.h
@@ -49,6 +49,7 @@ class ProfileCompilationInfo;
class TimingLogger;
class TypeLookupTable;
class VdexFile;
+class VerificationResults;
class ZipEntry;
namespace debug {
@@ -115,6 +116,7 @@ enum class CopyOption {
class OatWriter {
public:
OatWriter(const CompilerOptions& compiler_options,
+ const VerificationResults* verification_results,
TimingLogger* timings,
ProfileCompilationInfo* info,
CompactDexLevel compact_dex_level);
@@ -391,6 +393,7 @@ class OatWriter {
const CompilerDriver* compiler_driver_;
const CompilerOptions& compiler_options_;
+ const VerificationResults* const verification_results_;
ImageWriter* image_writer_;
// Whether the dex files being compiled are going to be extracted to the vdex.
bool extract_dex_files_into_vdex_;
diff --git a/dex2oat/linker/oat_writer_test.cc b/dex2oat/linker/oat_writer_test.cc
index 06f5066aee..2810bede1b 100644
--- a/dex2oat/linker/oat_writer_test.cc
+++ b/dex2oat/linker/oat_writer_test.cc
@@ -107,6 +107,7 @@ class OatTest : public CommonCompilerDriverTest {
TimingLogger timings("WriteElf", false, false);
ClearBootImageOption();
OatWriter oat_writer(*compiler_options_,
+ verification_results_.get(),
&timings,
/*profile_compilation_info*/nullptr,
CompactDexLevel::kCompactDexLevelNone);
@@ -134,6 +135,7 @@ class OatTest : public CommonCompilerDriverTest {
TimingLogger timings("WriteElf", false, false);
ClearBootImageOption();
OatWriter oat_writer(*compiler_options_,
+ verification_results_.get(),
&timings,
profile_compilation_info,
CompactDexLevel::kCompactDexLevelNone);
@@ -156,6 +158,7 @@ class OatTest : public CommonCompilerDriverTest {
TimingLogger timings("WriteElf", false, false);
ClearBootImageOption();
OatWriter oat_writer(*compiler_options_,
+ verification_results_.get(),
&timings,
profile_compilation_info,
CompactDexLevel::kCompactDexLevelNone);