| 250 | } |
| 251 | |
| 252 | void State::parse(Ref<TokenStream> cin) |
| 253 | { |
| 254 | /* parse until end of stream */ |
| 255 | while (cin->peek() != Token::Eof()) |
| 256 | { |
| 257 | const Token tok = cin->get(); |
| 258 | |
| 259 | if (tok == Token::Id("threads") && cin->trySymbol("=")) |
| 260 | numThreads = cin->get().Int(); |
| 261 | |
| 262 | else if (tok == Token::Id("user_threads")&& cin->trySymbol("=")) |
| 263 | numUserThreads = cin->get().Int(); |
| 264 | |
| 265 | else if (tok == Token::Id("set_affinity")&& cin->trySymbol("=")) |
| 266 | set_affinity = cin->get().Int(); |
| 267 | |
| 268 | else if (tok == Token::Id("affinity")&& cin->trySymbol("=")) |
| 269 | set_affinity = cin->get().Int(); |
| 270 | |
| 271 | else if (tok == Token::Id("start_threads")&& cin->trySymbol("=")) |
| 272 | start_threads = cin->get().Int(); |
| 273 | |
| 274 | else if (tok == Token::Id("isa") && cin->trySymbol("=")) { |
| 275 | std::string isa_str = toLowerCase(cin->get().Identifier()); |
| 276 | enabled_cpu_features = string_to_cpufeatures(isa_str); |
| 277 | enabled_builder_cpu_features = enabled_cpu_features; |
| 278 | } |
| 279 | |
| 280 | else if (tok == Token::Id("max_isa") && cin->trySymbol("=")) { |
| 281 | std::string isa_str = toLowerCase(cin->get().Identifier()); |
| 282 | enabled_cpu_features &= string_to_cpufeatures(isa_str); |
| 283 | enabled_builder_cpu_features &= enabled_cpu_features; |
| 284 | } |
| 285 | |
| 286 | else if (tok == Token::Id("max_builder_isa") && cin->trySymbol("=")) { |
| 287 | std::string isa_str = toLowerCase(cin->get().Identifier()); |
| 288 | enabled_builder_cpu_features &= string_to_cpufeatures(isa_str); |
| 289 | } |
| 290 | |
| 291 | else if (tok == Token::Id("frequency_level") && cin->trySymbol("=")) { |
| 292 | std::string freq = cin->get().Identifier(); |
| 293 | if (freq == "simd128") frequency_level = FREQUENCY_SIMD128; |
| 294 | else if (freq == "simd256") frequency_level = FREQUENCY_SIMD256; |
| 295 | else if (freq == "simd512") frequency_level = FREQUENCY_SIMD512; |
| 296 | } |
| 297 | |
| 298 | else if (tok == Token::Id("enable_selockmemoryprivilege") && cin->trySymbol("=")) { |
| 299 | enable_selockmemoryprivilege = cin->get().Int(); |
| 300 | } |
| 301 | else if (tok == Token::Id("hugepages") && cin->trySymbol("=")) { |
| 302 | hugepages = cin->get().Int(); |
| 303 | } |
| 304 | |
| 305 | else if (tok == Token::Id("float_exceptions") && cin->trySymbol("=")) |
| 306 | float_exceptions = cin->get().Int(); |
| 307 | |
| 308 | else if ((tok == Token::Id("tri_accel") || tok == Token::Id("accel")) && cin->trySymbol("=")) |
| 309 | tri_accel = cin->get().Identifier(); |
nothing calls this directly
no test coverage detected