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, ThreadSuspendTimeout) 74RUNTIME_OPTIONS_KEY (bool, MonitorTimeoutEnable, false) 75RUNTIME_OPTIONS_KEY (int, MonitorTimeout, Monitor::kDefaultMonitorTimeoutMs) 76RUNTIME_OPTIONS_KEY (Unit, DumpGCPerformanceOnShutdown) 77RUNTIME_OPTIONS_KEY (Unit, DumpRegionInfoBeforeGC) 78RUNTIME_OPTIONS_KEY (Unit, DumpRegionInfoAfterGC) 79RUNTIME_OPTIONS_KEY (Unit, DumpJITInfoOnShutdown) 80RUNTIME_OPTIONS_KEY (Unit, IgnoreMaxFootprint) 81RUNTIME_OPTIONS_KEY (bool, AlwaysLogExplicitGcs, true) 82RUNTIME_OPTIONS_KEY (Unit, LowMemoryMode) 83RUNTIME_OPTIONS_KEY (bool, UseTLAB, kUseTlab) 84RUNTIME_OPTIONS_KEY (bool, EnableHSpaceCompactForOOM, true) 85RUNTIME_OPTIONS_KEY (bool, UseJitCompilation, true) 86RUNTIME_OPTIONS_KEY (bool, UseProfiledJitCompilation, false) 87RUNTIME_OPTIONS_KEY (bool, DumpNativeStackOnSigQuit, true) 88RUNTIME_OPTIONS_KEY (bool, MadviseRandomAccess, false) 89RUNTIME_OPTIONS_KEY (unsigned int, MadviseWillNeedVdexFileSize, 0) 90RUNTIME_OPTIONS_KEY (unsigned int, MadviseWillNeedOdexFileSize, 0) 91RUNTIME_OPTIONS_KEY (unsigned int, MadviseWillNeedArtFileSize, 0) 92RUNTIME_OPTIONS_KEY (JniIdType, OpaqueJniIds, JniIdType::kDefault) // -Xopaque-jni-ids:{true, false, swapable} 93RUNTIME_OPTIONS_KEY (bool, AutoPromoteOpaqueJniIds, true) // testing use only. -Xauto-promote-opaque-jni-ids:{true, false} 94RUNTIME_OPTIONS_KEY (unsigned int, JITOptimizeThreshold) 95RUNTIME_OPTIONS_KEY (unsigned int, JITWarmupThreshold) 96RUNTIME_OPTIONS_KEY (unsigned int, JITPriorityThreadWeight) 97RUNTIME_OPTIONS_KEY (unsigned int, JITInvokeTransitionWeight) 98RUNTIME_OPTIONS_KEY (int, JITPoolThreadPthreadPriority, jit::kJitPoolThreadPthreadDefaultPriority) 99RUNTIME_OPTIONS_KEY (int, JITZygotePoolThreadPthreadPriority, jit::kJitZygotePoolThreadPthreadDefaultPriority) 100RUNTIME_OPTIONS_KEY (MemoryKiB, JITCodeCacheInitialCapacity, jit::JitCodeCache::GetInitialCapacity()) 101RUNTIME_OPTIONS_KEY (MemoryKiB, JITCodeCacheMaxCapacity, jit::JitCodeCache::kMaxCapacity) 102RUNTIME_OPTIONS_KEY (MillisecondsToNanoseconds, \ 103 HSpaceCompactForOOMMinIntervalsMs,\ 104 MsToNs(100 * 1000)) // 100s 105RUNTIME_OPTIONS_KEY (std::vector<std::string>, \ 106 PropertiesList) // -D<whatever> -D<whatever> ... 107RUNTIME_OPTIONS_KEY (std::string, JniTrace) 108RUNTIME_OPTIONS_KEY (bool, Relocate, kDefaultMustRelocate) 109RUNTIME_OPTIONS_KEY (bool, ImageDex2Oat, true) 110RUNTIME_OPTIONS_KEY (bool, Interpret, false) // -Xint 111 // Disable the compiler for CC (for now). 112RUNTIME_OPTIONS_KEY (XGcOption, GcOption) // -Xgc: 113RUNTIME_OPTIONS_KEY (gc::space::LargeObjectSpaceType, \ 114 LargeObjectSpace, gc::Heap::kDefaultLargeObjectSpaceType) 115RUNTIME_OPTIONS_KEY (Memory<1>, LargeObjectThreshold, gc::Heap::kDefaultLargeObjectThreshold) 116RUNTIME_OPTIONS_KEY (BackgroundGcOption, BackgroundGc) 117 118RUNTIME_OPTIONS_KEY (Unit, DisableExplicitGC) 119RUNTIME_OPTIONS_KEY (Unit, DisableEagerlyReleaseExplicitGC) 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 (ProfileSaverOptions, ProfileSaverOpts) // -Xjitsaveprofilinginfo, -Xps-* 131RUNTIME_OPTIONS_KEY (std::string, Compiler) 132RUNTIME_OPTIONS_KEY (std::vector<std::string>, \ 133 CompilerOptions) // -Xcompiler-option ... 134RUNTIME_OPTIONS_KEY (std::vector<std::string>, \ 135 ImageCompilerOptions) // -Ximage-compiler-option ... 136RUNTIME_OPTIONS_KEY (verifier::VerifyMode, \ 137 Verify, verifier::VerifyMode::kEnable) 138RUNTIME_OPTIONS_KEY (unsigned int, TargetSdkVersion, \ 139 static_cast<unsigned int>(SdkVersion::kUnset)) 140RUNTIME_OPTIONS_KEY (hiddenapi::EnforcementPolicy, 141 HiddenApiPolicy, 142 hiddenapi::EnforcementPolicy::kDisabled) 143RUNTIME_OPTIONS_KEY (hiddenapi::EnforcementPolicy, 144 CorePlatformApiPolicy, 145 hiddenapi::EnforcementPolicy::kDisabled) 146RUNTIME_OPTIONS_KEY (std::string, NativeBridge) 147RUNTIME_OPTIONS_KEY (unsigned int, ZygoteMaxFailedBoots, 10) 148RUNTIME_OPTIONS_KEY (std::string, CpuAbiList) 149RUNTIME_OPTIONS_KEY (std::string, Fingerprint) 150RUNTIME_OPTIONS_KEY (ExperimentalFlags, Experimental, ExperimentalFlags::kNone) // -Xexperimental:{...} 151RUNTIME_OPTIONS_KEY (std::list<ti::AgentSpec>, AgentLib) // -agentlib:<libname>=<options> 152RUNTIME_OPTIONS_KEY (std::list<ti::AgentSpec>, AgentPath) // -agentpath:<libname>=<options> 153RUNTIME_OPTIONS_KEY (std::vector<Plugin>, Plugins) // -Xplugin:<library> 154 155// Not parse-able from command line, but can be provided explicitly. 156// (Do not add anything here that is defined in ParsedOptions::MakeParser) 157RUNTIME_OPTIONS_KEY (std::vector<std::unique_ptr<const DexFile>>*, \ 158 BootClassPathDexList) 159RUNTIME_OPTIONS_KEY (InstructionSet, ImageInstructionSet, kRuntimeISA) 160RUNTIME_OPTIONS_KEY (CompilerCallbacks*, CompilerCallbacksPtr) // TODO: make unique_ptr 161RUNTIME_OPTIONS_KEY (bool (*)(), HookIsSensitiveThread) 162RUNTIME_OPTIONS_KEY (int32_t (*)(FILE* stream, const char* format, va_list ap), \ 163 HookVfprintf, vfprintf) 164// Use `art::FastExit` instead of `exit` so that we won't get DCHECK failures 165// in global data destructors (see b/28106055). 166RUNTIME_OPTIONS_KEY (void (*)(int32_t status), \ 167 HookExit, art::FastExit) 168 // We don't call abort(3) by default; see 169 // Runtime::Abort. 170RUNTIME_OPTIONS_KEY (void (*)(), HookAbort, nullptr) 171 172RUNTIME_OPTIONS_KEY (bool, SlowDebug, false) 173 174RUNTIME_OPTIONS_KEY (unsigned int, GlobalRefAllocStackTraceLimit, 0) // 0 = off 175RUNTIME_OPTIONS_KEY (Unit, UseStderrLogger) 176 177RUNTIME_OPTIONS_KEY (Unit, OnlyUseTrustedOatFiles) 178RUNTIME_OPTIONS_KEY (Unit, DenyArtApexDataFiles) 179RUNTIME_OPTIONS_KEY (unsigned int, VerifierLoggingThreshold, 100) 180 181RUNTIME_OPTIONS_KEY (bool, FastClassNotFoundException, true) 182RUNTIME_OPTIONS_KEY (bool, VerifierMissingKThrowFatal, true) 183 184// Setting this to true causes ART to disable Zygote native fork loop. ART also 185// internally enables this if ZygoteJit is enabled. 186RUNTIME_OPTIONS_KEY (bool, ForceJavaZygoteForkLoop, false) 187 188// Whether to allow loading of the perfetto hprof plugin. 189// Even with this option set, we will still only actually load the plugin 190// if we are on a userdebug build or the app is debuggable or profileable. 191// 192// We do not want to enable this by default because PerfettoHprof does not 193// work on host, and we do not want to enable it in tests. 194// 195// Switching this on adds ~500us to the startup on userdebug builds, or for 196// profileable / debuggable apps. 197// 198// This is set to true in frameworks/base/core/jni/AndroidRuntime.cpp. 199RUNTIME_OPTIONS_KEY (bool, PerfettoHprof, false) 200 201// This is to enable/disable Perfetto Java Heap Stack Profiling 202RUNTIME_OPTIONS_KEY (bool, PerfettoJavaHeapStackProf, false) 203 204#undef RUNTIME_OPTIONS_KEY 205