src/share/vm/opto/output.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/opto

src/share/vm/opto/output.cpp

Print this page




1149   if (StressCodeBuffers)
1150     code_req = const_req = stub_req = exception_handler_req = deopt_handler_req = 0x10;  // force expansion
1151 
1152   int total_req =
1153     const_req +
1154     code_req +
1155     pad_req +
1156     stub_req +
1157     exception_handler_req +
1158     deopt_handler_req;               // deopt handler
1159 
1160   if (has_method_handle_invokes())
1161     total_req += deopt_handler_req;  // deopt MH handler
1162 
1163   CodeBuffer* cb = code_buffer();
1164   cb->initialize(total_req, locs_req);
1165 
1166   // Have we run out of code space?
1167   if ((cb->blob() == NULL) || (!CompileBroker::should_compile_new_jobs())) {
1168     C->record_failure("CodeCache is full");
1169     CompileBroker::handle_full_code_cache(CodeBlobType::NonNMethod);
1170     return NULL;
1171   }
1172   // Configure the code buffer.
1173   cb->initialize_consts_size(const_req);
1174   cb->initialize_stubs_size(stub_req);
1175   cb->initialize_oop_recorder(env()->oop_recorder());
1176 
1177   // fill in the nop array for bundling computations
1178   MachNode *_nop_list[Bundle::_nop_count];
1179   Bundle::initialize_nops(_nop_list);
1180 
1181   return cb;
1182 }
1183 
1184 //------------------------------fill_buffer------------------------------------
1185 void Compile::fill_buffer(CodeBuffer* cb, uint* blk_starts) {
1186   // blk_starts[] contains offsets calculated during short branches processing,
1187   // offsets should not be increased during following steps.
1188 
1189   // Compute the size of first NumberOfLoopInstrToAlign instructions at head


1474         }
1475 #endif
1476         else if (!n->is_Proj()) {
1477           // Remember the beginning of the previous instruction, in case
1478           // it's followed by a flag-kill and a null-check.  Happens on
1479           // Intel all the time, with add-to-memory kind of opcodes.
1480           previous_offset = current_offset;
1481         }
1482 
1483         // Not an else-if!
1484         // If this is a trap based cmp then add its offset to the list.
1485         if (mach->is_TrapBasedCheckNode()) {
1486           inct_starts[inct_cnt++] = current_offset;
1487         }
1488       }
1489 
1490       // Verify that there is sufficient space remaining
1491       cb->insts()->maybe_expand_to_ensure_remaining(MAX_inst_size);
1492       if ((cb->blob() == NULL) || (!CompileBroker::should_compile_new_jobs())) {
1493         C->record_failure("CodeCache is full");
1494         CompileBroker::handle_full_code_cache(CodeBlobType::NonNMethod);
1495         return;
1496       }
1497 
1498       // Save the offset for the listing
1499 #ifndef PRODUCT
1500       if (node_offsets && n->_idx < node_offset_limit)
1501         node_offsets[n->_idx] = cb->insts_size();
1502 #endif
1503 
1504       // "Normal" instruction case
1505       DEBUG_ONLY( uint instr_offset = cb->insts_size(); )
1506       n->emit(*cb, _regalloc);
1507       current_offset  = cb->insts_size();
1508 
1509 #ifdef ASSERT
1510       if (n->size(_regalloc) < (current_offset-instr_offset)) {
1511         n->dump();
1512         assert(false, "wrong size of mach node");
1513       }
1514 #endif


