summaryrefslogtreecommitdiffstats
path: root/compiler
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2015-06-25 10:01:47 +0100
committerNicolas Geoffray <ngeoffray@google.com>2015-06-25 10:48:38 +0100
commit20d60dd249e07a17351427770f0e0f6c68945b7a (patch)
tree98c99d1cf4f82003be7798b767d5a33fcdbe819f /compiler
parent559b1cc279deb9299414ddd46595bb8bca7fa090 (diff)
downloadart-20d60dd249e07a17351427770f0e0f6c68945b7a.zip
art-20d60dd249e07a17351427770f0e0f6c68945b7a.tar.gz
art-20d60dd249e07a17351427770f0e0f6c68945b7a.tar.bz2
Only do some checks when compiling against the core image.
This will avoid false negatives when running dex2oatd on apks. bug:21865473 (cherry picked from commit 335005e2b3a179f26b7a8ae64ca60a1406b669bd) Change-Id: Iac6dbe30c9d576077a0384b88696f79937d89471
Diffstat (limited to 'compiler')
-rw-r--r--compiler/optimizing/inliner.cc3
-rw-r--r--compiler/optimizing/optimizing_compiler.cc8
-rw-r--r--compiler/optimizing/optimizing_compiler.h5
3 files changed, 14 insertions, 2 deletions
diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc
index b984ef7..eeb1636 100644
--- a/compiler/optimizing/inliner.cc
+++ b/compiler/optimizing/inliner.cc
@@ -27,6 +27,7 @@
#include "mirror/class_loader.h"
#include "mirror/dex_cache.h"
#include "nodes.h"
+#include "optimizing_compiler.h"
#include "register_allocator.h"
#include "ssa_phi_elimination.h"
#include "scoped_thread_state_change.h"
@@ -56,7 +57,7 @@ void HInliner::Run() {
// We use the original invoke type to ensure the resolution of the called method
// works properly.
if (!TryInline(call, call->GetDexMethodIndex())) {
- if (kIsDebugBuild) {
+ if (kIsDebugBuild && IsCompilingWithCoreImage()) {
std::string callee_name =
PrettyMethod(call->GetDexMethodIndex(), *outer_compilation_unit_.GetDexFile());
bool should_inline = callee_name.find("$inline$") != std::string::npos;
diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc
index 8958932..5864741 100644
--- a/compiler/optimizing/optimizing_compiler.cc
+++ b/compiler/optimizing/optimizing_compiler.cc
@@ -558,7 +558,8 @@ CompiledMethod* OptimizingCompiler::TryCompile(const DexFile::CodeItem* code_ite
{
PassInfo pass_info(HGraphBuilder::kBuilderPassName, &pass_info_printer);
if (!builder.BuildGraph(*code_item)) {
- CHECK(!shouldCompile) << "Could not build graph in optimizing compiler";
+ DCHECK(!(IsCompilingWithCoreImage() && shouldCompile))
+ << "Could not build graph in optimizing compiler";
return nullptr;
}
}
@@ -646,4 +647,9 @@ Compiler* CreateOptimizingCompiler(CompilerDriver* driver) {
return new OptimizingCompiler(driver);
}
+bool IsCompilingWithCoreImage() {
+ const std::string& image = Runtime::Current()->GetImageLocation();
+ return EndsWith(image, "core.art") || EndsWith(image, "core-optimizing.art");
+}
+
} // namespace art
diff --git a/compiler/optimizing/optimizing_compiler.h b/compiler/optimizing/optimizing_compiler.h
index d076fb5..0c89da1 100644
--- a/compiler/optimizing/optimizing_compiler.h
+++ b/compiler/optimizing/optimizing_compiler.h
@@ -24,6 +24,11 @@ class CompilerDriver;
Compiler* CreateOptimizingCompiler(CompilerDriver* driver);
+// Returns whether we are compiling against a "core" image, which
+// is an indicative we are running tests. The compiler will use that
+// information for checking invariants.
+bool IsCompilingWithCoreImage();
+
} // namespace art
#endif // ART_COMPILER_OPTIMIZING_OPTIMIZING_COMPILER_H_