hotspot/src/share/vm/opto/output.cpp
changeset 17016 78b1c3670525
parent 16625 85b229ed3f41
child 17095 24f63661bb5e
equal deleted inserted replaced
17015:92390f57e8b1 17016:78b1c3670525
  1042 
  1042 
  1043   // Mark the end of the scope set.
  1043   // Mark the end of the scope set.
  1044   debug_info->end_non_safepoint(pc_offset);
  1044   debug_info->end_non_safepoint(pc_offset);
  1045 }
  1045 }
  1046 
  1046 
  1047 
       
  1048 
       
  1049 // helper for fill_buffer bailout logic
       
  1050 static void turn_off_compiler(Compile* C) {
       
  1051   if (CodeCache::largest_free_block() >= CodeCacheMinimumFreeSpace*10) {
       
  1052     // Do not turn off compilation if a single giant method has
       
  1053     // blown the code cache size.
       
  1054     C->record_failure("excessive request to CodeCache");
       
  1055   } else {
       
  1056     // Let CompilerBroker disable further compilations.
       
  1057     C->record_failure("CodeCache is full");
       
  1058   }
       
  1059 }
       
  1060 
       
  1061 
       
  1062 //------------------------------init_buffer------------------------------------
  1047 //------------------------------init_buffer------------------------------------
  1063 CodeBuffer* Compile::init_buffer(uint* blk_starts) {
  1048 CodeBuffer* Compile::init_buffer(uint* blk_starts) {
  1064 
  1049 
  1065   // Set the initially allocated size
  1050   // Set the initially allocated size
  1066   int  code_req   = initial_code_capacity;
  1051   int  code_req   = initial_code_capacity;
  1156   CodeBuffer* cb = code_buffer();
  1141   CodeBuffer* cb = code_buffer();
  1157   cb->initialize(total_req, locs_req);
  1142   cb->initialize(total_req, locs_req);
  1158 
  1143 
  1159   // Have we run out of code space?
  1144   // Have we run out of code space?
  1160   if ((cb->blob() == NULL) || (!CompileBroker::should_compile_new_jobs())) {
  1145   if ((cb->blob() == NULL) || (!CompileBroker::should_compile_new_jobs())) {
  1161     turn_off_compiler(this);
  1146     C->record_failure("CodeCache is full");
  1162     return NULL;
  1147     return NULL;
  1163   }
  1148   }
  1164   // Configure the code buffer.
  1149   // Configure the code buffer.
  1165   cb->initialize_consts_size(const_req);
  1150   cb->initialize_consts_size(const_req);
  1166   cb->initialize_stubs_size(stub_req);
  1151   cb->initialize_stubs_size(stub_req);
  1474       }
  1459       }
  1475 
  1460 
  1476       // Verify that there is sufficient space remaining
  1461       // Verify that there is sufficient space remaining
  1477       cb->insts()->maybe_expand_to_ensure_remaining(MAX_inst_size);
  1462       cb->insts()->maybe_expand_to_ensure_remaining(MAX_inst_size);
  1478       if ((cb->blob() == NULL) || (!CompileBroker::should_compile_new_jobs())) {
  1463       if ((cb->blob() == NULL) || (!CompileBroker::should_compile_new_jobs())) {
  1479         turn_off_compiler(this);
  1464         C->record_failure("CodeCache is full");
  1480         return;
  1465         return;
  1481       }
  1466       }
  1482 
  1467 
  1483       // Save the offset for the listing
  1468       // Save the offset for the listing
  1484 #ifndef PRODUCT
  1469 #ifndef PRODUCT
  1631     }
  1616     }
  1632   }
  1617   }
  1633 
  1618 
  1634   // One last check for failed CodeBuffer::expand:
  1619   // One last check for failed CodeBuffer::expand:
  1635   if ((cb->blob() == NULL) || (!CompileBroker::should_compile_new_jobs())) {
  1620   if ((cb->blob() == NULL) || (!CompileBroker::should_compile_new_jobs())) {
  1636     turn_off_compiler(this);
  1621     C->record_failure("CodeCache is full");
  1637     return;
  1622     return;
  1638   }
  1623   }
  1639 
  1624 
  1640 #ifndef PRODUCT
  1625 #ifndef PRODUCT
  1641   // Dump the assembly code, including basic-block numbers
  1626   // Dump the assembly code, including basic-block numbers