Mercurial > hg > graal-compiler
comparison src/share/vm/jvmci/jvmciOptions.hpp @ 21562:47bebae7454f
Merge.
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 28 May 2015 21:58:33 +0200 |
parents | src/share/vm/graal/graalOptions.hpp@cecb4e39521c |
children | 59c3f921e454 |
comparison
equal
deleted
inserted
replaced
21561:ce2113326bc8 | 21562:47bebae7454f |
---|---|
1 /* | |
2 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. | |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
20 * or visit www.oracle.com if you need additional information or have any | |
21 * questions. | |
22 */ | |
23 | |
24 #ifndef SHARE_VM_JVMCI_JVMCI_OPTIONS_HPP | |
25 #define SHARE_VM_JVMCI_JVMCI_OPTIONS_HPP | |
26 | |
27 #include "memory/allocation.hpp" | |
28 #include "utilities/exceptions.hpp" | |
29 #include "jvmci/jvmciHashtable.hpp" | |
30 | |
31 #define PRINT_FLAGS_ARG "PrintFlags" | |
32 #define PRINT_FLAGS_HELP "Prints all JVMCI flags (similar to XX's PrintFlagsFinal)" | |
33 | |
34 enum OptionType { | |
35 _string, | |
36 _int, | |
37 _long, | |
38 _float, | |
39 _double, | |
40 _boolean | |
41 }; | |
42 | |
43 struct OptionDesc { | |
44 const char* name; | |
45 const char* help; | |
46 OptionType type; | |
47 const char* declaringClass; | |
48 const char* fieldClass; | |
49 }; | |
50 | |
51 inline unsigned int compute_string_hash(const char *s, int n) { | |
52 unsigned int val = 0; | |
53 while (--n >= 0) { | |
54 val = *s++ + 31 * val; | |
55 } | |
56 return val; | |
57 } | |
58 | |
59 class OptionsTable : public JVMCIHashtable<const char*, OptionDesc> { | |
60 protected: | |
61 unsigned int compute_hash(const char* key) { return compute_string_hash(key, strlen(key)); } | |
62 bool key_equals(const char* k1, const char* k2) { return strcmp(k1, k2) == 0; } | |
63 const char* get_key(OptionDesc value) { return value.name; } ; | |
64 const char* get_key(OptionDesc* value) { return value->name; } ; | |
65 public: | |
66 OptionsTable() : JVMCIHashtable<const char*, OptionDesc>(100) {} | |
67 ~OptionsTable(); | |
68 using JVMCIHashtable<const char*, OptionDesc>::get; | |
69 OptionDesc* get(const char* name, size_t arglen); | |
70 OptionDesc * fuzzy_match(const char* name, size_t length); | |
71 | |
72 static OptionsTable* load_options(); | |
73 }; | |
74 | |
75 struct OptionValue { | |
76 OptionDesc desc; | |
77 union { | |
78 const char* string_value; | |
79 jint int_value; | |
80 jlong long_value; | |
81 jfloat float_value; | |
82 jdouble double_value; | |
83 jboolean boolean_value; | |
84 }; | |
85 }; | |
86 | |
87 class OptionsValueTable : public JVMCIHashtable<const char*, OptionValue> { | |
88 OptionsTable* _table; | |
89 protected: | |
90 unsigned int compute_hash(const char* key) { return compute_string_hash(key, strlen(key)); } | |
91 bool key_equals(const char* k1, const char* k2) { return strcmp(k1, k2) == 0; } | |
92 const char* get_key(OptionValue value) { return value.desc.name; } ; | |
93 const char* get_key(OptionValue* value) { return value->desc.name; } ; | |
94 public: | |
95 OptionsValueTable(OptionsTable* table) : _table(table), JVMCIHashtable<const char*, OptionValue>(100) {} | |
96 ~OptionsValueTable(); | |
97 using JVMCIHashtable<const char*, OptionValue>::get; | |
98 OptionValue* get(const char* name, size_t arglen); | |
99 OptionsTable* options_table() { return _table; } | |
100 }; | |
101 | |
102 | |
103 #endif // SHARE_VM_JVMCI_JVMCI_OPTIONS_HPP |