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