Home | History | Annotate | Download | only in runtime
      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* dex2oat_enabled = opt.Get(RuntimeOptions::Dex2Oat);
     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.
     37 RUNTIME_OPTIONS_KEY (Unit,                Zygote)
     38 RUNTIME_OPTIONS_KEY (Unit,                Help)
     39 RUNTIME_OPTIONS_KEY (Unit,                ShowVersion)
     40 RUNTIME_OPTIONS_KEY (std::string,         BootClassPath)
     41 RUNTIME_OPTIONS_KEY (ParseStringList<':'>,BootClassPathLocations)  // std::vector<std::string>
     42 RUNTIME_OPTIONS_KEY (std::string,         ClassPath)
     43 RUNTIME_OPTIONS_KEY (std::string,         Image)
     44 RUNTIME_OPTIONS_KEY (Unit,                CheckJni)
     45 RUNTIME_OPTIONS_KEY (Unit,                JniOptsForceCopy)
     46 RUNTIME_OPTIONS_KEY (std::string,         JdwpOptions, "")
     47 RUNTIME_OPTIONS_KEY (JdwpProvider,        JdwpProvider,                   JdwpProvider::kNone)
     48 RUNTIME_OPTIONS_KEY (MemoryKiB,           MemoryMaximumSize,              gc::Heap::kDefaultMaximumSize)  // -Xmx
     49 RUNTIME_OPTIONS_KEY (MemoryKiB,           MemoryInitialSize,              gc::Heap::kDefaultInitialSize)  // -Xms
     50 RUNTIME_OPTIONS_KEY (MemoryKiB,           HeapGrowthLimit)                // Default is 0 for unlimited
     51 RUNTIME_OPTIONS_KEY (MemoryKiB,           HeapMinFree,                    gc::Heap::kDefaultMinFree)
     52 RUNTIME_OPTIONS_KEY (MemoryKiB,           HeapMaxFree,                    gc::Heap::kDefaultMaxFree)
     53 RUNTIME_OPTIONS_KEY (MemoryKiB,           NonMovingSpaceCapacity,         gc::Heap::kDefaultNonMovingSpaceCapacity)
     54 RUNTIME_OPTIONS_KEY (double,              HeapTargetUtilization,          gc::Heap::kDefaultTargetUtilization)
     55 RUNTIME_OPTIONS_KEY (double,              ForegroundHeapGrowthMultiplier, gc::Heap::kDefaultHeapGrowthMultiplier)
     56 RUNTIME_OPTIONS_KEY (unsigned int,        ParallelGCThreads,              0u)
     57 RUNTIME_OPTIONS_KEY (unsigned int,        ConcGCThreads)
     58 RUNTIME_OPTIONS_KEY (Memory<1>,           StackSize)  // -Xss
     59 RUNTIME_OPTIONS_KEY (unsigned int,        MaxSpinsBeforeThinLockInflation,Monitor::kDefaultMaxSpinsBeforeThinLockInflation)
     60 RUNTIME_OPTIONS_KEY (MillisecondsToNanoseconds, \
     61                                           LongPauseLogThreshold,          gc::Heap::kDefaultLongPauseLogThreshold)
     62 RUNTIME_OPTIONS_KEY (MillisecondsToNanoseconds, \
     63                                           LongGCLogThreshold,             gc::Heap::kDefaultLongGCLogThreshold)
     64 RUNTIME_OPTIONS_KEY (MillisecondsToNanoseconds, \
     65                                           ThreadSuspendTimeout,           ThreadList::kDefaultThreadSuspendTimeout)
     66 RUNTIME_OPTIONS_KEY (Unit,                DumpGCPerformanceOnShutdown)
     67 RUNTIME_OPTIONS_KEY (Unit,                DumpJITInfoOnShutdown)
     68 RUNTIME_OPTIONS_KEY (Unit,                IgnoreMaxFootprint)
     69 RUNTIME_OPTIONS_KEY (Unit,                LowMemoryMode)
     70 RUNTIME_OPTIONS_KEY (bool,                UseTLAB,                        (kUseTlab || kUseReadBarrier))
     71 RUNTIME_OPTIONS_KEY (bool,                EnableHSpaceCompactForOOM,      true)
     72 RUNTIME_OPTIONS_KEY (bool,                UseJitCompilation,              false)
     73 RUNTIME_OPTIONS_KEY (bool,                DumpNativeStackOnSigQuit,       true)
     74 RUNTIME_OPTIONS_KEY (bool,                MadviseRandomAccess,            false)
     75 RUNTIME_OPTIONS_KEY (unsigned int,        JITCompileThreshold)
     76 RUNTIME_OPTIONS_KEY (unsigned int,        JITWarmupThreshold)
     77 RUNTIME_OPTIONS_KEY (unsigned int,        JITOsrThreshold)
     78 RUNTIME_OPTIONS_KEY (unsigned int,        JITPriorityThreadWeight)
     79 RUNTIME_OPTIONS_KEY (unsigned int,        JITInvokeTransitionWeight)
     80 RUNTIME_OPTIONS_KEY (MemoryKiB,           JITCodeCacheInitialCapacity,    jit::JitCodeCache::kInitialCapacity)
     81 RUNTIME_OPTIONS_KEY (MemoryKiB,           JITCodeCacheMaxCapacity,        jit::JitCodeCache::kMaxCapacity)
     82 RUNTIME_OPTIONS_KEY (MillisecondsToNanoseconds, \
     83                                           HSpaceCompactForOOMMinIntervalsMs,\
     84                                                                           MsToNs(100 * 1000))  // 100s
     85 RUNTIME_OPTIONS_KEY (std::vector<std::string>, \
     86                                           PropertiesList)  // -D<whatever> -D<whatever> ...
     87 RUNTIME_OPTIONS_KEY (std::string,         JniTrace)
     88 RUNTIME_OPTIONS_KEY (std::string,         PatchOat)
     89 RUNTIME_OPTIONS_KEY (bool,                Relocate,                       kDefaultMustRelocate)
     90 RUNTIME_OPTIONS_KEY (bool,                Dex2Oat,                        true)
     91 RUNTIME_OPTIONS_KEY (bool,                ImageDex2Oat,                   true)
     92 RUNTIME_OPTIONS_KEY (bool,                Interpret,                      false) // -Xint
     93                                                         // Disable the compiler for CC (for now).
     94 RUNTIME_OPTIONS_KEY (XGcOption,           GcOption)  // -Xgc:
     95 RUNTIME_OPTIONS_KEY (gc::space::LargeObjectSpaceType, \
     96                                           LargeObjectSpace,               gc::Heap::kDefaultLargeObjectSpaceType)
     97 RUNTIME_OPTIONS_KEY (Memory<1>,           LargeObjectThreshold,           gc::Heap::kDefaultLargeObjectThreshold)
     98 RUNTIME_OPTIONS_KEY (BackgroundGcOption,  BackgroundGc)
     99 
    100 RUNTIME_OPTIONS_KEY (Unit,                DisableExplicitGC)
    101 RUNTIME_OPTIONS_KEY (Unit,                NoSigChain)
    102 RUNTIME_OPTIONS_KEY (Unit,                ForceNativeBridge)
    103 RUNTIME_OPTIONS_KEY (LogVerbosity,        Verbose)
    104 RUNTIME_OPTIONS_KEY (unsigned int,        LockProfThreshold)
    105 RUNTIME_OPTIONS_KEY (unsigned int,        StackDumpLockProfThreshold)
    106 RUNTIME_OPTIONS_KEY (bool,                UseTombstonedTraces, false)
    107 RUNTIME_OPTIONS_KEY (std::string,         StackTraceFile)
    108 RUNTIME_OPTIONS_KEY (Unit,                MethodTrace)
    109 RUNTIME_OPTIONS_KEY (std::string,         MethodTraceFile,                "/data/misc/trace/method-trace-file.bin")
    110 RUNTIME_OPTIONS_KEY (unsigned int,        MethodTraceFileSize,            10 * MB)
    111 RUNTIME_OPTIONS_KEY (Unit,                MethodTraceStreaming)
    112 RUNTIME_OPTIONS_KEY (TraceClockSource,    ProfileClock,                   kDefaultTraceClockSource)  // -Xprofile:
    113 RUNTIME_OPTIONS_KEY (ProfileSaverOptions, ProfileSaverOpts)  // -Xjitsaveprofilinginfo, -Xps-*
    114 RUNTIME_OPTIONS_KEY (std::string,         Compiler)
    115 RUNTIME_OPTIONS_KEY (std::vector<std::string>, \
    116                                           CompilerOptions)  // -Xcompiler-option ...
    117 RUNTIME_OPTIONS_KEY (std::vector<std::string>, \
    118                                           ImageCompilerOptions)  // -Ximage-compiler-option ...
    119 RUNTIME_OPTIONS_KEY (verifier::VerifyMode, \
    120                                           Verify,                         verifier::VerifyMode::kEnable)
    121 RUNTIME_OPTIONS_KEY (int,                 TargetSdkVersion,               Runtime::kUnsetSdkVersion)
    122 RUNTIME_OPTIONS_KEY (Unit,                HiddenApiChecks)
    123 RUNTIME_OPTIONS_KEY (std::string,         NativeBridge)
    124 RUNTIME_OPTIONS_KEY (unsigned int,        ZygoteMaxFailedBoots,           10)
    125 RUNTIME_OPTIONS_KEY (Unit,                NoDexFileFallback)
    126 RUNTIME_OPTIONS_KEY (std::string,         CpuAbiList)
    127 RUNTIME_OPTIONS_KEY (std::string,         Fingerprint)
    128 RUNTIME_OPTIONS_KEY (ExperimentalFlags,   Experimental,     ExperimentalFlags::kNone) // -Xexperimental:{...}
    129 RUNTIME_OPTIONS_KEY (std::list<ti::AgentSpec>,         AgentLib)  // -agentlib:<libname>=<options>
    130 RUNTIME_OPTIONS_KEY (std::list<ti::AgentSpec>,         AgentPath)  // -agentpath:<libname>=<options>
    131 RUNTIME_OPTIONS_KEY (std::vector<Plugin>,            Plugins)  // -Xplugin:<library>
    132 
    133 // Not parse-able from command line, but can be provided explicitly.
    134 // (Do not add anything here that is defined in ParsedOptions::MakeParser)
    135 RUNTIME_OPTIONS_KEY (std::vector<std::unique_ptr<const DexFile>>*, \
    136                                           BootClassPathDexList)
    137 RUNTIME_OPTIONS_KEY (InstructionSet,      ImageInstructionSet,            kRuntimeISA)
    138 RUNTIME_OPTIONS_KEY (CompilerCallbacks*,  CompilerCallbacksPtr)  // TDOO: make unique_ptr
    139 RUNTIME_OPTIONS_KEY (bool (*)(),          HookIsSensitiveThread)
    140 RUNTIME_OPTIONS_KEY (int32_t (*)(FILE* stream, const char* format, va_list ap), \
    141                                           HookVfprintf,                   vfprintf)
    142 // Use _exit instead of exit so that we won't get DCHECK failures in global data
    143 // destructors. b/28106055.
    144 RUNTIME_OPTIONS_KEY (void (*)(int32_t status), \
    145                                           HookExit,                       _exit)
    146                                                                           // We don't call abort(3) by default; see
    147                                                                           // Runtime::Abort.
    148 RUNTIME_OPTIONS_KEY (void (*)(),          HookAbort,                      nullptr)
    149 
    150 RUNTIME_OPTIONS_KEY (bool,                SlowDebug,                      false)
    151 
    152 RUNTIME_OPTIONS_KEY (unsigned int,        GlobalRefAllocStackTraceLimit,  0)  // 0 = off
    153 RUNTIME_OPTIONS_KEY (Unit,                UseStderrLogger)
    154 
    155 RUNTIME_OPTIONS_KEY (Unit,                OnlyUseSystemOatFiles)
    156 
    157 #undef RUNTIME_OPTIONS_KEY
    158