1/* 2 * Copyright (C) 2015 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#ifndef RUNTIME_OPTIONS_KEY 18#error "Please #define RUNTIME_OPTIONS_KEY before #including this file" 19#define RUNTIME_OPTIONS_KEY(...) // Don't display errors in this file in IDEs. 20#endif 21 22// This file defines the list of keys for RuntimeOptions. 23// These can be used with RuntimeOptions.Get/Set/etc, for example: 24// RuntimeOptions opt; bool* image_dex2oat_enabled = opt.Get(RuntimeOptions::ImageDex2Oat); 25// 26// Column Descriptions: 27// <<Type>> <<Key Name>> <<Default Value>> 28// 29// Default values are only used by Map::GetOrDefault(K<T>). 30// If a default value is omitted here, T{} is used as the default value, which is 31// almost-always the value of the type as if it was memset to all 0. 32// 33// Please keep the columns aligned if possible when adding new rows. 34// 35 36// Parse-able keys from the command line. 37RUNTIME_OPTIONS_KEY (Unit, Zygote) 38RUNTIME_OPTIONS_KEY (Unit, PrimaryZygote) 39RUNTIME_OPTIONS_KEY (Unit, Help) 40RUNTIME_OPTIONS_KEY (Unit, ShowVersion) 41RUNTIME_OPTIONS_KEY (ParseStringList<':'>,BootClassPath) // std::vector<std::string> 42RUNTIME_OPTIONS_KEY (ParseStringList<':'>,BootClassPathLocations) // std::vector<std::string> 43RUNTIME_OPTIONS_KEY (ParseIntList<':'>, BootClassPathFds) // std::vector<int> 44RUNTIME_OPTIONS_KEY (ParseIntList<':'>, BootClassPathImageFds) // std::vector<int> 45RUNTIME_OPTIONS_KEY (ParseIntList<':'>, BootClassPathVdexFds) // std::vector<int> 46RUNTIME_OPTIONS_KEY (ParseIntList<':'>, BootClassPathOatFds) // std::vector<int> 47RUNTIME_OPTIONS_KEY (std::string, ClassPath) 48RUNTIME_OPTIONS_KEY (ParseStringList<':'>,Image) 49RUNTIME_OPTIONS_KEY (Unit, ForceJitZygote) 50RUNTIME_OPTIONS_KEY (Unit, AllowInMemoryCompilation) 51RUNTIME_OPTIONS_KEY (Unit, CheckJni) 52RUNTIME_OPTIONS_KEY (Unit, JniOptsForceCopy) 53RUNTIME_OPTIONS_KEY (std::string, JdwpOptions, "suspend=n,server=y") 54RUNTIME_OPTIONS_KEY (JdwpProvider, JdwpProvider, JdwpProvider::kUnset) 55RUNTIME_OPTIONS_KEY (MemoryKiB, MemoryMaximumSize, gc::Heap::kDefaultMaximumSize) // -Xmx 56RUNTIME_OPTIONS_KEY (MemoryKiB, MemoryInitialSize, gc::Heap::kDefaultInitialSize) // -Xms 57RUNTIME_OPTIONS_KEY (MemoryKiB, HeapGrowthLimit) // Default is 0 for unlimited 58RUNTIME_OPTIONS_KEY (MemoryKiB, HeapMinFree, gc::Heap::kDefaultMinFree) 59RUNTIME_OPTIONS_KEY (MemoryKiB, HeapMaxFree, gc::Heap::kDefaultMaxFree) 60RUNTIME_OPTIONS_KEY (MemoryKiB, NonMovingSpaceCapacity, gc::Heap::kDefaultNonMovingSpaceCapacity) 61RUNTIME_OPTIONS_KEY (MemoryKiB, StopForNativeAllocs, 1 * GB) 62RUNTIME_OPTIONS_KEY (double, HeapTargetUtilization, gc::Heap::kDefaultTargetUtilization) 63RUNTIME_OPTIONS_KEY (double, ForegroundHeapGrowthMultiplier, gc::Heap::kDefaultHeapGrowthMultiplier) 64RUNTIME_OPTIONS_KEY (unsigned int, ParallelGCThreads, 0u) 65RUNTIME_OPTIONS_KEY (unsigned int, ConcGCThreads) 66RUNTIME_OPTIONS_KEY (unsigned int, FinalizerTimeoutMs, 10000u) 67RUNTIME_OPTIONS_KEY (Memory<1>, StackSize) // -Xss 68RUNTIME_OPTIONS_KEY (unsigned int, MaxSpinsBeforeThinLockInflation,Monitor::kDefaultMaxSpinsBeforeThinLockInflation) 69RUNTIME_OPTIONS_KEY (MillisecondsToNanoseconds, \ 70 LongPauseLogThreshold, gc::Heap::kDefaultLongPauseLogThreshold) 71RUNTIME_OPTIONS_KEY (MillisecondsToNanoseconds, \ 72 LongGCLogThreshold, gc::Heap::kDefaultLongGCLogThreshold) 73RUNTIME_OPTIONS_KEY (MillisecondsToNanoseconds, \ 74 ThreadSuspendTimeout, ThreadList::kDefaultThreadSuspendTimeout) 75RUNTIME_OPTIONS_KEY (bool, MonitorTimeoutEnable, false) 76RUNTIME_OPTIONS_KEY (int, MonitorTimeout, Monitor::kDefaultMonitorTimeoutMs) 77RUNTIME_OPTIONS_KEY (Unit, DumpGCPerformanceOnShutdown) 78RUNTIME_OPTIONS_KEY (Unit, DumpRegionInfoBeforeGC) 79RUNTIME_OPTIONS_KEY (Unit, DumpRegionInfoAfterGC) 80RUNTIME_OPTIONS_KEY (Unit, DumpJITInfoOnShutdown) 81RUNTIME_OPTIONS_KEY (Unit, IgnoreMaxFootprint) 82RUNTIME_OPTIONS_KEY (bool, AlwaysLogExplicitGcs, true) 83RUNTIME_OPTIONS_KEY (Unit, LowMemoryMode) 84RUNTIME_OPTIONS_KEY (bool, UseTLAB, kUseTlab) 85RUNTIME_OPTIONS_KEY (bool, EnableHSpaceCompactForOOM, true) 86RUNTIME_OPTIONS_KEY (bool, UseJitCompilation, true) 87RUNTIME_OPTIONS_KEY (bool, UseProfiledJitCompilation, false) 88RUNTIME_OPTIONS_KEY (bool, DumpNativeStackOnSigQuit, true) 89RUNTIME_OPTIONS_KEY (bool, MadviseRandomAccess, false) 90RUNTIME_OPTIONS_KEY (unsigned int, MadviseWillNeedVdexFileSize, 0) 91RUNTIME_OPTIONS_KEY (unsigned int, MadviseWillNeedOdexFileSize, 0) 92RUNTIME_OPTIONS_KEY (unsigned int, MadviseWillNeedArtFileSize, 0) 93RUNTIME_OPTIONS_KEY (JniIdType, OpaqueJniIds, JniIdType::kDefault) // -Xopaque-jni-ids:{true, false, swapable} 94RUNTIME_OPTIONS_KEY (bool, AutoPromoteOpaqueJniIds, true) // testing use only. -Xauto-promote-opaque-jni-ids:{true, false} 95RUNTIME_OPTIONS_KEY (unsigned int, JITOptimizeThreshold) 96RUNTIME_OPTIONS_KEY (unsigned int, JITWarmupThreshold) 97RUNTIME_OPTIONS_KEY (unsigned int, JITPriorityThreadWeight) 98RUNTIME_OPTIONS_KEY (unsigned int, JITInvokeTransitionWeight) 99RUNTIME_OPTIONS_KEY (int, JITPoolThreadPthreadPriority, jit::kJitPoolThreadPthreadDefaultPriority) 100RUNTIME_OPTIONS_KEY (int, JITZygotePoolThreadPthreadPriority, jit::kJitZygotePoolThreadPthreadDefaultPriority) 101RUNTIME_OPTIONS_KEY (MemoryKiB, JITCodeCacheInitialCapacity, jit::JitCodeCache::kInitialCapacity) 102RUNTIME_OPTIONS_KEY (MemoryKiB, JITCodeCacheMaxCapacity, jit::JitCodeCache::kMaxCapacity) 103RUNTIME_OPTIONS_KEY (MillisecondsToNanoseconds, \ 104 HSpaceCompactForOOMMinIntervalsMs,\ 105 MsToNs(100 * 1000)) // 100s 106RUNTIME_OPTIONS_KEY (std::vector<std::string>, \ 107 PropertiesList) // -D<whatever> -D<whatever> ... 108RUNTIME_OPTIONS_KEY (std::string, JniTrace) 109RUNTIME_OPTIONS_KEY (bool, Relocate, kDefaultMustRelocate) 110RUNTIME_OPTIONS_KEY (bool, ImageDex2Oat, true) 111RUNTIME_OPTIONS_KEY (bool, Interpret, false) // -Xint 112 // Disable the compiler for CC (for now). 113RUNTIME_OPTIONS_KEY (XGcOption, GcOption) // -Xgc: 114RUNTIME_OPTIONS_KEY (gc::space::LargeObjectSpaceType, \ 115 LargeObjectSpace, gc::Heap::kDefaultLargeObjectSpaceType) 116RUNTIME_OPTIONS_KEY (Memory<1>, LargeObjectThreshold, gc::Heap::kDefaultLargeObjectThreshold) 117RUNTIME_OPTIONS_KEY (BackgroundGcOption, BackgroundGc) 118 119RUNTIME_OPTIONS_KEY (Unit, DisableExplicitGC) 120RUNTIME_OPTIONS_KEY (Unit, NoSigChain) 121RUNTIME_OPTIONS_KEY (Unit, ForceNativeBridge) 122RUNTIME_OPTIONS_KEY (LogVerbosity, Verbose) 123RUNTIME_OPTIONS_KEY (unsigned int, LockProfThreshold) 124RUNTIME_OPTIONS_KEY (unsigned int, StackDumpLockProfThreshold) 125RUNTIME_OPTIONS_KEY (Unit, MethodTrace) 126RUNTIME_OPTIONS_KEY (std::string, MethodTraceFile, "/data/misc/trace/method-trace-file.bin") 127RUNTIME_OPTIONS_KEY (unsigned int, MethodTraceFileSize, 10 * MB) 128RUNTIME_OPTIONS_KEY (Unit, MethodTraceStreaming) 129RUNTIME_OPTIONS_KEY (TraceClockSource, MethodTraceClock, kDefaultTraceClockSource) 130RUNTIME_OPTIONS_KEY (TraceClockSource, ProfileClock, kDefaultTraceClockSource) // -Xprofile: 131RUNTIME_OPTIONS_KEY (ProfileSaverOptions, ProfileSaverOpts) // -Xjitsaveprofilinginfo, -Xps-* 132RUNTIME_OPTIONS_KEY (std::string, Compiler) 133RUNTIME_OPTIONS_KEY (std::vector<std::string>, \ 134 CompilerOptions) // -Xcompiler-option ... 135RUNTIME_OPTIONS_KEY (std::vector<std::string>, \ 136 ImageCompilerOptions) // -Ximage-compiler-option ... 137RUNTIME_OPTIONS_KEY (verifier::VerifyMode, \ 138 Verify, verifier::VerifyMode::kEnable) 139RUNTIME_OPTIONS_KEY (unsigned int, TargetSdkVersion, \ 140 static_cast<unsigned int>(SdkVersion::kUnset)) 141RUNTIME_OPTIONS_KEY (hiddenapi::EnforcementPolicy, 142 HiddenApiPolicy, 143 hiddenapi::EnforcementPolicy::kDisabled) 144RUNTIME_OPTIONS_KEY (hiddenapi::EnforcementPolicy, 145 CorePlatformApiPolicy, 146 hiddenapi::EnforcementPolicy::kDisabled) 147RUNTIME_OPTIONS_KEY (std::string, NativeBridge) 148RUNTIME_OPTIONS_KEY (unsigned int, ZygoteMaxFailedBoots, 10) 149RUNTIME_OPTIONS_KEY (std::string, CpuAbiList) 150RUNTIME_OPTIONS_KEY (std::string, Fingerprint) 151RUNTIME_OPTIONS_KEY (ExperimentalFlags, Experimental, ExperimentalFlags::kNone) // -Xexperimental:{...} 152RUNTIME_OPTIONS_KEY (std::list<ti::AgentSpec>, AgentLib) // -agentlib:<libname>=<options> 153RUNTIME_OPTIONS_KEY (std::list<ti::AgentSpec>, AgentPath) // -agentpath:<libname>=<options> 154RUNTIME_OPTIONS_KEY (std::vector<Plugin>, Plugins) // -Xplugin:<library> 155 156// Not parse-able from command line, but can be provided explicitly. 157// (Do not add anything here that is defined in ParsedOptions::MakeParser) 158RUNTIME_OPTIONS_KEY (std::vector<std::unique_ptr<const DexFile>>*, \ 159 BootClassPathDexList) 160RUNTIME_OPTIONS_KEY (InstructionSet, ImageInstructionSet, kRuntimeISA) 161RUNTIME_OPTIONS_KEY (CompilerCallbacks*, CompilerCallbacksPtr) // TODO: make unique_ptr 162RUNTIME_OPTIONS_KEY (bool (*)(), HookIsSensitiveThread) 163RUNTIME_OPTIONS_KEY (int32_t (*)(FILE* stream, const char* format, va_list ap), \ 164 HookVfprintf, vfprintf) 165// Use `art::FastExit` instead of `exit` so that we won't get DCHECK failures 166// in global data destructors (see b/28106055). 167RUNTIME_OPTIONS_KEY (void (*)(int32_t status), \ 168 HookExit, art::FastExit) 169 // We don't call abort(3) by default; see 170 // Runtime::Abort. 171RUNTIME_OPTIONS_KEY (void (*)(), HookAbort, nullptr) 172 173RUNTIME_OPTIONS_KEY (bool, SlowDebug, false) 174 175RUNTIME_OPTIONS_KEY (unsigned int, GlobalRefAllocStackTraceLimit, 0) // 0 = off 176RUNTIME_OPTIONS_KEY (Unit, UseStderrLogger) 177 178RUNTIME_OPTIONS_KEY (Unit, OnlyUseTrustedOatFiles) 179RUNTIME_OPTIONS_KEY (Unit, DenyArtApexDataFiles) 180RUNTIME_OPTIONS_KEY (unsigned int, VerifierLoggingThreshold, 100) 181 182RUNTIME_OPTIONS_KEY (bool, FastClassNotFoundException, true) 183RUNTIME_OPTIONS_KEY (bool, VerifierMissingKThrowFatal, true) 184 185// Setting this to true causes ART to disable Zygote native fork loop. ART also 186// internally enables this if ZygoteJit is enabled. 187RUNTIME_OPTIONS_KEY (bool, ForceJavaZygoteForkLoop, false) 188 189// Whether to allow loading of the perfetto hprof plugin. 190// Even with this option set, we will still only actually load the plugin 191// if we are on a userdebug build or the app is debuggable or profileable. 192// 193// We do not want to enable this by default because PerfettoHprof does not 194// work on host, and we do not want to enable it in tests. 195// 196// Switching this on adds ~500us to the startup on userdebug builds, or for 197// profileable / debuggable apps. 198// 199// This is set to true in frameworks/base/core/jni/AndroidRuntime.cpp. 200RUNTIME_OPTIONS_KEY (bool, PerfettoHprof, false) 201 202// This is to enable/disable Perfetto Java Heap Stack Profiling 203RUNTIME_OPTIONS_KEY (bool, PerfettoJavaHeapStackProf, false) 204 205#undef RUNTIME_OPTIONS_KEY 206