Mercurial > hg > graal-compiler
comparison src/share/vm/adlc/adlparse.cpp @ 7996:39901f2f1abe
8007403: Incorrect format arguments in adlparse.cpp
Reviewed-by: kvn, twisti
author | mikael |
---|---|
date | Mon, 04 Feb 2013 10:28:39 -0800 |
parents | d336b3173277 |
children | c9ccd7b85f20 |
comparison
equal
deleted
inserted
replaced
7995:37c18711a0df | 7996:39901f2f1abe |
---|---|
166 else get_oplist(instr->_parameters, instr->_localNames); | 166 else get_oplist(instr->_parameters, instr->_localNames); |
167 skipws(); // Skip leading whitespace | 167 skipws(); // Skip leading whitespace |
168 // Check for block delimiter | 168 // Check for block delimiter |
169 if ( (_curchar != '%') | 169 if ( (_curchar != '%') |
170 || ( next_char(), (_curchar != '{')) ) { | 170 || ( next_char(), (_curchar != '{')) ) { |
171 parse_err(SYNERR, "missing '%{' in instruction definition\n"); | 171 parse_err(SYNERR, "missing '%%{' in instruction definition\n"); |
172 return; | 172 return; |
173 } | 173 } |
174 next_char(); // Maintain the invariant | 174 next_char(); // Maintain the invariant |
175 do { | 175 do { |
176 ident = get_ident(); // Grab next identifier | 176 ident = get_ident(); // Grab next identifier |
251 } | 251 } |
252 skipws(); | 252 skipws(); |
253 } while(_curchar != '%'); | 253 } while(_curchar != '%'); |
254 next_char(); | 254 next_char(); |
255 if (_curchar != '}') { | 255 if (_curchar != '}') { |
256 parse_err(SYNERR, "missing '%}' in instruction definition\n"); | 256 parse_err(SYNERR, "missing '%%}' in instruction definition\n"); |
257 return; | 257 return; |
258 } | 258 } |
259 // Check for "Set" form of chain rule | 259 // Check for "Set" form of chain rule |
260 adjust_set_rule(instr); | 260 adjust_set_rule(instr); |
261 if (_AD._pipeline ) { | 261 if (_AD._pipeline ) { |
421 } | 421 } |
422 else get_oplist(oper->_parameters, oper->_localNames); // Parse the component operand list | 422 else get_oplist(oper->_parameters, oper->_localNames); // Parse the component operand list |
423 skipws(); | 423 skipws(); |
424 // Check for block delimiter | 424 // Check for block delimiter |
425 if ((_curchar != '%') || (*(_ptr+1) != '{')) { // If not open block | 425 if ((_curchar != '%') || (*(_ptr+1) != '{')) { // If not open block |
426 parse_err(SYNERR, "missing '%c{' in operand definition\n","%"); | 426 parse_err(SYNERR, "missing '%%{' in operand definition\n"); |
427 return; | 427 return; |
428 } | 428 } |
429 next_char(); next_char(); // Skip over "%{" symbol | 429 next_char(); next_char(); // Skip over "%{" symbol |
430 do { | 430 do { |
431 ident = get_ident(); // Grab next identifier | 431 ident = get_ident(); // Grab next identifier |
481 } | 481 } |
482 skipws(); | 482 skipws(); |
483 } while(_curchar != '%'); | 483 } while(_curchar != '%'); |
484 next_char(); | 484 next_char(); |
485 if (_curchar != '}') { | 485 if (_curchar != '}') { |
486 parse_err(SYNERR, "missing '%}' in operand definition\n"); | 486 parse_err(SYNERR, "missing '%%}' in operand definition\n"); |
487 return; | 487 return; |
488 } | 488 } |
489 // Add operand to tail of operand list | 489 // Add operand to tail of operand list |
490 _AD.addForm(oper); | 490 _AD.addForm(oper); |
491 } | 491 } |
1322 | 1322 |
1323 skipws(); // Skip leading whitespace | 1323 skipws(); // Skip leading whitespace |
1324 // Check for block delimiter | 1324 // Check for block delimiter |
1325 if ( (_curchar != '%') | 1325 if ( (_curchar != '%') |
1326 || ( next_char(), (_curchar != '{')) ) { | 1326 || ( next_char(), (_curchar != '{')) ) { |
1327 parse_err(SYNERR, "missing '%{' in pipeline definition\n"); | 1327 parse_err(SYNERR, "missing '%%{' in pipeline definition\n"); |
1328 return; | 1328 return; |
1329 } | 1329 } |
1330 next_char(); // Maintain the invariant | 1330 next_char(); // Maintain the invariant |
1331 do { | 1331 do { |
1332 ident = get_ident(); // Grab next identifier | 1332 ident = get_ident(); // Grab next identifier |
1339 else if (!strcmp(ident, "pipe_class")) pipe_class_parse(*pipeline); | 1339 else if (!strcmp(ident, "pipe_class")) pipe_class_parse(*pipeline); |
1340 else if (!strcmp(ident, "define")) { | 1340 else if (!strcmp(ident, "define")) { |
1341 skipws(); | 1341 skipws(); |
1342 if ( (_curchar != '%') | 1342 if ( (_curchar != '%') |
1343 || ( next_char(), (_curchar != '{')) ) { | 1343 || ( next_char(), (_curchar != '{')) ) { |
1344 parse_err(SYNERR, "expected '%{'\n"); | 1344 parse_err(SYNERR, "expected '%%{'\n"); |
1345 return; | 1345 return; |
1346 } | 1346 } |
1347 next_char(); skipws(); | 1347 next_char(); skipws(); |
1348 | 1348 |
1349 char *node_class = get_ident(); | 1349 char *node_class = get_ident(); |
1395 bool vsi_seen = false; | 1395 bool vsi_seen = false; |
1396 | 1396 |
1397 skipws(); | 1397 skipws(); |
1398 if ( (_curchar != '%') | 1398 if ( (_curchar != '%') |
1399 || ( next_char(), (_curchar != '{')) ) { | 1399 || ( next_char(), (_curchar != '{')) ) { |
1400 parse_err(SYNERR, "expected '%{'\n"); | 1400 parse_err(SYNERR, "expected '%%{'\n"); |
1401 return; | 1401 return; |
1402 } | 1402 } |
1403 next_char(); skipws(); | 1403 next_char(); skipws(); |
1404 | 1404 |
1405 while (_curchar != '%') { | 1405 while (_curchar != '%') { |
1584 parse_err(SYNERR, "unknown specifier \"%s\"\n", ident); | 1584 parse_err(SYNERR, "unknown specifier \"%s\"\n", ident); |
1585 } | 1585 } |
1586 | 1586 |
1587 if ( (_curchar != '%') | 1587 if ( (_curchar != '%') |
1588 || ( next_char(), (_curchar != '}')) ) { | 1588 || ( next_char(), (_curchar != '}')) ) { |
1589 parse_err(SYNERR, "expected '%}', found \"%c\"\n", _curchar); | 1589 parse_err(SYNERR, "expected '%%}', found \"%c\"\n", _curchar); |
1590 } | 1590 } |
1591 next_char(); skipws(); | 1591 next_char(); skipws(); |
1592 | 1592 |
1593 if (pipeline->_maxInstrsPerBundle == 0) | 1593 if (pipeline->_maxInstrsPerBundle == 0) |
1594 parse_err(SYNERR, "\"max_instructions_per_bundle\" unspecified\n"); | 1594 parse_err(SYNERR, "\"max_instructions_per_bundle\" unspecified\n"); |
1610 skipws(); | 1610 skipws(); |
1611 } while(_curchar != '%'); | 1611 } while(_curchar != '%'); |
1612 | 1612 |
1613 next_char(); | 1613 next_char(); |
1614 if (_curchar != '}') { | 1614 if (_curchar != '}') { |
1615 parse_err(SYNERR, "missing \"%}\" in pipeline definition\n"); | 1615 parse_err(SYNERR, "missing \"%%}\" in pipeline definition\n"); |
1616 return; | 1616 return; |
1617 } | 1617 } |
1618 | 1618 |
1619 next_char(); | 1619 next_char(); |
1620 } | 1620 } |
1773 else get_oplist(pipe_class->_parameters, pipe_class->_localNames); | 1773 else get_oplist(pipe_class->_parameters, pipe_class->_localNames); |
1774 skipws(); // Skip leading whitespace | 1774 skipws(); // Skip leading whitespace |
1775 // Check for block delimiter | 1775 // Check for block delimiter |
1776 if ( (_curchar != '%') | 1776 if ( (_curchar != '%') |
1777 || ( next_char(), (_curchar != '{')) ) { | 1777 || ( next_char(), (_curchar != '{')) ) { |
1778 parse_err(SYNERR, "missing \"%{\" in pipe_class definition\n"); | 1778 parse_err(SYNERR, "missing \"%%{\" in pipe_class definition\n"); |
1779 return; | 1779 return; |
1780 } | 1780 } |
1781 next_char(); | 1781 next_char(); |
1782 | 1782 |
1783 do { | 1783 do { |
2060 return; | 2060 return; |
2061 } while(_curchar != '%'); | 2061 } while(_curchar != '%'); |
2062 | 2062 |
2063 next_char(); | 2063 next_char(); |
2064 if (_curchar != '}') { | 2064 if (_curchar != '}') { |
2065 parse_err(SYNERR, "missing \"%}\" in pipe_class definition\n"); | 2065 parse_err(SYNERR, "missing \"%%}\" in pipe_class definition\n"); |
2066 return; | 2066 return; |
2067 } | 2067 } |
2068 | 2068 |
2069 next_char(); | 2069 next_char(); |
2070 } | 2070 } |
3339 char *index = NULL; | 3339 char *index = NULL; |
3340 char *scale = NULL; | 3340 char *scale = NULL; |
3341 char *disp = NULL; | 3341 char *disp = NULL; |
3342 | 3342 |
3343 if (_curchar != '%') { | 3343 if (_curchar != '%') { |
3344 parse_err(SYNERR, "Missing '%{' for 'interface' block.\n"); | 3344 parse_err(SYNERR, "Missing '%%{' for 'interface' block.\n"); |
3345 return NULL; | 3345 return NULL; |
3346 } | 3346 } |
3347 next_char(); // Skip '%' | 3347 next_char(); // Skip '%' |
3348 if (_curchar != '{') { | 3348 if (_curchar != '{') { |
3349 parse_err(SYNERR, "Missing '%{' for 'interface' block.\n"); | 3349 parse_err(SYNERR, "Missing '%%{' for 'interface' block.\n"); |
3350 return NULL; | 3350 return NULL; |
3351 } | 3351 } |
3352 next_char(); // Skip '{' | 3352 next_char(); // Skip '{' |
3353 skipws(); | 3353 skipws(); |
3354 do { | 3354 do { |
3355 char *field = get_ident(); | 3355 char *field = get_ident(); |
3356 if (field == NULL) { | 3356 if (field == NULL) { |
3357 parse_err(SYNERR, "Expected keyword, base|index|scale|disp, or '%}' ending interface.\n"); | 3357 parse_err(SYNERR, "Expected keyword, base|index|scale|disp, or '%%}' ending interface.\n"); |
3358 return NULL; | 3358 return NULL; |
3359 } | 3359 } |
3360 if ( strcmp(field,"base") == 0 ) { | 3360 if ( strcmp(field,"base") == 0 ) { |
3361 base = interface_field_parse(); | 3361 base = interface_field_parse(); |
3362 } | 3362 } |
3368 } | 3368 } |
3369 else if ( strcmp(field,"disp") == 0 ) { | 3369 else if ( strcmp(field,"disp") == 0 ) { |
3370 disp = interface_field_parse(); | 3370 disp = interface_field_parse(); |
3371 } | 3371 } |
3372 else { | 3372 else { |
3373 parse_err(SYNERR, "Expected keyword, base|index|scale|disp, or '%}' ending interface.\n"); | 3373 parse_err(SYNERR, "Expected keyword, base|index|scale|disp, or '%%}' ending interface.\n"); |
3374 return NULL; | 3374 return NULL; |
3375 } | 3375 } |
3376 } while( _curchar != '%' ); | 3376 } while( _curchar != '%' ); |
3377 next_char(); // Skip '%' | 3377 next_char(); // Skip '%' |
3378 if ( _curchar != '}' ) { | 3378 if ( _curchar != '}' ) { |
3379 parse_err(SYNERR, "Missing '%}' for 'interface' block.\n"); | 3379 parse_err(SYNERR, "Missing '%%}' for 'interface' block.\n"); |
3380 return NULL; | 3380 return NULL; |
3381 } | 3381 } |
3382 next_char(); // Skip '}' | 3382 next_char(); // Skip '}' |
3383 | 3383 |
3384 // Construct desired object and return | 3384 // Construct desired object and return |
3401 const char *greater_equal_format = "ge"; | 3401 const char *greater_equal_format = "ge"; |
3402 const char *less_equal_format = "le"; | 3402 const char *less_equal_format = "le"; |
3403 const char *greater_format = "gt"; | 3403 const char *greater_format = "gt"; |
3404 | 3404 |
3405 if (_curchar != '%') { | 3405 if (_curchar != '%') { |
3406 parse_err(SYNERR, "Missing '%{' for 'cond_interface' block.\n"); | 3406 parse_err(SYNERR, "Missing '%%{' for 'cond_interface' block.\n"); |
3407 return NULL; | 3407 return NULL; |
3408 } | 3408 } |
3409 next_char(); // Skip '%' | 3409 next_char(); // Skip '%' |
3410 if (_curchar != '{') { | 3410 if (_curchar != '{') { |
3411 parse_err(SYNERR, "Missing '%{' for 'cond_interface' block.\n"); | 3411 parse_err(SYNERR, "Missing '%%{' for 'cond_interface' block.\n"); |
3412 return NULL; | 3412 return NULL; |
3413 } | 3413 } |
3414 next_char(); // Skip '{' | 3414 next_char(); // Skip '{' |
3415 skipws(); | 3415 skipws(); |
3416 do { | 3416 do { |
3417 char *field = get_ident(); | 3417 char *field = get_ident(); |
3418 if (field == NULL) { | 3418 if (field == NULL) { |
3419 parse_err(SYNERR, "Expected keyword, base|index|scale|disp, or '%}' ending interface.\n"); | 3419 parse_err(SYNERR, "Expected keyword, base|index|scale|disp, or '%%}' ending interface.\n"); |
3420 return NULL; | 3420 return NULL; |
3421 } | 3421 } |
3422 if ( strcmp(field,"equal") == 0 ) { | 3422 if ( strcmp(field,"equal") == 0 ) { |
3423 equal = interface_field_parse(&equal_format); | 3423 equal = interface_field_parse(&equal_format); |
3424 } | 3424 } |
3436 } | 3436 } |
3437 else if ( strcmp(field,"greater") == 0 ) { | 3437 else if ( strcmp(field,"greater") == 0 ) { |
3438 greater = interface_field_parse(&greater_format); | 3438 greater = interface_field_parse(&greater_format); |
3439 } | 3439 } |
3440 else { | 3440 else { |
3441 parse_err(SYNERR, "Expected keyword, base|index|scale|disp, or '%}' ending interface.\n"); | 3441 parse_err(SYNERR, "Expected keyword, base|index|scale|disp, or '%%}' ending interface.\n"); |
3442 return NULL; | 3442 return NULL; |
3443 } | 3443 } |
3444 } while( _curchar != '%' ); | 3444 } while( _curchar != '%' ); |
3445 next_char(); // Skip '%' | 3445 next_char(); // Skip '%' |
3446 if ( _curchar != '}' ) { | 3446 if ( _curchar != '}' ) { |
3447 parse_err(SYNERR, "Missing '%}' for 'interface' block.\n"); | 3447 parse_err(SYNERR, "Missing '%%}' for 'interface' block.\n"); |
3448 return NULL; | 3448 return NULL; |
3449 } | 3449 } |
3450 next_char(); // Skip '}' | 3450 next_char(); // Skip '}' |
3451 | 3451 |
3452 // Construct desired object and return | 3452 // Construct desired object and return |
3541 cnstr = NULL; // no constructor for this form | 3541 cnstr = NULL; // no constructor for this form |
3542 next_char(); // Move past the ';', replaced with '\0' | 3542 next_char(); // Move past the ';', replaced with '\0' |
3543 } | 3543 } |
3544 else if ((cnstr = find_cpp_block("match constructor")) == NULL ) { | 3544 else if ((cnstr = find_cpp_block("match constructor")) == NULL ) { |
3545 parse_err(SYNERR, "invalid construction of match rule\n" | 3545 parse_err(SYNERR, "invalid construction of match rule\n" |
3546 "Missing ';' or invalid '%{' and '%}' constructor\n"); | 3546 "Missing ';' or invalid '%%{' and '%%}' constructor\n"); |
3547 return NULL; // No MatchRule to return | 3547 return NULL; // No MatchRule to return |
3548 } | 3548 } |
3549 if (_AD._adl_debug > 1) | 3549 if (_AD._adl_debug > 1) |
3550 if (cnstr) fprintf(stderr,"Match Constructor: %s\n", cnstr); | 3550 if (cnstr) fprintf(stderr,"Match Constructor: %s\n", cnstr); |
3551 // Build new MatchRule object | 3551 // Build new MatchRule object |
3644 } // end while part of format description | 3644 } // end while part of format description |
3645 | 3645 |
3646 // Check for closing '"' and '%}' in format description | 3646 // Check for closing '"' and '%}' in format description |
3647 skipws(); // Move to closing '%}' | 3647 skipws(); // Move to closing '%}' |
3648 if ( _curchar != '%' ) { | 3648 if ( _curchar != '%' ) { |
3649 parse_err(SYNERR, "non-blank characters between closing '\"' and '%' in format"); | 3649 parse_err(SYNERR, "non-blank characters between closing '\"' and '%%' in format"); |
3650 return NULL; | 3650 return NULL; |
3651 } | 3651 } |
3652 } // Done with format description inside | 3652 } // Done with format description inside |
3653 | 3653 |
3654 skipws(); | 3654 skipws(); |
3655 // Past format description, at '%' | 3655 // Past format description, at '%' |
3656 if ( _curchar != '%' || *(_ptr+1) != '}' ) { | 3656 if ( _curchar != '%' || *(_ptr+1) != '}' ) { |
3657 parse_err(SYNERR, "missing '%}' at end of format block"); | 3657 parse_err(SYNERR, "missing '%%}' at end of format block"); |
3658 return NULL; | 3658 return NULL; |
3659 } | 3659 } |
3660 next_char(); // Move past the '%' | 3660 next_char(); // Move past the '%' |
3661 next_char(); // Move past the '}' | 3661 next_char(); // Move past the '}' |
3662 } | 3662 } |
3783 } | 3783 } |
3784 | 3784 |
3785 skipws(); | 3785 skipws(); |
3786 // Past format description, at '%' | 3786 // Past format description, at '%' |
3787 if ( _curchar != '%' || *(_ptr+1) != '}' ) { | 3787 if ( _curchar != '%' || *(_ptr+1) != '}' ) { |
3788 parse_err(SYNERR, "missing '%}' at end of format block"); | 3788 parse_err(SYNERR, "missing '%%}' at end of format block"); |
3789 return NULL; | 3789 return NULL; |
3790 } | 3790 } |
3791 next_char(); // Move past the '%' | 3791 next_char(); // Move past the '%' |
3792 next_char(); // Move past the '}' | 3792 next_char(); // Move past the '}' |
3793 | 3793 |
3832 // which has an ordered list of operands. | 3832 // which has an ordered list of operands. |
3833 // Check for block delimiter | 3833 // Check for block delimiter |
3834 skipws(); // Skip leading whitespace | 3834 skipws(); // Skip leading whitespace |
3835 if ((_curchar != '%') | 3835 if ((_curchar != '%') |
3836 || (next_char(), (_curchar != '{')) ) { // If not open block | 3836 || (next_char(), (_curchar != '{')) ) { // If not open block |
3837 parse_err(SYNERR, "missing '%{' in expand definition\n"); | 3837 parse_err(SYNERR, "missing '%%{' in expand definition\n"); |
3838 return(NULL); | 3838 return(NULL); |
3839 } | 3839 } |
3840 next_char(); // Maintain the invariant | 3840 next_char(); // Maintain the invariant |
3841 do { | 3841 do { |
3842 ident = get_ident(); // Grab next identifier | 3842 ident = get_ident(); // Grab next identifier |
3931 } | 3931 } |
3932 | 3932 |
3933 } while(_curchar != '%'); | 3933 } while(_curchar != '%'); |
3934 next_char(); | 3934 next_char(); |
3935 if (_curchar != '}') { | 3935 if (_curchar != '}') { |
3936 parse_err(SYNERR, "missing '%}' in expand rule definition\n"); | 3936 parse_err(SYNERR, "missing '%%}' in expand rule definition\n"); |
3937 return(NULL); | 3937 return(NULL); |
3938 } | 3938 } |
3939 next_char(); | 3939 next_char(); |
3940 | 3940 |
3941 // Debug Stuff | 3941 // Debug Stuff |