src/hotspot/share/adlc/dfa.cpp
changeset 51078 fc6cfe40e32a
parent 47216 71c04702a3d5
child 52683 e017d2f176d0
equal deleted inserted replaced
51077:9baa91bc7567 51078:fc6cfe40e32a
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   500     case '=':
   500     case '=':
   501       return true;
   501       return true;
   502     case '"':  // such as: #line 10 "myfile.ad"\n mypredicate
   502     case '"':  // such as: #line 10 "myfile.ad"\n mypredicate
   503       return true;
   503       return true;
   504     case '|':
   504     case '|':
   505       if( prev != pred && *(prev-1) == '|' ) return true;
   505       if (prev != pred && *(prev-1) == '|') return true;
       
   506       break;
   506     case '&':
   507     case '&':
   507       if( prev != pred && *(prev-1) == '&' ) return true;
   508       if (prev != pred && *(prev-1) == '&') return true;
       
   509       break;
   508     default:
   510     default:
   509       return false;
   511       return false;
   510     }
   512     }
   511 
   513 
   512     return false;
   514     return false;
   715 const char *Expr::compute_external(const Expr *c1, const Expr *c2) {
   717 const char *Expr::compute_external(const Expr *c1, const Expr *c2) {
   716   const char * result = NULL;
   718   const char * result = NULL;
   717 
   719 
   718   // Preserve use of external name which has a zero value
   720   // Preserve use of external name which has a zero value
   719   if( c1->_external_name != NULL ) {
   721   if( c1->_external_name != NULL ) {
   720     sprintf( string_buffer, "%s", c1->as_string());
   722     sprintf(string_buffer, "%s", c1->as_string());
   721     if( !c2->is_zero() ) {
   723     if( !c2->is_zero() ) {
   722       strcat( string_buffer, "+");
   724       strncat(string_buffer, "+", STRING_BUFFER_LENGTH);
   723       strcat( string_buffer, c2->as_string());
   725       strncat(string_buffer, c2->as_string(), STRING_BUFFER_LENGTH);
   724     }
   726     }
   725     result = strdup(string_buffer);
   727     result = strdup(string_buffer);
   726   }
   728   }
   727   else if( c2->_external_name != NULL ) {
   729   else if( c2->_external_name != NULL ) {
   728     if( !c1->is_zero() ) {
   730     if( !c1->is_zero() ) {
   729       sprintf( string_buffer, "%s", c1->as_string());
   731       sprintf(string_buffer, "%s", c1->as_string());
   730       strcat( string_buffer, " + ");
   732       strncat(string_buffer, " + ", STRING_BUFFER_LENGTH);
   731     } else {
   733     } else {
   732       string_buffer[0] = '\0';
   734       string_buffer[0] = '\0';
   733     }
   735     }
   734     strcat( string_buffer, c2->_external_name );
   736     strncat(string_buffer, c2->_external_name, STRING_BUFFER_LENGTH);
   735     result = strdup(string_buffer);
   737     result = strdup(string_buffer);
   736   }
   738   }
   737   return result;
   739   return result;
   738 }
   740 }
   739 
   741 
   740 const char *Expr::compute_expr(const Expr *c1, const Expr *c2) {
   742 const char *Expr::compute_expr(const Expr *c1, const Expr *c2) {
   741   if( !c1->is_zero() ) {
   743   if( !c1->is_zero() ) {
   742     sprintf( string_buffer, "%s", c1->_expr);
   744     sprintf( string_buffer, "%s", c1->_expr);
   743     if( !c2->is_zero() ) {
   745     if( !c2->is_zero() ) {
   744       strcat( string_buffer, "+");
   746       strncat(string_buffer, "+", STRING_BUFFER_LENGTH);
   745       strcat( string_buffer, c2->_expr);
   747       strncat(string_buffer, c2->_expr, STRING_BUFFER_LENGTH);
   746     }
   748     }
   747   }
   749   }
   748   else if( !c2->is_zero() ) {
   750   else if( !c2->is_zero() ) {
   749     sprintf( string_buffer, "%s", c2->_expr);
   751     sprintf( string_buffer, "%s", c2->_expr);
   750   }
   752   }