comparison src/share/vm/adlc/adlparse.cpp @ 23286:dd9cc155639c

Merge with jdk8u66-b17
author Gilles Duboscq <gilles.m.duboscq@oracle.com>
date Thu, 07 Jan 2016 17:28:46 +0100
parents 52b4284cb496 a1642365d69f
children
comparison
equal deleted inserted replaced
22786:ac649db7fec4 23286:dd9cc155639c
798 parse_err(SYNERR, "missing identifier inside register block.\n"); 798 parse_err(SYNERR, "missing identifier inside register block.\n");
799 return; 799 return;
800 } 800 }
801 if (strcmp(token,"reg_def")==0) { reg_def_parse(); } 801 if (strcmp(token,"reg_def")==0) { reg_def_parse(); }
802 else if (strcmp(token,"reg_class")==0) { reg_class_parse(); } 802 else if (strcmp(token,"reg_class")==0) { reg_class_parse(); }
803 else if (strcmp(token, "reg_class_dynamic") == 0) { reg_class_dynamic_parse(); }
803 else if (strcmp(token,"alloc_class")==0) { alloc_class_parse(); } 804 else if (strcmp(token,"alloc_class")==0) { alloc_class_parse(); }
804 else if (strcmp(token,"#define")==0) { preproc_define(); } 805 else if (strcmp(token,"#define")==0) { preproc_define(); }
805 else { parse_err(SYNERR, "bad token %s inside register block.\n", token); break; } 806 else { parse_err(SYNERR, "bad token %s inside register block.\n", token); break; }
806 skipws(); 807 skipws();
807 } 808 }
2321 return; 2322 return;
2322 } 2323 }
2323 // Debug Stuff 2324 // Debug Stuff
2324 if (_AD._adl_debug >1) fprintf(stderr,"Register Class: %s\n", cname); 2325 if (_AD._adl_debug >1) fprintf(stderr,"Register Class: %s\n", cname);
2325 2326
2326 RegClass *reg_class = _AD._register->addRegClass(cname);
2327
2328 // Collect registers in class
2329 skipws(); 2327 skipws();
2330 if (_curchar == '(') { 2328 if (_curchar == '(') {
2329 // A register list is defined for the register class.
2330 // Collect registers into a generic RegClass register class.
2331 RegClass* reg_class = _AD._register->addRegClass<RegClass>(cname);
2332
2331 next_char(); // Skip '(' 2333 next_char(); // Skip '('
2332 skipws(); 2334 skipws();
2333 while (_curchar != ')') { 2335 while (_curchar != ')') {
2334 char *rname = get_ident(); 2336 char *rname = get_ident();
2335 if (rname==NULL) { 2337 if (rname==NULL) {
2350 skipws(); 2352 skipws();
2351 } 2353 }
2352 } 2354 }
2353 next_char(); // Skip closing ')' 2355 next_char(); // Skip closing ')'
2354 } else if (_curchar == '%') { 2356 } else if (_curchar == '%') {
2357 // A code snippet is defined for the register class.
2358 // Collect the code snippet into a CodeSnippetRegClass register class.
2359 CodeSnippetRegClass* reg_class = _AD._register->addRegClass<CodeSnippetRegClass>(cname);
2355 char *code = find_cpp_block("reg class"); 2360 char *code = find_cpp_block("reg class");
2356 if (code == NULL) { 2361 if (code == NULL) {
2357 parse_err(SYNERR, "missing code declaration for reg class.\n"); 2362 parse_err(SYNERR, "missing code declaration for reg class.\n");
2358 return; 2363 return;
2359 } 2364 }
2360 reg_class->_user_defined = code; 2365 reg_class->set_code_snippet(code);
2361 return; 2366 return;
2362 } 2367 }
2363 2368
2364 // Check for terminating ';' 2369 // Check for terminating ';'
2365 skipws(); 2370 skipws();
2368 return; 2373 return;
2369 } 2374 }
2370 next_char(); // Skip trailing ';' 2375 next_char(); // Skip trailing ';'
2371 2376
2372 // Check RegClass size, must be <= 32 registers in class. 2377 // Check RegClass size, must be <= 32 registers in class.
2378
2379 return;
2380 }
2381
2382 //------------------------------reg_class_dynamic_parse------------------------
2383 void ADLParser::reg_class_dynamic_parse(void) {
2384 char *cname; // Name of dynamic register class being defined
2385
2386 // Get register class name
2387 skipws();
2388 cname = get_ident();
2389 if (cname == NULL) {
2390 parse_err(SYNERR, "missing dynamic register class name after 'reg_class_dynamic'\n");
2391 return;
2392 }
2393
2394 if (_AD._adl_debug > 1) {
2395 fprintf(stdout, "Dynamic Register Class: %s\n", cname);
2396 }
2397
2398 skipws();
2399 if (_curchar != '(') {
2400 parse_err(SYNERR, "missing '(' at the beginning of reg_class_dynamic definition\n");
2401 return;
2402 }
2403 next_char();
2404 skipws();
2405
2406 // Collect two register classes and the C++ code representing the condition code used to
2407 // select between the two classes into a ConditionalRegClass register class.
2408 ConditionalRegClass* reg_class = _AD._register->addRegClass<ConditionalRegClass>(cname);
2409 int i;
2410 for (i = 0; i < 2; i++) {
2411 char* name = get_ident();
2412 if (name == NULL) {
2413 parse_err(SYNERR, "missing class identifier inside reg_class_dynamic list.\n");
2414 return;
2415 }
2416 RegClass* rc = _AD._register->getRegClass(name);
2417 if (rc == NULL) {
2418 parse_err(SEMERR, "unknown identifier %s inside reg_class_dynamic list.\n", name);
2419 } else {
2420 reg_class->set_rclass_at_index(i, rc);
2421 }
2422
2423 skipws();
2424 if (_curchar == ',') {
2425 next_char();
2426 skipws();
2427 } else {
2428 parse_err(SYNERR, "missing separator ',' inside reg_class_dynamic list.\n");
2429 }
2430 }
2431
2432 // Collect the condition code.
2433 skipws();
2434 if (_curchar == '%') {
2435 char* code = find_cpp_block("reg class dynamic");
2436 if (code == NULL) {
2437 parse_err(SYNERR, "missing code declaration for reg_class_dynamic.\n");
2438 return;
2439 }
2440 reg_class->set_condition_code(code);
2441 } else {
2442 parse_err(SYNERR, "missing %% at the beginning of code block in reg_class_dynamic definition\n");
2443 return;
2444 }
2445
2446 skipws();
2447 if (_curchar != ')') {
2448 parse_err(SYNERR, "missing ')' at the end of reg_class_dynamic definition\n");
2449 return;
2450 }
2451 next_char();
2452
2453 skipws();
2454 if (_curchar != ';') {
2455 parse_err(SYNERR, "missing ';' at the end of reg_class_dynamic definition.\n");
2456 return;
2457 }
2458 next_char(); // Skip trailing ';'
2373 2459
2374 return; 2460 return;
2375 } 2461 }
2376 2462
2377 //------------------------------alloc_class_parse------------------------------ 2463 //------------------------------alloc_class_parse------------------------------