diff options
author | Richard Uhler <ruhler@google.com> | 2015-01-02 13:28:22 -0800 |
---|---|---|
committer | Richard Uhler <ruhler@google.com> | 2015-01-08 10:50:38 -0800 |
commit | c275259449ec57987e52d3ab1eda3272b994488f (patch) | |
tree | ca3a6d182d768f8ef046a33576572a2e46370cc1 /runtime/parsed_options.cc | |
parent | 4270e74152d8a7cd979ab5a92fe2a8f84adb8a42 (diff) | |
download | art-c275259449ec57987e52d3ab1eda3272b994488f.tar.gz art-c275259449ec57987e52d3ab1eda3272b994488f.tar.bz2 art-c275259449ec57987e52d3ab1eda3272b994488f.zip |
Remove back-door bootclasspath option from Runtime
The 'bootclasspath' option allowed users of the Runtime to load their
own boot class path DexFiles and pass them directly to the Runtime as
an option. This obscures the fact that the Runtime must take ownership
of the boot class path DexFiles.
This change removes the use of the bootclasspath option by dex2oat and
the common runtime tests. For dex2oat, we use the existing
-Xbootclasspath option instead, and introduce a new
-Xbootclasspath-locations option to override the dex locations for the
loaded boot class path dex files. For the common runtime tests, we
simply use -Xbootclasspath.
Bug: 18809837
Change-Id: Idfcd4885390bf0f3dc350993756dd337220def73
Diffstat (limited to 'runtime/parsed_options.cc')
-rw-r--r-- | runtime/parsed_options.cc | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/runtime/parsed_options.cc b/runtime/parsed_options.cc index 1b992d5159..4ba3cb999d 100644 --- a/runtime/parsed_options.cc +++ b/runtime/parsed_options.cc @@ -34,7 +34,6 @@ namespace art { ParsedOptions::ParsedOptions() : - boot_class_path_(nullptr), check_jni_(kIsDebugBuild), // -Xcheck:jni is off by default for regular // builds but on by default in debug builds. force_copy_(false), @@ -288,6 +287,9 @@ bool ParsedOptions::Parse(const RuntimeOptions& options, bool ignore_unrecognize } else if (StartsWith(option, "-Xbootclasspath:")) { boot_class_path_string_ = option.substr(strlen("-Xbootclasspath:")).data(); LOG(INFO) << "setting boot class path to " << boot_class_path_string_; + } else if (StartsWith(option, "-Xbootclasspath-locations:")) { + boot_class_path_locations_string_ = option.substr( + strlen("-Xbootclasspath-locations:")).data(); } else if (option == "-classpath" || option == "-cp") { // TODO: support -Djava.class.path i++; @@ -297,9 +299,6 @@ bool ParsedOptions::Parse(const RuntimeOptions& options, bool ignore_unrecognize } const StringPiece& value = options[i].first; class_path_string_ = value.data(); - } else if (option == "bootclasspath") { - boot_class_path_ - = reinterpret_cast<const std::vector<const DexFile*>*>(options[i].second); } else if (StartsWith(option, "-Ximage:")) { if (!ParseStringAfterChar(option, ':', &image_)) { return false; @@ -720,6 +719,24 @@ bool ParsedOptions::Parse(const RuntimeOptions& options, bool ignore_unrecognize boot_class_path_string_.replace(core_jar_pos, core_jar.size(), core_libart_jar); } + if (!boot_class_path_locations_string_.empty()) { + std::vector<std::string> files; + Split(boot_class_path_string_, ':', &files); + + std::vector<std::string> locations; + Split(boot_class_path_locations_string_, ':', &locations); + + if (files.size() != locations.size()) { + Usage("The number of boot class path files does not match" + " the number of boot class path locations given\n" + " boot class path files (%zu): %s\n" + " boot class path locations (%zu): %s\n", + files.size(), boot_class_path_string_.c_str(), + locations.size(), boot_class_path_locations_string_.c_str()); + return false; + } + } + if (compiler_callbacks_ == nullptr && image_.empty()) { image_ += GetAndroidRoot(); image_ += "/framework/boot.art"; @@ -804,6 +821,8 @@ void ParsedOptions::Usage(const char* fmt, ...) { UsageMessage(stream, " -Xgc:[no]postverify_rosalloc\n"); UsageMessage(stream, " -Xgc:[no]presweepingverify\n"); UsageMessage(stream, " -Ximage:filename\n"); + UsageMessage(stream, " -Xbootclasspath-locations:bootclasspath\n" + " (override the dex locations of the -Xbootclasspath files)\n"); UsageMessage(stream, " -XX:+DisableExplicitGC\n"); UsageMessage(stream, " -XX:ParallelGCThreads=integervalue\n"); UsageMessage(stream, " -XX:ConcGCThreads=integervalue\n"); |