src/share/vm/adlc/output_c.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 8031320_8u Sdiff src/share/vm/adlc

src/share/vm/adlc/output_c.cpp

Print this page
rev 5968 : 8031320: Use Intel RTM instructions for locks
Summary: Use RTM for inflated locks and stack locks.
Reviewed-by: iveresov, twisti, roland, dcubed


1575                              node->_ident, new_id);
1576       }
1577 
1578       // Build the node for the instruction
1579       fprintf(fp,"\n  %sNode *n%d = new (C) %sNode();\n", new_id, cnt, new_id);
1580       // Add control edge for this node
1581       fprintf(fp,"  n%d->add_req(_in[0]);\n", cnt);
1582       // Build the operand for the value this node defines.
1583       Form *form = (Form*)_globalNames[new_id];
1584       assert( form, "'new_id' must be a defined form name");
1585       // Grab the InstructForm for the new instruction
1586       new_inst = form->is_instruction();
1587       assert( new_inst, "'new_id' must be an instruction name");
1588       if( node->is_ideal_if() && new_inst->is_ideal_if() ) {
1589         fprintf(fp, "  ((MachIfNode*)n%d)->_prob = _prob;\n",cnt);
1590         fprintf(fp, "  ((MachIfNode*)n%d)->_fcnt = _fcnt;\n",cnt);
1591       }
1592 
1593       if( node->is_ideal_fastlock() && new_inst->is_ideal_fastlock() ) {
1594         fprintf(fp, "  ((MachFastLockNode*)n%d)->_counters = _counters;\n",cnt);


1595       }
1596 
1597       // Fill in the bottom_type where requested
1598       if (node->captures_bottom_type(_globalNames) &&
1599           new_inst->captures_bottom_type(_globalNames)) {
1600         fprintf(fp, "  ((MachTypeNode*)n%d)->_bottom_type = bottom_type();\n", cnt);
1601       }
1602 
1603       const char *resultOper = new_inst->reduce_result();
1604       fprintf(fp,"  n%d->set_opnd_array(0, state->MachOperGenerator( %s, C ));\n",
1605               cnt, machOperEnum(resultOper));
1606 
1607       // get the formal operand NameList
1608       NameList *formal_lst = &new_inst->_parameters;
1609       formal_lst->reset();
1610 
1611       // Handle any memory operand
1612       int memory_operand = new_inst->memory_operand(_globalNames);
1613       if( memory_operand != InstructForm::NO_MEMORY_OPERAND ) {
1614         int node_mem_op = node->memory_operand(_globalNames);


3811       path_to_constant(fp_cpp, _globalNames, op->_matrule, i);
3812       for ( i = 1; i < num_consts; ++i ) {
3813         fprintf(fp_cpp, ", ");
3814         path_to_constant(fp_cpp, _globalNames, op->_matrule, i);
3815       }
3816     }
3817     fprintf(fp_cpp, " );\n");
3818     // #####
3819   }
3820 
3821   // Fill in the bottom_type where requested
3822   if ( inst->captures_bottom_type(_globalNames) ) {
3823     fprintf(fp_cpp, "%s node->_bottom_type = _leaf->bottom_type();\n", indent);
3824   }
3825   if( inst->is_ideal_if() ) {
3826     fprintf(fp_cpp, "%s node->_prob = _leaf->as_If()->_prob;\n", indent);
3827     fprintf(fp_cpp, "%s node->_fcnt = _leaf->as_If()->_fcnt;\n", indent);
3828   }
3829   if( inst->is_ideal_fastlock() ) {
3830     fprintf(fp_cpp, "%s node->_counters = _leaf->as_FastLock()->counters();\n", indent);


3831   }
3832 
3833 }
3834 
3835 //---------------------------declare_cisc_version------------------------------
3836 // Build CISC version of this instruction
3837 void InstructForm::declare_cisc_version(ArchDesc &AD, FILE *fp_hpp) {
3838   if( AD.can_cisc_spill() ) {
3839     InstructForm *inst_cisc = cisc_spill_alternate();
3840     if (inst_cisc != NULL) {
3841       fprintf(fp_hpp, "  virtual int            cisc_operand() const { return %d; }\n", cisc_spill_operand());
3842       fprintf(fp_hpp, "  virtual MachNode      *cisc_version(int offset, Compile* C);\n");
3843       fprintf(fp_hpp, "  virtual void           use_cisc_RegMask();\n");
3844       fprintf(fp_hpp, "  virtual const RegMask *cisc_RegMask() const { return _cisc_RegMask; }\n");
3845     }
3846   }
3847 }
3848 
3849 //---------------------------define_cisc_version-------------------------------
3850 // Build CISC version of this instruction




