668 assert(entry.rspec().type() == relocInfo::runtime_call_type
669 || entry.rspec().type() == relocInfo::opt_virtual_call_type
670 || entry.rspec().type() == relocInfo::static_call_type
671 || entry.rspec().type() == relocInfo::virtual_call_type, "wrong reloc type");
672
673 unsigned int start_offset = offset();
674 if (far_branches() && !Compile::current()->in_scratch_emit_size()) {
675 address stub = emit_trampoline_stub(start_offset, entry.target());
676 if (stub == NULL) {
677 return NULL; // CodeCache is full
678 }
679 }
680
681 if (cbuf) cbuf->set_insts_mark();
682 relocate(entry.rspec());
683 if (Assembler::reachable_from_branch_at(pc(), entry.target())) {
684 bl(entry.target());
685 } else {
686 bl(pc());
687 }
688 return start_offset;
689 }
690
691
692 // Emit a trampoline stub for a call to a target which is too far away.
693 //
694 // code sequences:
695 //
696 // call-site:
697 // branch-and-link to <destination> or <trampoline stub>
698 //
699 // Related trampoline stub for this call site in the stub section:
700 // load the call target from the constant pool
701 // branch (LR still points to the call site above)
702
703 address MacroAssembler::emit_trampoline_stub(int insts_call_instruction_offset,
704 address dest) {
705 address stub = start_a_stub(Compile::MAX_stubs_size/2);
706 if (stub == NULL) {
707 return NULL; // CodeBuffer::expand failed
708 }
|
668 assert(entry.rspec().type() == relocInfo::runtime_call_type
669 || entry.rspec().type() == relocInfo::opt_virtual_call_type
670 || entry.rspec().type() == relocInfo::static_call_type
671 || entry.rspec().type() == relocInfo::virtual_call_type, "wrong reloc type");
672
673 unsigned int start_offset = offset();
674 if (far_branches() && !Compile::current()->in_scratch_emit_size()) {
675 address stub = emit_trampoline_stub(start_offset, entry.target());
676 if (stub == NULL) {
677 return NULL; // CodeCache is full
678 }
679 }
680
681 if (cbuf) cbuf->set_insts_mark();
682 relocate(entry.rspec());
683 if (Assembler::reachable_from_branch_at(pc(), entry.target())) {
684 bl(entry.target());
685 } else {
686 bl(pc());
687 }
688 // just need to return a non-null address
689 return pc();
690 }
691
692
693 // Emit a trampoline stub for a call to a target which is too far away.
694 //
695 // code sequences:
696 //
697 // call-site:
698 // branch-and-link to <destination> or <trampoline stub>
699 //
700 // Related trampoline stub for this call site in the stub section:
701 // load the call target from the constant pool
702 // branch (LR still points to the call site above)
703
704 address MacroAssembler::emit_trampoline_stub(int insts_call_instruction_offset,
705 address dest) {
706 address stub = start_a_stub(Compile::MAX_stubs_size/2);
707 if (stub == NULL) {
708 return NULL; // CodeBuffer::expand failed
709 }
|