49 } |
49 } |
50 |
50 |
51 // ---------------------------------------------------------------------------- |
51 // ---------------------------------------------------------------------------- |
52 |
52 |
53 #define __ _masm. |
53 #define __ _masm. |
54 void CompiledStaticCall::emit_to_interp_stub(CodeBuffer &cbuf) { |
54 address CompiledStaticCall::emit_to_interp_stub(CodeBuffer &cbuf) { |
55 // Stub is fixed up when the corresponding call is converted from |
55 // Stub is fixed up when the corresponding call is converted from |
56 // calling compiled code to calling interpreted code. |
56 // calling compiled code to calling interpreted code. |
57 // mov rmethod, 0 |
57 // mov rmethod, 0 |
58 // jmp -4 # to self |
58 // jmp -4 # to self |
59 |
59 |
61 |
61 |
62 // Note that the code buffer's insts_mark is always relative to insts. |
62 // Note that the code buffer's insts_mark is always relative to insts. |
63 // That's why we must use the macroassembler to generate a stub. |
63 // That's why we must use the macroassembler to generate a stub. |
64 MacroAssembler _masm(&cbuf); |
64 MacroAssembler _masm(&cbuf); |
65 |
65 |
66 address base = __ start_a_stub(to_interp_stub_size()*2); |
66 address base = __ start_a_stub(to_interp_stub_size()); |
67 |
|
68 int offset = __ offset(); |
67 int offset = __ offset(); |
69 if (base == NULL) return; // CodeBuffer::expand failed |
68 if (base == NULL) { |
|
69 return NULL; // CodeBuffer::expand failed |
|
70 } |
70 // static stub relocation stores the instruction address of the call |
71 // static stub relocation stores the instruction address of the call |
71 __ relocate(static_stub_Relocation::spec(mark)); |
72 __ relocate(static_stub_Relocation::spec(mark)); |
72 // static stub relocation also tags the Method* in the code-stream. |
73 // static stub relocation also tags the Method* in the code-stream. |
73 __ mov_metadata(rmethod, (Metadata*)NULL); |
74 __ mov_metadata(rmethod, (Metadata*)NULL); |
74 __ movptr(rscratch1, 0); |
75 __ movptr(rscratch1, 0); |
75 __ br(rscratch1); |
76 __ br(rscratch1); |
76 |
77 |
77 assert((__ offset() - offset) <= (int)to_interp_stub_size(), "stub too big"); |
78 assert((__ offset() - offset) <= (int)to_interp_stub_size(), "stub too big"); |
78 __ end_a_stub(); |
79 __ end_a_stub(); |
|
80 return base; |
79 } |
81 } |
80 #undef __ |
82 #undef __ |
81 |
83 |
82 int CompiledStaticCall::to_interp_stub_size() { |
84 int CompiledStaticCall::to_interp_stub_size() { |
83 return 7 * NativeInstruction::instruction_size; |
85 return 7 * NativeInstruction::instruction_size; |