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 1513 non_safepoints.observe_instruction(n, current_offset); 1514 1515 // mcall is last "call" that can be a safepoint 1516 // record it so we can see if a poll will directly follow it 1517 // in which case we'll need a pad to make the PcDesc sites unique 1518 // see 5010568. This can be slightly inaccurate but conservative 1519 // in the case that return address is not actually at current_offset. 1520 // This is a small price to pay. 1521 1522 if (is_mcall) { 1523 last_call_offset = current_offset; 1524 } 1525 1526 if (n->is_Mach() && n->as_Mach()->avoid_back_to_back(MachNode::AVOID_AFTER)) { | 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 // Above we only verified that there is enough space in the instruction section. 1508 // However, the instruction may emit stubs that cause code buffer expansion. 1509 // Bail out here if expansion failed due to lack of code cache space. 1510 if (cb->blob() == NULL) { 1511 C->record_failure("CodeCache is full"); 1512 return; 1513 } 1514 1515 #ifdef ASSERT 1516 if (n->size(_regalloc) < (current_offset-instr_offset)) { 1517 n->dump(); 1518 assert(false, "wrong size of mach node"); 1519 } 1520 #endif 1521 non_safepoints.observe_instruction(n, current_offset); 1522 1523 // mcall is last "call" that can be a safepoint 1524 // record it so we can see if a poll will directly follow it 1525 // in which case we'll need a pad to make the PcDesc sites unique 1526 // see 5010568. This can be slightly inaccurate but conservative 1527 // in the case that return address is not actually at current_offset. 1528 // This is a small price to pay. 1529 1530 if (is_mcall) { 1531 last_call_offset = current_offset; 1532 } 1533 1534 if (n->is_Mach() && n->as_Mach()->avoid_back_to_back(MachNode::AVOID_AFTER)) { |