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/output_h.cpp
          +++ new/src/share/vm/adlc/output_h.cpp
↓ open down ↓ 1542 lines elided ↑ open up ↑
1543 1543          fprintf(fp,"  int             %s() const { return %s; }\n",
1544 1544                  attr->_ident, attr->_val);
1545 1545        }
1546 1546        // Check value for ins_pc_relative, and if it is true (1), set the flag
1547 1547        if (!strcmp(attr->_ident,"ins_pc_relative") && attr->int_val(*this) != 0)
1548 1548          is_pc_relative = true;
1549 1549        attr = (Attribute *)attr->_next;
1550 1550      }
1551 1551  
1552 1552      // virtual functions for encode and format
1553      -    //
     1553 +
     1554 +    // Virtual function for evaluating the constant.
     1555 +    if (instr->is_mach_constant()) {
     1556 +      fprintf(fp,"  virtual void           eval_constant();\n");
     1557 +    }
     1558 +
1554 1559      // Output the opcode function and the encode function here using the
1555 1560      // encoding class information in the _insencode slot.
1556 1561      if ( instr->_insencode ) {
1557 1562        fprintf(fp,"  virtual void           emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const;\n");
1558 1563      }
1559 1564  
1560 1565      // virtual function for getting the size of an instruction
1561 1566      if ( instr->_size ) {
1562 1567         fprintf(fp,"  virtual uint           size(PhaseRegAlloc *ra_) const;\n");
1563 1568      }
↓ open down ↓ 181 lines elided ↑ open up ↑
1745 1750      fprintf(fp,"}\n");
1746 1751  
1747 1752      // size_of, used by base class's clone to obtain the correct size.
1748 1753      fprintf(fp,"  virtual uint           size_of() const {");
1749 1754      fprintf(fp,   " return sizeof(%sNode);", instr->_ident);
1750 1755      fprintf(fp, " }\n");
1751 1756  
1752 1757      // Virtual methods which are only generated to override base class
1753 1758      if( instr->expands() || instr->needs_projections() ||
1754 1759          instr->has_temps() ||
     1760 +        instr->is_mach_constant() ||
1755 1761          instr->_matrule != NULL &&
1756 1762          instr->num_opnds() != instr->num_unique_opnds() ) {
1757 1763        fprintf(fp,"  virtual MachNode      *Expand(State *state, Node_List &proj_list, Node* mem);\n");
1758 1764      }
1759 1765  
1760 1766      if (instr->is_pinned(_globalNames)) {
1761 1767        fprintf(fp,"  virtual bool           pinned() const { return ");
1762 1768        if (instr->is_parm(_globalNames)) {
1763 1769          fprintf(fp,"_in[0]->pinned();");
1764 1770        } else {
↓ open down ↓ 8 lines elided ↑ open up ↑
1773 1779           || instr->is_chain_of_constant(_globalNames) ) {
1774 1780        fprintf(fp,"  friend MachNode *State::MachNodeGenerator(int opcode, Compile* C);\n");
1775 1781      }
1776 1782      if ( instr->rematerialize(_globalNames, get_registers()) ) {
1777 1783        fprintf(fp,"  // Rematerialize %s\n", instr->_ident);
1778 1784      }
1779 1785  
1780 1786      // Declare short branch methods, if applicable
1781 1787      instr->declare_short_branch_methods(fp);
1782 1788  
1783      -    // Instructions containing a constant that will be entered into the
1784      -    // float/double table redefine the base virtual function
1785      -#ifdef SPARC
1786      -    // Sparc doubles entries in the constant table require more space for
1787      -    // alignment. (expires 9/98)
1788      -    int table_entries = (3 * instr->num_consts( _globalNames, Form::idealD ))
1789      -      + instr->num_consts( _globalNames, Form::idealF );
1790      -#else
1791      -    int table_entries = instr->num_consts( _globalNames, Form::idealD )
1792      -      + instr->num_consts( _globalNames, Form::idealF );
1793      -#endif
1794      -    if( table_entries != 0 ) {
1795      -      fprintf(fp,"  virtual int            const_size() const {");
1796      -      fprintf(fp,   " return %d;", table_entries);
1797      -      fprintf(fp, " }\n");
1798      -    }
1799      -
1800      -
1801 1789      // See if there is an "ins_pipe" declaration for this instruction
1802 1790      if (instr->_ins_pipe) {
1803 1791        fprintf(fp,"  static  const Pipeline *pipeline_class();\n");
1804 1792        fprintf(fp,"  virtual const Pipeline *pipeline() const;\n");
1805 1793      }
1806 1794  
1807 1795      // Generate virtual function for MachNodeX::bottom_type when necessary
1808 1796      //
1809 1797      // Note on accuracy:  Pointer-types of machine nodes need to be accurate,
1810 1798      // or else alias analysis on the matched graph may produce bad code.
↓ open down ↓ 384 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX