159 __ call_VM(rax,
160 CAST_FROM_FN_PTR(address, InterpreterRuntime::create_exception),
161 c_rarg1, c_rarg2);
162 }
163 // throw exception
164 __ jump(ExternalAddress(Interpreter::throw_exception_entry()));
165 return entry;
166 }
167
168
169 address TemplateInterpreterGenerator::generate_continuation_for(TosState state) {
170 address entry = __ pc();
171 // NULL last_sp until next java call
172 __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD);
173 __ dispatch_next(state);
174 return entry;
175 }
176
177
178 address TemplateInterpreterGenerator::generate_return_entry_for(TosState state,
179 int step) {
180
181 // amd64 doesn't need to do anything special about compiled returns
182 // to the interpreter so the code that exists on x86 to place a sentinel
183 // here and the specialized cleanup code is not needed here.
184
185 address entry = __ pc();
186
187 // Restore stack bottom in case i2c adjusted stack
188 __ movptr(rsp, Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize));
189 // and NULL it as marker that esp is now tos until next java call
190 __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD);
191
192 __ restore_bcp();
193 __ restore_locals();
194 __ get_cache_and_index_at_bcp(rbx, rcx, 1);
195 __ movl(rbx, Address(rbx, rcx,
196 Address::times_8,
197 in_bytes(constantPoolCacheOopDesc::base_offset()) +
198 3 * wordSize));
199 __ andl(rbx, 0xFF);
200 if (TaggedStackInterpreter) __ shll(rbx, 1); // 2 slots per parameter.
201 __ lea(rsp, Address(rsp, rbx, Address::times_8));
202 __ dispatch_next(state, step);
203 return entry;
204 }
205
206
207 address TemplateInterpreterGenerator::generate_deopt_entry_for(TosState state,
208 int step) {
209 address entry = __ pc();
210 // NULL last_sp until next java call
211 __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD);
212 __ restore_bcp();
213 __ restore_locals();
214 // handle exceptions
215 {
216 Label L;
217 __ cmpptr(Address(r15_thread, Thread::pending_exception_offset()), (int32_t) NULL_WORD);
218 __ jcc(Assembler::zero, L);
219 __ call_VM(noreg,
220 CAST_FROM_FN_PTR(address,
221 InterpreterRuntime::throw_pending_exception));
222 __ should_not_reach_here();
|
159 __ call_VM(rax,
160 CAST_FROM_FN_PTR(address, InterpreterRuntime::create_exception),
161 c_rarg1, c_rarg2);
162 }
163 // throw exception
164 __ jump(ExternalAddress(Interpreter::throw_exception_entry()));
165 return entry;
166 }
167
168
169 address TemplateInterpreterGenerator::generate_continuation_for(TosState state) {
170 address entry = __ pc();
171 // NULL last_sp until next java call
172 __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD);
173 __ dispatch_next(state);
174 return entry;
175 }
176
177
178 address TemplateInterpreterGenerator::generate_return_entry_for(TosState state,
179 int step,
180 bool unbox) {
181 TosState incoming_state = state;
182 if (InvokeDynamic) {
183 if (unbox) {
184 incoming_state = atos;
185 }
186 Unimplemented();
187 } else {
188 assert(!unbox, "old behavior");
189 }
190
191 // amd64 doesn't need to do anything special about compiled returns
192 // to the interpreter so the code that exists on x86 to place a sentinel
193 // here and the specialized cleanup code is not needed here.
194
195 address entry = __ pc();
196
197 // Restore stack bottom in case i2c adjusted stack
198 __ movptr(rsp, Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize));
199 // and NULL it as marker that esp is now tos until next java call
200 __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD);
201
202 __ restore_bcp();
203 __ restore_locals();
204
205 Label L_got_cache, L_giant_index;
206 if (InvokeDynamic) {
207 __ cmpb(Address(r13, 0), Bytecodes::_invokedynamic);
208 __ jcc(Assembler::equal, L_giant_index);
209 }
210 __ get_cache_and_index_at_bcp(rbx, rcx, 1, false);
211 __ bind(L_got_cache);
212 __ movl(rbx, Address(rbx, rcx,
213 Address::times_8,
214 in_bytes(constantPoolCacheOopDesc::base_offset()) +
215 3 * wordSize));
216 __ andl(rbx, 0xFF);
217 if (TaggedStackInterpreter) __ shll(rbx, 1); // 2 slots per parameter.
218 __ lea(rsp, Address(rsp, rbx, Address::times_8));
219 __ dispatch_next(state, step);
220
221 if (InvokeDynamic) {
222 __ get_cache_and_index_at_bcp(rbx, rcx, 1, true);
223 __ jmp(L_got_cache);
224 }
225
226 return entry;
227 }
228
229
230 address TemplateInterpreterGenerator::generate_deopt_entry_for(TosState state,
231 int step) {
232 address entry = __ pc();
233 // NULL last_sp until next java call
234 __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD);
235 __ restore_bcp();
236 __ restore_locals();
237 // handle exceptions
238 {
239 Label L;
240 __ cmpptr(Address(r15_thread, Thread::pending_exception_offset()), (int32_t) NULL_WORD);
241 __ jcc(Assembler::zero, L);
242 __ call_VM(noreg,
243 CAST_FROM_FN_PTR(address,
244 InterpreterRuntime::throw_pending_exception));
245 __ should_not_reach_here();
|