1631 
1632   // Only java methods have exception handlers and deopt handlers
1633   // class HandlerImpl is platform-specific and defined in the *.ad files.
1634   if (_method) {
1635     // Emit the exception handler code.
1636     _code_offsets.set_value(CodeOffsets::Exceptions, HandlerImpl::emit_exception_handler(*cb));
1637     // Emit the deopt handler code.
1638     _code_offsets.set_value(CodeOffsets::Deopt, HandlerImpl::emit_deopt_handler(*cb));
1639 
1640     // Emit the MethodHandle deopt handler code (if required).
1641     if (has_method_handle_invokes()) {
1642       // We can use the same code as for the normal deopt handler, we
1643       // just need a different entry point address.
1644       _code_offsets.set_value(CodeOffsets::DeoptMH, HandlerImpl::emit_deopt_handler(*cb));
1645     }
1646   }
1647 
1648   // One last check for failed CodeBuffer::expand:
1649   if ((cb->blob() == NULL) || (!CompileBroker::should_compile_new_jobs())) {
1650     C->record_failure("CodeCache is full");
1651     CompileBroker::handle_full_code_cache(CodeBlobType::NonNMethod);
1652     return;
1653   }
1654 
1655 #ifndef PRODUCT
1656   // Dump the assembly code, including basic-block numbers
1657   if (print_assembly()) {
1658     ttyLocker ttyl;  // keep the following output all in one block
1659     if (!VMThread::should_terminate()) {  // test this under the tty lock
1660       // This output goes directly to the tty, not the compiler log.
1661       // To enable tools to match it up with the compilation activity,
1662       // be sure to tag this tty output with the compile ID.
1663       if (xtty != NULL) {
1664         xtty->head("opto_assembly compile_id='%d'%s", compile_id(),
1665                    is_osr_compilation()    ? " compile_kind='osr'" :
1666                    "");
1667       }
1668       if (method() != NULL) {
1669         method()->print_metadata();
1670       }
1671       dump_asm(node_offsets, node_offset_limit);




1149   if (StressCodeBuffers)
1150     code_req = const_req = stub_req = exception_handler_req = deopt_handler_req = 0x10;  // force expansion
1151 
1152   int total_req =
1153     const_req +
1154     code_req +
1155     pad_req +
1156     stub_req +
1157     exception_handler_req +
1158     deopt_handler_req;               // deopt handler
1159 
1160   if (has_method_handle_invokes())
1161     total_req += deopt_handler_req;  // deopt MH handler
1162 
1163   CodeBuffer* cb = code_buffer();
1164   cb->initialize(total_req, locs_req);
1165 
1166   // Have we run out of code space?
1167   if ((cb->blob() == NULL) || (!CompileBroker::should_compile_new_jobs())) {
1168     C->record_failure("CodeCache is full");

1169     return NULL;
1170   }
1171   // Configure the code buffer.
1172   cb->initialize_consts_size(const_req);
1173   cb->initialize_stubs_size(stub_req);
1174   cb->initialize_oop_recorder(env()->oop_recorder());
1175 
1176   // fill in the nop array for bundling computations
1177   MachNode *_nop_list[Bundle::_nop_count];
1178   Bundle::initialize_nops(_nop_list);
1179 
1180   return cb;
1181 }
1182 
1183 //------------------------------fill_buffer------------------------------------
1184 void Compile::fill_buffer(CodeBuffer* cb, uint* blk_starts) {
1185   // blk_starts[] contains offsets calculated during short branches processing,
1186   // offsets should not be increased during following steps.
1187 
1188   // Compute the size of first NumberOfLoopInstrToAlign instructions at head


1473         }
1474 #endif
1475         else if (!n->is_Proj()) {
1476           // Remember the beginning of the previous instruction, in case
1477           // it's followed by a flag-kill and a null-check.  Happens on
1478           // Intel all the time, with add-to-memory kind of opcodes.
1479           previous_offset = current_offset;
1480         }
1481 
1482         // Not an else-if!
1483         // If this is a trap based cmp then add its offset to the list.
1484         if (mach->is_TrapBasedCheckNode()) {
1485           inct_starts[inct_cnt++] = current_offset;
1486         }
1487       }
1488 
1489       // Verify that there is sufficient space remaining
1490       cb->insts()->maybe_expand_to_ensure_remaining(MAX_inst_size);
1491       if ((cb->blob() == NULL) || (!CompileBroker::should_compile_new_jobs())) {
1492         C->record_failure("CodeCache is full");

1493         return;
1494       }
1495 
1496       // Save the offset for the listing
1497 #ifndef PRODUCT
1498       if (node_offsets && n->_idx < node_offset_limit)
1499         node_offsets[n->_idx] = cb->insts_size();
1500 #endif
1501 
1502       // "Normal" instruction case
1503       DEBUG_ONLY( uint instr_offset = cb->insts_size(); )
1504       n->emit(*cb, _regalloc);
1505       current_offset  = cb->insts_size();
1506 
1507 #ifdef ASSERT
1508       if (n->size(_regalloc) < (current_offset-instr_offset)) {
1509         n->dump();
1510         assert(false, "wrong size of mach node");
1511       }
1512 #endif


1629 
1630   // Only java methods have exception handlers and deopt handlers
1631   // class HandlerImpl is platform-specific and defined in the *.ad files.
1632   if (_method) {
1633     // Emit the exception handler code.
1634     _code_offsets.set_value(CodeOffsets::Exceptions, HandlerImpl::emit_exception_handler(*cb));
1635     // Emit the deopt handler code.
1636     _code_offsets.set_value(CodeOffsets::Deopt, HandlerImpl::emit_deopt_handler(*cb));
1637 
1638     // Emit the MethodHandle deopt handler code (if required).
1639     if (has_method_handle_invokes()) {
1640       // We can use the same code as for the normal deopt handler, we
1641       // just need a different entry point address.
1642       _code_offsets.set_value(CodeOffsets::DeoptMH, HandlerImpl::emit_deopt_handler(*cb));
1643     }
1644   }
1645 
1646   // One last check for failed CodeBuffer::expand:
1647   if ((cb->blob() == NULL) || (!CompileBroker::should_compile_new_jobs())) {
1648     C->record_failure("CodeCache is full");

1649     return;
1650   }
1651 
1652 #ifndef PRODUCT
1653   // Dump the assembly code, including basic-block numbers
1654   if (print_assembly()) {
1655     ttyLocker ttyl;  // keep the following output all in one block
1656     if (!VMThread::should_terminate()) {  // test this under the tty lock
1657       // This output goes directly to the tty, not the compiler log.
1658       // To enable tools to match it up with the compilation activity,
1659       // be sure to tag this tty output with the compile ID.
1660       if (xtty != NULL) {
1661         xtty->head("opto_assembly compile_id='%d'%s", compile_id(),
1662                    is_osr_compilation()    ? " compile_kind='osr'" :
1663                    "");
1664       }
1665       if (method() != NULL) {
1666         method()->print_metadata();
1667       }
1668       dump_asm(node_offsets, node_offset_limit);


src/share/vm/opto/output.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File