Mercurial > hg > graal-compiler
comparison src/share/vm/jvmci/jvmciOptions.cpp @ 21875:431b127fc0d1
Renaming of classes around jvmciOptions for clarity
author | Gilles Duboscq <gilles.m.duboscq@oracle.com> |
---|---|
date | Tue, 09 Jun 2015 13:06:37 +0200 |
parents | ccf89c722ac8 |
children |
comparison
equal
deleted
inserted
replaced
21874:f79218584d37 | 21875:431b127fc0d1 |
---|---|
25 #include "jvmci/jvmciOptions.hpp" | 25 #include "jvmci/jvmciOptions.hpp" |
26 #include "jvmci/jvmciRuntime.hpp" | 26 #include "jvmci/jvmciRuntime.hpp" |
27 #include "runtime/arguments.hpp" | 27 #include "runtime/arguments.hpp" |
28 #include "utilities/hashtable.inline.hpp" | 28 #include "utilities/hashtable.inline.hpp" |
29 | 29 |
30 class OptionsParseClosure : public ParseClosure { | 30 class OptionDescParseClosure : public ParseClosure { |
31 OptionsTable* _table; | 31 OptionDescsTable* _table; |
32 public: | 32 public: |
33 OptionsParseClosure(OptionsTable* table) : _table(table) {} | 33 OptionDescParseClosure(OptionDescsTable* table) : _table(table) {} |
34 void do_line(char* line) { | 34 void do_line(char* line) { |
35 char* idx = strchr(line, '\t'); | 35 char* idx = strchr(line, '\t'); |
36 if (idx == NULL) { | 36 if (idx == NULL) { |
37 warn_and_abort("invalid format: could not find first tab"); | 37 warn_and_abort("invalid format: could not find first tab"); |
38 return; | 38 return; |
116 } | 116 } |
117 FREE_C_HEAP_ARRAY(char, desc->name, mtCompiler); | 117 FREE_C_HEAP_ARRAY(char, desc->name, mtCompiler); |
118 } | 118 } |
119 }; | 119 }; |
120 | 120 |
121 OptionsTable::~OptionsTable() { | 121 OptionDescsTable::~OptionDescsTable() { |
122 FreeNamesClosure closure; | 122 FreeNamesClosure closure; |
123 for_each(&closure); | 123 for_each(&closure); |
124 } | 124 } |
125 | 125 |
126 OptionsTable* OptionsTable::load_options() { | 126 OptionDescsTable* OptionDescsTable::load_options() { |
127 OptionsTable* table = new OptionsTable(); | 127 OptionDescsTable* table = new OptionDescsTable(); |
128 // Add PrintFlags option manually | 128 // Add PrintFlags option manually |
129 OptionDesc printFlagsDesc; | 129 OptionDesc printFlagsDesc; |
130 printFlagsDesc.name = PRINT_FLAGS_ARG; | 130 printFlagsDesc.name = PRINT_FLAGS_ARG; |
131 printFlagsDesc.type = _boolean; | 131 printFlagsDesc.type = _boolean; |
132 printFlagsDesc.help = PRINT_FLAGS_HELP; | 132 printFlagsDesc.help = PRINT_FLAGS_HELP; |
140 Arguments::get_java_home(), fileSep, fileSep, fileSep); | 140 Arguments::get_java_home(), fileSep, fileSep, fileSep); |
141 DIR* dir = os::opendir(optionsDir); | 141 DIR* dir = os::opendir(optionsDir); |
142 if (dir != NULL) { | 142 if (dir != NULL) { |
143 struct dirent *entry; | 143 struct dirent *entry; |
144 char *dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(optionsDir), mtInternal); | 144 char *dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(optionsDir), mtInternal); |
145 OptionsParseClosure closure(table); | 145 OptionDescParseClosure closure(table); |
146 while ((entry = os::readdir(dir, (dirent *) dbuf)) != NULL && !closure.is_aborted()) { | 146 while ((entry = os::readdir(dir, (dirent *) dbuf)) != NULL && !closure.is_aborted()) { |
147 const char* name = entry->d_name; | 147 const char* name = entry->d_name; |
148 char optionFilePath[JVM_MAXPATHLEN]; | 148 char optionFilePath[JVM_MAXPATHLEN]; |
149 jio_snprintf(optionFilePath, sizeof(optionFilePath), "%s%s%s",optionsDir, fileSep, name); | 149 jio_snprintf(optionFilePath, sizeof(optionFilePath), "%s%s%s",optionsDir, fileSep, name); |
150 JVMCIRuntime::parse_lines(optionFilePath, &closure, false); | 150 JVMCIRuntime::parse_lines(optionFilePath, &closure, false); |
160 // TODO(gd) should this be silent? | 160 // TODO(gd) should this be silent? |
161 warning("Could not open jvmci options directory (%s)",optionsDir); | 161 warning("Could not open jvmci options directory (%s)",optionsDir); |
162 return table; | 162 return table; |
163 } | 163 } |
164 | 164 |
165 OptionDesc* OptionsTable::get(const char* name, size_t arglen) { | 165 OptionDesc* OptionDescsTable::get(const char* name, size_t arglen) { |
166 char nameOnly[256]; | 166 char nameOnly[256]; |
167 guarantee(arglen < 256, "Max supported option name len is 256"); | 167 guarantee(arglen < 256, "Max supported option name len is 256"); |
168 strncpy(nameOnly, name, arglen); | 168 strncpy(nameOnly, name, arglen); |
169 nameOnly[arglen] = '\0'; | 169 nameOnly[arglen] = '\0'; |
170 return JVMCIHashtable<const char*, OptionDesc>::get(nameOnly); | 170 return JVMCIHashtable<const char*, OptionDesc>::get(nameOnly); |
211 OptionDesc* get_match() { | 211 OptionDesc* get_match() { |
212 return _match; | 212 return _match; |
213 } | 213 } |
214 }; | 214 }; |
215 | 215 |
216 OptionDesc * OptionsTable::fuzzy_match(const char* name, size_t length) { | 216 OptionDesc * OptionDescsTable::fuzzy_match(const char* name, size_t length) { |
217 FuzzyMatchClosure closure(name); | 217 FuzzyMatchClosure closure(name); |
218 for_each(&closure); | 218 for_each(&closure); |
219 return closure.get_match(); | 219 return closure.get_match(); |
220 } | 220 } |
221 | 221 |
225 FREE_C_HEAP_ARRAY(char, value->string_value, mtCompiler); | 225 FREE_C_HEAP_ARRAY(char, value->string_value, mtCompiler); |
226 } | 226 } |
227 } | 227 } |
228 }; | 228 }; |
229 | 229 |
230 OptionsValueTable::~OptionsValueTable() { | 230 OptionValuesTable::~OptionValuesTable() { |
231 FreeStringsClosure closure; | 231 FreeStringsClosure closure; |
232 for_each(&closure); | 232 for_each(&closure); |
233 delete _table; | 233 delete _table; |
234 } | 234 } |
235 | 235 |
236 | 236 |
237 | 237 |
238 OptionValue* OptionsValueTable::get(const char* name, size_t arglen) { | 238 OptionValue* OptionValuesTable::get(const char* name, size_t arglen) { |
239 char nameOnly[256]; | 239 char nameOnly[256]; |
240 guarantee(arglen < 256, "Max supported option name len is 256"); | 240 guarantee(arglen < 256, "Max supported option name len is 256"); |
241 strncpy(nameOnly, name, arglen); | 241 strncpy(nameOnly, name, arglen); |
242 nameOnly[arglen] = '\0'; | 242 nameOnly[arglen] = '\0'; |
243 return JVMCIHashtable<const char*, OptionValue>::get(nameOnly); | 243 return JVMCIHashtable<const char*, OptionValue>::get(nameOnly); |