summaryrefslogtreecommitdiffstats
path: root/compiler/optimizing/optimizing_compiler.cc
diff options
context:
space:
mode:
authorCalin Juravle <calin@google.com>2015-04-13 18:42:21 +0100
committerCalin Juravle <calin@google.com>2015-04-16 16:28:11 +0100
commitf1c6d9e87cbfd27702103ccc7c7f08ce784dc872 (patch)
tree45ad9f5bb52eb0db3857e344ab67b5aab2309472 /compiler/optimizing/optimizing_compiler.cc
parente015a31e509c3f4de8a90b57b77329ba6609ce2f (diff)
downloadart-f1c6d9e87cbfd27702103ccc7c7f08ce784dc872.zip
art-f1c6d9e87cbfd27702103ccc7c7f08ce784dc872.tar.gz
art-f1c6d9e87cbfd27702103ccc7c7f08ce784dc872.tar.bz2
Fallback to quick in case of soft verification errors
Add a regression test: using uninitialized values triggers a soft verification error and optimizing should not crash. Thanks to Stephen Kyle (stephenckyle@googlemail.com) for the bug report. Bug: 19988704 Change-Id: I67174538eed853baff735694b3ae8eb34afe2a39
Diffstat (limited to 'compiler/optimizing/optimizing_compiler.cc')
-rw-r--r--compiler/optimizing/optimizing_compiler.cc23
1 files changed, 18 insertions, 5 deletions
diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc
index 56cea8a..64a066d 100644
--- a/compiler/optimizing/optimizing_compiler.cc
+++ b/compiler/optimizing/optimizing_compiler.cc
@@ -31,6 +31,8 @@
#include "constant_folding.h"
#include "dead_code_elimination.h"
#include "dex/quick/dex_file_to_method_inliner_map.h"
+#include "dex/verified_method.h"
+#include "dex/verification_results.h"
#include "driver/compiler_driver.h"
#include "driver/compiler_options.h"
#include "driver/dex_compilation_unit.h"
@@ -45,13 +47,13 @@
#include "mirror/art_method-inl.h"
#include "nodes.h"
#include "prepare_for_register_allocation.h"
+#include "reference_type_propagation.h"
#include "register_allocator.h"
#include "side_effects_analysis.h"
#include "ssa_builder.h"
#include "ssa_phi_elimination.h"
#include "ssa_liveness_analysis.h"
#include "utils/assembler.h"
-#include "reference_type_propagation.h"
namespace art {
@@ -592,15 +594,26 @@ CompiledMethod* OptimizingCompiler::Compile(const DexFile::CodeItem* code_item,
InvokeType invoke_type,
uint16_t class_def_idx,
uint32_t method_idx,
- jobject class_loader,
+ jobject jclass_loader,
const DexFile& dex_file) const {
- CompiledMethod* method = TryCompile(code_item, access_flags, invoke_type, class_def_idx,
- method_idx, class_loader, dex_file);
+ CompilerDriver* compiler_driver = GetCompilerDriver();
+ CompiledMethod* method = nullptr;
+ if (compiler_driver->IsMethodVerifiedWithoutFailures(method_idx, class_def_idx, dex_file)) {
+ method = TryCompile(code_item, access_flags, invoke_type, class_def_idx,
+ method_idx, jclass_loader, dex_file);
+ } else {
+ if (compiler_driver->GetCompilerOptions().VerifyAtRuntime()) {
+ compilation_stats_.RecordStat(MethodCompilationStat::kNotCompiledVerifyAtRuntime);
+ } else {
+ compilation_stats_.RecordStat(MethodCompilationStat::kNotCompiledClassNotVerified);
+ }
+ }
+
if (method != nullptr) {
return method;
}
method = delegate_->Compile(code_item, access_flags, invoke_type, class_def_idx, method_idx,
- class_loader, dex_file);
+ jclass_loader, dex_file);
if (method != nullptr) {
compilation_stats_.RecordStat(MethodCompilationStat::kCompiledQuick);