5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
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 "asm/macroAssembler.hpp"
26 #include "classfile/javaClasses.hpp"
27 #include "classfile/vmIntrinsics.hpp"
28 #include "compiler/oopMap.hpp"
29 #include "gc/shared/barrierSet.hpp"
30 #include "gc/shared/barrierSetAssembler.hpp"
31 #include "gc/shared/barrierSetNMethod.hpp"
32 #include "gc/shared/gc_globals.hpp"
33 #include "memory/universe.hpp"
34 #include "prims/jvmtiExport.hpp"
35 #include "prims/upcallLinker.hpp"
36 #include "runtime/arguments.hpp"
37 #include "runtime/continuationEntry.hpp"
38 #include "runtime/javaThread.hpp"
39 #include "runtime/sharedRuntime.hpp"
40 #include "runtime/stubRoutines.hpp"
41 #include "stubGenerator_x86_64.hpp"
42 #ifdef COMPILER2
43 #include "opto/runtime.hpp"
44 #include "opto/c2_globals.hpp"
45 #endif
46 #if INCLUDE_JVMCI
47 #include "jvmci/jvmci_globals.hpp"
48 #endif
49
50 // For a more detailed description of the stub routine structure
51 // see the comment in stubRoutines.hpp
52
53 #define __ _masm->
54 #define TIMES_OOP (UseCompressedOops ? Address::times_4 : Address::times_8)
55
56 #ifdef PRODUCT
57 #define BLOCK_COMMENT(str) /* nothing */
58 #else
59 #define BLOCK_COMMENT(str) __ block_comment(str)
60 #endif // PRODUCT
284 __ BIND(loop);
285 __ movptr(rax, Address(c_rarg2, 0));// get parameter
286 __ addptr(c_rarg2, wordSize); // advance to next parameter
287 __ decrementl(c_rarg1); // decrement counter
288 __ push(rax); // pass parameter
289 __ jcc(Assembler::notZero, loop);
290
291 // call Java function
292 __ BIND(parameters_done);
293 __ movptr(rbx, method); // get Method*
294 __ movptr(c_rarg1, entry_point); // get entry_point
295 __ mov(r13, rsp); // set sender sp
296 BLOCK_COMMENT("call Java function");
297 __ call(c_rarg1);
298
299 BLOCK_COMMENT("call_stub_return_address:");
300 return_address = __ pc();
301
302 // store result depending on type (everything that is not
303 // T_OBJECT, T_LONG, T_FLOAT or T_DOUBLE is treated as T_INT)
304 __ movptr(c_rarg0, result);
305 Label is_long, is_float, is_double, exit;
306 __ movl(c_rarg1, result_type);
307 __ cmpl(c_rarg1, T_OBJECT);
308 __ jcc(Assembler::equal, is_long);
309 __ cmpl(c_rarg1, T_LONG);
310 __ jcc(Assembler::equal, is_long);
311 __ cmpl(c_rarg1, T_FLOAT);
312 __ jcc(Assembler::equal, is_float);
313 __ cmpl(c_rarg1, T_DOUBLE);
314 __ jcc(Assembler::equal, is_double);
315 #ifdef ASSERT
316 // make sure the type is INT
317 {
318 Label L;
319 __ cmpl(c_rarg1, T_INT);
320 __ jcc(Assembler::equal, L);
321 __ stop("StubRoutines::call_stub: unexpected result type");
322 __ bind(L);
323 }
324 #endif
325
326 // handle T_INT case
327 __ movl(Address(c_rarg0, 0), rax);
328
329 __ BIND(exit);
330
331 // pop parameters
332 __ lea(rsp, rsp_after_call);
333
334 #ifdef ASSERT
335 // verify that threads correspond
336 {
337 Label L1, L2, L3;
338 __ cmpptr(r15_thread, thread);
339 __ jcc(Assembler::equal, L1);
340 __ stop("StubRoutines::call_stub: r15_thread is corrupted");
341 __ bind(L1);
342 __ get_thread(rbx);
343 __ cmpptr(r15_thread, thread);
344 __ jcc(Assembler::equal, L2);
345 __ stop("StubRoutines::call_stub: r15_thread is modified by call");
346 __ bind(L2);
347 __ cmpptr(r15_thread, rbx);
365 __ movptr(r13, r13_save);
366 __ movptr(r12, r12_save);
367 __ movptr(rbx, rbx_save);
368
369 #ifdef _WIN64
370 __ movptr(rdi, rdi_save);
371 __ movptr(rsi, rsi_save);
372 #else
373 __ ldmxcsr(mxcsr_save);
374 #endif
375
376 // restore rsp
377 __ addptr(rsp, -rsp_after_call_off * wordSize);
378
379 // return
380 __ vzeroupper();
381 __ pop(rbp);
382 __ ret(0);
383
384 // handle return types different from T_INT
385 __ BIND(is_long);
386 __ movq(Address(c_rarg0, 0), rax);
387 __ jmp(exit);
388
389 __ BIND(is_float);
390 __ movflt(Address(c_rarg0, 0), xmm0);
391 __ jmp(exit);
392
393 __ BIND(is_double);
394 __ movdbl(Address(c_rarg0, 0), xmm0);
395 __ jmp(exit);
396
397 return start;
398 }
399
400 // Return point for a Java call if there's an exception thrown in
401 // Java code. The exception is caught and transformed into a
402 // pending exception stored in JavaThread that can be tested from
403 // within the VM.
404 //
405 // Note: Usually the parameters are removed by the callee. In case
406 // of an exception crossing an activation frame boundary, that is
407 // not the case if the callee is compiled code => need to setup the
408 // rsp.
409 //
410 // rax: exception oop
411
412 address StubGenerator::generate_catch_exception() {
413 StubGenStubId stub_id = StubGenStubId::catch_exception_id;
414 StubCodeMark mark(this, stub_id);
4048 // Initialization
4049 void StubGenerator::generate_initial_stubs() {
4050 // Generates all stubs and initializes the entry points
4051
4052 // This platform-specific settings are needed by generate_call_stub()
4053 create_control_words();
4054
4055 // Initialize table for unsafe copy memeory check.
4056 if (UnsafeMemoryAccess::_table == nullptr) {
4057 UnsafeMemoryAccess::create_table(16 + 4); // 16 for copyMemory; 4 for setMemory
4058 }
4059
4060 // entry points that exist in all platforms Note: This is code
4061 // that could be shared among different platforms - however the
4062 // benefit seems to be smaller than the disadvantage of having a
4063 // much more complicated generator structure. See also comment in
4064 // stubRoutines.hpp.
4065
4066 StubRoutines::_forward_exception_entry = generate_forward_exception();
4067
4068 StubRoutines::_call_stub_entry =
4069 generate_call_stub(StubRoutines::_call_stub_return_address);
4070
4071 // is referenced by megamorphic call
4072 StubRoutines::_catch_exception_entry = generate_catch_exception();
4073
4074 // atomic calls
4075 StubRoutines::_fence_entry = generate_orderaccess_fence();
4076
4077 // platform dependent
4078 StubRoutines::x86::_get_previous_sp_entry = generate_get_previous_sp();
4079
4080 StubRoutines::x86::_verify_mxcsr_entry = generate_verify_mxcsr();
4081
4082 StubRoutines::x86::_f2i_fixup = generate_f2i_fixup();
4083 StubRoutines::x86::_f2l_fixup = generate_f2l_fixup();
4084 StubRoutines::x86::_d2i_fixup = generate_d2i_fixup();
4085 StubRoutines::x86::_d2l_fixup = generate_d2l_fixup();
4086
4087 StubRoutines::x86::_float_sign_mask = generate_fp_mask(StubGenStubId::float_sign_mask_id, 0x7FFFFFFF7FFFFFFF);
4100 StubRoutines::x86::generate_CRC32C_table(supports_clmul);
4101 StubRoutines::_crc32c_table_addr = (address)StubRoutines::x86::_crc32c_table;
4102 StubRoutines::_updateBytesCRC32C = generate_updateBytesCRC32C(supports_clmul);
4103 }
4104
4105 if (VM_Version::supports_float16()) {
4106 // For results consistency both intrinsics should be enabled.
4107 // vmIntrinsics checks InlineIntrinsics flag, no need to check it here.
4108 if (vmIntrinsics::is_intrinsic_available(vmIntrinsics::_float16ToFloat) &&
4109 vmIntrinsics::is_intrinsic_available(vmIntrinsics::_floatToFloat16)) {
4110 StubRoutines::_hf2f = generate_float16ToFloat();
4111 StubRoutines::_f2hf = generate_floatToFloat16();
4112 }
4113 }
4114
4115 generate_libm_stubs();
4116
4117 StubRoutines::_fmod = generate_libmFmod(); // from stubGenerator_x86_64_fmod.cpp
4118 }
4119
4120 void StubGenerator::generate_continuation_stubs() {
4121 // Continuation stubs:
4122 StubRoutines::_cont_thaw = generate_cont_thaw();
4123 StubRoutines::_cont_returnBarrier = generate_cont_returnBarrier();
4124 StubRoutines::_cont_returnBarrierExc = generate_cont_returnBarrier_exception();
4125 StubRoutines::_cont_preempt_stub = generate_cont_preempt_stub();
4126 }
4127
4128 void StubGenerator::generate_final_stubs() {
4129 // Generates the rest of stubs and initializes the entry points
4130
4131 // support for verify_oop (must happen after universe_init)
4132 if (VerifyOops) {
4133 StubRoutines::_verify_oop_subroutine_entry = generate_verify_oop();
4134 }
4135
4136 // arraycopy stubs used by compilers
4137 generate_arraycopy_stubs();
4138
4139 BarrierSetNMethod* bs_nm = BarrierSet::barrier_set()->barrier_set_nmethod();
|
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
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 "asm/assembler.hpp"
26 #include "asm/macroAssembler.hpp"
27 #include "classfile/javaClasses.hpp"
28 #include "classfile/vmIntrinsics.hpp"
29 #include "compiler/oopMap.hpp"
30 #include "gc/shared/barrierSet.hpp"
31 #include "gc/shared/barrierSetAssembler.hpp"
32 #include "gc/shared/barrierSetNMethod.hpp"
33 #include "gc/shared/gc_globals.hpp"
34 #include "memory/universe.hpp"
35 #include "prims/jvmtiExport.hpp"
36 #include "prims/upcallLinker.hpp"
37 #include "runtime/arguments.hpp"
38 #include "runtime/continuationEntry.hpp"
39 #include "runtime/javaThread.hpp"
40 #include "runtime/sharedRuntime.hpp"
41 #include "runtime/stubRoutines.hpp"
42 #include "utilities/macros.hpp"
43 #include "vmreg_x86.inline.hpp"
44 #include "stubGenerator_x86_64.hpp"
45 #ifdef COMPILER2
46 #include "opto/runtime.hpp"
47 #include "opto/c2_globals.hpp"
48 #endif
49 #if INCLUDE_JVMCI
50 #include "jvmci/jvmci_globals.hpp"
51 #endif
52
53 // For a more detailed description of the stub routine structure
54 // see the comment in stubRoutines.hpp
55
56 #define __ _masm->
57 #define TIMES_OOP (UseCompressedOops ? Address::times_4 : Address::times_8)
58
59 #ifdef PRODUCT
60 #define BLOCK_COMMENT(str) /* nothing */
61 #else
62 #define BLOCK_COMMENT(str) __ block_comment(str)
63 #endif // PRODUCT
287 __ BIND(loop);
288 __ movptr(rax, Address(c_rarg2, 0));// get parameter
289 __ addptr(c_rarg2, wordSize); // advance to next parameter
290 __ decrementl(c_rarg1); // decrement counter
291 __ push(rax); // pass parameter
292 __ jcc(Assembler::notZero, loop);
293
294 // call Java function
295 __ BIND(parameters_done);
296 __ movptr(rbx, method); // get Method*
297 __ movptr(c_rarg1, entry_point); // get entry_point
298 __ mov(r13, rsp); // set sender sp
299 BLOCK_COMMENT("call Java function");
300 __ call(c_rarg1);
301
302 BLOCK_COMMENT("call_stub_return_address:");
303 return_address = __ pc();
304
305 // store result depending on type (everything that is not
306 // T_OBJECT, T_LONG, T_FLOAT or T_DOUBLE is treated as T_INT)
307 __ movptr(r13, result);
308 Label is_long, is_float, is_double, check_prim, exit;
309 __ movl(rbx, result_type);
310 __ cmpl(rbx, T_OBJECT);
311 __ jcc(Assembler::equal, check_prim);
312 __ cmpl(rbx, T_LONG);
313 __ jcc(Assembler::equal, is_long);
314 __ cmpl(rbx, T_FLOAT);
315 __ jcc(Assembler::equal, is_float);
316 __ cmpl(rbx, T_DOUBLE);
317 __ jcc(Assembler::equal, is_double);
318 #ifdef ASSERT
319 // make sure the type is INT
320 {
321 Label L;
322 __ cmpl(rbx, T_INT);
323 __ jcc(Assembler::equal, L);
324 __ stop("StubRoutines::call_stub: unexpected result type");
325 __ bind(L);
326 }
327 #endif
328
329 // handle T_INT case
330 __ movl(Address(r13, 0), rax);
331
332 __ BIND(exit);
333
334 // pop parameters
335 __ lea(rsp, rsp_after_call);
336
337 #ifdef ASSERT
338 // verify that threads correspond
339 {
340 Label L1, L2, L3;
341 __ cmpptr(r15_thread, thread);
342 __ jcc(Assembler::equal, L1);
343 __ stop("StubRoutines::call_stub: r15_thread is corrupted");
344 __ bind(L1);
345 __ get_thread(rbx);
346 __ cmpptr(r15_thread, thread);
347 __ jcc(Assembler::equal, L2);
348 __ stop("StubRoutines::call_stub: r15_thread is modified by call");
349 __ bind(L2);
350 __ cmpptr(r15_thread, rbx);
368 __ movptr(r13, r13_save);
369 __ movptr(r12, r12_save);
370 __ movptr(rbx, rbx_save);
371
372 #ifdef _WIN64
373 __ movptr(rdi, rdi_save);
374 __ movptr(rsi, rsi_save);
375 #else
376 __ ldmxcsr(mxcsr_save);
377 #endif
378
379 // restore rsp
380 __ addptr(rsp, -rsp_after_call_off * wordSize);
381
382 // return
383 __ vzeroupper();
384 __ pop(rbp);
385 __ ret(0);
386
387 // handle return types different from T_INT
388 __ BIND(check_prim);
389 if (InlineTypeReturnedAsFields) {
390 // Check for scalarized return value
391 __ testptr(rax, 1);
392 __ jcc(Assembler::zero, is_long);
393 // Load pack handler address
394 __ andptr(rax, -2);
395 __ movptr(rax, Address(rax, InstanceKlass::adr_inlineklass_fixed_block_offset()));
396 __ movptr(rbx, Address(rax, InlineKlass::pack_handler_jobject_offset()));
397 // Call pack handler to initialize the buffer
398 __ call(rbx);
399 __ jmp(exit);
400 }
401 __ BIND(is_long);
402 __ movq(Address(r13, 0), rax);
403 __ jmp(exit);
404
405 __ BIND(is_float);
406 __ movflt(Address(r13, 0), xmm0);
407 __ jmp(exit);
408
409 __ BIND(is_double);
410 __ movdbl(Address(r13, 0), xmm0);
411 __ jmp(exit);
412
413 return start;
414 }
415
416 // Return point for a Java call if there's an exception thrown in
417 // Java code. The exception is caught and transformed into a
418 // pending exception stored in JavaThread that can be tested from
419 // within the VM.
420 //
421 // Note: Usually the parameters are removed by the callee. In case
422 // of an exception crossing an activation frame boundary, that is
423 // not the case if the callee is compiled code => need to setup the
424 // rsp.
425 //
426 // rax: exception oop
427
428 address StubGenerator::generate_catch_exception() {
429 StubGenStubId stub_id = StubGenStubId::catch_exception_id;
430 StubCodeMark mark(this, stub_id);
4064 // Initialization
4065 void StubGenerator::generate_initial_stubs() {
4066 // Generates all stubs and initializes the entry points
4067
4068 // This platform-specific settings are needed by generate_call_stub()
4069 create_control_words();
4070
4071 // Initialize table for unsafe copy memeory check.
4072 if (UnsafeMemoryAccess::_table == nullptr) {
4073 UnsafeMemoryAccess::create_table(16 + 4); // 16 for copyMemory; 4 for setMemory
4074 }
4075
4076 // entry points that exist in all platforms Note: This is code
4077 // that could be shared among different platforms - however the
4078 // benefit seems to be smaller than the disadvantage of having a
4079 // much more complicated generator structure. See also comment in
4080 // stubRoutines.hpp.
4081
4082 StubRoutines::_forward_exception_entry = generate_forward_exception();
4083
4084 // Generate these first because they are called from other stubs
4085 if (InlineTypeReturnedAsFields) {
4086 StubRoutines::_load_inline_type_fields_in_regs =
4087 generate_return_value_stub(CAST_FROM_FN_PTR(address, SharedRuntime::load_inline_type_fields_in_regs),
4088 "load_inline_type_fields_in_regs", false);
4089 StubRoutines::_store_inline_type_fields_to_buf =
4090 generate_return_value_stub(CAST_FROM_FN_PTR(address, SharedRuntime::store_inline_type_fields_to_buf),
4091 "store_inline_type_fields_to_buf", true);
4092 }
4093
4094 StubRoutines::_call_stub_entry =
4095 generate_call_stub(StubRoutines::_call_stub_return_address);
4096
4097 // is referenced by megamorphic call
4098 StubRoutines::_catch_exception_entry = generate_catch_exception();
4099
4100 // atomic calls
4101 StubRoutines::_fence_entry = generate_orderaccess_fence();
4102
4103 // platform dependent
4104 StubRoutines::x86::_get_previous_sp_entry = generate_get_previous_sp();
4105
4106 StubRoutines::x86::_verify_mxcsr_entry = generate_verify_mxcsr();
4107
4108 StubRoutines::x86::_f2i_fixup = generate_f2i_fixup();
4109 StubRoutines::x86::_f2l_fixup = generate_f2l_fixup();
4110 StubRoutines::x86::_d2i_fixup = generate_d2i_fixup();
4111 StubRoutines::x86::_d2l_fixup = generate_d2l_fixup();
4112
4113 StubRoutines::x86::_float_sign_mask = generate_fp_mask(StubGenStubId::float_sign_mask_id, 0x7FFFFFFF7FFFFFFF);
4126 StubRoutines::x86::generate_CRC32C_table(supports_clmul);
4127 StubRoutines::_crc32c_table_addr = (address)StubRoutines::x86::_crc32c_table;
4128 StubRoutines::_updateBytesCRC32C = generate_updateBytesCRC32C(supports_clmul);
4129 }
4130
4131 if (VM_Version::supports_float16()) {
4132 // For results consistency both intrinsics should be enabled.
4133 // vmIntrinsics checks InlineIntrinsics flag, no need to check it here.
4134 if (vmIntrinsics::is_intrinsic_available(vmIntrinsics::_float16ToFloat) &&
4135 vmIntrinsics::is_intrinsic_available(vmIntrinsics::_floatToFloat16)) {
4136 StubRoutines::_hf2f = generate_float16ToFloat();
4137 StubRoutines::_f2hf = generate_floatToFloat16();
4138 }
4139 }
4140
4141 generate_libm_stubs();
4142
4143 StubRoutines::_fmod = generate_libmFmod(); // from stubGenerator_x86_64_fmod.cpp
4144 }
4145
4146 // Call here from the interpreter or compiled code to either load
4147 // multiple returned values from the inline type instance being
4148 // returned to registers or to store returned values to a newly
4149 // allocated inline type instance.
4150 // Register is a class, but it would be assigned numerical value.
4151 // "0" is assigned for xmm0. Thus we need to ignore -Wnonnull.
4152 PRAGMA_DIAG_PUSH
4153 PRAGMA_NONNULL_IGNORED
4154 address StubGenerator::generate_return_value_stub(address destination, const char* name, bool has_res) {
4155 // We need to save all registers the calling convention may use so
4156 // the runtime calls read or update those registers. This needs to
4157 // be in sync with SharedRuntime::java_return_convention().
4158 enum layout {
4159 pad_off = frame::arg_reg_save_area_bytes/BytesPerInt, pad_off_2,
4160 rax_off, rax_off_2,
4161 j_rarg5_off, j_rarg5_2,
4162 j_rarg4_off, j_rarg4_2,
4163 j_rarg3_off, j_rarg3_2,
4164 j_rarg2_off, j_rarg2_2,
4165 j_rarg1_off, j_rarg1_2,
4166 j_rarg0_off, j_rarg0_2,
4167 j_farg0_off, j_farg0_2,
4168 j_farg1_off, j_farg1_2,
4169 j_farg2_off, j_farg2_2,
4170 j_farg3_off, j_farg3_2,
4171 j_farg4_off, j_farg4_2,
4172 j_farg5_off, j_farg5_2,
4173 j_farg6_off, j_farg6_2,
4174 j_farg7_off, j_farg7_2,
4175 rbp_off, rbp_off_2,
4176 return_off, return_off_2,
4177
4178 framesize
4179 };
4180
4181 CodeBuffer buffer(name, 1000, 512);
4182 MacroAssembler* _masm = new MacroAssembler(&buffer);
4183
4184 int frame_size_in_bytes = align_up(framesize*BytesPerInt, 16);
4185 assert(frame_size_in_bytes == framesize*BytesPerInt, "misaligned");
4186 int frame_size_in_slots = frame_size_in_bytes / BytesPerInt;
4187 int frame_size_in_words = frame_size_in_bytes / wordSize;
4188
4189 OopMapSet *oop_maps = new OopMapSet();
4190 OopMap* map = new OopMap(frame_size_in_slots, 0);
4191
4192 map->set_callee_saved(VMRegImpl::stack2reg(rax_off), rax->as_VMReg());
4193 map->set_callee_saved(VMRegImpl::stack2reg(j_rarg5_off), j_rarg5->as_VMReg());
4194 map->set_callee_saved(VMRegImpl::stack2reg(j_rarg4_off), j_rarg4->as_VMReg());
4195 map->set_callee_saved(VMRegImpl::stack2reg(j_rarg3_off), j_rarg3->as_VMReg());
4196 map->set_callee_saved(VMRegImpl::stack2reg(j_rarg2_off), j_rarg2->as_VMReg());
4197 map->set_callee_saved(VMRegImpl::stack2reg(j_rarg1_off), j_rarg1->as_VMReg());
4198 map->set_callee_saved(VMRegImpl::stack2reg(j_rarg0_off), j_rarg0->as_VMReg());
4199 map->set_callee_saved(VMRegImpl::stack2reg(j_farg0_off), j_farg0->as_VMReg());
4200 map->set_callee_saved(VMRegImpl::stack2reg(j_farg1_off), j_farg1->as_VMReg());
4201 map->set_callee_saved(VMRegImpl::stack2reg(j_farg2_off), j_farg2->as_VMReg());
4202 map->set_callee_saved(VMRegImpl::stack2reg(j_farg3_off), j_farg3->as_VMReg());
4203 map->set_callee_saved(VMRegImpl::stack2reg(j_farg4_off), j_farg4->as_VMReg());
4204 map->set_callee_saved(VMRegImpl::stack2reg(j_farg5_off), j_farg5->as_VMReg());
4205 map->set_callee_saved(VMRegImpl::stack2reg(j_farg6_off), j_farg6->as_VMReg());
4206 map->set_callee_saved(VMRegImpl::stack2reg(j_farg7_off), j_farg7->as_VMReg());
4207
4208 int start = __ offset();
4209
4210 __ subptr(rsp, frame_size_in_bytes - 8 /* return address*/);
4211
4212 __ movptr(Address(rsp, rbp_off * BytesPerInt), rbp);
4213 __ movdbl(Address(rsp, j_farg7_off * BytesPerInt), j_farg7);
4214 __ movdbl(Address(rsp, j_farg6_off * BytesPerInt), j_farg6);
4215 __ movdbl(Address(rsp, j_farg5_off * BytesPerInt), j_farg5);
4216 __ movdbl(Address(rsp, j_farg4_off * BytesPerInt), j_farg4);
4217 __ movdbl(Address(rsp, j_farg3_off * BytesPerInt), j_farg3);
4218 __ movdbl(Address(rsp, j_farg2_off * BytesPerInt), j_farg2);
4219 __ movdbl(Address(rsp, j_farg1_off * BytesPerInt), j_farg1);
4220 __ movdbl(Address(rsp, j_farg0_off * BytesPerInt), j_farg0);
4221
4222 __ movptr(Address(rsp, j_rarg0_off * BytesPerInt), j_rarg0);
4223 __ movptr(Address(rsp, j_rarg1_off * BytesPerInt), j_rarg1);
4224 __ movptr(Address(rsp, j_rarg2_off * BytesPerInt), j_rarg2);
4225 __ movptr(Address(rsp, j_rarg3_off * BytesPerInt), j_rarg3);
4226 __ movptr(Address(rsp, j_rarg4_off * BytesPerInt), j_rarg4);
4227 __ movptr(Address(rsp, j_rarg5_off * BytesPerInt), j_rarg5);
4228 __ movptr(Address(rsp, rax_off * BytesPerInt), rax);
4229
4230 int frame_complete = __ offset();
4231
4232 __ set_last_Java_frame(noreg, noreg, nullptr, rscratch1);
4233
4234 __ mov(c_rarg0, r15_thread);
4235 __ mov(c_rarg1, rax);
4236
4237 __ call(RuntimeAddress(destination));
4238
4239 // Set an oopmap for the call site.
4240
4241 oop_maps->add_gc_map( __ offset() - start, map);
4242
4243 // clear last_Java_sp
4244 __ reset_last_Java_frame(false);
4245
4246 __ movptr(rbp, Address(rsp, rbp_off * BytesPerInt));
4247 __ movdbl(j_farg7, Address(rsp, j_farg7_off * BytesPerInt));
4248 __ movdbl(j_farg6, Address(rsp, j_farg6_off * BytesPerInt));
4249 __ movdbl(j_farg5, Address(rsp, j_farg5_off * BytesPerInt));
4250 __ movdbl(j_farg4, Address(rsp, j_farg4_off * BytesPerInt));
4251 __ movdbl(j_farg3, Address(rsp, j_farg3_off * BytesPerInt));
4252 __ movdbl(j_farg2, Address(rsp, j_farg2_off * BytesPerInt));
4253 __ movdbl(j_farg1, Address(rsp, j_farg1_off * BytesPerInt));
4254 __ movdbl(j_farg0, Address(rsp, j_farg0_off * BytesPerInt));
4255
4256 __ movptr(j_rarg0, Address(rsp, j_rarg0_off * BytesPerInt));
4257 __ movptr(j_rarg1, Address(rsp, j_rarg1_off * BytesPerInt));
4258 __ movptr(j_rarg2, Address(rsp, j_rarg2_off * BytesPerInt));
4259 __ movptr(j_rarg3, Address(rsp, j_rarg3_off * BytesPerInt));
4260 __ movptr(j_rarg4, Address(rsp, j_rarg4_off * BytesPerInt));
4261 __ movptr(j_rarg5, Address(rsp, j_rarg5_off * BytesPerInt));
4262 __ movptr(rax, Address(rsp, rax_off * BytesPerInt));
4263
4264 __ addptr(rsp, frame_size_in_bytes-8);
4265
4266 // check for pending exceptions
4267 Label pending;
4268 __ cmpptr(Address(r15_thread, Thread::pending_exception_offset()), (int32_t)NULL_WORD);
4269 __ jcc(Assembler::notEqual, pending);
4270
4271 if (has_res) {
4272 __ get_vm_result(rax, r15_thread);
4273 }
4274
4275 __ ret(0);
4276
4277 __ bind(pending);
4278
4279 __ movptr(rax, Address(r15_thread, Thread::pending_exception_offset()));
4280 __ jump(RuntimeAddress(StubRoutines::forward_exception_entry()));
4281
4282 // -------------
4283 // make sure all code is generated
4284 _masm->flush();
4285
4286 RuntimeStub* stub = RuntimeStub::new_runtime_stub(name, &buffer, frame_complete, frame_size_in_words, oop_maps, false);
4287 return stub->entry_point();
4288 }
4289
4290 void StubGenerator::generate_continuation_stubs() {
4291 // Continuation stubs:
4292 StubRoutines::_cont_thaw = generate_cont_thaw();
4293 StubRoutines::_cont_returnBarrier = generate_cont_returnBarrier();
4294 StubRoutines::_cont_returnBarrierExc = generate_cont_returnBarrier_exception();
4295 StubRoutines::_cont_preempt_stub = generate_cont_preempt_stub();
4296 }
4297
4298 void StubGenerator::generate_final_stubs() {
4299 // Generates the rest of stubs and initializes the entry points
4300
4301 // support for verify_oop (must happen after universe_init)
4302 if (VerifyOops) {
4303 StubRoutines::_verify_oop_subroutine_entry = generate_verify_oop();
4304 }
4305
4306 // arraycopy stubs used by compilers
4307 generate_arraycopy_stubs();
4308
4309 BarrierSetNMethod* bs_nm = BarrierSet::barrier_set()->barrier_set_nmethod();
|