--- a/hotspot/src/share/vm/adlc/archDesc.cpp Tue Oct 09 12:40:05 2012 -0700
+++ b/hotspot/src/share/vm/adlc/archDesc.cpp Tue Oct 09 16:09:31 2012 -0700
@@ -221,6 +221,7 @@
_register = NULL;
_encode = NULL;
_pipeline = NULL;
+ _frame = NULL;
}
ArchDesc::~ArchDesc() {
@@ -648,7 +649,10 @@
// Return the textual binding for a given CPP flag name.
// Return NULL if there is no binding, or it has been #undef-ed.
char* ArchDesc::get_preproc_def(const char* flag) {
- SourceForm* deff = (SourceForm*) _preproc_table[flag];
+ // In case of syntax errors, flag may take the value NULL.
+ SourceForm* deff = NULL;
+ if (flag != NULL)
+ deff = (SourceForm*) _preproc_table[flag];
return (deff == NULL) ? NULL : deff->_code;
}
@@ -803,7 +807,9 @@
while (i++ <= 15) fputc(' ', errfile);
fprintf(errfile, "%-8s:", pref);
vfprintf(errfile, fmt, args);
- fprintf(errfile, "\n"); }
+ fprintf(errfile, "\n");
+ fflush(errfile);
+ }
return 1;
}
@@ -855,8 +861,14 @@
// Check constraints on result's register class
const char *result_class = opForm.constrained_reg_class();
- if (!result_class) opForm.dump();
- assert( result_class, "Resulting register class was not defined for operand");
+ if (result_class == NULL) {
+ opForm.dump();
+ syntax_err(opForm._linenum,
+ "Use of an undefined result class for operand: %s",
+ opForm._ident);
+ abort();
+ }
+
regMask = reg_class_to_reg_mask( result_class );
return regMask;
@@ -865,8 +877,14 @@
// Obtain the name of the RegMask for an InstructForm
const char *ArchDesc::reg_mask(InstructForm &inForm) {
const char *result = inForm.reduce_result();
- assert( result,
- "Did not find result operand or RegMask for this instruction");
+
+ if (result == NULL) {
+ syntax_err(inForm._linenum,
+ "Did not find result operand or RegMask"
+ " for this instruction: %s",
+ inForm._ident);
+ abort();
+ }
// Instructions producing 'Universe' use RegMask::Empty
if( strcmp(result,"Universe")==0 ) {
@@ -875,10 +893,17 @@
// Lookup this result operand and get its register class
Form *form = (Form*)_globalNames[result];
- assert( form, "Result operand must be defined");
+ if (form == NULL) {
+ syntax_err(inForm._linenum,
+ "Did not find result operand for result: %s", result);
+ abort();
+ }
OperandForm *oper = form->is_operand();
- if (oper == NULL) form->dump();
- assert( oper, "Result must be an OperandForm");
+ if (oper == NULL) {
+ syntax_err(inForm._linenum, "Form is not an OperandForm:");
+ form->dump();
+ abort();
+ }
return reg_mask( *oper );
}
@@ -887,7 +912,13 @@
char *ArchDesc::stack_or_reg_mask(OperandForm &opForm) {
// name of cisc_spillable version
const char *reg_mask_name = reg_mask(opForm);
- assert( reg_mask_name != NULL, "called with incorrect opForm");
+
+ if (reg_mask_name == NULL) {
+ syntax_err(opForm._linenum,
+ "Did not find reg_mask for opForm: %s",
+ opForm._ident);
+ abort();
+ }
const char *stack_or = "STACK_OR_";
int length = (int)strlen(stack_or) + (int)strlen(reg_mask_name) + 1;