提交 a3dafeb4 编写于 作者: T twisti

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
上级 f566dc9c
#
# 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 = $(SYSDEFS) $(INCLUDES)
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 = \
......
#
# 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 @@ ifndef USE_GCC
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")
......
......@@ -79,6 +79,7 @@ typedef unsigned int uintptr_t;
// 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))
......
/*
* 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 @@ void ADLParser::matchrule_clone_and_swap(MatchRule* rule, const char* instr_iden
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 @@ void ADLParser::peep_constraint_parse(Peephole &peep) {
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 @@ void ADLParser::peep_constraint_parse(Peephole &peep) {
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 @@ FormatRule* ADLParser::template_parse(void) {
// (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 @@ FormatRule* ADLParser::template_parse(void) {
// 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 @@ ExpandRule* ADLParser::expand_parse(InstructForm *instr) {
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 ADLParser::get_int(void) {
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
......
//
// 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 @@ void ArchDesc::build_chain_rule(OperandForm *oper) {
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 @@ void ArchDesc::initBaseOpTypes() {
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);
}
}
......
/*
* 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 @@ void ExprDict::print_asserts(FILE *fp) {
}
// 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 @@ void ProductionState::set_cost_bounds(const char *result, const Expr *cost, bool
}
// 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() {
......
/*
* 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 @@ static int printline( ostream& os, const char *fname, int line,
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------------------------------------------
......
/*
* 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 <iostream>
using namespace std;
// STRUCTURE FOR HANDLING INPUT AND OUTPUT FILES
typedef struct {
const char *_name;
......@@ -72,7 +73,7 @@ class FileBuff {
// 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 @@ class FileBuffRegion {
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&);
};
/*
* 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 @@ bool FormDict::operator ==(const FormDict &d) const {
}
// 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() {
......
/*
* 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 @@ protected:
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;
......
/*
* 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 @@ int RegClass::regs_in_word( int wordnum, bool stack_also ) {
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<<i);
word |= (1 << i);
}
return word;
......@@ -592,10 +592,10 @@ void PeepMatch::add_instruction(int parent, int position, const char *name,
int input) {
if( position > _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 @@ int PeepMatch::max_position() {
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 @@ void PeepMatch::reset() {
_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 @@ void PeepMatch::output(FILE *fp) { // Write info to output files
}
//------------------------------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_instruction(char *root) {
}
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 @@ void PeepReplace::reset() {
_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();
}
......
/*
* 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 @@ public:
// 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 @@ private:
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 @@ public:
// 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();
......
/*
* 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 @@ void InstructForm::build_components() {
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 @@ bool InstructForm::cisc_spills_to(ArchDesc &AD, InstructForm *instr) {
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 @@ int OperandForm::operand_position(const char *name, int usedef) {
// 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 @@ void OperandForm::disp_is_oop(FILE *fp, FormDict &globals) {
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 @@ bool MatchNode::find_type(const char *type, int &position) const {
// 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 @@ void MatchNode::append_components(FormDict &locals, ComponentList &components,
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 @@ bool static root_ops_match(FormDict &globals, const char *op1, const char *op2)
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 * &reg_type) {
int MatchNode::cisc_spill_match(FormDict& globals, RegisterForm* registers, MatchNode* mRule2, const char* &operand, const char* &reg_type) {
int cisc_spillable = Maybe_cisc_spillable;
int left_spillable = Maybe_cisc_spillable;
int right_spillable = Maybe_cisc_spillable;
......@@ -3480,13 +3484,13 @@ int MatchNode::cisc_spill_match(FormDict &globals, RegisterForm *registers, Mat
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 * &reg_type) {
int MatchRule::matchrule_cisc_spill_match(FormDict& globals, RegisterForm* registers,
MatchRule* mRule2, const char* &operand,
const char* &reg_type) {
int cisc_spillable = Maybe_cisc_spillable;
int left_spillable = Maybe_cisc_spillable;
int right_spillable = Maybe_cisc_spillable;
......@@ -3524,7 +3528,7 @@ int MatchRule::cisc_spill_match(FormDict &globals, RegisterForm *registers,
//----------------------------- 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 @@ void MatchNode::swap_commutative_op(bool atroot, int id) {
//-------------------------- 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 @@ void MatchRule::swap_commutative_op(const char* instr_ident, int count, int& mat
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 @@ MatchRule::~MatchRule() {
// 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,
......
/*
* 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 @@ public:
// 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 @@ public:
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 * &reg_type);
int cisc_spill_match(FormDict& globals, RegisterForm* registers,
MatchNode* mRule2, const char* &operand,
const char* &reg_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 @@ public:
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 @@ public:
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 * &reg_type);
int matchrule_cisc_spill_match(FormDict &globals, RegisterForm* registers,
MatchRule* mRule2, const char* &operand,
const char* &reg_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);
......
/*
* 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 @@ void ArchDesc::close_files(int delete_out)
}
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 @@ void ArchDesc::close_files(int delete_out)
_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 @@ int get_legal_text(FileBuff &fbuf, char **legal_text)
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.
......
/*
* 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 @@ static int pipeline_reads_initializer(FILE *fp_cpp, NameList &pipeline_reads, Pi
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 @@ static int pipeline_reads_initializer(FILE *fp_cpp, NameList &pipeline_reads, Pi
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 @@ static void defineOut_RegMask(FILE *fp, const char *node, const char *regMask) {
// 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 @@ static void check_peepmatch_instruction_tree(FILE *fp, PeepMatch *pmatch, PeepCo
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 check_peepmatch_instruction_tree(FILE *fp, PeepMatch *pmatch, PeepCo
}
}
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 @@ static void check_peepmatch_instruction_sequence(FILE *fp, PeepMatch *pmatch, Pe
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 @@ static void check_peepmatch_instruction_sequence(FILE *fp, PeepMatch *pmatch, Pe
// 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 @@ static void build_instruction_index_mapping( FILE *fp, FormDict &globals, PeepMa
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 @@ static void check_peepconstraints(FILE *fp, FormDict &globals, PeepMatch *pmatch
}
// 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 @@ static void check_peepconstraints(FILE *fp, FormDict &globals, PeepMatch *pmatch
// 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 @@ static void generate_peepreplace( FILE *fp, FormDict &globals, PeepMatch *pmatch
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 @@ static void generate_peepreplace( FILE *fp, FormDict &globals, PeepMatch *pmatch
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 @@ static void generate_peepreplace( FILE *fp, FormDict &globals, PeepMatch *pmatch
// 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 @@ void ArchDesc::definePeephole(FILE *fp, InstructForm *node) {
}
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 @@ void ArchDesc::defineExpand(FILE *fp, InstructForm *node) {
}
// 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 @@ void ArchDesc::defineExpand(FILE *fp, InstructForm *node) {
fprintf(fp,"\n");
if( node->expands() ) {
fprintf(fp," return result;\n",cnt-1);
fprintf(fp," return result;\n");
} else {
fprintf(fp," return this;\n");
}
......
/*
* 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 @@ void ArchDesc::declareClasses(FILE *fp) {
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");
......
......@@ -474,6 +474,7 @@ cardTableModRefBS.cpp java.hpp
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
......
/*
* 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 @@ void VMError::report(outputStream* st) {
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 @@ void VMError::report(outputStream* st) {
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);
}
......
/*
* 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 @@ class VMError : public StackObj {
// additional info for VM internal errors
const char * _filename;
size_t _lineno;
int _lineno;
// used by fatal error handler
int _current_step;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册