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