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 "precompiled.hpp"
26 #include "interp_masm_x86.hpp"
27 #include "interpreter/interpreter.hpp"
28 #include "interpreter/interpreterRuntime.hpp"
29 #include "logging/log.hpp"
30 #include "memory/vtBuffer.hpp"
31 #include "oops/arrayOop.hpp"
32 #include "oops/markOop.hpp"
33 #include "oops/methodData.hpp"
34 #include "oops/method.hpp"
35 #include "oops/valueKlass.hpp"
36 #include "prims/jvmtiExport.hpp"
37 #include "prims/jvmtiThreadState.hpp"
38 #include "runtime/basicLock.hpp"
39 #include "runtime/biasedLocking.hpp"
40 #include "runtime/frame.inline.hpp"
41 #include "runtime/safepointMechanism.hpp"
42 #include "runtime/sharedRuntime.hpp"
43 #include "runtime/thread.inline.hpp"
44
45 // Implementation of InterpreterMacroAssembler
46
47 void InterpreterMacroAssembler::jump_to_entry(address entry) {
48 assert(entry, "Entry must have been generated by now");
49 jump(RuntimeAddress(entry));
50 }
1107 Register rthread = LP64_ONLY(r15_thread) NOT_LP64(rcx);
1108 Label no_reserved_zone_enabling;
1109
1110 NOT_LP64(get_thread(rthread);)
1111
1112 cmpl(Address(rthread, JavaThread::stack_guard_state_offset()), JavaThread::stack_guard_enabled);
1113 jcc(Assembler::equal, no_reserved_zone_enabling);
1114
1115 cmpptr(rbx, Address(rthread, JavaThread::reserved_stack_activation_offset()));
1116 jcc(Assembler::lessEqual, no_reserved_zone_enabling);
1117
1118 call_VM_leaf(
1119 CAST_FROM_FN_PTR(address, SharedRuntime::enable_stack_reserved_zone), rthread);
1120 call_VM(noreg, CAST_FROM_FN_PTR(address,
1121 InterpreterRuntime::throw_delayed_StackOverflowError));
1122 should_not_reach_here();
1123
1124 bind(no_reserved_zone_enabling);
1125 }
1126
1127 if (ValueTypesBufferMaxMemory > 0) {
1128 // Code below is taking care of recycling TLVB memory, no safepoint should
1129 // occur between this point and the end of the remove_activation() method
1130 Label vtbuffer_slow, vtbuffer_done, no_buffered_value_returned;
1131 const Register thread1 = NOT_LP64(rcx) LP64_ONLY(r15_thread);
1132 const uintptr_t chunk_mask = VTBufferChunk::chunk_mask();
1133 NOT_LP64(get_thread(thread1));
1134 cmpptr(Address(thread1, JavaThread::return_buffered_value_offset()), (intptr_t)NULL_WORD);
1135 jcc(Assembler::equal, no_buffered_value_returned);
1136 movptr(rbx, Address(rbp, frame::interpreter_frame_vt_alloc_ptr_offset * wordSize));
1137 call_VM_leaf(CAST_FROM_FN_PTR(address,
1138 InterpreterRuntime::return_value_step2), rax, rbx);
1139 NOT_LP64(get_thread(thread1));
1140 get_vm_result(rax, thread1);
1141 jmp(vtbuffer_done);
1142 bind(no_buffered_value_returned);
1143 movptr(rbx, Address(rbp, frame::interpreter_frame_vt_alloc_ptr_offset * wordSize));
1144 NOT_LP64(get_thread(thread1));
1145 movptr(rcx, Address(thread1, JavaThread::vt_alloc_ptr_offset()));
1146 cmpptr(rbx, rcx);
1147 jcc(Assembler::equal, vtbuffer_done);
1148 andptr(rbx, chunk_mask);
1149 andptr(rcx, chunk_mask);
1150 cmpptr(rbx, rcx);
1151 jcc(Assembler::notEqual, vtbuffer_slow);
1152 movptr(rbx, Address(rbp, frame::interpreter_frame_vt_alloc_ptr_offset * wordSize));
1153 movptr(Address(thread1, JavaThread::vt_alloc_ptr_offset()), rbx);
1154 jmp(vtbuffer_done);
1155 bind(vtbuffer_slow);
1156 push(state);
1157 movptr(rbx, Address(rbp, frame::interpreter_frame_vt_alloc_ptr_offset * wordSize));
1158 call_VM_leaf(CAST_FROM_FN_PTR(address,
1159 InterpreterRuntime::recycle_vtbuffer), rbx);
1160 pop(state);
1161 bind(vtbuffer_done);
1162 }
1163
1164 // remove activation
1165 // get sender sp
1166 movptr(rbx,
1167 Address(rbp, frame::interpreter_frame_sender_sp_offset * wordSize));
1168
1169 if (load_values) {
1170 // We are returning a value type, load its fields into registers
1171 #ifndef _LP64
1172 super_call_VM_leaf(StubRoutines::load_value_type_fields_in_regs());
1173 #else
1174 load_klass(rdi, rax);
1175 movptr(rdi, Address(rdi, ValueKlass::unpack_handler_offset()));
1176
1177 Label skip;
1178 testptr(rdi, rdi);
1179 jcc(Assembler::equal, skip);
1180
1181 // Load fields from a buffered value with a value class specific
1182 // handler
1183 call(rdi);
|
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 "precompiled.hpp"
26 #include "interp_masm_x86.hpp"
27 #include "interpreter/interpreter.hpp"
28 #include "interpreter/interpreterRuntime.hpp"
29 #include "logging/log.hpp"
30 #include "oops/arrayOop.hpp"
31 #include "oops/markOop.hpp"
32 #include "oops/methodData.hpp"
33 #include "oops/method.hpp"
34 #include "oops/valueKlass.hpp"
35 #include "prims/jvmtiExport.hpp"
36 #include "prims/jvmtiThreadState.hpp"
37 #include "runtime/basicLock.hpp"
38 #include "runtime/biasedLocking.hpp"
39 #include "runtime/frame.inline.hpp"
40 #include "runtime/safepointMechanism.hpp"
41 #include "runtime/sharedRuntime.hpp"
42 #include "runtime/thread.inline.hpp"
43
44 // Implementation of InterpreterMacroAssembler
45
46 void InterpreterMacroAssembler::jump_to_entry(address entry) {
47 assert(entry, "Entry must have been generated by now");
48 jump(RuntimeAddress(entry));
49 }
1106 Register rthread = LP64_ONLY(r15_thread) NOT_LP64(rcx);
1107 Label no_reserved_zone_enabling;
1108
1109 NOT_LP64(get_thread(rthread);)
1110
1111 cmpl(Address(rthread, JavaThread::stack_guard_state_offset()), JavaThread::stack_guard_enabled);
1112 jcc(Assembler::equal, no_reserved_zone_enabling);
1113
1114 cmpptr(rbx, Address(rthread, JavaThread::reserved_stack_activation_offset()));
1115 jcc(Assembler::lessEqual, no_reserved_zone_enabling);
1116
1117 call_VM_leaf(
1118 CAST_FROM_FN_PTR(address, SharedRuntime::enable_stack_reserved_zone), rthread);
1119 call_VM(noreg, CAST_FROM_FN_PTR(address,
1120 InterpreterRuntime::throw_delayed_StackOverflowError));
1121 should_not_reach_here();
1122
1123 bind(no_reserved_zone_enabling);
1124 }
1125
1126 // remove activation
1127 // get sender sp
1128 movptr(rbx,
1129 Address(rbp, frame::interpreter_frame_sender_sp_offset * wordSize));
1130
1131 if (load_values) {
1132 // We are returning a value type, load its fields into registers
1133 #ifndef _LP64
1134 super_call_VM_leaf(StubRoutines::load_value_type_fields_in_regs());
1135 #else
1136 load_klass(rdi, rax);
1137 movptr(rdi, Address(rdi, ValueKlass::unpack_handler_offset()));
1138
1139 Label skip;
1140 testptr(rdi, rdi);
1141 jcc(Assembler::equal, skip);
1142
1143 // Load fields from a buffered value with a value class specific
1144 // handler
1145 call(rdi);
|