16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "asm/macroAssembler.inline.hpp"
27 #include "code/compiledIC.hpp"
28 #include "code/icBuffer.hpp"
29 #include "code/nativeInst.hpp"
30 #include "code/nmethod.hpp"
31 #include "memory/resourceArea.hpp"
32 #include "runtime/mutexLocker.hpp"
33 #include "runtime/safepoint.hpp"
34
35 // ----------------------------------------------------------------------------
36 #if defined(COMPILER2) || INCLUDE_JVMCI
37 #define __ _masm.
38 // emit call stub, compiled java to interpreter
39 address CompiledStaticCall::emit_to_interp_stub(CodeBuffer &cbuf, address mark) {
40 // Stub is fixed up when the corresponding call is converted from calling
41 // compiled code to calling interpreted code.
42 // set (empty), R9
43 // b -1
44
45 if (mark == NULL) {
46 mark = cbuf.insts_mark(); // get mark within main instrs section
47 }
48
49 MacroAssembler _masm(&cbuf);
50
51 address base = __ start_a_stub(to_interp_stub_size());
52 if (base == NULL) {
53 return NULL; // CodeBuffer::expand failed
54 }
55
56 // static stub relocation stores the instruction address of the call
72 // Can't trash LR, FP, or argument registers
73 __ indirect_jump(dest, Rtemp);
74 }
75 __ bind_literal(object_literal); // includes spec_for_immediate reloc
76 if (!near_range) {
77 __ bind_literal(dest); // special NativeJump -1 destination
78 }
79
80 assert(__ pc() - base <= to_interp_stub_size(), "wrong stub size");
81
82 // Update current stubs pointer and restore code_end.
83 __ end_a_stub();
84 return base;
85 }
86 #undef __
87
88 // Relocation entries for call stub, compiled java to interpreter.
89 int CompiledStaticCall::reloc_to_interp_stub() {
90 return 10; // 4 in emit_to_interp_stub + 1 in Java_Static_Call
91 }
92 #endif // COMPILER2 || JVMCI
93
94 // size of C2 call stub, compiled java to interpretor
95 int CompiledStaticCall::to_interp_stub_size() {
96 return 8 * NativeInstruction::instruction_size;
97 }
98
99 void CompiledDirectStaticCall::set_to_interpreted(const methodHandle& callee, address entry) {
100 address stub = find_stub(/*is_aot*/ false);
101 guarantee(stub != NULL, "stub not found");
102
103 if (TraceICs) {
104 ResourceMark rm;
105 tty->print_cr("CompiledDirectStaticCall@" INTPTR_FORMAT ": set_to_interpreted %s",
106 p2i(instruction_address()),
107 callee->name_and_sig_as_C_string());
108 }
109
110 // Creation also verifies the object.
111 NativeMovConstReg* method_holder = nativeMovConstReg_at(stub);
112 NativeJump* jump = nativeJump_at(method_holder->next_instruction_address());
|
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "asm/macroAssembler.inline.hpp"
27 #include "code/compiledIC.hpp"
28 #include "code/icBuffer.hpp"
29 #include "code/nativeInst.hpp"
30 #include "code/nmethod.hpp"
31 #include "memory/resourceArea.hpp"
32 #include "runtime/mutexLocker.hpp"
33 #include "runtime/safepoint.hpp"
34
35 // ----------------------------------------------------------------------------
36 #if COMPILER2_OR_JVMCI
37 #define __ _masm.
38 // emit call stub, compiled java to interpreter
39 address CompiledStaticCall::emit_to_interp_stub(CodeBuffer &cbuf, address mark) {
40 // Stub is fixed up when the corresponding call is converted from calling
41 // compiled code to calling interpreted code.
42 // set (empty), R9
43 // b -1
44
45 if (mark == NULL) {
46 mark = cbuf.insts_mark(); // get mark within main instrs section
47 }
48
49 MacroAssembler _masm(&cbuf);
50
51 address base = __ start_a_stub(to_interp_stub_size());
52 if (base == NULL) {
53 return NULL; // CodeBuffer::expand failed
54 }
55
56 // static stub relocation stores the instruction address of the call
72 // Can't trash LR, FP, or argument registers
73 __ indirect_jump(dest, Rtemp);
74 }
75 __ bind_literal(object_literal); // includes spec_for_immediate reloc
76 if (!near_range) {
77 __ bind_literal(dest); // special NativeJump -1 destination
78 }
79
80 assert(__ pc() - base <= to_interp_stub_size(), "wrong stub size");
81
82 // Update current stubs pointer and restore code_end.
83 __ end_a_stub();
84 return base;
85 }
86 #undef __
87
88 // Relocation entries for call stub, compiled java to interpreter.
89 int CompiledStaticCall::reloc_to_interp_stub() {
90 return 10; // 4 in emit_to_interp_stub + 1 in Java_Static_Call
91 }
92 #endif // COMPILER2_OR_JVMCI
93
94 // size of C2 call stub, compiled java to interpretor
95 int CompiledStaticCall::to_interp_stub_size() {
96 return 8 * NativeInstruction::instruction_size;
97 }
98
99 void CompiledDirectStaticCall::set_to_interpreted(const methodHandle& callee, address entry) {
100 address stub = find_stub(/*is_aot*/ false);
101 guarantee(stub != NULL, "stub not found");
102
103 if (TraceICs) {
104 ResourceMark rm;
105 tty->print_cr("CompiledDirectStaticCall@" INTPTR_FORMAT ": set_to_interpreted %s",
106 p2i(instruction_address()),
107 callee->name_and_sig_as_C_string());
108 }
109
110 // Creation also verifies the object.
111 NativeMovConstReg* method_holder = nativeMovConstReg_at(stub);
112 NativeJump* jump = nativeJump_at(method_holder->next_instruction_address());
|