diff options
author | Andreas Gampe <agampe@google.com> | 2015-02-27 19:35:46 -0800 |
---|---|---|
committer | Andreas Gampe <agampe@google.com> | 2015-02-27 20:16:40 -0800 |
commit | 1d00addb6e6a6d0386cba393774031dbd88121ba (patch) | |
tree | 9a0f9d86dd97fbe5ca55208d685e7f87a2d0501b /dex2oat | |
parent | 02abb5075f3085e69c0c81fb5724c066f6c845b7 (diff) | |
download | art-1d00addb6e6a6d0386cba393774031dbd88121ba.zip art-1d00addb6e6a6d0386cba393774031dbd88121ba.tar.gz art-1d00addb6e6a6d0386cba393774031dbd88121ba.tar.bz2 |
ART: Allow dex2oat for apps only with image
Do not allow a runtime without image when compiling an app. This
avoids the current abort when we then try to run out of the (missing)
boot classpath.
Bug: 19100590
Change-Id: Ic269dc2fa807d003215ea134cb42fe4c4d78124e
Diffstat (limited to 'dex2oat')
-rw-r--r-- | dex2oat/dex2oat.cc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc index 0b1f14d..22665ea 100644 --- a/dex2oat/dex2oat.cc +++ b/dex2oat/dex2oat.cc @@ -1052,6 +1052,13 @@ class Dex2Oat FINAL { runtime_options.push_back( std::make_pair("imageinstructionset", GetInstructionSetString(instruction_set_))); + // Only allow no boot image for the runtime if we're compiling one. When we compile an app, + // we don't want fallback mode, it will abort as we do not push a boot classpath (it might + // have been stripped in preopting, anyways). + if (!image_) { + runtime_options.push_back(std::make_pair("-Xno-dex-file-fallback", nullptr)); + } + if (!CreateRuntime(runtime_options)) { return false; } @@ -1637,9 +1644,13 @@ class Dex2Oat FINAL { } void LogCompletionTime() { + // Note: when creation of a runtime fails, e.g., when trying to compile an app but when there + // is no image, there won't be a Runtime::Current(). LOG(INFO) << "dex2oat took " << PrettyDuration(NanoTime() - start_ns_) << " (threads: " << thread_count_ << ") " - << driver_->GetMemoryUsageString(kIsDebugBuild || VLOG_IS_ON(compiler)); + << ((Runtime::Current() != nullptr) ? + driver_->GetMemoryUsageString(kIsDebugBuild || VLOG_IS_ON(compiler)) : + ""); } std::unique_ptr<CompilerOptions> compiler_options_; |