# HG changeset patch # User twisti # Date 1235734540 28800 # Node ID dbbe28fc66b500ce6c008360a09e62d55ede299d # Parent ed6404fac86b2fb6a14d4bee2a4adc779ce374aa 6778669: Patch from Red Hat -- fixes compilation errors Summary: Some fixes which are required to build on recent GCCs. Reviewed-by: never, kvn Contributed-by: langel@redhat.com diff -r ed6404fac86b -r dbbe28fc66b5 make/linux/makefiles/adlc.make --- a/make/linux/makefiles/adlc.make Thu Feb 26 16:57:21 2009 -0800 +++ b/make/linux/makefiles/adlc.make Fri Feb 27 03:35:40 2009 -0800 @@ -1,5 +1,5 @@ # -# Copyright 1999-2008 Sun Microsystems, Inc. All Rights Reserved. +# Copyright 1999-2009 Sun Microsystems, Inc. All Rights Reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -61,8 +61,8 @@ CPPFLAGS += -DASSERT # CFLAGS_WARN holds compiler options to suppress/enable warnings. -# Suppress warnings (for now) -CFLAGS_WARN = -w +# Compiler warnings are treated as errors +CFLAGS_WARN = -Werror CFLAGS += $(CFLAGS_WARN) OBJECTNAMES = \ diff -r ed6404fac86b -r dbbe28fc66b5 make/solaris/makefiles/adlc.make --- a/make/solaris/makefiles/adlc.make Thu Feb 26 16:57:21 2009 -0800 +++ b/make/solaris/makefiles/adlc.make Fri Feb 27 03:35:40 2009 -0800 @@ -1,5 +1,5 @@ # -# Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. +# Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -67,6 +67,8 @@ endif # CFLAGS_WARN holds compiler options to suppress/enable warnings. +# Compiler warnings are treated as errors +CFLAGS_WARN = +w -errwarn CFLAGS += $(CFLAGS_WARN) ifeq ("${Platform_compiler}", "sparcWorks") diff -r ed6404fac86b -r dbbe28fc66b5 src/share/vm/adlc/adlc.hpp --- a/src/share/vm/adlc/adlc.hpp Thu Feb 26 16:57:21 2009 -0800 +++ b/src/share/vm/adlc/adlc.hpp Fri Feb 27 03:35:40 2009 -0800 @@ -79,6 +79,7 @@ // Macros // Debugging note: Put a breakpoint on "abort". +#undef assert #define assert(cond, msg) { if (!(cond)) { fprintf(stderr, "assert fails %s %d: %s\n", __FILE__, __LINE__, msg); abort(); }} #define max(a, b) (((a)>(b)) ? (a) : (b)) diff -r ed6404fac86b -r dbbe28fc66b5 src/share/vm/adlc/adlparse.cpp --- a/src/share/vm/adlc/adlparse.cpp Thu Feb 26 16:57:21 2009 -0800 +++ b/src/share/vm/adlc/adlparse.cpp Fri Feb 27 03:35:40 2009 -0800 @@ -1,5 +1,5 @@ /* - * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -298,7 +298,7 @@ rule->count_commutative_op(count); if (count > 0) { // Clone match rule and swap commutative operation's operands. - rule->swap_commutative_op(instr_ident, count, match_rules_cnt); + rule->matchrule_swap_commutative_op(instr_ident, count, match_rules_cnt); } } @@ -2586,7 +2586,7 @@ while( _curchar != ')' ) { // Get information on the left instruction and its operand // left-instructions's number - intptr_t left_inst = get_int(); + int left_inst = get_int(); // Left-instruction's operand skipws(); if( _curchar != '.' ) { @@ -2602,7 +2602,7 @@ skipws(); // Get information on the right instruction and its operand - intptr_t right_inst; // Right-instructions's number + int right_inst; // Right-instructions's number if( isdigit(_curchar) ) { right_inst = get_int(); // Right-instruction's operand @@ -3497,22 +3497,24 @@ // (1) // Check if there is a string to pass through to output - char *start = _ptr; // Record start of the next string - while ((_curchar != '$') && ((_curchar != '%') || (*(_ptr+1) != '}')) ) { - // If at the start of a comment, skip past it - if( (_curchar == '/') && ((*(_ptr+1) == '/') || (*(_ptr+1) == '*')) ) { - skipws_no_preproc(); - } else { - // ELSE advance to the next character, or start of the next line - next_char_or_line(); + { + char *start = _ptr; // Record start of the next string + while ((_curchar != '$') && ((_curchar != '%') || (*(_ptr+1) != '}')) ) { + // If at the start of a comment, skip past it + if( (_curchar == '/') && ((*(_ptr+1) == '/') || (*(_ptr+1) == '*')) ) { + skipws_no_preproc(); + } else { + // ELSE advance to the next character, or start of the next line + next_char_or_line(); + } } - } - // If a string was found, terminate it and record in EncClass - if ( start != _ptr ) { - *_ptr = '\0'; // Terminate the string - // Add flag to _strings list indicating we should check _rep_vars - format->_strings.addName(NameList::_signal2); - format->_strings.addName(start); + // If a string was found, terminate it and record in EncClass + if ( start != _ptr ) { + *_ptr = '\0'; // Terminate the string + // Add flag to _strings list indicating we should check _rep_vars + format->_strings.addName(NameList::_signal2); + format->_strings.addName(start); + } } // (2) @@ -3563,10 +3565,10 @@ // copy it and record in FormatRule if ( _curchar == '$' ) { next_char(); // Move past the '$' - char* rep_var = get_ident(); // Nil terminate the variable name - rep_var = strdup(rep_var);// Copy the string + char* next_rep_var = get_ident(); // Nil terminate the variable name + next_rep_var = strdup(next_rep_var);// Copy the string *_ptr = _curchar; // and replace Nil with original character - format->_rep_vars.addName(rep_var); + format->_rep_vars.addName(next_rep_var); // Add flag to _strings list indicating we should check _rep_vars format->_strings.addName(NameList::_signal); } @@ -3714,13 +3716,13 @@ parse_err(SYNERR, "identifier expected at %c\n", _curchar); continue; } // Check that you have a valid operand - const Form *form = instr->_localNames[ident2]; - if (!form) { + const Form *form2 = instr->_localNames[ident2]; + if (!form2) { parse_err(SYNERR, "operand name expected at %s\n", ident2); continue; } - oper = form->is_operand(); - if (oper == NULL && !form->is_opclass()) { + oper = form2->is_operand(); + if (oper == NULL && !form2->is_opclass()) { parse_err(SYNERR, "operand name expected at %s\n", ident2); continue; } // Add operand to list @@ -4271,7 +4273,7 @@ int result; // Storage for integer result if( _curline == NULL ) // Return NULL at EOF. - return NULL; + return 0; skipws(); // Skip whitespace before identifier start = end = _ptr; // Start points at first character diff -r ed6404fac86b -r dbbe28fc66b5 src/share/vm/adlc/archDesc.cpp --- a/src/share/vm/adlc/archDesc.cpp Thu Feb 26 16:57:21 2009 -0800 +++ b/src/share/vm/adlc/archDesc.cpp Fri Feb 27 03:35:40 2009 -0800 @@ -1,5 +1,5 @@ // -// Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. +// Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. // // This code is free software; you can redistribute it and/or modify it @@ -436,10 +436,12 @@ if ((oper->_matrule) && (oper->_matrule->_lChild == NULL) && (oper->_matrule->_rChild == NULL)) { - const Form *form = _globalNames[oper->_matrule->_opType]; - if ((form) && form->is_operand() && - (form->ideal_only() == false)) { - add_chain_rule_entry(oper->_matrule->_opType, oper->cost(), oper->_ident); + { + const Form *form = _globalNames[oper->_matrule->_opType]; + if ((form) && form->is_operand() && + (form->ideal_only() == false)) { + add_chain_rule_entry(oper->_matrule->_opType, oper->cost(), oper->_ident); + } } // Check for additional chain rules if (oper->_matrule->_next) { @@ -1015,12 +1017,12 @@ int idealIndex = 0; for (idealIndex = 1; idealIndex < _last_machine_leaf; ++idealIndex) { const char *idealName = NodeClassNames[idealIndex]; - _idealIndex.Insert((void*)idealName, (void*)idealIndex); + _idealIndex.Insert((void*) idealName, (void*) (intptr_t) idealIndex); } for ( idealIndex = _last_machine_leaf+1; idealIndex < _last_opcode; ++idealIndex) { const char *idealName = NodeClassNames[idealIndex]; - _idealIndex.Insert((void*)idealName, (void*)idealIndex); + _idealIndex.Insert((void*) idealName, (void*) (intptr_t) idealIndex); } } diff -r ed6404fac86b -r dbbe28fc66b5 src/share/vm/adlc/dfa.cpp --- a/src/share/vm/adlc/dfa.cpp Thu Feb 26 16:57:21 2009 -0800 +++ b/src/share/vm/adlc/dfa.cpp Fri Feb 27 03:35:40 2009 -0800 @@ -1,5 +1,5 @@ /* - * Copyright 1997-2004 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -870,7 +870,7 @@ } // Print out the dictionary contents as key-value pairs -static void dumpekey(const void* key) { fprintf(stdout, "%s", key); } +static void dumpekey(const void* key) { fprintf(stdout, "%s", (char*) key); } static void dumpexpr(const void* expr) { fflush(stdout); ((Expr*)expr)->print(); } void ExprDict::dump() { @@ -1020,7 +1020,7 @@ } // Print out the dictionary contents as key-value pairs -static void print_key (const void* key) { fprintf(stdout, "%s", key); } +static void print_key (const void* key) { fprintf(stdout, "%s", (char*) key); } static void print_production(const void* production) { fflush(stdout); ((Production*)production)->print(); } void ProductionState::print() { diff -r ed6404fac86b -r dbbe28fc66b5 src/share/vm/adlc/filebuff.cpp --- a/src/share/vm/adlc/filebuff.cpp Thu Feb 26 16:57:21 2009 -0800 +++ b/src/share/vm/adlc/filebuff.cpp Fri Feb 27 03:35:40 2009 -0800 @@ -1,5 +1,5 @@ /* - * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ // FILEBUFF.CPP - Routines for handling a parser file buffer #include "adlc.hpp" +using namespace std; + //------------------------------FileBuff--------------------------------------- // Create a new parsing buffer FileBuff::FileBuff( BufferedFile *fptr, ArchDesc& archDesc) : _fp(fptr), _AD(archDesc) { @@ -217,7 +219,7 @@ off = expandtab(os,off,*s++,'-','-'); if( i == len ) os << '^'; // Mark end of region os << '\n'; // End of marked line - return 0L; // All done + return 0; // All done } //------------------------------print------------------------------------------ diff -r ed6404fac86b -r dbbe28fc66b5 src/share/vm/adlc/filebuff.hpp --- a/src/share/vm/adlc/filebuff.hpp Thu Feb 26 16:57:21 2009 -0800 +++ b/src/share/vm/adlc/filebuff.hpp Fri Feb 27 03:35:40 2009 -0800 @@ -1,5 +1,5 @@ /* - * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,7 @@ #include using namespace std; + // STRUCTURE FOR HANDLING INPUT AND OUTPUT FILES typedef struct { const char *_name; @@ -72,7 +73,7 @@ // This converts a pointer into the buffer to a file offset. It only works // when the pointer is valid (i.e. just obtained from getline()). - int getoff(const char *s) { return _bufoff+(int)(s-_buf); } + long getoff(const char* s) { return _bufoff + (s - _buf); } }; //------------------------------FileBuffRegion--------------------------------- @@ -95,8 +96,6 @@ FileBuffRegion *copy(); // Deep copy FileBuffRegion *merge(FileBuffRegion*); // Merge 2 regions; delete input -// void print(std::ostream&); -// friend std::ostream& operator<< (std::ostream&, FileBuffRegion&); void print(ostream&); friend ostream& operator<< (ostream&, FileBuffRegion&); }; diff -r ed6404fac86b -r dbbe28fc66b5 src/share/vm/adlc/forms.cpp --- a/src/share/vm/adlc/forms.cpp Thu Feb 26 16:57:21 2009 -0800 +++ b/src/share/vm/adlc/forms.cpp Fri Feb 27 03:35:40 2009 -0800 @@ -1,5 +1,5 @@ /* - * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -370,7 +370,7 @@ } // Print out the dictionary contents as key-value pairs -static void dumpkey (const void* key) { fprintf(stdout, "%s", key); } +static void dumpkey (const void* key) { fprintf(stdout, "%s", (char*) key); } static void dumpform(const void* form) { fflush(stdout); ((Form*)form)->dump(); } void FormDict::dump() { diff -r ed6404fac86b -r dbbe28fc66b5 src/share/vm/adlc/forms.hpp --- a/src/share/vm/adlc/forms.hpp Thu Feb 26 16:57:21 2009 -0800 +++ b/src/share/vm/adlc/forms.hpp Fri Feb 27 03:35:40 2009 -0800 @@ -1,5 +1,5 @@ /* - * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -124,7 +124,7 @@ public: // Public Data Form *_next; // Next pointer for form lists - long _linenum; // Line number for debugging + int _linenum; // Line number for debugging // Dynamic type check for common forms. virtual OpClassForm *is_opclass() const; diff -r ed6404fac86b -r dbbe28fc66b5 src/share/vm/adlc/formsopt.cpp --- a/src/share/vm/adlc/formsopt.cpp Thu Feb 26 16:57:21 2009 -0800 +++ b/src/share/vm/adlc/formsopt.cpp Fri Feb 27 03:35:40 2009 -0800 @@ -1,5 +1,5 @@ /* - * Copyright 1998-2006 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1998-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -273,13 +273,13 @@ for(_regDefs.reset(); (name = _regDefs.iter()) != NULL;) { int rnum = ((RegDef*)_regDef[name])->register_num(); if( (rnum >> 5) == wordnum ) - word |= (1L<<(rnum&31)); + word |= (1 << (rnum & 31)); } if( stack_also ) { // Now also collect stack bits for( int i = 0; i < 32; i++ ) if( wordnum*32+i >= RegisterForm::_reg_ctr ) - word |= (1L< _max_position ) _max_position = position; - _parent.addName((char *)parent); - _position.addName((char *)position); + _parent.addName((char*) (intptr_t) parent); + _position.addName((char*) (intptr_t) position); _instrs.addName(name); - _input.addName((char *)input); + _input.addName((char*) (intptr_t) input); } // Access info about instructions in the peep-match rule @@ -603,7 +603,7 @@ return _max_position; } -const char *PeepMatch::instruction_name(intptr_t position) { +const char *PeepMatch::instruction_name(int position) { return _instrs.name(position); } @@ -615,11 +615,11 @@ _input.reset(); } -void PeepMatch::next_instruction( intptr_t &parent, intptr_t &position, const char * &name, intptr_t &input ){ - parent = (intptr_t)_parent.iter(); - position = (intptr_t)_position.iter(); +void PeepMatch::next_instruction(int &parent, int &position, const char* &name, int &input) { + parent = (int) (intptr_t) _parent.iter(); + position = (int) (intptr_t) _position.iter(); name = _instrs.iter(); - input = (intptr_t)_input.iter(); + input = (int) (intptr_t) _input.iter(); } // 'true' if current position in iteration is a placeholder, not matched. @@ -637,15 +637,15 @@ } //------------------------------PeepConstraint--------------------------------- -PeepConstraint::PeepConstraint(intptr_t left_inst, char *left_op, char *relation, - intptr_t right_inst, char *right_op) +PeepConstraint::PeepConstraint(int left_inst, char* left_op, char* relation, + int right_inst, char* right_op) : _left_inst(left_inst), _left_op(left_op), _relation(relation), _right_inst(right_inst), _right_op(right_op), _next(NULL) {} PeepConstraint::~PeepConstraint() { } // Check if constraints use instruction at position -bool PeepConstraint::constrains_instruction(intptr_t position) { +bool PeepConstraint::constrains_instruction(int position) { // Check local instruction constraints if( _left_inst == position ) return true; if( _right_inst == position ) return true; @@ -692,7 +692,7 @@ } void PeepReplace::add_operand( int inst_num, char *inst_operand ) { _instruction.add_signal(); - _operand_inst_num.addName((char*)inst_num); + _operand_inst_num.addName((char*) (intptr_t) inst_num); _operand_op_name.addName(inst_operand); } @@ -702,15 +702,15 @@ _operand_inst_num.reset(); _operand_op_name.reset(); } -void PeepReplace::next_instruction(const char * &inst){ +void PeepReplace::next_instruction(const char* &inst){ inst = _instruction.iter(); - intptr_t inst_num = (intptr_t)_operand_inst_num.iter(); - const char *inst_operand = _operand_op_name.iter(); + int inst_num = (int) (intptr_t) _operand_inst_num.iter(); + const char* inst_operand = _operand_op_name.iter(); } -void PeepReplace::next_operand( intptr_t &inst_num, const char * &inst_operand ) { - const char *inst = _instruction.iter(); - inst_num = (intptr_t)_operand_inst_num.iter(); - inst_operand = _operand_op_name.iter(); +void PeepReplace::next_operand(int &inst_num, const char* &inst_operand) { + const char* inst = _instruction.iter(); + inst_num = (int) (intptr_t) _operand_inst_num.iter(); + inst_operand = _operand_op_name.iter(); } diff -r ed6404fac86b -r dbbe28fc66b5 src/share/vm/adlc/formsopt.hpp --- a/src/share/vm/adlc/formsopt.hpp Thu Feb 26 16:57:21 2009 -0800 +++ b/src/share/vm/adlc/formsopt.hpp Fri Feb 27 03:35:40 2009 -0800 @@ -1,5 +1,5 @@ /* - * Copyright 1998-2006 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1998-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -457,10 +457,10 @@ // Access info about instructions in the peep-match rule int max_position(); - const char *instruction_name(intptr_t position); + const char *instruction_name(int position); // Iterate through all info on matched instructions void reset(); - void next_instruction( intptr_t &parent, intptr_t &position, const char * &name, intptr_t &input ); + void next_instruction(int &parent, int &position, const char* &name, int &input); // 'true' if current position in iteration is a placeholder, not matched. bool is_placeholder(); @@ -474,20 +474,20 @@ PeepConstraint *_next; // Additional constraints ANDed together public: - const intptr_t _left_inst; - const char *_left_op; - const char *_relation; - const intptr_t _right_inst; - const char *_right_op; + const int _left_inst; + const char* _left_op; + const char* _relation; + const int _right_inst; + const char* _right_op; public: // Public Methods - PeepConstraint(intptr_t left_inst, char *left_op, char *relation, - intptr_t right_inst, char *right_op); + PeepConstraint(int left_inst, char* left_op, char* relation, + int right_inst, char* right_op); ~PeepConstraint(); // Check if constraints use instruction at position - bool constrains_instruction(intptr_t position); + bool constrains_instruction(int position); // Add another constraint void append(PeepConstraint *next_peep_constraint); @@ -519,7 +519,7 @@ // Access contents of peepreplace void reset(); void next_instruction(const char * &root); - void next_operand( intptr_t &inst_num, const char * &inst_operand ); + void next_operand(int &inst_num, const char * &inst_operand ); // Utilities void dump(); diff -r ed6404fac86b -r dbbe28fc66b5 src/share/vm/adlc/formssel.cpp --- a/src/share/vm/adlc/formssel.cpp Thu Feb 26 16:57:21 2009 -0800 +++ b/src/share/vm/adlc/formssel.cpp Fri Feb 27 03:35:40 2009 -0800 @@ -1,5 +1,5 @@ /* - * Copyright 1998-2008 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1998-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -844,8 +844,12 @@ for (_parameters.reset(); (name = _parameters.iter()) != NULL;) { OperandForm *opForm = (OperandForm*)_localNames[name]; - const Form *form = _effects[name]; - Effect *e = form ? form->is_effect() : NULL; + Effect* e = NULL; + { + const Form* form = _effects[name]; + e = form ? form->is_effect() : NULL; + } + if (e != NULL) { has_temp |= e->is(Component::TEMP); @@ -1110,7 +1114,7 @@ const char *op_name = NULL; const char *reg_type = NULL; FormDict &globals = AD.globalNames(); - cisc_spill_operand = _matrule->cisc_spill_match(globals, AD.get_registers(), instr->_matrule, op_name, reg_type); + cisc_spill_operand = _matrule->matchrule_cisc_spill_match(globals, AD.get_registers(), instr->_matrule, op_name, reg_type); if( (cisc_spill_operand != Not_cisc_spillable) && (op_name != NULL) && equivalent_predicates(this, instr) ) { cisc_spill_operand = operand_position(op_name, Component::USE); int def_oper = operand_position(op_name, Component::DEF); @@ -2194,7 +2198,7 @@ // Return -1 if not in list. int OperandForm::constant_position(FormDict &globals, const Component *last) { // Iterate through components and count constants preceeding 'constant' - uint position = 0; + int position = 0; Component *comp; _components.reset(); while( (comp = _components.iter()) != NULL && (comp != last) ) { @@ -2297,7 +2301,7 @@ if ( op->is_base_constant(globals) == Form::idealP ) { // Find the constant's index: _c0, _c1, _c2, ... , _cN uint idx = op->constant_position( globals, rep_var); - fprintf(fp," virtual bool disp_is_oop() const {", _ident); + fprintf(fp," virtual bool disp_is_oop() const {"); fprintf(fp, " return _c%d->isa_oop_ptr();", idx); fprintf(fp, " }\n"); } @@ -3035,9 +3039,9 @@ // Recursive call collecting info on top-level operands, not transitive. // Implementation does not modify state of internal structures. -void MatchNode::append_components(FormDict &locals, ComponentList &components, - bool deflag) const { - int usedef = deflag ? Component::DEF : Component::USE; +void MatchNode::append_components(FormDict& locals, ComponentList& components, + bool def_flag) const { + int usedef = def_flag ? Component::DEF : Component::USE; FormDict &globals = _AD.globalNames(); assert (_name != NULL, "MatchNode::build_components encountered empty node\n"); @@ -3055,10 +3059,10 @@ return; } // Promote results of "Set" to DEF - bool def_flag = (!strcmp(_opType, "Set")) ? true : false; - if (_lChild) _lChild->append_components(locals, components, def_flag); - def_flag = false; // only applies to component immediately following 'Set' - if (_rChild) _rChild->append_components(locals, components, def_flag); + bool tmpdef_flag = (!strcmp(_opType, "Set")) ? true : false; + if (_lChild) _lChild->append_components(locals, components, tmpdef_flag); + tmpdef_flag = false; // only applies to component immediately following 'Set' + if (_rChild) _rChild->append_components(locals, components, tmpdef_flag); } // Find the n'th base-operand in the match node, @@ -3404,9 +3408,9 @@ return (form1 == form2); } -//-------------------------cisc_spill_match------------------------------------ +//-------------------------cisc_spill_match_node------------------------------- // Recursively check two MatchRules for legal conversion via cisc-spilling -int MatchNode::cisc_spill_match(FormDict &globals, RegisterForm *registers, MatchNode *mRule2, const char * &operand, const char * ®_type) { +int MatchNode::cisc_spill_match(FormDict& globals, RegisterForm* registers, MatchNode* mRule2, const char* &operand, const char* ®_type) { int cisc_spillable = Maybe_cisc_spillable; int left_spillable = Maybe_cisc_spillable; int right_spillable = Maybe_cisc_spillable; @@ -3480,13 +3484,13 @@ return cisc_spillable; } -//---------------------------cisc_spill_match---------------------------------- +//---------------------------cisc_spill_match_rule------------------------------ // Recursively check two MatchRules for legal conversion via cisc-spilling // This method handles the root of Match tree, // general recursive checks done in MatchNode -int MatchRule::cisc_spill_match(FormDict &globals, RegisterForm *registers, - MatchRule *mRule2, const char * &operand, - const char * ®_type) { +int MatchRule::matchrule_cisc_spill_match(FormDict& globals, RegisterForm* registers, + MatchRule* mRule2, const char* &operand, + const char* ®_type) { int cisc_spillable = Maybe_cisc_spillable; int left_spillable = Maybe_cisc_spillable; int right_spillable = Maybe_cisc_spillable; @@ -3524,7 +3528,7 @@ //----------------------------- equivalent ------------------------------------ // Recursively check to see if two match rules are equivalent. // This rule handles the root. -bool MatchRule::equivalent(FormDict &globals, MatchRule *mRule2) { +bool MatchRule::equivalent(FormDict &globals, MatchNode *mRule2) { // Check that each sets a result if (sets_result() != mRule2->sets_result()) { return false; @@ -3640,7 +3644,7 @@ //-------------------------- swap_commutative_op ------------------------------ // Recursively swap specified commutative operation with subtree operands. -void MatchRule::swap_commutative_op(const char* instr_ident, int count, int& match_rules_cnt) { +void MatchRule::matchrule_swap_commutative_op(const char* instr_ident, int count, int& match_rules_cnt) { assert(match_rules_cnt < 100," too many match rule clones"); // Clone MatchRule* clone = new MatchRule(_AD, this); @@ -3653,8 +3657,8 @@ clone->_next = this->_next; this-> _next = clone; if( (--count) > 0 ) { - this-> swap_commutative_op(instr_ident, count, match_rules_cnt); - clone->swap_commutative_op(instr_ident, count, match_rules_cnt); + this-> matchrule_swap_commutative_op(instr_ident, count, match_rules_cnt); + clone->matchrule_swap_commutative_op(instr_ident, count, match_rules_cnt); } } @@ -3686,7 +3690,7 @@ // Recursive call collecting info on top-level operands, not transitive. // Implementation does not modify state of internal structures. -void MatchRule::append_components(FormDict &locals, ComponentList &components) const { +void MatchRule::append_components(FormDict& locals, ComponentList& components, bool def_flag) const { assert (_name != NULL, "MatchNode::build_components encountered empty node\n"); MatchNode::append_components(locals, components, diff -r ed6404fac86b -r dbbe28fc66b5 src/share/vm/adlc/formssel.hpp --- a/src/share/vm/adlc/formssel.hpp Thu Feb 26 16:57:21 2009 -0800 +++ b/src/share/vm/adlc/formssel.hpp Fri Feb 27 03:35:40 2009 -0800 @@ -1,5 +1,5 @@ /* - * Copyright 1998-2008 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1998-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -920,8 +920,8 @@ // return 1 if found and position is incremented by operand offset in rule bool find_name(const char *str, int &position) const; bool find_type(const char *str, int &position) const; - void append_components(FormDict &locals, ComponentList &components, - bool def_flag) const; + virtual void append_components(FormDict& locals, ComponentList& components, + bool def_flag = false) const; bool base_operand(uint &position, FormDict &globals, const char * &result, const char * &name, const char * &opType) const; @@ -947,12 +947,12 @@ const char *reduce_left (FormDict &globals) const; // Recursive version of check in MatchRule - int cisc_spill_match(FormDict &globals, RegisterForm *registers, - MatchNode *mRule2, const char * &operand, - const char * ®_type); + int cisc_spill_match(FormDict& globals, RegisterForm* registers, + MatchNode* mRule2, const char* &operand, + const char* ®_type); int cisc_spill_merge(int left_result, int right_result); - bool equivalent(FormDict &globals, MatchNode *mNode2); + virtual bool equivalent(FormDict& globals, MatchNode* mNode2); void count_commutative_op(int& count); void swap_commutative_op(bool atroot, int count); @@ -979,7 +979,7 @@ MatchRule(ArchDesc &ad, MatchNode* mroot, int depth, char* construct, int numleaves); ~MatchRule(); - void append_components(FormDict &locals, ComponentList &components) const; + virtual void append_components(FormDict& locals, ComponentList& components, bool def_flag = false) const; // Recursive call on all operands' match rules in my match rule. bool base_operand(uint &position, FormDict &globals, const char * &result, const char * &name, @@ -1006,14 +1006,14 @@ Form::DataType is_ideal_store() const;// node matches ideal 'StoreXNode' // Check if 'mRule2' is a cisc-spill variant of this MatchRule - int cisc_spill_match(FormDict &globals, RegisterForm *registers, - MatchRule *mRule2, const char * &operand, - const char * ®_type); + int matchrule_cisc_spill_match(FormDict &globals, RegisterForm* registers, + MatchRule* mRule2, const char* &operand, + const char* ®_type); // Check if 'mRule2' is equivalent to this MatchRule - bool equivalent(FormDict &globals, MatchRule *mRule2); + virtual bool equivalent(FormDict& globals, MatchNode* mRule2); - void swap_commutative_op(const char* instr_ident, int count, int& match_rules_cnt); + void matchrule_swap_commutative_op(const char* instr_ident, int count, int& match_rules_cnt); void dump(); void output(FILE *fp); diff -r ed6404fac86b -r dbbe28fc66b5 src/share/vm/adlc/main.cpp --- a/src/share/vm/adlc/main.cpp Thu Feb 26 16:57:21 2009 -0800 +++ b/src/share/vm/adlc/main.cpp Fri Feb 27 03:35:40 2009 -0800 @@ -1,5 +1,5 @@ /* - * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -349,7 +349,7 @@ } else { if (_ADL_file._name) printf("%s --> ", _ADL_file._name); - printf("%s, %s, %s, %s, %s, %s, %s, %s, %s", + printf("%s, %s, %s, %s, %s, %s, %s, %s, %s, %s", _CPP_file._name, _CPP_CLONE_file._name, _CPP_EXPAND_file._name, @@ -358,7 +358,8 @@ _CPP_MISC_file._name, _CPP_PEEPHOLE_file._name, _CPP_PIPELINE_file._name, - _HPP_file._name, _DFA_file._name); + _HPP_file._name, + _DFA_file._name); } printf("\n"); } @@ -431,7 +432,7 @@ legal_end = fbuf.get_line(); } *legal_text = legal_start; - return (legal_end - legal_start); + return (int) (legal_end - legal_start); } // VS2005 has its own definition, identical to this one. diff -r ed6404fac86b -r dbbe28fc66b5 src/share/vm/adlc/output_c.cpp --- a/src/share/vm/adlc/output_c.cpp Thu Feb 26 16:57:21 2009 -0800 +++ b/src/share/vm/adlc/output_c.cpp Fri Feb 27 03:35:40 2009 -0800 @@ -1,5 +1,5 @@ /* - * Copyright 1998-2008 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1998-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -225,11 +225,11 @@ pipeclass->_parameters.reset(); while ( (paramname = pipeclass->_parameters.iter()) != NULL ) { - const PipeClassOperandForm *pipeopnd = + const PipeClassOperandForm *tmppipeopnd = (const PipeClassOperandForm *)pipeclass->_localUsage[paramname]; - if (pipeopnd) - templen += 10 + (int)strlen(pipeopnd->_stage); + if (tmppipeopnd) + templen += 10 + (int)strlen(tmppipeopnd->_stage); else templen += 19; @@ -253,10 +253,10 @@ pipeclass->_parameters.reset(); while ( (paramname = pipeclass->_parameters.iter()) != NULL ) { - const PipeClassOperandForm *pipeopnd = + const PipeClassOperandForm *tmppipeopnd = (const PipeClassOperandForm *)pipeclass->_localUsage[paramname]; templen += sprintf(&operand_stages[templen], " stage_%s%c\n", - pipeopnd ? pipeopnd->_stage : "undefined", + tmppipeopnd ? tmppipeopnd->_stage : "undefined", (++i < paramcount ? ',' : ' ') ); } @@ -1042,10 +1042,10 @@ // Scan the peepmatch and output a test for each instruction static void check_peepmatch_instruction_tree(FILE *fp, PeepMatch *pmatch, PeepConstraint *pconstraint) { - intptr_t parent = -1; - intptr_t inst_position = 0; - const char *inst_name = NULL; - intptr_t input = 0; + int parent = -1; + int inst_position = 0; + const char* inst_name = NULL; + int input = 0; fprintf(fp, " // Check instruction sub-tree\n"); pmatch->reset(); for( pmatch->next_instruction( parent, inst_position, inst_name, input ); @@ -1055,14 +1055,14 @@ if( ! pmatch->is_placeholder() ) { // Define temporaries 'inst#', based on parent and parent's input index if( parent != -1 ) { // root was initialized - fprintf(fp, " inst%ld = inst%ld->in(%ld);\n", + fprintf(fp, " inst%d = inst%d->in(%d);\n", inst_position, parent, input); } // When not the root // Test we have the correct instruction by comparing the rule if( parent != -1 ) { - fprintf(fp, " matches = matches && ( inst%ld->rule() == %s_rule );", + fprintf(fp, " matches = matches && ( inst%d->rule() == %s_rule );", inst_position, inst_name); } } else { @@ -1073,20 +1073,20 @@ } } -static void print_block_index(FILE *fp, intptr_t inst_position) { +static void print_block_index(FILE *fp, int inst_position) { assert( inst_position >= 0, "Instruction number less than zero"); fprintf(fp, "block_index"); if( inst_position != 0 ) { - fprintf(fp, " - %ld", inst_position); + fprintf(fp, " - %d", inst_position); } } // Scan the peepmatch and output a test for each instruction static void check_peepmatch_instruction_sequence(FILE *fp, PeepMatch *pmatch, PeepConstraint *pconstraint) { - intptr_t parent = -1; - intptr_t inst_position = 0; - const char *inst_name = NULL; - intptr_t input = 0; + int parent = -1; + int inst_position = 0; + const char* inst_name = NULL; + int input = 0; fprintf(fp, " // Check instruction sub-tree\n"); pmatch->reset(); for( pmatch->next_instruction( parent, inst_position, inst_name, input ); @@ -1101,14 +1101,14 @@ print_block_index(fp, inst_position); fprintf(fp, " > 0 ) {\n Node *n = block->_nodes.at("); print_block_index(fp, inst_position); - fprintf(fp, ");\n inst%ld = (n->is_Mach()) ? ", inst_position); + fprintf(fp, ");\n inst%d = (n->is_Mach()) ? ", inst_position); fprintf(fp, "n->as_Mach() : NULL;\n }\n"); } // When not the root // Test we have the correct instruction by comparing the rule. if( parent != -1 ) { - fprintf(fp, " matches = matches && (inst%ld != NULL) && (inst%ld->rule() == %s_rule);\n", + fprintf(fp, " matches = matches && (inst%d != NULL) && (inst%d->rule() == %s_rule);\n", inst_position, inst_position, inst_name); } } else { @@ -1121,10 +1121,10 @@ // Build mapping for register indices, num_edges to input static void build_instruction_index_mapping( FILE *fp, FormDict &globals, PeepMatch *pmatch ) { - intptr_t parent = -1; - intptr_t inst_position = 0; - const char *inst_name = NULL; - intptr_t input = 0; + int parent = -1; + int inst_position = 0; + const char* inst_name = NULL; + int input = 0; fprintf(fp, " // Build map to register info\n"); pmatch->reset(); for( pmatch->next_instruction( parent, inst_position, inst_name, input ); @@ -1136,9 +1136,9 @@ InstructForm *inst = globals[inst_name]->is_instruction(); if( inst != NULL ) { char inst_prefix[] = "instXXXX_"; - sprintf(inst_prefix, "inst%ld_", inst_position); + sprintf(inst_prefix, "inst%d_", inst_position); char receiver[] = "instXXXX->"; - sprintf(receiver, "inst%ld->", inst_position); + sprintf(receiver, "inst%d->", inst_position); inst->index_temps( fp, globals, inst_prefix, receiver ); } } @@ -1168,7 +1168,7 @@ } // LEFT - intptr_t left_index = pconstraint->_left_inst; + int left_index = pconstraint->_left_inst; const char *left_op = pconstraint->_left_op; // Access info on the instructions whose operands are compared InstructForm *inst_left = globals[pmatch->instruction_name(left_index)]->is_instruction(); @@ -1191,7 +1191,7 @@ // RIGHT int right_op_index = -1; - intptr_t right_index = pconstraint->_right_inst; + int right_index = pconstraint->_right_inst; const char *right_op = pconstraint->_right_op; if( right_index != -1 ) { // Match operand // Access info on the instructions whose operands are compared @@ -1351,7 +1351,7 @@ assert( root_form != NULL, "Replacement instruction was not previously defined"); fprintf(fp, " %sNode *root = new (C) %sNode();\n", root_inst, root_inst); - intptr_t inst_num; + int inst_num; const char *op_name; int opnds_index = 0; // define result operand // Then install the use-operands for the new sub-tree @@ -1362,7 +1362,6 @@ InstructForm *inst_form; inst_form = globals[pmatch->instruction_name(inst_num)]->is_instruction(); assert( inst_form, "Parser should guaranty this is an instruction"); - int op_base = inst_form->oper_input_base(globals); int inst_op_num = inst_form->operand_position(op_name, Component::USE); if( inst_op_num == NameList::Not_in_list ) inst_op_num = inst_form->operand_position(op_name, Component::USE_DEF); @@ -1379,32 +1378,32 @@ // Add unmatched edges from root of match tree int op_base = root_form->oper_input_base(globals); for( int unmatched_edge = 1; unmatched_edge < op_base; ++unmatched_edge ) { - fprintf(fp, " root->add_req(inst%ld->in(%d)); // unmatched ideal edge\n", + fprintf(fp, " root->add_req(inst%d->in(%d)); // unmatched ideal edge\n", inst_num, unmatched_edge); } // If new instruction captures bottom type if( root_form->captures_bottom_type() ) { // Get bottom type from instruction whose result we are replacing - fprintf(fp, " root->_bottom_type = inst%ld->bottom_type();\n", inst_num); + fprintf(fp, " root->_bottom_type = inst%d->bottom_type();\n", inst_num); } // Define result register and result operand - fprintf(fp, " ra_->add_reference(root, inst%ld);\n", inst_num); - fprintf(fp, " ra_->set_oop (root, ra_->is_oop(inst%ld));\n", inst_num); - fprintf(fp, " ra_->set_pair(root->_idx, ra_->get_reg_second(inst%ld), ra_->get_reg_first(inst%ld));\n", inst_num, inst_num); - fprintf(fp, " root->_opnds[0] = inst%ld->_opnds[0]->clone(C); // result\n", inst_num); + fprintf(fp, " ra_->add_reference(root, inst%d);\n", inst_num); + fprintf(fp, " ra_->set_oop (root, ra_->is_oop(inst%d));\n", inst_num); + fprintf(fp, " ra_->set_pair(root->_idx, ra_->get_reg_second(inst%d), ra_->get_reg_first(inst%d));\n", inst_num, inst_num); + fprintf(fp, " root->_opnds[0] = inst%d->_opnds[0]->clone(C); // result\n", inst_num); fprintf(fp, " // ----- Done with initial setup -----\n"); } else { if( (op_form == NULL) || (op_form->is_base_constant(globals) == Form::none) ) { // Do not have ideal edges for constants after matching - fprintf(fp, " for( unsigned x%d = inst%ld_idx%d; x%d < inst%ld_idx%d; x%d++ )\n", + fprintf(fp, " for( unsigned x%d = inst%d_idx%d; x%d < inst%d_idx%d; x%d++ )\n", inst_op_num, inst_num, inst_op_num, inst_op_num, inst_num, inst_op_num+1, inst_op_num ); - fprintf(fp, " root->add_req( inst%ld->in(x%d) );\n", + fprintf(fp, " root->add_req( inst%d->in(x%d) );\n", inst_num, inst_op_num ); } else { fprintf(fp, " // no ideal edge for constants after matching\n"); } - fprintf(fp, " root->_opnds[%d] = inst%ld->_opnds[%d]->clone(C);\n", + fprintf(fp, " root->_opnds[%d] = inst%d->_opnds[%d]->clone(C);\n", opnds_index, inst_num, inst_op_num ); } ++opnds_index; @@ -1443,7 +1442,7 @@ } for( int i = 0; i <= max_position; ++i ) { if( i == 0 ) { - fprintf(fp, " MachNode *inst0 = this;\n", i); + fprintf(fp, " MachNode *inst0 = this;\n"); } else { fprintf(fp, " MachNode *inst%d = NULL;\n", i); } @@ -1743,7 +1742,7 @@ } // delete the rest of edges fprintf(fp," for(int i = idx%d - 1; i >= (int)idx%d; i--) {\n", cur_num_opnds, new_num_opnds); - fprintf(fp," del_req(i);\n", i); + fprintf(fp," del_req(i);\n"); fprintf(fp," }\n"); fprintf(fp," _num_opnds = %d;\n", new_num_opnds); } @@ -1817,7 +1816,7 @@ fprintf(fp,"\n"); if( node->expands() ) { - fprintf(fp," return result;\n",cnt-1); + fprintf(fp," return result;\n"); } else { fprintf(fp," return this;\n"); } diff -r ed6404fac86b -r dbbe28fc66b5 src/share/vm/adlc/output_h.cpp --- a/src/share/vm/adlc/output_h.cpp Thu Feb 26 16:57:21 2009 -0800 +++ b/src/share/vm/adlc/output_h.cpp Fri Feb 27 03:35:40 2009 -0800 @@ -1,5 +1,5 @@ /* - * Copyright 1998-2008 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1998-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1832,7 +1832,7 @@ break; case Form::idealP: case Form::idealN: - fprintf(fp," return opnd_array(1)->type();\n",result); + fprintf(fp," return opnd_array(1)->type();\n"); break; case Form::idealD: fprintf(fp," return TypeD::make(opnd_array(1)->constantD());\n"); diff -r ed6404fac86b -r dbbe28fc66b5 src/share/vm/includeDB_core --- a/src/share/vm/includeDB_core Thu Feb 26 16:57:21 2009 -0800 +++ b/src/share/vm/includeDB_core Fri Feb 27 03:35:40 2009 -0800 @@ -474,6 +474,7 @@ cardTableModRefBS.cpp mutexLocker.hpp cardTableModRefBS.cpp sharedHeap.hpp cardTableModRefBS.cpp space.hpp +cardTableModRefBS.cpp space.inline.hpp cardTableModRefBS.cpp universe.hpp cardTableModRefBS.cpp virtualspace.hpp diff -r ed6404fac86b -r dbbe28fc66b5 src/share/vm/utilities/vmError.cpp --- a/src/share/vm/utilities/vmError.cpp Thu Feb 26 16:57:21 2009 -0800 +++ b/src/share/vm/utilities/vmError.cpp Fri Feb 27 03:35:40 2009 -0800 @@ -1,5 +1,5 @@ /* - * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2003-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -306,7 +306,7 @@ strncpy(buf, file, buflen); if (len + 10 < buflen) { - sprintf(buf + len, ":" SIZE_FORMAT, _lineno); + sprintf(buf + len, ":%d", _lineno); } st->print(" (%s)", buf); } else { @@ -420,7 +420,7 @@ if (fr.sp()) { st->print(", sp=" PTR_FORMAT, fr.sp()); - st->print(", free space=%dk", + st->print(", free space=%" INTPTR_FORMAT "k", ((intptr_t)fr.sp() - (intptr_t)stack_bottom) >> 10); } diff -r ed6404fac86b -r dbbe28fc66b5 src/share/vm/utilities/vmError.hpp --- a/src/share/vm/utilities/vmError.hpp Thu Feb 26 16:57:21 2009 -0800 +++ b/src/share/vm/utilities/vmError.hpp Fri Feb 27 03:35:40 2009 -0800 @@ -1,5 +1,5 @@ /* - * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2003-2009 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,7 +50,7 @@ // additional info for VM internal errors const char * _filename; - size_t _lineno; + int _lineno; // used by fatal error handler int _current_step;