summaryrefslogtreecommitdiff
path: root/compiler/compiler.cc
diff options
context:
space:
mode:
author David Srbecky <dsrbecky@google.com> 2019-02-27 15:10:52 +0000
committer David Srbecky <dsrbecky@google.com> 2019-03-22 18:22:34 +0000
commite5d93b58a530be39c9a067cdd7f491e4626ec51d (patch)
tree30becd07985c4c2f7b2a339f7d6783220255f08e /compiler/compiler.cc
parent336245d020ce5d1595c56a2953bf7b3103b54984 (diff)
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
Diffstat (limited to 'compiler/compiler.cc')
-rw-r--r--compiler/compiler.cc4
1 files changed, 4 insertions, 0 deletions
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<uint8_t, 4> compiler_oat_version = OatHeader::kOatVersion;
+ OatHeader::CheckOatVersion(compiler_oat_version);
switch (kind) {
case kQuick:
// TODO: Remove Quick in options.