< prev index next >
src/share/vm/adlc/formssel.cpp
Print this page
rev 10979 : 8140594: Various minor code improvements (compiler)
@@ -1497,25 +1497,26 @@
//------------------------------build_predicate--------------------------------
// Build instruction predicates. If the user uses the same operand name
// twice, we need to check that the operands are pointer-eequivalent in
// the DFA during the labeling process.
Predicate *InstructForm::build_predicate() {
- char buf[1024], *s=buf;
+ const int buflen = 1024;
+ char buf[buflen], *s=buf;
Dict names(cmpstr,hashstr,Form::arena); // Map Names to counts
MatchNode *mnode =
strcmp(_matrule->_opType, "Set") ? _matrule : _matrule->_rChild;
mnode->count_instr_names(names);
uint first = 1;
// Start with the predicate supplied in the .ad file.
- if( _predicate ) {
- if( first ) first=0;
- strcpy(s,"("); s += strlen(s);
- strcpy(s,_predicate->_pred);
+ if (_predicate) {
+ if (first) first = 0;
+ strcpy(s, "("); s += strlen(s);
+ strncpy(s, _predicate->_pred, buflen - strlen(s) - 1);
s += strlen(s);
- strcpy(s,")"); s += strlen(s);
+ strcpy(s, ")"); s += strlen(s);
}
for( DictI i(&names); i.test(); ++i ) {
uintptr_t cnt = (uintptr_t)i._value;
if( cnt > 1 ) { // Need a predicate at all?
assert( cnt == 2, "Unimplemented" );
< prev index next >