Igor Murashkin | aaebaa0 | 2015-01-26 10:55:53 -0800 | [diff] [blame] | 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 ART_RUNTIME_RUNTIME_OPTIONS_H_ |
| 18 | #define ART_RUNTIME_RUNTIME_OPTIONS_H_ |
| 19 | |
Igor Murashkin | aaebaa0 | 2015-01-26 10:55:53 -0800 | [diff] [blame] | 20 | #include <vector> |
| 21 | #include <string> |
Andreas Gampe | 6d7abbd | 2017-04-24 13:19:09 -0700 | [diff] [blame] | 22 | |
| 23 | #include <stdio.h> |
| 24 | #include <stdarg.h> |
| 25 | |
Vladimir Marko | 88b2b80 | 2015-12-04 14:19:04 +0000 | [diff] [blame] | 26 | #include "base/logging.h" |
Andreas Gampe | 6d7abbd | 2017-04-24 13:19:09 -0700 | [diff] [blame] | 27 | #include "base/variant_map.h" |
| 28 | #include "cmdline_types.h" // TODO: don't need to include this file here |
Igor Murashkin | aaebaa0 | 2015-01-26 10:55:53 -0800 | [diff] [blame] | 29 | #include "jdwp/jdwp.h" |
Mathieu Chartier | e5f13e5 | 2015-02-24 09:37:21 -0800 | [diff] [blame] | 30 | #include "jit/jit.h" |
| 31 | #include "jit/jit_code_cache.h" |
Igor Murashkin | aaebaa0 | 2015-01-26 10:55:53 -0800 | [diff] [blame] | 32 | #include "gc/collector_type.h" |
| 33 | #include "gc/space/large_object_space.h" |
Igor Murashkin | aaebaa0 | 2015-01-26 10:55:53 -0800 | [diff] [blame] | 34 | #include "arch/instruction_set.h" |
Calin Juravle | 138dbff | 2016-06-28 19:36:58 +0100 | [diff] [blame] | 35 | #include "jit/profile_saver_options.h" |
Andreas Gampe | 6d7abbd | 2017-04-24 13:19:09 -0700 | [diff] [blame] | 36 | #include "verifier/verifier_enums.h" |
Igor Murashkin | aaebaa0 | 2015-01-26 10:55:53 -0800 | [diff] [blame] | 37 | |
| 38 | namespace art { |
| 39 | |
| 40 | class CompilerCallbacks; |
| 41 | class DexFile; |
| 42 | struct XGcOption; |
| 43 | struct BackgroundGcOption; |
Igor Murashkin | aaebaa0 | 2015-01-26 10:55:53 -0800 | [diff] [blame] | 44 | |
| 45 | #define DECLARE_KEY(Type, Name) static const Key<Type> Name |
| 46 | |
| 47 | // Define a key that is usable with a RuntimeArgumentMap. |
| 48 | // This key will *not* work with other subtypes of VariantMap. |
| 49 | template <typename TValue> |
| 50 | struct RuntimeArgumentMapKey : VariantMapKey<TValue> { |
| 51 | RuntimeArgumentMapKey() {} |
| 52 | explicit RuntimeArgumentMapKey(TValue default_value) |
| 53 | : VariantMapKey<TValue>(std::move(default_value)) {} |
| 54 | // Don't ODR-use constexpr default values, which means that Struct::Fields |
| 55 | // that are declared 'static constexpr T Name = Value' don't need to have a matching definition. |
| 56 | }; |
| 57 | |
| 58 | // Defines a type-safe heterogeneous key->value map. |
| 59 | // Use the VariantMap interface to look up or to store a RuntimeArgumentMapKey,Value pair. |
| 60 | // |
| 61 | // Example: |
| 62 | // auto map = RuntimeArgumentMap(); |
| 63 | // map.Set(RuntimeArgumentMap::HeapTargetUtilization, 5.0); |
| 64 | // double *target_utilization = map.Get(RuntimeArgumentMap); |
| 65 | // |
| 66 | struct RuntimeArgumentMap : VariantMap<RuntimeArgumentMap, RuntimeArgumentMapKey> { |
| 67 | // This 'using' line is necessary to inherit the variadic constructor. |
| 68 | using VariantMap<RuntimeArgumentMap, RuntimeArgumentMapKey>::VariantMap; |
| 69 | |
| 70 | // Make the next many usages of Key slightly shorter to type. |
| 71 | template <typename TValue> |
| 72 | using Key = RuntimeArgumentMapKey<TValue>; |
| 73 | |
| 74 | // List of key declarations, shorthand for 'static const Key<T> Name' |
Chih-Hung Hsieh | fba3997 | 2016-05-11 11:26:48 -0700 | [diff] [blame] | 75 | #define RUNTIME_OPTIONS_KEY(Type, Name, ...) static const Key<Type> (Name); |
Igor Murashkin | aaebaa0 | 2015-01-26 10:55:53 -0800 | [diff] [blame] | 76 | #include "runtime_options.def" |
| 77 | }; |
| 78 | |
| 79 | #undef DECLARE_KEY |
| 80 | |
| 81 | // using RuntimeOptions = RuntimeArgumentMap; |
| 82 | } // namespace art |
| 83 | |
| 84 | #endif // ART_RUNTIME_RUNTIME_OPTIONS_H_ |