8006952: Slow VM due to excessive code cache freelist iteration

Remove continous free block requirement

Reviewed-by: kvn
This commit is contained in:
Nils Eliasson 2013-04-11 13:57:44 +02:00
parent 33e3f6b59b
commit 92ef5fe748
8 changed files with 123 additions and 154 deletions

View file

@ -501,18 +501,17 @@ nmethod* nmethod::new_native_nmethod(methodHandle method,
{
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
int native_nmethod_size = allocation_size(code_buffer, sizeof(nmethod));
if (CodeCache::has_space(native_nmethod_size)) {
CodeOffsets offsets;
offsets.set_value(CodeOffsets::Verified_Entry, vep_offset);
offsets.set_value(CodeOffsets::Frame_Complete, frame_complete);
nm = new (native_nmethod_size) nmethod(method(), native_nmethod_size,
compile_id, &offsets,
code_buffer, frame_size,
basic_lock_owner_sp_offset,
basic_lock_sp_offset, oop_maps);
NOT_PRODUCT(if (nm != NULL) nmethod_stats.note_native_nmethod(nm));
if (PrintAssembly && nm != NULL)
Disassembler::decode(nm);
CodeOffsets offsets;
offsets.set_value(CodeOffsets::Verified_Entry, vep_offset);
offsets.set_value(CodeOffsets::Frame_Complete, frame_complete);
nm = new (native_nmethod_size) nmethod(method(), native_nmethod_size,
compile_id, &offsets,
code_buffer, frame_size,
basic_lock_owner_sp_offset,
basic_lock_sp_offset, oop_maps);
NOT_PRODUCT(if (nm != NULL) nmethod_stats.note_native_nmethod(nm));
if (PrintAssembly && nm != NULL) {
Disassembler::decode(nm);
}
}
// verify nmethod
@ -538,18 +537,17 @@ nmethod* nmethod::new_dtrace_nmethod(methodHandle method,
{
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
int nmethod_size = allocation_size(code_buffer, sizeof(nmethod));
if (CodeCache::has_space(nmethod_size)) {
CodeOffsets offsets;
offsets.set_value(CodeOffsets::Verified_Entry, vep_offset);
offsets.set_value(CodeOffsets::Dtrace_trap, trap_offset);
offsets.set_value(CodeOffsets::Frame_Complete, frame_complete);
CodeOffsets offsets;
offsets.set_value(CodeOffsets::Verified_Entry, vep_offset);
offsets.set_value(CodeOffsets::Dtrace_trap, trap_offset);
offsets.set_value(CodeOffsets::Frame_Complete, frame_complete);
nm = new (nmethod_size) nmethod(method(), nmethod_size,
&offsets, code_buffer, frame_size);
nm = new (nmethod_size) nmethod(method(), nmethod_size,
&offsets, code_buffer, frame_size);
NOT_PRODUCT(if (nm != NULL) nmethod_stats.note_nmethod(nm));
if (PrintAssembly && nm != NULL)
Disassembler::decode(nm);
NOT_PRODUCT(if (nm != NULL) nmethod_stats.note_nmethod(nm));
if (PrintAssembly && nm != NULL) {
Disassembler::decode(nm);
}
}
// verify nmethod
@ -591,16 +589,16 @@ nmethod* nmethod::new_nmethod(methodHandle method,
+ round_to(handler_table->size_in_bytes(), oopSize)
+ round_to(nul_chk_table->size_in_bytes(), oopSize)
+ round_to(debug_info->data_size() , oopSize);
if (CodeCache::has_space(nmethod_size)) {
nm = new (nmethod_size)
nmethod(method(), nmethod_size, compile_id, entry_bci, offsets,
orig_pc_offset, debug_info, dependencies, code_buffer, frame_size,
oop_maps,
handler_table,
nul_chk_table,
compiler,
comp_level);
}
nm = new (nmethod_size)
nmethod(method(), nmethod_size, compile_id, entry_bci, offsets,
orig_pc_offset, debug_info, dependencies, code_buffer, frame_size,
oop_maps,
handler_table,
nul_chk_table,
compiler,
comp_level);
if (nm != NULL) {
// To make dependency checking during class loading fast, record
// the nmethod dependencies in the classes it is dependent on.
@ -612,15 +610,18 @@ nmethod* nmethod::new_nmethod(methodHandle method,
// classes the slow way is too slow.
for (Dependencies::DepStream deps(nm); deps.next(); ) {
Klass* klass = deps.context_type();
if (klass == NULL) continue; // ignore things like evol_method
if (klass == NULL) {
continue; // ignore things like evol_method
}
// record this nmethod as dependent on this klass
InstanceKlass::cast(klass)->add_dependent_nmethod(nm);
}
}
NOT_PRODUCT(if (nm != NULL) nmethod_stats.note_nmethod(nm));
if (PrintAssembly && nm != NULL)
if (PrintAssembly && nm != NULL) {
Disassembler::decode(nm);
}
}
// verify nmethod
@ -798,13 +799,11 @@ nmethod::nmethod(
}
#endif // def HAVE_DTRACE_H
void* nmethod::operator new(size_t size, int nmethod_size) {
void* alloc = CodeCache::allocate(nmethod_size);
guarantee(alloc != NULL, "CodeCache should have enough space");
return alloc;
void* nmethod::operator new(size_t size, int nmethod_size) throw () {
// Not critical, may return null if there is too little continuous memory
return CodeCache::allocate(nmethod_size);
}
nmethod::nmethod(
Method* method,
int nmethod_size,