From 8fb5ce3a7e1dec587642f900be86729c10224174 Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Fri, 4 Jul 2014 09:43:26 +0100 Subject: Do not attempt to compile on architectures we do not support. Change-Id: I431edff0a753a7fa37c79bdf7ab918d6747667a4 --- compiler/optimizing/optimizing_compiler.cc | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'compiler/optimizing/optimizing_compiler.cc') diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc index ccacbef401..b4d7fff178 100644 --- a/compiler/optimizing/optimizing_compiler.cc +++ b/compiler/optimizing/optimizing_compiler.cc @@ -77,6 +77,17 @@ CompiledMethod* OptimizingCompiler::TryCompile(const DexFile::CodeItem* code_ite uint32_t method_idx, jobject class_loader, const DexFile& dex_file) const { + InstructionSet instruction_set = GetCompilerDriver()->GetInstructionSet(); + // The optimizing compiler currently does not have a Thumb2 assembler. + if (instruction_set == kThumb2) { + instruction_set = kArm; + } + + // Do not attempt to compile on architectures we do not support. + if (instruction_set != kX86 && instruction_set != kX86_64 && instruction_set != kArm) { + return nullptr; + } + DexCompilationUnit dex_compilation_unit( nullptr, class_loader, art::Runtime::Current()->GetClassLinker(), dex_file, code_item, class_def_idx, method_idx, access_flags, @@ -100,11 +111,6 @@ CompiledMethod* OptimizingCompiler::TryCompile(const DexFile::CodeItem* code_ite return nullptr; } - InstructionSet instruction_set = GetCompilerDriver()->GetInstructionSet(); - // The optimizing compiler currently does not have a Thumb2 assembler. - if (instruction_set == kThumb2) { - instruction_set = kArm; - } CodeGenerator* codegen = CodeGenerator::Create(&arena, graph, instruction_set); if (codegen == nullptr) { if (shouldCompile) { -- cgit v1.2.3-59-g8ed1b