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 "prims/jvmtiExport.hpp"
35 #include "prims/jvmtiThreadState.hpp"
36 #include "runtime/basicLock.hpp"
37 #include "runtime/biasedLocking.hpp"
38 #include "runtime/sharedRuntime.hpp"
39 #include "runtime/thread.inline.hpp"
40
41 // Implementation of InterpreterMacroAssembler
42
43 void InterpreterMacroAssembler::jump_to_entry(address entry) {
44 assert(entry, "Entry must have been generated by now");
45 jump(RuntimeAddress(entry));
46 }
47
48 void InterpreterMacroAssembler::profile_obj_type(Register obj, const Address& mdo_addr) {
49 Label update, next, none;
1059
1060 bind(loop);
1061 // check if current entry is used
1062 cmpptr(Address(rmon, BasicObjectLock::obj_offset_in_bytes()), (int32_t) NULL);
1063 jcc(Assembler::notEqual, exception);
1064
1065 addptr(rmon, entry_size); // otherwise advance to next entry
1066 bind(entry);
1067 cmpptr(rmon, rbx); // check if bottom reached
1068 jcc(Assembler::notEqual, loop); // if not at bottom then check this entry
1069 }
1070
1071 bind(no_unlock);
1072
1073 // jvmti support
1074 if (notify_jvmdi) {
1075 notify_method_exit(state, NotifyJVMTI); // preserve TOSCA
1076 } else {
1077 notify_method_exit(state, SkipNotifyJVMTI); // preserve TOSCA
1078 }
1079
1080 // remove activation
1081 // get sender sp
1082 movptr(rbx,
1083 Address(rbp, frame::interpreter_frame_sender_sp_offset * wordSize));
1084 if (StackReservedPages > 0) {
1085 // testing if reserved zone needs to be re-enabled
1086 Register rthread = LP64_ONLY(r15_thread) NOT_LP64(rcx);
1087 Label no_reserved_zone_enabling;
1088
1089 NOT_LP64(get_thread(rthread);)
1090
1091 cmpl(Address(rthread, JavaThread::stack_guard_state_offset()), JavaThread::stack_guard_enabled);
1092 jcc(Assembler::equal, no_reserved_zone_enabling);
1093
1094 cmpptr(rbx, Address(rthread, JavaThread::reserved_stack_activation_offset()));
1095 jcc(Assembler::lessEqual, no_reserved_zone_enabling);
1096
1097 call_VM_leaf(
1098 CAST_FROM_FN_PTR(address, SharedRuntime::enable_stack_reserved_zone), rthread);
|
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 "prims/jvmtiExport.hpp"
36 #include "prims/jvmtiThreadState.hpp"
37 #include "runtime/basicLock.hpp"
38 #include "runtime/biasedLocking.hpp"
39 #include "runtime/sharedRuntime.hpp"
40 #include "runtime/thread.inline.hpp"
41
42 // Implementation of InterpreterMacroAssembler
43
44 void InterpreterMacroAssembler::jump_to_entry(address entry) {
45 assert(entry, "Entry must have been generated by now");
46 jump(RuntimeAddress(entry));
47 }
48
49 void InterpreterMacroAssembler::profile_obj_type(Register obj, const Address& mdo_addr) {
50 Label update, next, none;
1060
1061 bind(loop);
1062 // check if current entry is used
1063 cmpptr(Address(rmon, BasicObjectLock::obj_offset_in_bytes()), (int32_t) NULL);
1064 jcc(Assembler::notEqual, exception);
1065
1066 addptr(rmon, entry_size); // otherwise advance to next entry
1067 bind(entry);
1068 cmpptr(rmon, rbx); // check if bottom reached
1069 jcc(Assembler::notEqual, loop); // if not at bottom then check this entry
1070 }
1071
1072 bind(no_unlock);
1073
1074 // jvmti support
1075 if (notify_jvmdi) {
1076 notify_method_exit(state, NotifyJVMTI); // preserve TOSCA
1077 } else {
1078 notify_method_exit(state, SkipNotifyJVMTI); // preserve TOSCA
1079 }
1080
1081 Label vtbuffer_slow, vtbuffer_done;
1082 const Register thread1 = NOT_LP64(rcx) LP64_ONLY(r15_thread);
1083 const uintptr_t chunk_mask = VTBufferChunk::chunk_mask();
1084 movptr(rbx, Address(rbp, frame::interpreter_frame_vt_alloc_ptr_offset * wordSize));
1085 NOT_LP64(get_thread(thread1));
1086 movptr(rcx, Address(thread1, JavaThread::vt_alloc_ptr_offset()));
1087 cmpptr(rbx, rcx);
1088 jcc(Assembler::equal, vtbuffer_done);
1089 andptr(rbx, chunk_mask);
1090 andptr(rcx, chunk_mask);
1091 cmpptr(rbx, rcx);
1092 jcc(Assembler::notEqual, vtbuffer_slow);
1093 movptr(rbx, Address(rbp, frame::interpreter_frame_vt_alloc_ptr_offset * wordSize));
1094 movptr(Address(thread1, JavaThread::vt_alloc_ptr_offset()), rbx);
1095 jmp(vtbuffer_done);
1096 bind(vtbuffer_slow);
1097 push(state);
1098 call_VM(noreg, CAST_FROM_FN_PTR(address,
1099 InterpreterRuntime::recycle_vtbuffer));
1100 pop(state);
1101 bind(vtbuffer_done);
1102
1103 // remove activation
1104 // get sender sp
1105 movptr(rbx,
1106 Address(rbp, frame::interpreter_frame_sender_sp_offset * wordSize));
1107 if (StackReservedPages > 0) {
1108 // testing if reserved zone needs to be re-enabled
1109 Register rthread = LP64_ONLY(r15_thread) NOT_LP64(rcx);
1110 Label no_reserved_zone_enabling;
1111
1112 NOT_LP64(get_thread(rthread);)
1113
1114 cmpl(Address(rthread, JavaThread::stack_guard_state_offset()), JavaThread::stack_guard_enabled);
1115 jcc(Assembler::equal, no_reserved_zone_enabling);
1116
1117 cmpptr(rbx, Address(rthread, JavaThread::reserved_stack_activation_offset()));
1118 jcc(Assembler::lessEqual, no_reserved_zone_enabling);
1119
1120 call_VM_leaf(
1121 CAST_FROM_FN_PTR(address, SharedRuntime::enable_stack_reserved_zone), rthread);
|