parsed_options.cc revision 4af0b08c7da92770f1ef92a260fa0eecccba6899
1/* 2 * Copyright (C) 2011 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17#include "parsed_options.h" 18 19#include <sstream> 20 21#include "base/stringpiece.h" 22#include "debugger.h" 23#include "gc/heap.h" 24#include "monitor.h" 25#include "runtime.h" 26#include "trace.h" 27#include "utils.h" 28 29#include "cmdline_parser.h" 30#include "runtime_options.h" 31 32namespace art { 33 34using MemoryKiB = Memory<1024>; 35 36ParsedOptions::ParsedOptions() 37 : hook_is_sensitive_thread_(nullptr), 38 hook_vfprintf_(vfprintf), 39 hook_exit_(exit), 40 hook_abort_(nullptr) { // We don't call abort(3) by default; see 41 // Runtime::Abort 42} 43 44ParsedOptions* ParsedOptions::Create(const RuntimeOptions& options, bool ignore_unrecognized, 45 RuntimeArgumentMap* runtime_options) { 46 CHECK(runtime_options != nullptr); 47 48 std::unique_ptr<ParsedOptions> parsed(new ParsedOptions()); 49 if (parsed->Parse(options, ignore_unrecognized, runtime_options)) { 50 return parsed.release(); 51 } 52 return nullptr; 53} 54 55using RuntimeParser = CmdlineParser<RuntimeArgumentMap, RuntimeArgumentMap::Key>; 56 57// Yes, the stack frame is huge. But we get called super early on (and just once) 58// to pass the command line arguments, so we'll probably be ok. 59// Ideas to avoid suppressing this diagnostic are welcome! 60#pragma GCC diagnostic push 61#pragma GCC diagnostic ignored "-Wframe-larger-than=" 62 63std::unique_ptr<RuntimeParser> ParsedOptions::MakeParser(bool ignore_unrecognized) { 64 using M = RuntimeArgumentMap; 65 66 std::unique_ptr<RuntimeParser::Builder> parser_builder = 67 std::unique_ptr<RuntimeParser::Builder>(new RuntimeParser::Builder()); 68 69 parser_builder-> 70 Define("-Xzygote") 71 .IntoKey(M::Zygote) 72 .Define("-help") 73 .IntoKey(M::Help) 74 .Define("-showversion") 75 .IntoKey(M::ShowVersion) 76 .Define("-Xbootclasspath:_") 77 .WithType<std::string>() 78 .IntoKey(M::BootClassPath) 79 .Define("-Xbootclasspath-locations:_") 80 .WithType<ParseStringList<':'>>() // std::vector<std::string>, split by : 81 .IntoKey(M::BootClassPathLocations) 82 .Define({"-classpath _", "-cp _"}) 83 .WithType<std::string>() 84 .IntoKey(M::ClassPath) 85 .Define("-Ximage:_") 86 .WithType<std::string>() 87 .IntoKey(M::Image) 88 .Define("-Xcheck:jni") 89 .IntoKey(M::CheckJni) 90 .Define("-Xjniopts:forcecopy") 91 .IntoKey(M::JniOptsForceCopy) 92 .Define({"-Xrunjdwp:_", "-agentlib:jdwp=_"}) 93 .WithType<JDWP::JdwpOptions>() 94 .IntoKey(M::JdwpOptions) 95 .Define("-Xms_") 96 .WithType<MemoryKiB>() 97 .IntoKey(M::MemoryInitialSize) 98 .Define("-Xmx_") 99 .WithType<MemoryKiB>() 100 .IntoKey(M::MemoryMaximumSize) 101 .Define("-XX:HeapGrowthLimit=_") 102 .WithType<MemoryKiB>() 103 .IntoKey(M::HeapGrowthLimit) 104 .Define("-XX:HeapMinFree=_") 105 .WithType<MemoryKiB>() 106 .IntoKey(M::HeapMinFree) 107 .Define("-XX:HeapMaxFree=_") 108 .WithType<MemoryKiB>() 109 .IntoKey(M::HeapMaxFree) 110 .Define("-XX:NonMovingSpaceCapacity=_") 111 .WithType<MemoryKiB>() 112 .IntoKey(M::NonMovingSpaceCapacity) 113 .Define("-XX:HeapTargetUtilization=_") 114 .WithType<double>().WithRange(0.1, 0.9) 115 .IntoKey(M::HeapTargetUtilization) 116 .Define("-XX:ForegroundHeapGrowthMultiplier=_") 117 .WithType<double>().WithRange(0.1, 1.0) 118 .IntoKey(M::ForegroundHeapGrowthMultiplier) 119 .Define("-XX:ParallelGCThreads=_") 120 .WithType<unsigned int>() 121 .IntoKey(M::ParallelGCThreads) 122 .Define("-XX:ConcGCThreads=_") 123 .WithType<unsigned int>() 124 .IntoKey(M::ConcGCThreads) 125 .Define("-Xss_") 126 .WithType<Memory<1>>() 127 .IntoKey(M::StackSize) 128 .Define("-XX:MaxSpinsBeforeThinLockInflation=_") 129 .WithType<unsigned int>() 130 .IntoKey(M::MaxSpinsBeforeThinLockInflation) 131 .Define("-XX:LongPauseLogThreshold=_") // in ms 132 .WithType<MillisecondsToNanoseconds>() // store as ns 133 .IntoKey(M::LongPauseLogThreshold) 134 .Define("-XX:LongGCLogThreshold=_") // in ms 135 .WithType<MillisecondsToNanoseconds>() // store as ns 136 .IntoKey(M::LongGCLogThreshold) 137 .Define("-XX:DumpGCPerformanceOnShutdown") 138 .IntoKey(M::DumpGCPerformanceOnShutdown) 139 .Define("-XX:IgnoreMaxFootprint") 140 .IntoKey(M::IgnoreMaxFootprint) 141 .Define("-XX:LowMemoryMode") 142 .IntoKey(M::LowMemoryMode) 143 .Define("-XX:UseTLAB") 144 .IntoKey(M::UseTLAB) 145 .Define({"-XX:EnableHSpaceCompactForOOM", "-XX:DisableHSpaceCompactForOOM"}) 146 .WithValues({true, false}) 147 .IntoKey(M::EnableHSpaceCompactForOOM) 148 .Define("-XX:HspaceCompactForOOMMinIntervalMs=_") // in ms 149 .WithType<MillisecondsToNanoseconds>() // store as ns 150 .IntoKey(M::HSpaceCompactForOOMMinIntervalsMs) 151 .Define("-D_") 152 .WithType<std::vector<std::string>>().AppendValues() 153 .IntoKey(M::PropertiesList) 154 .Define("-Xjnitrace:_") 155 .WithType<std::string>() 156 .IntoKey(M::JniTrace) 157 .Define("-Xpatchoat:_") 158 .WithType<std::string>() 159 .IntoKey(M::PatchOat) 160 .Define({"-Xrelocate", "-Xnorelocate"}) 161 .WithValues({true, false}) 162 .IntoKey(M::Relocate) 163 .Define({"-Xdex2oat", "-Xnodex2oat"}) 164 .WithValues({true, false}) 165 .IntoKey(M::Dex2Oat) 166 .Define({"-Ximage-dex2oat", "-Xnoimage-dex2oat"}) 167 .WithValues({true, false}) 168 .IntoKey(M::ImageDex2Oat) 169 .Define("-Xint") 170 .WithValue(true) 171 .IntoKey(M::Interpret) 172 .Define("-Xgc:_") 173 .WithType<XGcOption>() 174 .IntoKey(M::GcOption) 175 .Define("-XX:LargeObjectSpace=_") 176 .WithType<gc::space::LargeObjectSpaceType>() 177 .WithValueMap({{"disabled", gc::space::LargeObjectSpaceType::kDisabled}, 178 {"freelist", gc::space::LargeObjectSpaceType::kFreeList}, 179 {"map", gc::space::LargeObjectSpaceType::kMap}}) 180 .IntoKey(M::LargeObjectSpace) 181 .Define("-XX:LargeObjectThreshold=_") 182 .WithType<Memory<1>>() 183 .IntoKey(M::LargeObjectThreshold) 184 .Define("-XX:BackgroundGC=_") 185 .WithType<BackgroundGcOption>() 186 .IntoKey(M::BackgroundGc) 187 .Define("-XX:+DisableExplicitGC") 188 .IntoKey(M::DisableExplicitGC) 189 .Define("-verbose:_") 190 .WithType<LogVerbosity>() 191 .IntoKey(M::Verbose) 192 .Define("-Xlockprofthreshold:_") 193 .WithType<unsigned int>() 194 .IntoKey(M::LockProfThreshold) 195 .Define("-Xstacktracefile:_") 196 .WithType<std::string>() 197 .IntoKey(M::StackTraceFile) 198 .Define("-Xmethod-trace") 199 .IntoKey(M::MethodTrace) 200 .Define("-Xmethod-trace-file:_") 201 .WithType<std::string>() 202 .IntoKey(M::MethodTraceFile) 203 .Define("-Xmethod-trace-file-size:_") 204 .WithType<unsigned int>() 205 .IntoKey(M::MethodTraceFileSize) 206 .Define("-Xprofile:_") 207 .WithType<TraceClockSource>() 208 .WithValueMap({{"threadcpuclock", TraceClockSource::kThreadCpu}, 209 {"wallclock", TraceClockSource::kWall}, 210 {"dualclock", TraceClockSource::kDual}}) 211 .IntoKey(M::ProfileClock) 212 .Define("-Xenable-profiler") 213 .WithType<TestProfilerOptions>() 214 .AppendValues() 215 .IntoKey(M::ProfilerOpts) // NOTE: Appends into same key as -Xprofile-* 216 .Define("-Xprofile-_") // -Xprofile-<key>:<value> 217 .WithType<TestProfilerOptions>() 218 .AppendValues() 219 .IntoKey(M::ProfilerOpts) // NOTE: Appends into same key as -Xenable-profiler 220 .Define("-Xcompiler:_") 221 .WithType<std::string>() 222 .IntoKey(M::Compiler) 223 .Define("-Xcompiler-option _") 224 .WithType<std::vector<std::string>>() 225 .AppendValues() 226 .IntoKey(M::CompilerOptions) 227 .Define("-Ximage-compiler-option _") 228 .WithType<std::vector<std::string>>() 229 .AppendValues() 230 .IntoKey(M::ImageCompilerOptions) 231 .Define("-Xverify:_") 232 .WithType<bool>() 233 .WithValueMap({{"none", false}, 234 {"remote", true}, 235 {"all", true}}) 236 .IntoKey(M::Verify) 237 .Define("-XX:NativeBridge=_") 238 .WithType<std::string>() 239 .IntoKey(M::NativeBridge) 240 .Ignore({ 241 "-ea", "-da", "-enableassertions", "-disableassertions", "--runtime-arg", "-esa", 242 "-dsa", "-enablesystemassertions", "-disablesystemassertions", "-Xrs", "-Xint:_", 243 "-Xdexopt:_", "-Xnoquithandler", "-Xjnigreflimit:_", "-Xgenregmap", "-Xnogenregmap", 244 "-Xverifyopt:_", "-Xcheckdexsum", "-Xincludeselectedop", "-Xjitop:_", 245 "-Xincludeselectedmethod", "-Xjitthreshold:_", "-Xjitcodecachesize:_", 246 "-Xjitblocking", "-Xjitmethod:_", "-Xjitclass:_", "-Xjitoffset:_", 247 "-Xjitconfig:_", "-Xjitcheckcg", "-Xjitverbose", "-Xjitprofile", 248 "-Xjitdisableopt", "-Xjitsuspendpoll", "-XX:mainThreadStackSize=_"}) 249 .IgnoreUnrecognized(ignore_unrecognized); 250 251 // TODO: Move Usage information into this DSL. 252 253 return std::unique_ptr<RuntimeParser>(new RuntimeParser(parser_builder->Build())); 254} 255 256#pragma GCC diagnostic pop 257 258// Remove all the special options that have something in the void* part of the option. 259// If runtime_options is not null, put the options in there. 260// As a side-effect, populate the hooks from options. 261bool ParsedOptions::ProcessSpecialOptions(const RuntimeOptions& options, 262 RuntimeArgumentMap* runtime_options, 263 std::vector<std::string>* out_options) { 264 using M = RuntimeArgumentMap; 265 266 // TODO: Move the below loop into JNI 267 // Handle special options that set up hooks 268 for (size_t i = 0; i < options.size(); ++i) { 269 const std::string option(options[i].first); 270 // TODO: support -Djava.class.path 271 if (option == "bootclasspath") { 272 auto boot_class_path 273 = reinterpret_cast<const std::vector<const DexFile*>*>(options[i].second); 274 275 if (runtime_options != nullptr) { 276 runtime_options->Set(M::BootClassPathDexList, boot_class_path); 277 } 278 } else if (option == "compilercallbacks") { 279 CompilerCallbacks* compiler_callbacks = 280 reinterpret_cast<CompilerCallbacks*>(const_cast<void*>(options[i].second)); 281 if (runtime_options != nullptr) { 282 runtime_options->Set(M::CompilerCallbacksPtr, compiler_callbacks); 283 } 284 } else if (option == "imageinstructionset") { 285 const char* isa_str = reinterpret_cast<const char*>(options[i].second); 286 auto&& image_isa = GetInstructionSetFromString(isa_str); 287 if (image_isa == kNone) { 288 Usage("%s is not a valid instruction set.", isa_str); 289 return false; 290 } 291 if (runtime_options != nullptr) { 292 runtime_options->Set(M::ImageInstructionSet, image_isa); 293 } 294 } else if (option == "sensitiveThread") { 295 const void* hook = options[i].second; 296 bool (*hook_is_sensitive_thread)() = reinterpret_cast<bool (*)()>(const_cast<void*>(hook)); 297 298 if (runtime_options != nullptr) { 299 runtime_options->Set(M::HookIsSensitiveThread, hook_is_sensitive_thread); 300 } 301 } else if (option == "vfprintf") { 302 const void* hook = options[i].second; 303 if (hook == nullptr) { 304 Usage("vfprintf argument was NULL"); 305 return false; 306 } 307 int (*hook_vfprintf)(FILE *, const char*, va_list) = 308 reinterpret_cast<int (*)(FILE *, const char*, va_list)>(const_cast<void*>(hook)); 309 310 if (runtime_options != nullptr) { 311 runtime_options->Set(M::HookVfprintf, hook_vfprintf); 312 } 313 hook_vfprintf_ = hook_vfprintf; 314 } else if (option == "exit") { 315 const void* hook = options[i].second; 316 if (hook == nullptr) { 317 Usage("exit argument was NULL"); 318 return false; 319 } 320 void(*hook_exit)(jint) = reinterpret_cast<void(*)(jint)>(const_cast<void*>(hook)); 321 if (runtime_options != nullptr) { 322 runtime_options->Set(M::HookExit, hook_exit); 323 } 324 hook_exit_ = hook_exit; 325 } else if (option == "abort") { 326 const void* hook = options[i].second; 327 if (hook == nullptr) { 328 Usage("abort was NULL\n"); 329 return false; 330 } 331 void(*hook_abort)() = reinterpret_cast<void(*)()>(const_cast<void*>(hook)); 332 if (runtime_options != nullptr) { 333 runtime_options->Set(M::HookAbort, hook_abort); 334 } 335 hook_abort_ = hook_abort; 336 } else { 337 // It is a regular option, that doesn't have a known 'second' value. 338 // Push it on to the regular options which will be parsed by our parser. 339 if (out_options != nullptr) { 340 out_options->push_back(option); 341 } 342 } 343 } 344 345 return true; 346} 347 348bool ParsedOptions::Parse(const RuntimeOptions& options, bool ignore_unrecognized, 349 RuntimeArgumentMap* runtime_options) { 350// gLogVerbosity.class_linker = true; // TODO: don't check this in! 351// gLogVerbosity.compiler = true; // TODO: don't check this in! 352// gLogVerbosity.gc = true; // TODO: don't check this in! 353// gLogVerbosity.heap = true; // TODO: don't check this in! 354// gLogVerbosity.jdwp = true; // TODO: don't check this in! 355// gLogVerbosity.jni = true; // TODO: don't check this in! 356// gLogVerbosity.monitor = true; // TODO: don't check this in! 357// gLogVerbosity.profiler = true; // TODO: don't check this in! 358// gLogVerbosity.signals = true; // TODO: don't check this in! 359// gLogVerbosity.startup = true; // TODO: don't check this in! 360// gLogVerbosity.third_party_jni = true; // TODO: don't check this in! 361// gLogVerbosity.threads = true; // TODO: don't check this in! 362// gLogVerbosity.verifier = true; // TODO: don't check this in! 363 364 for (size_t i = 0; i < options.size(); ++i) { 365 if (true && options[0].first == "-Xzygote") { 366 LOG(INFO) << "option[" << i << "]=" << options[i].first; 367 } 368 } 369 370 auto parser = MakeParser(ignore_unrecognized); 371 372 // Convert to a simple string list (without the magic pointer options) 373 std::vector<std::string> argv_list; 374 if (!ProcessSpecialOptions(options, nullptr, &argv_list)) { 375 return false; 376 } 377 378 CmdlineResult parse_result = parser->Parse(argv_list); 379 380 // Handle parse errors by displaying the usage and potentially exiting. 381 if (parse_result.IsError()) { 382 if (parse_result.GetStatus() == CmdlineResult::kUsage) { 383 UsageMessage(stdout, "%s\n", parse_result.GetMessage().c_str()); 384 Exit(0); 385 } else if (parse_result.GetStatus() == CmdlineResult::kUnknown && !ignore_unrecognized) { 386 Usage("%s\n", parse_result.GetMessage().c_str()); 387 return false; 388 } else { 389 Usage("%s\n", parse_result.GetMessage().c_str()); 390 Exit(0); 391 } 392 393 UNREACHABLE(); 394 return false; 395 } 396 397 using M = RuntimeArgumentMap; 398 RuntimeArgumentMap args = parser->ReleaseArgumentsMap(); 399 400 // -help, -showversion, etc. 401 if (args.Exists(M::Help)) { 402 Usage(nullptr); 403 return false; 404 } else if (args.Exists(M::ShowVersion)) { 405 UsageMessage(stdout, "ART version %s\n", Runtime::GetVersion()); 406 Exit(0); 407 } else if (args.Exists(M::BootClassPath)) { 408 LOG(INFO) << "setting boot class path to " << *args.Get(M::BootClassPath); 409 } 410 411 // Set a default boot class path if we didn't get an explicit one via command line. 412 if (getenv("BOOTCLASSPATH") != nullptr) { 413 args.SetIfMissing(M::BootClassPath, std::string(getenv("BOOTCLASSPATH"))); 414 } 415 416 // Set a default class path if we didn't get an explicit one via command line. 417 if (getenv("CLASSPATH") != nullptr) { 418 args.SetIfMissing(M::ClassPath, std::string(getenv("CLASSPATH"))); 419 } 420 421 // Default to number of processors minus one since the main GC thread also does work. 422 args.SetIfMissing(M::ParallelGCThreads, 423 static_cast<unsigned int>(sysconf(_SC_NPROCESSORS_CONF) - 1u)); 424 425 // -Xverbose: 426 { 427 LogVerbosity *log_verbosity = args.Get(M::Verbose); 428 if (log_verbosity != nullptr) { 429 gLogVerbosity = *log_verbosity; 430 } 431 } 432 433 // -Xprofile: 434 Trace::SetDefaultClockSource(args.GetOrDefault(M::ProfileClock)); 435 436 if (!ProcessSpecialOptions(options, &args, nullptr)) { 437 return false; 438 } 439 440 { 441 // If not set, background collector type defaults to homogeneous compaction. 442 // If foreground is GSS, use GSS as background collector. 443 // If not low memory mode, semispace otherwise. 444 445 gc::CollectorType background_collector_type_; 446 gc::CollectorType collector_type_ = (XGcOption{}).collector_type_; // NOLINT [whitespace/braces] [5] 447 bool low_memory_mode_ = args.Exists(M::LowMemoryMode); 448 449 background_collector_type_ = args.GetOrDefault(M::BackgroundGc); 450 { 451 XGcOption* xgc = args.Get(M::GcOption); 452 if (xgc != nullptr && xgc->collector_type_ != gc::kCollectorTypeNone) { 453 collector_type_ = xgc->collector_type_; 454 } 455 } 456 457 if (background_collector_type_ == gc::kCollectorTypeNone) { 458 if (collector_type_ != gc::kCollectorTypeGSS) { 459 background_collector_type_ = low_memory_mode_ ? 460 gc::kCollectorTypeSS : gc::kCollectorTypeHomogeneousSpaceCompact; 461 } else { 462 background_collector_type_ = collector_type_; 463 } 464 } 465 466 args.Set(M::BackgroundGc, BackgroundGcOption { background_collector_type_ }); 467 } 468 469 // If a reference to the dalvik core.jar snuck in, replace it with 470 // the art specific version. This can happen with on device 471 // boot.art/boot.oat generation by GenerateImage which relies on the 472 // value of BOOTCLASSPATH. 473#if defined(ART_TARGET) 474 std::string core_jar("/core.jar"); 475 std::string core_libart_jar("/core-libart.jar"); 476#else 477 // The host uses hostdex files. 478 std::string core_jar("/core-hostdex.jar"); 479 std::string core_libart_jar("/core-libart-hostdex.jar"); 480#endif 481 auto boot_class_path_string = args.GetOrDefault(M::BootClassPath); 482 483 size_t core_jar_pos = boot_class_path_string.find(core_jar); 484 if (core_jar_pos != std::string::npos) { 485 boot_class_path_string.replace(core_jar_pos, core_jar.size(), core_libart_jar); 486 args.Set(M::BootClassPath, boot_class_path_string); 487 } 488 489 { 490 auto&& boot_class_path = args.GetOrDefault(M::BootClassPath); 491 auto&& boot_class_path_locations = args.GetOrDefault(M::BootClassPathLocations); 492 if (args.Exists(M::BootClassPathLocations)) { 493 size_t boot_class_path_count = ParseStringList<':'>::Split(boot_class_path).Size(); 494 495 if (boot_class_path_count != boot_class_path_locations.Size()) { 496 Usage("The number of boot class path files does not match" 497 " the number of boot class path locations given\n" 498 " boot class path files (%zu): %s\n" 499 " boot class path locations (%zu): %s\n", 500 boot_class_path.size(), boot_class_path_string.c_str(), 501 boot_class_path_locations.Size(), boot_class_path_locations.Join().c_str()); 502 return false; 503 } 504 } 505 } 506 507 if (!args.Exists(M::CompilerCallbacksPtr) && !args.Exists(M::Image)) { 508 std::string image = GetAndroidRoot(); 509 image += "/framework/boot.art"; 510 args.Set(M::Image, image); 511 } 512 513 if (args.GetOrDefault(M::HeapGrowthLimit) == 0u) { // 0 means no growth limit 514 args.Set(M::HeapGrowthLimit, args.GetOrDefault(M::MemoryMaximumSize)); 515 } 516 517 *runtime_options = std::move(args); 518 return true; 519} 520 521void ParsedOptions::Exit(int status) { 522 hook_exit_(status); 523} 524 525void ParsedOptions::Abort() { 526 hook_abort_(); 527} 528 529void ParsedOptions::UsageMessageV(FILE* stream, const char* fmt, va_list ap) { 530 hook_vfprintf_(stream, fmt, ap); 531} 532 533void ParsedOptions::UsageMessage(FILE* stream, const char* fmt, ...) { 534 va_list ap; 535 va_start(ap, fmt); 536 UsageMessageV(stream, fmt, ap); 537 va_end(ap); 538} 539 540void ParsedOptions::Usage(const char* fmt, ...) { 541 bool error = (fmt != nullptr); 542 FILE* stream = error ? stderr : stdout; 543 544 if (fmt != nullptr) { 545 va_list ap; 546 va_start(ap, fmt); 547 UsageMessageV(stream, fmt, ap); 548 va_end(ap); 549 } 550 551 const char* program = "dalvikvm"; 552 UsageMessage(stream, "%s: [options] class [argument ...]\n", program); 553 UsageMessage(stream, "\n"); 554 UsageMessage(stream, "The following standard options are supported:\n"); 555 UsageMessage(stream, " -classpath classpath (-cp classpath)\n"); 556 UsageMessage(stream, " -Dproperty=value\n"); 557 UsageMessage(stream, " -verbose:tag ('gc', 'jni', or 'class')\n"); 558 UsageMessage(stream, " -showversion\n"); 559 UsageMessage(stream, " -help\n"); 560 UsageMessage(stream, " -agentlib:jdwp=options\n"); 561 UsageMessage(stream, "\n"); 562 563 UsageMessage(stream, "The following extended options are supported:\n"); 564 UsageMessage(stream, " -Xrunjdwp:<options>\n"); 565 UsageMessage(stream, " -Xbootclasspath:bootclasspath\n"); 566 UsageMessage(stream, " -Xcheck:tag (e.g. 'jni')\n"); 567 UsageMessage(stream, " -XmsN (min heap, must be multiple of 1K, >= 1MB)\n"); 568 UsageMessage(stream, " -XmxN (max heap, must be multiple of 1K, >= 2MB)\n"); 569 UsageMessage(stream, " -XssN (stack size)\n"); 570 UsageMessage(stream, " -Xint\n"); 571 UsageMessage(stream, "\n"); 572 573 UsageMessage(stream, "The following Dalvik options are supported:\n"); 574 UsageMessage(stream, " -Xzygote\n"); 575 UsageMessage(stream, " -Xjnitrace:substring (eg NativeClass or nativeMethod)\n"); 576 UsageMessage(stream, " -Xstacktracefile:<filename>\n"); 577 UsageMessage(stream, " -Xgc:[no]preverify\n"); 578 UsageMessage(stream, " -Xgc:[no]postverify\n"); 579 UsageMessage(stream, " -XX:HeapGrowthLimit=N\n"); 580 UsageMessage(stream, " -XX:HeapMinFree=N\n"); 581 UsageMessage(stream, " -XX:HeapMaxFree=N\n"); 582 UsageMessage(stream, " -XX:NonMovingSpaceCapacity=N\n"); 583 UsageMessage(stream, " -XX:HeapTargetUtilization=doublevalue\n"); 584 UsageMessage(stream, " -XX:ForegroundHeapGrowthMultiplier=doublevalue\n"); 585 UsageMessage(stream, " -XX:LowMemoryMode\n"); 586 UsageMessage(stream, " -Xprofile:{threadcpuclock,wallclock,dualclock}\n"); 587 UsageMessage(stream, "\n"); 588 589 UsageMessage(stream, "The following unique to ART options are supported:\n"); 590 UsageMessage(stream, " -Xgc:[no]preverify_rosalloc\n"); 591 UsageMessage(stream, " -Xgc:[no]postsweepingverify_rosalloc\n"); 592 UsageMessage(stream, " -Xgc:[no]postverify_rosalloc\n"); 593 UsageMessage(stream, " -Xgc:[no]presweepingverify\n"); 594 UsageMessage(stream, " -Ximage:filename\n"); 595 UsageMessage(stream, " -Xbootclasspath-locations:bootclasspath\n" 596 " (override the dex locations of the -Xbootclasspath files)\n"); 597 UsageMessage(stream, " -XX:+DisableExplicitGC\n"); 598 UsageMessage(stream, " -XX:ParallelGCThreads=integervalue\n"); 599 UsageMessage(stream, " -XX:ConcGCThreads=integervalue\n"); 600 UsageMessage(stream, " -XX:MaxSpinsBeforeThinLockInflation=integervalue\n"); 601 UsageMessage(stream, " -XX:LongPauseLogThreshold=integervalue\n"); 602 UsageMessage(stream, " -XX:LongGCLogThreshold=integervalue\n"); 603 UsageMessage(stream, " -XX:DumpGCPerformanceOnShutdown\n"); 604 UsageMessage(stream, " -XX:IgnoreMaxFootprint\n"); 605 UsageMessage(stream, " -XX:UseTLAB\n"); 606 UsageMessage(stream, " -XX:BackgroundGC=none\n"); 607 UsageMessage(stream, " -XX:LargeObjectSpace={disabled,map,freelist}\n"); 608 UsageMessage(stream, " -XX:LargeObjectThreshold=N\n"); 609 UsageMessage(stream, " -Xmethod-trace\n"); 610 UsageMessage(stream, " -Xmethod-trace-file:filename"); 611 UsageMessage(stream, " -Xmethod-trace-file-size:integervalue\n"); 612 UsageMessage(stream, " -Xenable-profiler\n"); 613 UsageMessage(stream, " -Xprofile-filename:filename\n"); 614 UsageMessage(stream, " -Xprofile-period:integervalue\n"); 615 UsageMessage(stream, " -Xprofile-duration:integervalue\n"); 616 UsageMessage(stream, " -Xprofile-interval:integervalue\n"); 617 UsageMessage(stream, " -Xprofile-backoff:doublevalue\n"); 618 UsageMessage(stream, " -Xprofile-start-immediately\n"); 619 UsageMessage(stream, " -Xprofile-top-k-threshold:doublevalue\n"); 620 UsageMessage(stream, " -Xprofile-top-k-change-threshold:doublevalue\n"); 621 UsageMessage(stream, " -Xprofile-type:{method,stack}\n"); 622 UsageMessage(stream, " -Xprofile-max-stack-depth:integervalue\n"); 623 UsageMessage(stream, " -Xcompiler:filename\n"); 624 UsageMessage(stream, " -Xcompiler-option dex2oat-option\n"); 625 UsageMessage(stream, " -Ximage-compiler-option dex2oat-option\n"); 626 UsageMessage(stream, " -Xpatchoat:filename\n"); 627 UsageMessage(stream, " -X[no]relocate\n"); 628 UsageMessage(stream, " -X[no]dex2oat (Whether to invoke dex2oat on the application)\n"); 629 UsageMessage(stream, " -X[no]image-dex2oat (Whether to create and use a boot image)\n"); 630 UsageMessage(stream, "\n"); 631 632 UsageMessage(stream, "The following previously supported Dalvik options are ignored:\n"); 633 UsageMessage(stream, " -ea[:<package name>... |:<class name>]\n"); 634 UsageMessage(stream, " -da[:<package name>... |:<class name>]\n"); 635 UsageMessage(stream, " (-enableassertions, -disableassertions)\n"); 636 UsageMessage(stream, " -esa\n"); 637 UsageMessage(stream, " -dsa\n"); 638 UsageMessage(stream, " (-enablesystemassertions, -disablesystemassertions)\n"); 639 UsageMessage(stream, " -Xverify:{none,remote,all}\n"); 640 UsageMessage(stream, " -Xrs\n"); 641 UsageMessage(stream, " -Xint:portable, -Xint:fast, -Xint:jit\n"); 642 UsageMessage(stream, " -Xdexopt:{none,verified,all,full}\n"); 643 UsageMessage(stream, " -Xnoquithandler\n"); 644 UsageMessage(stream, " -Xjniopts:{warnonly,forcecopy}\n"); 645 UsageMessage(stream, " -Xjnigreflimit:integervalue\n"); 646 UsageMessage(stream, " -Xgc:[no]precise\n"); 647 UsageMessage(stream, " -Xgc:[no]verifycardtable\n"); 648 UsageMessage(stream, " -X[no]genregmap\n"); 649 UsageMessage(stream, " -Xverifyopt:[no]checkmon\n"); 650 UsageMessage(stream, " -Xcheckdexsum\n"); 651 UsageMessage(stream, " -Xincludeselectedop\n"); 652 UsageMessage(stream, " -Xjitop:hexopvalue[-endvalue][,hexopvalue[-endvalue]]*\n"); 653 UsageMessage(stream, " -Xincludeselectedmethod\n"); 654 UsageMessage(stream, " -Xjitthreshold:integervalue\n"); 655 UsageMessage(stream, " -Xjitcodecachesize:decimalvalueofkbytes\n"); 656 UsageMessage(stream, " -Xjitblocking\n"); 657 UsageMessage(stream, " -Xjitmethod:signature[,signature]* (eg Ljava/lang/String\\;replace)\n"); 658 UsageMessage(stream, " -Xjitclass:classname[,classname]*\n"); 659 UsageMessage(stream, " -Xjitoffset:offset[,offset]\n"); 660 UsageMessage(stream, " -Xjitconfig:filename\n"); 661 UsageMessage(stream, " -Xjitcheckcg\n"); 662 UsageMessage(stream, " -Xjitverbose\n"); 663 UsageMessage(stream, " -Xjitprofile\n"); 664 UsageMessage(stream, " -Xjitdisableopt\n"); 665 UsageMessage(stream, " -Xjitsuspendpoll\n"); 666 UsageMessage(stream, " -XX:mainThreadStackSize=N\n"); 667 UsageMessage(stream, "\n"); 668 669 Exit((error) ? 1 : 0); 670} 671 672} // namespace art 673