1575                              node->_ident, new_id);
1576       }
1577 
1578       // Build the node for the instruction
1579       fprintf(fp,"\n  %sNode *n%d = new (C) %sNode();\n", new_id, cnt, new_id);
1580       // Add control edge for this node
1581       fprintf(fp,"  n%d->add_req(_in[0]);\n", cnt);
1582       // Build the operand for the value this node defines.
1583       Form *form = (Form*)_globalNames[new_id];
1584       assert( form, "'new_id' must be a defined form name");
1585       // Grab the InstructForm for the new instruction
1586       new_inst = form->is_instruction();
1587       assert( new_inst, "'new_id' must be an instruction name");
1588       if( node->is_ideal_if() && new_inst->is_ideal_if() ) {
1589         fprintf(fp, "  ((MachIfNode*)n%d)->_prob = _prob;\n",cnt);
1590         fprintf(fp, "  ((MachIfNode*)n%d)->_fcnt = _fcnt;\n",cnt);
1591       }
1592 
1593       if( node->is_ideal_fastlock() && new_inst->is_ideal_fastlock() ) {
1594         fprintf(fp, "  ((MachFastLockNode*)n%d)->_counters = _counters;\n",cnt);
1595         fprintf(fp, "  ((MachFastLockNode*)n%d)->_rtm_counters = _rtm_counters;\n",cnt);
1596         fprintf(fp, "  ((MachFastLockNode*)n%d)->_stack_rtm_counters = _stack_rtm_counters;\n",cnt);
1597       }
1598 
1599       // Fill in the bottom_type where requested
1600       if (node->captures_bottom_type(_globalNames) &&
1601           new_inst->captures_bottom_type(_globalNames)) {
1602         fprintf(fp, "  ((MachTypeNode*)n%d)->_bottom_type = bottom_type();\n", cnt);
1603       }
1604 
1605       const char *resultOper = new_inst->reduce_result();
1606       fprintf(fp,"  n%d->set_opnd_array(0, state->MachOperGenerator( %s, C ));\n",
1607               cnt, machOperEnum(resultOper));
1608 
1609       // get the formal operand NameList
1610       NameList *formal_lst = &new_inst->_parameters;
1611       formal_lst->reset();
1612 
1613       // Handle any memory operand
1614       int memory_operand = new_inst->memory_operand(_globalNames);
1615       if( memory_operand != InstructForm::NO_MEMORY_OPERAND ) {
1616         int node_mem_op = node->memory_operand(_globalNames);


3813       path_to_constant(fp_cpp, _globalNames, op->_matrule, i);
3814       for ( i = 1; i < num_consts; ++i ) {
3815         fprintf(fp_cpp, ", ");
3816         path_to_constant(fp_cpp, _globalNames, op->_matrule, i);
3817       }
3818     }
3819     fprintf(fp_cpp, " );\n");
3820     // #####
3821   }
3822 
3823   // Fill in the bottom_type where requested
3824   if ( inst->captures_bottom_type(_globalNames) ) {
3825     fprintf(fp_cpp, "%s node->_bottom_type = _leaf->bottom_type();\n", indent);
3826   }
3827   if( inst->is_ideal_if() ) {
3828     fprintf(fp_cpp, "%s node->_prob = _leaf->as_If()->_prob;\n", indent);
3829     fprintf(fp_cpp, "%s node->_fcnt = _leaf->as_If()->_fcnt;\n", indent);
3830   }
3831   if( inst->is_ideal_fastlock() ) {
3832     fprintf(fp_cpp, "%s node->_counters = _leaf->as_FastLock()->counters();\n", indent);
3833     fprintf(fp_cpp, "%s node->_rtm_counters = _leaf->as_FastLock()->rtm_counters();\n", indent);
3834     fprintf(fp_cpp, "%s node->_stack_rtm_counters = _leaf->as_FastLock()->stack_rtm_counters();\n", indent);
3835   }
3836 
3837 }
3838 
3839 //---------------------------declare_cisc_version------------------------------
3840 // Build CISC version of this instruction
3841 void InstructForm::declare_cisc_version(ArchDesc &AD, FILE *fp_hpp) {
3842   if( AD.can_cisc_spill() ) {
3843     InstructForm *inst_cisc = cisc_spill_alternate();
3844     if (inst_cisc != NULL) {
3845       fprintf(fp_hpp, "  virtual int            cisc_operand() const { return %d; }\n", cisc_spill_operand());
3846       fprintf(fp_hpp, "  virtual MachNode      *cisc_version(int offset, Compile* C);\n");
3847       fprintf(fp_hpp, "  virtual void           use_cisc_RegMask();\n");
3848       fprintf(fp_hpp, "  virtual const RegMask *cisc_RegMask() const { return _cisc_RegMask; }\n");
3849     }
3850   }
3851 }
3852 
3853 //---------------------------define_cisc_version-------------------------------
3854 // Build CISC version of this instruction


src/share/vm/adlc/output_c.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File