hotspot/src/share/vm/opto/output.cpp
changeset 22872 b6902ee5bc8d
parent 22234 da823d78ad65
parent 22856 03ad2cf18166
child 22925 c086ad9247c5
equal deleted inserted replaced
22511:fae90cb64946 22872:b6902ee5bc8d
  1063   }
  1063   }
  1064 
  1064 
  1065   // Compute prolog code size
  1065   // Compute prolog code size
  1066   _method_size = 0;
  1066   _method_size = 0;
  1067   _frame_slots = OptoReg::reg2stack(_matcher->_old_SP)+_regalloc->_framesize;
  1067   _frame_slots = OptoReg::reg2stack(_matcher->_old_SP)+_regalloc->_framesize;
  1068 #ifdef IA64
  1068 #if defined(IA64) && !defined(AIX)
  1069   if (save_argument_registers()) {
  1069   if (save_argument_registers()) {
  1070     // 4815101: this is a stub with implicit and unknown precision fp args.
  1070     // 4815101: this is a stub with implicit and unknown precision fp args.
  1071     // The usual spill mechanism can only generate stfd's in this case, which
  1071     // The usual spill mechanism can only generate stfd's in this case, which
  1072     // doesn't work if the fp reg to spill contains a single-precision denorm.
  1072     // doesn't work if the fp reg to spill contains a single-precision denorm.
  1073     // Instead, we hack around the normal spill mechanism using stfspill's and
  1073     // Instead, we hack around the normal spill mechanism using stfspill's and
  1081   }
  1081   }
  1082 #endif
  1082 #endif
  1083   assert(_frame_slots >= 0 && _frame_slots < 1000000, "sanity check");
  1083   assert(_frame_slots >= 0 && _frame_slots < 1000000, "sanity check");
  1084 
  1084 
  1085   if (has_mach_constant_base_node()) {
  1085   if (has_mach_constant_base_node()) {
       
  1086     uint add_size = 0;
  1086     // Fill the constant table.
  1087     // Fill the constant table.
  1087     // Note:  This must happen before shorten_branches.
  1088     // Note:  This must happen before shorten_branches.
  1088     for (uint i = 0; i < _cfg->number_of_blocks(); i++) {
  1089     for (uint i = 0; i < _cfg->number_of_blocks(); i++) {
  1089       Block* b = _cfg->get_block(i);
  1090       Block* b = _cfg->get_block(i);
  1090 
  1091 
  1094         // If the node is a MachConstantNode evaluate the constant
  1095         // If the node is a MachConstantNode evaluate the constant
  1095         // value section.
  1096         // value section.
  1096         if (n->is_MachConstant()) {
  1097         if (n->is_MachConstant()) {
  1097           MachConstantNode* machcon = n->as_MachConstant();
  1098           MachConstantNode* machcon = n->as_MachConstant();
  1098           machcon->eval_constant(C);
  1099           machcon->eval_constant(C);
       
  1100         } else if (n->is_Mach()) {
       
  1101           // On Power there are more nodes that issue constants.
       
  1102           add_size += (n->as_Mach()->ins_num_consts() * 8);
  1099         }
  1103         }
  1100       }
  1104       }
  1101     }
  1105     }
  1102 
  1106 
  1103     // Calculate the offsets of the constants and the size of the
  1107     // Calculate the offsets of the constants and the size of the
  1104     // constant table (including the padding to the next section).
  1108     // constant table (including the padding to the next section).
  1105     constant_table().calculate_offsets_and_size();
  1109     constant_table().calculate_offsets_and_size();
  1106     const_req = constant_table().size();
  1110     const_req = constant_table().size() + add_size;
  1107   }
  1111   }
  1108 
  1112 
  1109   // Initialize the space for the BufferBlob used to find and verify
  1113   // Initialize the space for the BufferBlob used to find and verify
  1110   // instruction size in MachNode::emit_size()
  1114   // instruction size in MachNode::emit_size()
  1111   init_scratch_buffer_blob(const_req);
  1115   init_scratch_buffer_blob(const_req);
  1372            assert(delay_slot == NULL, "not expecting delay slot node");
  1376            assert(delay_slot == NULL, "not expecting delay slot node");
  1373            int br_size = n->size(_regalloc);
  1377            int br_size = n->size(_regalloc);
  1374             int offset = blk_starts[block_num] - current_offset;
  1378             int offset = blk_starts[block_num] - current_offset;
  1375             if (block_num >= i) {
  1379             if (block_num >= i) {
  1376               // Current and following block's offset are not
  1380               // Current and following block's offset are not
  1377               // finilized yet, adjust distance by the difference
  1381               // finalized yet, adjust distance by the difference
  1378               // between calculated and final offsets of current block.
  1382               // between calculated and final offsets of current block.
  1379               offset -= (blk_starts[i] - blk_offset);
  1383               offset -= (blk_starts[i] - blk_offset);
  1380             }
  1384             }
  1381             // In the following code a nop could be inserted before
  1385             // In the following code a nop could be inserted before
  1382             // the branch which will increase the backward distance.
  1386             // the branch which will increase the backward distance.
  1452         else if (!n->is_Proj()) {
  1456         else if (!n->is_Proj()) {
  1453           // Remember the beginning of the previous instruction, in case
  1457           // Remember the beginning of the previous instruction, in case
  1454           // it's followed by a flag-kill and a null-check.  Happens on
  1458           // it's followed by a flag-kill and a null-check.  Happens on
  1455           // Intel all the time, with add-to-memory kind of opcodes.
  1459           // Intel all the time, with add-to-memory kind of opcodes.
  1456           previous_offset = current_offset;
  1460           previous_offset = current_offset;
       
  1461         }
       
  1462 
       
  1463         // Not an else-if!
       
  1464         // If this is a trap based cmp then add its offset to the list.
       
  1465         if (mach->is_TrapBasedCheckNode()) {
       
  1466           inct_starts[inct_cnt++] = current_offset;
  1457         }
  1467         }
  1458       }
  1468       }
  1459 
  1469 
  1460       // Verify that there is sufficient space remaining
  1470       // Verify that there is sufficient space remaining
  1461       cb->insts()->maybe_expand_to_ensure_remaining(MAX_inst_size);
  1471       cb->insts()->maybe_expand_to_ensure_remaining(MAX_inst_size);
  1719     if (n->is_MachNullCheck()) {
  1729     if (n->is_MachNullCheck()) {
  1720       uint block_num = block->non_connector_successor(0)->_pre_order;
  1730       uint block_num = block->non_connector_successor(0)->_pre_order;
  1721       _inc_table.append(inct_starts[inct_cnt++], blk_labels[block_num].loc_pos());
  1731       _inc_table.append(inct_starts[inct_cnt++], blk_labels[block_num].loc_pos());
  1722       continue;
  1732       continue;
  1723     }
  1733     }
       
  1734     // Handle implicit exception table updates: trap instructions.
       
  1735     if (n->is_Mach() && n->as_Mach()->is_TrapBasedCheckNode()) {
       
  1736       uint block_num = block->non_connector_successor(0)->_pre_order;
       
  1737       _inc_table.append(inct_starts[inct_cnt++], blk_labels[block_num].loc_pos());
       
  1738       continue;
       
  1739     }
  1724   } // End of for all blocks fill in exception table entries
  1740   } // End of for all blocks fill in exception table entries
  1725 }
  1741 }
  1726 
  1742 
  1727 // Static Variables
  1743 // Static Variables
  1728 #ifndef PRODUCT
  1744 #ifndef PRODUCT