summaryrefslogtreecommitdiff
path: root/compiler/optimizing
diff options
context:
space:
mode:
author Calin Juravle <calin@google.com> 2015-04-16 15:41:02 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2015-04-16 15:41:03 +0000
commit8aec061f5e58876bcc892d8c0309bc13b5349f5c (patch)
tree468528f9081cc33299317a3fa62cfc6d84c224e8 /compiler/optimizing
parentf90b8548e91392dfc24e8b0f7d3000f4f121c19d (diff)
parentf1c6d9e87cbfd27702103ccc7c7f08ce784dc872 (diff)
Merge "Fallback to quick in case of soft verification errors"
Diffstat (limited to 'compiler/optimizing')
-rw-r--r--compiler/optimizing/inliner.cc8
-rw-r--r--compiler/optimizing/optimizing_compiler.cc23
-rw-r--r--compiler/optimizing/optimizing_compiler_stats.h4
3 files changed, 28 insertions, 7 deletions
diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc
index b249817698..6d2a8d77e2 100644
--- a/compiler/optimizing/inliner.cc
+++ b/compiler/optimizing/inliner.cc
@@ -31,6 +31,8 @@
#include "ssa_phi_elimination.h"
#include "scoped_thread_state_change.h"
#include "thread.h"
+#include "dex/verified_method.h"
+#include "dex/verification_results.h"
namespace art {
@@ -114,9 +116,11 @@ bool HInliner::TryInline(HInvoke* invoke_instruction,
return false;
}
- if (!resolved_method->GetDeclaringClass()->IsVerified()) {
+ uint16_t class_def_idx = resolved_method->GetDeclaringClass()->GetDexClassDefIndex();
+ if (!compiler_driver_->IsMethodVerifiedWithoutFailures(
+ resolved_method->GetDexMethodIndex(), class_def_idx, *resolved_method->GetDexFile())) {
VLOG(compiler) << "Method " << PrettyMethod(method_index, caller_dex_file)
- << " is not inlined because its class could not be verified";
+ << " couldn't be verified, so it cannot be inlined";
return false;
}
diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc
index efca1a59ba..a17d6e1822 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);
diff --git a/compiler/optimizing/optimizing_compiler_stats.h b/compiler/optimizing/optimizing_compiler_stats.h
index 4d5b8d0639..d4a936d1c3 100644
--- a/compiler/optimizing/optimizing_compiler_stats.h
+++ b/compiler/optimizing/optimizing_compiler_stats.h
@@ -45,6 +45,8 @@ enum MethodCompilationStat {
kNotCompiledCantAccesType,
kNotOptimizedRegisterAllocator,
kNotCompiledUnhandledInstruction,
+ kNotCompiledVerifyAtRuntime,
+ kNotCompiledClassNotVerified,
kRemovedCheckedCast,
kRemovedNullCheck,
kInstructionSimplifications,
@@ -109,6 +111,8 @@ class OptimizingCompilerStats {
case kNotCompiledSpaceFilter : return "kNotCompiledSpaceFilter";
case kNotOptimizedRegisterAllocator : return "kNotOptimizedRegisterAllocator";
case kNotCompiledUnhandledInstruction : return "kNotCompiledUnhandledInstruction";
+ case kNotCompiledVerifyAtRuntime : return "kNotCompiledVerifyAtRuntime";
+ case kNotCompiledClassNotVerified : return "kNotCompiledClassNotVerified";
case kRemovedCheckedCast: return "kRemovedCheckedCast";
case kRemovedNullCheck: return "kRemovedNullCheck";
case kInstructionSimplifications: return "kInstructionSimplifications";