From a68629ed992e2eef7b139b09e46ebe8fd3fb5ef2 Mon Sep 17 00:00:00 2001 From: Calin Juravle Date: Fri, 22 Aug 2014 12:53:59 +0100 Subject: [PATCH] Always setup the native bridge library ... even if the string is empty. This will initialize the native bridge library but mark it as unavailable. - also, rename native_bridge_library_path to native_bridge_library_filename to be closer to the actual meaning (it's just the filename without any path). Bug: 16404669 (cherry picked from commit I94628639691459d48d1fbf0841f36b68d51818e7) Change-Id: I94628639691459d48d1fbf0841f36b68d51818e7 --- runtime/parsed_options.cc | 2 +- runtime/parsed_options.h | 2 +- runtime/runtime.cc | 11 ++++++----- runtime/runtime.h | 7 ++++--- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/runtime/parsed_options.cc b/runtime/parsed_options.cc index 26360d77e..97332fc41 100644 --- a/runtime/parsed_options.cc +++ b/runtime/parsed_options.cc @@ -613,7 +613,7 @@ bool ParsedOptions::Parse(const RuntimeOptions& options, bool ignore_unrecognize return false; } } else if (StartsWith(option, "-XX:NativeBridge=")) { - if (!ParseStringAfterChar(option, '=', &native_bridge_library_path_)) { + if (!ParseStringAfterChar(option, '=', &native_bridge_library_filename_)) { return false; } } else if (StartsWith(option, "-ea") || diff --git a/runtime/parsed_options.h b/runtime/parsed_options.h index 1afd610a5..5c71f9895 100644 --- a/runtime/parsed_options.h +++ b/runtime/parsed_options.h @@ -46,7 +46,7 @@ class ParsedOptions { bool check_jni_; bool force_copy_; std::string jni_trace_; - std::string native_bridge_library_path_; + std::string native_bridge_library_filename_; CompilerCallbacks* compiler_callbacks_; bool is_zygote_; bool must_relocate_; diff --git a/runtime/runtime.cc b/runtime/runtime.cc index ee8cbe1c6..84df444be 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -712,11 +712,12 @@ bool Runtime::Init(const RuntimeOptions& raw_options, bool ignore_unrecognized) self->ClearException(); // Look for a native bridge. - native_bridge_library_path_ = options->native_bridge_library_path_; - if (!native_bridge_library_path_.empty()) { - android::SetupNativeBridge(native_bridge_library_path_.c_str(), &native_bridge_art_callbacks_); - VLOG(startup) << "Runtime::Setup native bridge library: " << native_bridge_library_path_; - } + native_bridge_library_filename_ = options->native_bridge_library_filename_; + android::SetupNativeBridge(native_bridge_library_filename_.c_str(), &native_bridge_art_callbacks_); + VLOG(startup) << "Runtime::Setup native bridge library: " + << (native_bridge_library_filename_.empty() ? + "(empty)" : native_bridge_library_filename_); + VLOG(startup) << "Runtime::Init exiting"; return true; } diff --git a/runtime/runtime.h b/runtime/runtime.h index 34ccdcb3d..259691adc 100644 --- a/runtime/runtime.h +++ b/runtime/runtime.h @@ -617,13 +617,14 @@ class Runtime { bool implicit_so_checks_; // StackOverflow checks are implicit. bool implicit_suspend_checks_; // Thread suspension checks are implicit. - // The path to the native bridge library. If this is not empty the native bridge will be - // initialized and loaded from the pointed path. + // The filename to the native bridge library. If this is not empty the native bridge will be + // initialized and loaded from the given file (initialized and available). An empty value means + // that there's no native bridge (initialized but not available). // // The native bridge allows running native code compiled for a foreign ISA. The way it works is, // if standard dlopen fails to load native library associated with native activity, it calls to // the native bridge to load it and then gets the trampoline for the entry to native activity. - std::string native_bridge_library_path_; + std::string native_bridge_library_filename_; // Native bridge library runtime callbacks. They represent the runtime interface to native bridge. // -- 2.11.0