summaryrefslogtreecommitdiffstats
path: root/cmdline
diff options
context:
space:
mode:
authorVladimir Marko <vmarko@google.com>2018-11-30 09:58:02 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2018-11-30 09:58:02 +0000
commit1ee723b683307c804c5ddf2ad7d699f5abfc362a (patch)
treeacfd8b753d194d708b17d6e16396d352c799c21b /cmdline
parent458128737485d72028d0e4af9855b7773c81010b (diff)
parent813b91443d37087f75eef7164043c9fff43b7077 (diff)
downloadart-1ee723b683307c804c5ddf2ad7d699f5abfc362a.tar.gz
art-1ee723b683307c804c5ddf2ad7d699f5abfc362a.tar.bz2
art-1ee723b683307c804c5ddf2ad7d699f5abfc362a.zip
Merge "Add --runtime-arg to command line tools."
Diffstat (limited to 'cmdline')
-rw-r--r--cmdline/cmdline.h30
1 files changed, 27 insertions, 3 deletions
diff --git a/cmdline/cmdline.h b/cmdline/cmdline.h
index 95ab12324c..81a21793d9 100644
--- a/cmdline/cmdline.h
+++ b/cmdline/cmdline.h
@@ -85,7 +85,9 @@ static bool LocationToFilename(const std::string& location, InstructionSet isa,
}
}
-static Runtime* StartRuntime(const char* boot_image_location, InstructionSet instruction_set) {
+static Runtime* StartRuntime(const char* boot_image_location,
+ InstructionSet instruction_set,
+ const std::vector<const char*>& runtime_args) {
CHECK(boot_image_location != nullptr);
RuntimeOptions options;
@@ -101,13 +103,19 @@ static Runtime* StartRuntime(const char* boot_image_location, InstructionSet ins
std::string boot_image_option;
boot_image_option += "-Ximage:";
boot_image_option += boot_image_location;
- options.push_back(std::make_pair(boot_image_option.c_str(), nullptr));
+ options.push_back(std::make_pair(boot_image_option, nullptr));
}
// Instruction set.
options.push_back(
std::make_pair("imageinstructionset",
reinterpret_cast<const void*>(GetInstructionSetString(instruction_set))));
+
+ // Explicit runtime args.
+ for (const char* runtime_arg : runtime_args) {
+ options.push_back(std::make_pair(runtime_arg, nullptr));
+ }
+
// None of the command line tools need sig chain. If this changes we'll need
// to upgrade this option to a proper parameter.
options.push_back(std::make_pair("-Xno-sig-chain", nullptr));
@@ -154,6 +162,14 @@ struct CmdlineArgs {
PrintUsage();
return false;
}
+ } else if (option == "--runtime-arg") {
+ if (i + 1 == argc) {
+ fprintf(stderr, "Missing argument for --runtime-arg\n");
+ PrintUsage();
+ return false;
+ }
+ ++i;
+ runtime_args_.push_back(argv[i]);
} else if (option.starts_with("--output=")) {
output_name_ = option.substr(strlen("--output=")).ToString();
const char* filename = output_name_.c_str();
@@ -209,6 +225,12 @@ struct CmdlineArgs {
" Default: %s\n"
"\n",
GetInstructionSetString(kRuntimeISA));
+ usage +=
+ " --runtime-arg <argument> used to specify various arguments for the runtime\n"
+ " such as initial heap size, maximum heap size, and verbose output.\n"
+ " Use a separate --runtime-arg switch for each argument.\n"
+ " Example: --runtime-arg -Xms256m\n"
+ "\n";
usage += // Optional.
" --output=<file> may be used to send the output to a file.\n"
" Example: --output=/tmp/oatdump.txt\n"
@@ -221,6 +243,8 @@ struct CmdlineArgs {
const char* boot_image_location_ = nullptr;
// Specified by --instruction-set.
InstructionSet instruction_set_ = InstructionSet::kNone;
+ // Runtime arguments specified by --runtime-arg.
+ std::vector<const char*> runtime_args_;
// Specified by --output.
std::ostream* os_ = &std::cout;
std::unique_ptr<std::ofstream> out_; // If something besides cout is used
@@ -383,7 +407,7 @@ struct CmdlineMain {
Runtime* CreateRuntime(CmdlineArgs* args) {
CHECK(args != nullptr);
- return StartRuntime(args->boot_image_location_, args->instruction_set_);
+ return StartRuntime(args->boot_image_location_, args->instruction_set_, args_->runtime_args_);
}
};
} // namespace art