hotspot/src/share/vm/adlc/output_h.cpp
changeset 24424 2658d7834c6e
parent 24008 da7059252295
child 24429 4efc66ee325c
equal deleted inserted replaced
24358:8528b67f6562 24424:2658d7834c6e
     1 /*
     1 /*
     2  * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1998, 2014, 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.
   384 
   384 
   385 // Generate the format rule for condition codes
   385 // Generate the format rule for condition codes
   386 static void defineCCodeDump(OperandForm* oper, FILE *fp, int i) {
   386 static void defineCCodeDump(OperandForm* oper, FILE *fp, int i) {
   387   assert(oper != NULL, "what");
   387   assert(oper != NULL, "what");
   388   CondInterface* cond = oper->_interface->is_CondInterface();
   388   CondInterface* cond = oper->_interface->is_CondInterface();
   389   fprintf(fp, "       if( _c%d == BoolTest::eq ) st->print(\"%s\");\n",i,cond->_equal_format);
   389   fprintf(fp, "       if( _c%d == BoolTest::eq ) st->print_raw(\"%s\");\n",i,cond->_equal_format);
   390   fprintf(fp, "  else if( _c%d == BoolTest::ne ) st->print(\"%s\");\n",i,cond->_not_equal_format);
   390   fprintf(fp, "  else if( _c%d == BoolTest::ne ) st->print_raw(\"%s\");\n",i,cond->_not_equal_format);
   391   fprintf(fp, "  else if( _c%d == BoolTest::le ) st->print(\"%s\");\n",i,cond->_less_equal_format);
   391   fprintf(fp, "  else if( _c%d == BoolTest::le ) st->print_raw(\"%s\");\n",i,cond->_less_equal_format);
   392   fprintf(fp, "  else if( _c%d == BoolTest::ge ) st->print(\"%s\");\n",i,cond->_greater_equal_format);
   392   fprintf(fp, "  else if( _c%d == BoolTest::ge ) st->print_raw(\"%s\");\n",i,cond->_greater_equal_format);
   393   fprintf(fp, "  else if( _c%d == BoolTest::lt ) st->print(\"%s\");\n",i,cond->_less_format);
   393   fprintf(fp, "  else if( _c%d == BoolTest::lt ) st->print_raw(\"%s\");\n",i,cond->_less_format);
   394   fprintf(fp, "  else if( _c%d == BoolTest::gt ) st->print(\"%s\");\n",i,cond->_greater_format);
   394   fprintf(fp, "  else if( _c%d == BoolTest::gt ) st->print_raw(\"%s\");\n",i,cond->_greater_format);
   395   fprintf(fp, "  else if( _c%d == BoolTest::overflow ) st->print(\"%s\");\n",i,cond->_overflow_format);
   395   fprintf(fp, "  else if( _c%d == BoolTest::overflow ) st->print_raw(\"%s\");\n",i,cond->_overflow_format);
   396   fprintf(fp, "  else if( _c%d == BoolTest::no_overflow ) st->print(\"%s\");\n",i,cond->_no_overflow_format);
   396   fprintf(fp, "  else if( _c%d == BoolTest::no_overflow ) st->print_raw(\"%s\");\n",i,cond->_no_overflow_format);
   397 }
   397 }
   398 
   398 
   399 // Output code that dumps constant values, increment "i" if type is constant
   399 // Output code that dumps constant values, increment "i" if type is constant
   400 static uint dump_spec_constant(FILE *fp, const char *ideal_type, uint i, OperandForm* oper) {
   400 static uint dump_spec_constant(FILE *fp, const char *ideal_type, uint i, OperandForm* oper) {
   401   if (!strcmp(ideal_type, "ConI")) {
   401   if (!strcmp(ideal_type, "ConI")) {
   414   else if (!strcmp(ideal_type, "ConNKlass")) {
   414   else if (!strcmp(ideal_type, "ConNKlass")) {
   415     fprintf(fp,"    _c%d->dump_on(st);\n", i);
   415     fprintf(fp,"    _c%d->dump_on(st);\n", i);
   416     ++i;
   416     ++i;
   417   }
   417   }
   418   else if (!strcmp(ideal_type, "ConL")) {
   418   else if (!strcmp(ideal_type, "ConL")) {
   419     fprintf(fp,"    st->print(\"#\" INT64_FORMAT, _c%d);\n", i);
   419     fprintf(fp,"    st->print(\"#\" INT64_FORMAT, (int64_t)_c%d);\n", i);
   420     fprintf(fp,"    st->print(\"/\" PTR64_FORMAT, _c%d);\n", i);
   420     fprintf(fp,"    st->print(\"/\" PTR64_FORMAT, (uint64_t)_c%d);\n", i);
   421     ++i;
   421     ++i;
   422   }
   422   }
   423   else if (!strcmp(ideal_type, "ConF")) {
   423   else if (!strcmp(ideal_type, "ConF")) {
   424     fprintf(fp,"    st->print(\"#%%f\", _c%d);\n", i);
   424     fprintf(fp,"    st->print(\"#%%f\", _c%d);\n", i);
   425     fprintf(fp,"    jint _c%di = JavaValue(_c%d).get_jint();\n", i, i);
   425     fprintf(fp,"    jint _c%di = JavaValue(_c%d).get_jint();\n", i, i);
   427     ++i;
   427     ++i;
   428   }
   428   }
   429   else if (!strcmp(ideal_type, "ConD")) {
   429   else if (!strcmp(ideal_type, "ConD")) {
   430     fprintf(fp,"    st->print(\"#%%f\", _c%d);\n", i);
   430     fprintf(fp,"    st->print(\"#%%f\", _c%d);\n", i);
   431     fprintf(fp,"    jlong _c%dl = JavaValue(_c%d).get_jlong();\n", i, i);
   431     fprintf(fp,"    jlong _c%dl = JavaValue(_c%d).get_jlong();\n", i, i);
   432     fprintf(fp,"    st->print(\"/\" PTR64_FORMAT, _c%dl);\n", i);
   432     fprintf(fp,"    st->print(\"/\" PTR64_FORMAT, (uint64_t)_c%dl);\n", i);
   433     ++i;
   433     ++i;
   434   }
   434   }
   435   else if (!strcmp(ideal_type, "Bool")) {
   435   else if (!strcmp(ideal_type, "Bool")) {
   436     defineCCodeDump(oper, fp,i);
   436     defineCCodeDump(oper, fp,i);
   437     ++i;
   437     ++i;
   469 
   469 
   470         // Check if this is a standard string or a replacement variable
   470         // Check if this is a standard string or a replacement variable
   471         if ( string != NameList::_signal ) {
   471         if ( string != NameList::_signal ) {
   472           // Normal string
   472           // Normal string
   473           // Pass through to st->print
   473           // Pass through to st->print
   474           fprintf(fp,"  st->print(\"%s\");\n", string);
   474           fprintf(fp,"  st->print_raw(\"%s\");\n", string);
   475         } else {
   475         } else {
   476           // Replacement variable
   476           // Replacement variable
   477           const char *rep_var = oper._format->_rep_vars.iter();
   477           const char *rep_var = oper._format->_rep_vars.iter();
   478           // Check that it is a local name, and an operand
   478           // Check that it is a local name, and an operand
   479           const Form* form = oper._localNames[rep_var];
   479           const Form* form = oper._localNames[rep_var];
   540 
   540 
   541         // Check if this is a standard string or a replacement variable
   541         // Check if this is a standard string or a replacement variable
   542         if ( string != NameList::_signal ) {
   542         if ( string != NameList::_signal ) {
   543           // Normal string
   543           // Normal string
   544           // Pass through to st->print
   544           // Pass through to st->print
   545           fprintf(fp,"  st->print(\"%s\");\n", string);
   545           fprintf(fp,"  st->print_raw(\"%s\");\n", string);
   546         } else {
   546         } else {
   547           // Replacement variable
   547           // Replacement variable
   548           const char *rep_var = oper._format->_rep_vars.iter();
   548           const char *rep_var = oper._format->_rep_vars.iter();
   549          // Check that it is a local name, and an operand
   549          // Check that it is a local name, and an operand
   550           const Form* form = oper._localNames[rep_var];
   550           const Form* form = oper._localNames[rep_var];
   667           assert( false, "ShouldNotReachHere()");
   667           assert( false, "ShouldNotReachHere()");
   668         }
   668         }
   669       } else if( string == NameList::_signal2 ) // Raw program text
   669       } else if( string == NameList::_signal2 ) // Raw program text
   670         fputs(inst._format->_strings.iter(), fp);
   670         fputs(inst._format->_strings.iter(), fp);
   671       else
   671       else
   672         fprintf(fp,"st->print(\"%s\");\n", string);
   672         fprintf(fp,"st->print_raw(\"%s\");\n", string);
   673     } // Done with all format strings
   673     } // Done with all format strings
   674   } // Done generating the user-defined portion of the format
   674   } // Done generating the user-defined portion of the format
   675 
   675 
   676   // Add call debug info automatically
   676   // Add call debug info automatically
   677   Form::CallType call_type = inst.is_ideal_call();
   677   Form::CallType call_type = inst.is_ideal_call();
   694       fprintf(fp,"  st->print(\" %%s\", _name);");
   694       fprintf(fp,"  st->print(\" %%s\", _name);");
   695       break;
   695       break;
   696     default:
   696     default:
   697       assert(0,"ShouldNotReachHere");
   697       assert(0,"ShouldNotReachHere");
   698     }
   698     }
   699     fprintf(fp,  "  st->print_cr(\"\");\n" );
   699     fprintf(fp,  "  st->cr();\n" );
   700     fprintf(fp,  "  if (_jvms) _jvms->format(ra, this, st); else st->print_cr(\"        No JVM State Info\");\n" );
   700     fprintf(fp,  "  if (_jvms) _jvms->format(ra, this, st); else st->print_cr(\"        No JVM State Info\");\n" );
   701     fprintf(fp,  "  st->print(\"        # \");\n" );
   701     fprintf(fp,  "  st->print(\"        # \");\n" );
   702     fprintf(fp,  "  if( _jvms && _oop_map ) _oop_map->print_on(st);\n");
   702     fprintf(fp,  "  if( _jvms && _oop_map ) _oop_map->print_on(st);\n");
   703   }
   703   }
   704   else if(inst.is_ideal_safepoint()) {
   704   else if(inst.is_ideal_safepoint()) {
   705     fprintf(fp,  "  st->print(\"\");\n" );
   705     fprintf(fp,  "  st->print_raw(\"\");\n" );
   706     fprintf(fp,  "  if (_jvms) _jvms->format(ra, this, st); else st->print_cr(\"        No JVM State Info\");\n" );
   706     fprintf(fp,  "  if (_jvms) _jvms->format(ra, this, st); else st->print_cr(\"        No JVM State Info\");\n" );
   707     fprintf(fp,  "  st->print(\"        # \");\n" );
   707     fprintf(fp,  "  st->print(\"        # \");\n" );
   708     fprintf(fp,  "  if( _jvms && _oop_map ) _oop_map->print_on(st);\n");
   708     fprintf(fp,  "  if( _jvms && _oop_map ) _oop_map->print_on(st);\n");
   709   }
   709   }
   710   else if( inst.is_ideal_if() ) {
   710   else if( inst.is_ideal_if() ) {