737 assert(entry.rspec().type() == relocInfo::runtime_call_type |
737 assert(entry.rspec().type() == relocInfo::runtime_call_type |
738 || entry.rspec().type() == relocInfo::opt_virtual_call_type |
738 || entry.rspec().type() == relocInfo::opt_virtual_call_type |
739 || entry.rspec().type() == relocInfo::static_call_type |
739 || entry.rspec().type() == relocInfo::static_call_type |
740 || entry.rspec().type() == relocInfo::virtual_call_type, "wrong reloc type"); |
740 || entry.rspec().type() == relocInfo::virtual_call_type, "wrong reloc type"); |
741 |
741 |
742 unsigned int start_offset = offset(); |
742 // We need a trampoline if branches are far. |
743 if (far_branches() && !Compile::current()->in_scratch_emit_size()) { |
743 if (far_branches()) { |
744 address stub = emit_trampoline_stub(start_offset, entry.target()); |
744 // We don't want to emit a trampoline if C2 is generating dummy |
745 if (stub == NULL) { |
745 // code during its branch shortening phase. |
746 return NULL; // CodeCache is full |
746 CompileTask* task = ciEnv::current()->task(); |
|
747 bool in_scratch_emit_size = |
|
748 (task != NULL && is_c2_compile(task->comp_level()) && |
|
749 Compile::current()->in_scratch_emit_size()); |
|
750 if (!in_scratch_emit_size) { |
|
751 address stub = emit_trampoline_stub(offset(), entry.target()); |
|
752 if (stub == NULL) { |
|
753 return NULL; // CodeCache is full |
|
754 } |
747 } |
755 } |
748 } |
756 } |
749 |
757 |
750 if (cbuf) cbuf->set_insts_mark(); |
758 if (cbuf) cbuf->set_insts_mark(); |
751 relocate(entry.rspec()); |
759 relocate(entry.rspec()); |