hotspot/src/share/vm/adlc/formssel.cpp
changeset 38658 34f9c45625d8
parent 36316 7a83de7aabca
child 39419 cc993a4ab581
equal deleted inserted replaced
38657:3caf062361a6 38658:34f9c45625d8
  1497 //------------------------------build_predicate--------------------------------
  1497 //------------------------------build_predicate--------------------------------
  1498 // Build instruction predicates.  If the user uses the same operand name
  1498 // Build instruction predicates.  If the user uses the same operand name
  1499 // twice, we need to check that the operands are pointer-eequivalent in
  1499 // twice, we need to check that the operands are pointer-eequivalent in
  1500 // the DFA during the labeling process.
  1500 // the DFA during the labeling process.
  1501 Predicate *InstructForm::build_predicate() {
  1501 Predicate *InstructForm::build_predicate() {
  1502   char buf[1024], *s=buf;
  1502   const int buflen = 1024;
       
  1503   char buf[buflen], *s=buf;
  1503   Dict names(cmpstr,hashstr,Form::arena);       // Map Names to counts
  1504   Dict names(cmpstr,hashstr,Form::arena);       // Map Names to counts
  1504 
  1505 
  1505   MatchNode *mnode =
  1506   MatchNode *mnode =
  1506     strcmp(_matrule->_opType, "Set") ? _matrule : _matrule->_rChild;
  1507     strcmp(_matrule->_opType, "Set") ? _matrule : _matrule->_rChild;
  1507   mnode->count_instr_names(names);
  1508   mnode->count_instr_names(names);
  1508 
  1509 
  1509   uint first = 1;
  1510   uint first = 1;
  1510   // Start with the predicate supplied in the .ad file.
  1511   // Start with the predicate supplied in the .ad file.
  1511   if( _predicate ) {
  1512   if (_predicate) {
  1512     if( first ) first=0;
  1513     if (first) first = 0;
  1513     strcpy(s,"("); s += strlen(s);
  1514     strcpy(s, "("); s += strlen(s);
  1514     strcpy(s,_predicate->_pred);
  1515     strncpy(s, _predicate->_pred, buflen - strlen(s) - 1);
  1515     s += strlen(s);
  1516     s += strlen(s);
  1516     strcpy(s,")"); s += strlen(s);
  1517     strcpy(s, ")"); s += strlen(s);
  1517   }
  1518   }
  1518   for( DictI i(&names); i.test(); ++i ) {
  1519   for( DictI i(&names); i.test(); ++i ) {
  1519     uintptr_t cnt = (uintptr_t)i._value;
  1520     uintptr_t cnt = (uintptr_t)i._value;
  1520     if( cnt > 1 ) {             // Need a predicate at all?
  1521     if( cnt > 1 ) {             // Need a predicate at all?
  1521       assert( cnt == 2, "Unimplemented" );
  1522       assert( cnt == 2, "Unimplemented" );