From e5d93b58a530be39c9a067cdd7f491e4626ec51d Mon Sep 17 00:00:00 2001 From: David Srbecky Date: Wed, 27 Feb 2019 15:10:52 +0000 Subject: Compare the oat version of runtime, dex2oat and the compiler. Ensure they match, otherwise we might get confusing crashes. Bug: 125318570 Test: running ahat-test-dump after oat version bump triggers the check. Change-Id: If4bc832af50c2cb851054be03c9887f9a3d4d04b --- compiler/compiler.cc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'compiler/compiler.cc') diff --git a/compiler/compiler.cc b/compiler/compiler.cc index d044c2fe4f..98d73396bc 100644 --- a/compiler/compiler.cc +++ b/compiler/compiler.cc @@ -22,6 +22,7 @@ #include "base/utils.h" #include "dex/code_item_accessors-inl.h" #include "dex/dex_file.h" +#include "oat.h" #include "optimizing/optimizing_compiler.h" namespace art { @@ -29,6 +30,9 @@ namespace art { Compiler* Compiler::Create(const CompilerOptions& compiler_options, CompiledMethodStorage* storage, Compiler::Kind kind) { + // Check that oat version when runtime was compiled matches the oat version of the compiler. + constexpr std::array compiler_oat_version = OatHeader::kOatVersion; + OatHeader::CheckOatVersion(compiler_oat_version); switch (kind) { case kQuick: // TODO: Remove Quick in options. -- cgit v1.2.3-59-g8ed1b