Print this page
rev 1838 : 6961690: load oops from constant table on SPARC
Summary: oops should be loaded from the constant table of an nmethod instead of materializing them with a long code sequence.
Reviewed-by:

Split Close
Expand all
Collapse all
          --- old/src/share/vm/adlc/formssel.cpp
          +++ new/src/share/vm/adlc/formssel.cpp
↓ open down ↓ 22 lines elided ↑ open up ↑
  23   23   */
  24   24  
  25   25  // FORMS.CPP - Definitions for ADL Parser Forms Classes
  26   26  #include "adlc.hpp"
  27   27  
  28   28  //==============================Instructions===================================
  29   29  //------------------------------InstructForm-----------------------------------
  30   30  InstructForm::InstructForm(const char *id, bool ideal_only)
  31   31    : _ident(id), _ideal_only(ideal_only),
  32   32      _localNames(cmpstr, hashstr, Form::arena),
  33      -    _effects(cmpstr, hashstr, Form::arena) {
       33 +    _effects(cmpstr, hashstr, Form::arena),
       34 +    _is_mach_constant(false)
       35 +{
  34   36        _ftype = Form::INS;
  35   37  
  36   38        _matrule   = NULL;
  37   39        _insencode = NULL;
       40 +      _constant  = NULL;
  38   41        _opcode    = NULL;
  39   42        _size      = NULL;
  40   43        _attribs   = NULL;
  41   44        _predicate = NULL;
  42   45        _exprule   = NULL;
  43   46        _rewrule   = NULL;
  44   47        _format    = NULL;
  45   48        _peephole  = NULL;
  46   49        _ins_pipe  = NULL;
  47   50        _uniq_idx  = NULL;
↓ open down ↓ 3 lines elided ↑ open up ↑
  51   54        _cisc_reg_mask_name = NULL;
  52   55        _is_cisc_alternate = false;
  53   56        _is_short_branch = false;
  54   57        _short_branch_form = NULL;
  55   58        _alignment = 1;
  56   59  }
  57   60  
  58   61  InstructForm::InstructForm(const char *id, InstructForm *instr, MatchRule *rule)
  59   62    : _ident(id), _ideal_only(false),
  60   63      _localNames(instr->_localNames),
  61      -    _effects(instr->_effects) {
       64 +    _effects(instr->_effects),
       65 +    _is_mach_constant(false)
       66 +{
  62   67        _ftype = Form::INS;
  63   68  
  64   69        _matrule   = rule;
  65   70        _insencode = instr->_insencode;
       71 +      _constant  = instr->_constant;
  66   72        _opcode    = instr->_opcode;
  67   73        _size      = instr->_size;
  68   74        _attribs   = instr->_attribs;
  69   75        _predicate = instr->_predicate;
  70   76        _exprule   = instr->_exprule;
  71   77        _rewrule   = instr->_rewrule;
  72   78        _format    = instr->_format;
  73   79        _peephole  = instr->_peephole;
  74   80        _ins_pipe  = instr->_ins_pipe;
  75   81        _uniq_idx  = instr->_uniq_idx;
↓ open down ↓ 1011 lines elided ↑ open up ↑
1087 1093    }
1088 1094    else if (is_ideal_if()) {
1089 1095      return "MachIfNode";
1090 1096    }
1091 1097    else if (is_ideal_fastlock()) {
1092 1098      return "MachFastLockNode";
1093 1099    }
1094 1100    else if (is_ideal_nop()) {
1095 1101      return "MachNopNode";
1096 1102    }
     1103 +  else if (is_mach_constant()) {
     1104 +    return "MachConstantNode";
     1105 +  }
1097 1106    else if (captures_bottom_type(globals)) {
1098 1107      return "MachTypeNode";
1099 1108    } else {
1100 1109      return "MachNode";
1101 1110    }
1102 1111    assert( false, "ShouldNotReachHere()");
1103 1112    return NULL;
1104 1113  }
1105 1114  
1106 1115  // Compare the instruction predicates for textual equality
↓ open down ↓ 76 lines elided ↑ open up ↑
1183 1192      return true;
1184 1193    }
1185 1194    return false;
1186 1195  }
1187 1196  
1188 1197  
1189 1198  // --------------------------- FILE *output_routines
1190 1199  //
1191 1200  // Generate the format call for the replacement variable
1192 1201  void InstructForm::rep_var_format(FILE *fp, const char *rep_var) {
     1202 +  // Handle special constant table variables.
     1203 +  if (strcmp(rep_var, "constanttablebase") == 0) {
     1204 +    fprintf(fp, "char reg[128];  ra->dump_register(in(mach_constant_base_node_input()), reg);\n");
     1205 +    fprintf(fp, "st->print(\"%%s\");\n");
     1206 +    return;
     1207 +  }
     1208 +  if (strcmp(rep_var, "constantoffset") == 0) {
     1209 +    fprintf(fp, "st->print(\"#%%d\", constant_offset());\n");
     1210 +    return;
     1211 +  }
     1212 +  if (strcmp(rep_var, "constantaddress") == 0) {
     1213 +    fprintf(fp, "st->print(\"constant table base + #%%d\", constant_offset());\n");
     1214 +    return;
     1215 +  }
     1216 +
1193 1217    // Find replacement variable's type
1194 1218    const Form *form   = _localNames[rep_var];
1195 1219    if (form == NULL) {
1196 1220      fprintf(stderr, "unknown replacement variable in format statement: '%s'\n", rep_var);
1197 1221      assert(false, "ShouldNotReachHere()");
1198 1222    }
1199 1223    OpClassForm *opc   = form->is_opclass();
1200 1224    assert( opc, "replacement variable was not found in local names");
1201 1225    // Lookup the index position of the replacement variable
1202 1226    int idx  = operand_position_format(rep_var);
↓ open down ↓ 138 lines elided ↑ open up ↑
1341 1365  }
1342 1366  
1343 1367  void InstructForm::dump() {
1344 1368    output(stderr);
1345 1369  }
1346 1370  
1347 1371  void InstructForm::output(FILE *fp) {
1348 1372    fprintf(fp,"\nInstruction: %s\n", (_ident?_ident:""));
1349 1373    if (_matrule)   _matrule->output(fp);
1350 1374    if (_insencode) _insencode->output(fp);
     1375 +  if (_constant)  _constant->output(fp);
1351 1376    if (_opcode)    _opcode->output(fp);
1352 1377    if (_attribs)   _attribs->output(fp);
1353 1378    if (_predicate) _predicate->output(fp);
1354 1379    if (_effects.Size()) {
1355 1380      fprintf(fp,"Effects\n");
1356 1381      _effects.dump();
1357 1382    }
1358 1383    if (_exprule)   _exprule->output(fp);
1359 1384    if (_rewrule)   _rewrule->output(fp);
1360 1385    if (_format)    _format->output(fp);
↓ open down ↓ 2704 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX