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, "")
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 (Unit,                DumpGCPerformanceOnShutdown)
70RUNTIME_OPTIONS_KEY (Unit,                DumpRegionInfoBeforeGC)
71RUNTIME_OPTIONS_KEY (Unit,                DumpRegionInfoAfterGC)
72RUNTIME_OPTIONS_KEY (Unit,                DumpJITInfoOnShutdown)
73RUNTIME_OPTIONS_KEY (Unit,                IgnoreMaxFootprint)
74RUNTIME_OPTIONS_KEY (Unit,                LowMemoryMode)
75RUNTIME_OPTIONS_KEY (bool,                UseTLAB,                        (kUseTlab || kUseReadBarrier))
76RUNTIME_OPTIONS_KEY (bool,                EnableHSpaceCompactForOOM,      true)
77RUNTIME_OPTIONS_KEY (bool,                UseJitCompilation,              true)
78RUNTIME_OPTIONS_KEY (bool,                UseTieredJitCompilation,        interpreter::IsNterpSupported())
79RUNTIME_OPTIONS_KEY (bool,                DumpNativeStackOnSigQuit,       true)
80RUNTIME_OPTIONS_KEY (bool,                MadviseRandomAccess,            false)
81RUNTIME_OPTIONS_KEY (JniIdType,           OpaqueJniIds,                   JniIdType::kDefault)  // -Xopaque-jni-ids:{true, false, swapable}
82RUNTIME_OPTIONS_KEY (bool,                AutoPromoteOpaqueJniIds,        true)  // testing use only. -Xauto-promote-opaque-jni-ids:{true, false}
83RUNTIME_OPTIONS_KEY (unsigned int,        JITCompileThreshold)
84RUNTIME_OPTIONS_KEY (unsigned int,        JITWarmupThreshold)
85RUNTIME_OPTIONS_KEY (unsigned int,        JITOsrThreshold)
86RUNTIME_OPTIONS_KEY (unsigned int,        JITPriorityThreadWeight)
87RUNTIME_OPTIONS_KEY (unsigned int,        JITInvokeTransitionWeight)
88RUNTIME_OPTIONS_KEY (int,                 JITPoolThreadPthreadPriority,   jit::kJitPoolThreadPthreadDefaultPriority)
89RUNTIME_OPTIONS_KEY (MemoryKiB,           JITCodeCacheInitialCapacity,    jit::JitCodeCache::kInitialCapacity)
90RUNTIME_OPTIONS_KEY (MemoryKiB,           JITCodeCacheMaxCapacity,        jit::JitCodeCache::kMaxCapacity)
91RUNTIME_OPTIONS_KEY (MillisecondsToNanoseconds, \
92                                          HSpaceCompactForOOMMinIntervalsMs,\
93                                                                          MsToNs(100 * 1000))  // 100s
94RUNTIME_OPTIONS_KEY (std::vector<std::string>, \
95                                          PropertiesList)  // -D<whatever> -D<whatever> ...
96RUNTIME_OPTIONS_KEY (std::string,         JniTrace)
97RUNTIME_OPTIONS_KEY (bool,                Relocate,                       kDefaultMustRelocate)
98RUNTIME_OPTIONS_KEY (bool,                ImageDex2Oat,                   true)
99RUNTIME_OPTIONS_KEY (bool,                Interpret,                      false) // -Xint
100                                                        // Disable the compiler for CC (for now).
101RUNTIME_OPTIONS_KEY (XGcOption,           GcOption)  // -Xgc:
102RUNTIME_OPTIONS_KEY (gc::space::LargeObjectSpaceType, \
103                                          LargeObjectSpace,               gc::Heap::kDefaultLargeObjectSpaceType)
104RUNTIME_OPTIONS_KEY (Memory<1>,           LargeObjectThreshold,           gc::Heap::kDefaultLargeObjectThreshold)
105RUNTIME_OPTIONS_KEY (BackgroundGcOption,  BackgroundGc)
106
107RUNTIME_OPTIONS_KEY (Unit,                DisableExplicitGC)
108RUNTIME_OPTIONS_KEY (Unit,                NoSigChain)
109RUNTIME_OPTIONS_KEY (Unit,                ForceNativeBridge)
110RUNTIME_OPTIONS_KEY (LogVerbosity,        Verbose)
111RUNTIME_OPTIONS_KEY (unsigned int,        LockProfThreshold)
112RUNTIME_OPTIONS_KEY (unsigned int,        StackDumpLockProfThreshold)
113RUNTIME_OPTIONS_KEY (Unit,                MethodTrace)
114RUNTIME_OPTIONS_KEY (std::string,         MethodTraceFile,                "/data/misc/trace/method-trace-file.bin")
115RUNTIME_OPTIONS_KEY (unsigned int,        MethodTraceFileSize,            10 * MB)
116RUNTIME_OPTIONS_KEY (Unit,                MethodTraceStreaming)
117RUNTIME_OPTIONS_KEY (TraceClockSource,    ProfileClock,                   kDefaultTraceClockSource)  // -Xprofile:
118RUNTIME_OPTIONS_KEY (ProfileSaverOptions, ProfileSaverOpts)  // -Xjitsaveprofilinginfo, -Xps-*
119RUNTIME_OPTIONS_KEY (std::string,         Compiler)
120RUNTIME_OPTIONS_KEY (std::vector<std::string>, \
121                                          CompilerOptions)  // -Xcompiler-option ...
122RUNTIME_OPTIONS_KEY (std::vector<std::string>, \
123                                          ImageCompilerOptions)  // -Ximage-compiler-option ...
124RUNTIME_OPTIONS_KEY (verifier::VerifyMode, \
125                                          Verify,                         verifier::VerifyMode::kEnable)
126RUNTIME_OPTIONS_KEY (unsigned int,        TargetSdkVersion, \
127                                          static_cast<unsigned int>(SdkVersion::kUnset))
128RUNTIME_OPTIONS_KEY (hiddenapi::EnforcementPolicy,
129                                          HiddenApiPolicy,
130                                          hiddenapi::EnforcementPolicy::kDisabled)
131RUNTIME_OPTIONS_KEY (hiddenapi::EnforcementPolicy,
132                                          CorePlatformApiPolicy,
133                                          hiddenapi::EnforcementPolicy::kDisabled)
134RUNTIME_OPTIONS_KEY (std::string,         NativeBridge)
135RUNTIME_OPTIONS_KEY (unsigned int,        ZygoteMaxFailedBoots,           10)
136RUNTIME_OPTIONS_KEY (Unit,                NoDexFileFallback)
137RUNTIME_OPTIONS_KEY (std::string,         CpuAbiList)
138RUNTIME_OPTIONS_KEY (std::string,         Fingerprint)
139RUNTIME_OPTIONS_KEY (ExperimentalFlags,   Experimental,     ExperimentalFlags::kNone) // -Xexperimental:{...}
140RUNTIME_OPTIONS_KEY (std::list<ti::AgentSpec>,         AgentLib)  // -agentlib:<libname>=<options>
141RUNTIME_OPTIONS_KEY (std::list<ti::AgentSpec>,         AgentPath)  // -agentpath:<libname>=<options>
142RUNTIME_OPTIONS_KEY (std::vector<Plugin>,            Plugins)  // -Xplugin:<library>
143
144// Not parse-able from command line, but can be provided explicitly.
145// (Do not add anything here that is defined in ParsedOptions::MakeParser)
146RUNTIME_OPTIONS_KEY (std::vector<std::unique_ptr<const DexFile>>*, \
147                                          BootClassPathDexList)
148RUNTIME_OPTIONS_KEY (InstructionSet,      ImageInstructionSet,            kRuntimeISA)
149RUNTIME_OPTIONS_KEY (CompilerCallbacks*,  CompilerCallbacksPtr)  // TODO: make unique_ptr
150RUNTIME_OPTIONS_KEY (bool (*)(),          HookIsSensitiveThread)
151RUNTIME_OPTIONS_KEY (int32_t (*)(FILE* stream, const char* format, va_list ap), \
152                                          HookVfprintf,                   vfprintf)
153// Use _exit instead of exit so that we won't get DCHECK failures in global data
154// destructors. b/28106055.
155RUNTIME_OPTIONS_KEY (void (*)(int32_t status), \
156                                          HookExit,                       _exit)
157                                                                          // We don't call abort(3) by default; see
158                                                                          // Runtime::Abort.
159RUNTIME_OPTIONS_KEY (void (*)(),          HookAbort,                      nullptr)
160
161RUNTIME_OPTIONS_KEY (bool,                SlowDebug,                      false)
162
163RUNTIME_OPTIONS_KEY (unsigned int,        GlobalRefAllocStackTraceLimit,  0)  // 0 = off
164RUNTIME_OPTIONS_KEY (Unit,                UseStderrLogger)
165
166RUNTIME_OPTIONS_KEY (Unit,                OnlyUseSystemOatFiles)
167RUNTIME_OPTIONS_KEY (unsigned int,        VerifierLoggingThreshold,       100)
168
169RUNTIME_OPTIONS_KEY (gc::space::ImageSpaceLoadingOrder, \
170                     ImageSpaceLoadingOrder, \
171                     gc::space::ImageSpaceLoadingOrder::kSystemFirst)
172
173RUNTIME_OPTIONS_KEY (bool,                FastClassNotFoundException,     true)
174RUNTIME_OPTIONS_KEY (bool,                VerifierMissingKThrowFatal,     true)
175
176// Whether to allow loading of the perfetto hprof plugin.
177// Even with this option set, we will still only actually load the plugin
178// if we are on a userdebug build or the app is debuggable or profileable.
179//
180// We do not want to enable this by default because PerfettoHprof does not
181// work on host, and we do not want to enable it in tests.
182//
183// Switching this on adds ~500us to the startup on userdebug builds, or for
184// profileable / debuggable apps.
185//
186// This is set to true in frameworks/base/core/jni/AndroidRuntime.cpp.
187RUNTIME_OPTIONS_KEY (bool,                PerfettoHprof,                  false)
188
189#undef RUNTIME_OPTIONS_KEY
190