blob: 39b44e78721c7fe30e152560b244d9a97d8a9273 [file] [log] [blame]
Igor Murashkinaaebaa02015-01-26 10:55:53 -08001/*
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 ART_RUNTIME_RUNTIME_OPTIONS_H_
18#define ART_RUNTIME_RUNTIME_OPTIONS_H_
19
Andreas Gampe8cf9cb32017-07-19 09:28:38 -070020#include <cstdarg>
21#include <cstdio>
Igor Murashkinaaebaa02015-01-26 10:55:53 -080022#include <string>
Andreas Gampe8cf9cb32017-07-19 09:28:38 -070023#include <vector>
Andreas Gampe6d7abbd2017-04-24 13:19:09 -070024
Andreas Gampe8cf9cb32017-07-19 09:28:38 -070025#include "arch/instruction_set.h"
Andreas Gampe6d7abbd2017-04-24 13:19:09 -070026#include "base/variant_map.h"
27#include "cmdline_types.h" // TODO: don't need to include this file here
Andreas Gampe8cf9cb32017-07-19 09:28:38 -070028#include "gc/collector_type.h"
29#include "gc/space/large_object_space.h"
Igor Murashkinaaebaa02015-01-26 10:55:53 -080030#include "jdwp/jdwp.h"
Mathieu Chartiere5f13e52015-02-24 09:37:21 -080031#include "jit/jit.h"
32#include "jit/jit_code_cache.h"
Calin Juravle138dbff2016-06-28 19:36:58 +010033#include "jit/profile_saver_options.h"
Andreas Gampe6d7abbd2017-04-24 13:19:09 -070034#include "verifier/verifier_enums.h"
Igor Murashkinaaebaa02015-01-26 10:55:53 -080035
36namespace art {
37
38class CompilerCallbacks;
39class DexFile;
40struct XGcOption;
41struct BackgroundGcOption;
Igor Murashkinaaebaa02015-01-26 10:55:53 -080042
43#define DECLARE_KEY(Type, Name) static const Key<Type> Name
44
Igor Murashkin2ffb7032017-11-08 13:35:21 -080045// Define a key that is usable with a RuntimeArgumentMap.
46// This key will *not* work with other subtypes of VariantMap.
47template <typename TValue>
48struct RuntimeArgumentMapKey : VariantMapKey<TValue> {
49 RuntimeArgumentMapKey() {}
50 explicit RuntimeArgumentMapKey(TValue default_value)
51 : VariantMapKey<TValue>(std::move(default_value)) {}
52 // Don't ODR-use constexpr default values, which means that Struct::Fields
53 // that are declared 'static constexpr T Name = Value' don't need to have a matching definition.
54};
55
56// Defines a type-safe heterogeneous key->value map.
57// Use the VariantMap interface to look up or to store a RuntimeArgumentMapKey,Value pair.
58//
59// Example:
60// auto map = RuntimeArgumentMap();
61// map.Set(RuntimeArgumentMap::HeapTargetUtilization, 5.0);
62// double *target_utilization = map.Get(RuntimeArgumentMap);
63//
64struct RuntimeArgumentMap : VariantMap<RuntimeArgumentMap, RuntimeArgumentMapKey> {
65 // This 'using' line is necessary to inherit the variadic constructor.
66 using VariantMap<RuntimeArgumentMap, RuntimeArgumentMapKey>::VariantMap;
67
68 // Make the next many usages of Key slightly shorter to type.
Igor Murashkinaaebaa02015-01-26 10:55:53 -080069 template <typename TValue>
Igor Murashkin2ffb7032017-11-08 13:35:21 -080070 using Key = RuntimeArgumentMapKey<TValue>;
Igor Murashkinaaebaa02015-01-26 10:55:53 -080071
Igor Murashkin2ffb7032017-11-08 13:35:21 -080072 // List of key declarations, shorthand for 'static const Key<T> Name'
Chih-Hung Hsiehfba39972016-05-11 11:26:48 -070073#define RUNTIME_OPTIONS_KEY(Type, Name, ...) static const Key<Type> (Name);
Igor Murashkinaaebaa02015-01-26 10:55:53 -080074#include "runtime_options.def"
Igor Murashkin2ffb7032017-11-08 13:35:21 -080075};
Igor Murashkinaaebaa02015-01-26 10:55:53 -080076
77#undef DECLARE_KEY
78
79 // using RuntimeOptions = RuntimeArgumentMap;
80} // namespace art
81
82#endif // ART_RUNTIME_RUNTIME_OPTIONS_H_