1 /*
2 * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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 *
107 __ cmp_and_br_short(temp, ref_kind, Assembler::equal, Assembler::pt, L);
108 { char* buf = NEW_C_HEAP_ARRAY(char, 100, mtInternal);
109 jio_snprintf(buf, 100, "verify_ref_kind expected %x", ref_kind);
110 if (ref_kind == JVM_REF_invokeVirtual ||
111 ref_kind == JVM_REF_invokeSpecial)
112 // could do this for all ref_kinds, but would explode assembly code size
113 trace_method_handle(_masm, buf);
114 __ STOP(buf);
115 }
116 BLOCK_COMMENT("} verify_ref_kind");
117 __ bind(L);
118 }
119
120 #endif // ASSERT
121
122 void MethodHandles::jump_from_method_handle(MacroAssembler* _masm, Register method, Register target, Register temp,
123 bool for_compiler_entry) {
124 assert(method == G5_method, "interpreter calling convention");
125 assert_different_registers(method, target, temp);
126
127 if (!for_compiler_entry && JvmtiExport::can_post_interpreter_events()) {
128 Label run_compiled_code;
129 // JVMTI events, such as single-stepping, are implemented partly by avoiding running
130 // compiled code in threads for which the event is enabled. Check here for
131 // interp_only_mode if these events CAN be enabled.
132 __ verify_thread();
133 const Address interp_only(G2_thread, JavaThread::interp_only_mode_offset());
134 __ ld(interp_only, temp);
135 __ cmp_and_br_short(temp, 0, Assembler::zero, Assembler::pt, run_compiled_code);
136 __ ld_ptr(G5_method, in_bytes(Method::interpreter_entry_offset()), target);
137 __ jmp(target, 0);
138 __ delayed()->nop();
139 __ BIND(run_compiled_code);
140 // Note: we could fill some delay slots here, but
141 // it doesn't matter, since this is interpreter code.
142 }
143
144 const ByteSize entry_offset = for_compiler_entry ? Method::from_compiled_offset() :
145 Method::from_interpreted_offset();
146 __ ld_ptr(G5_method, in_bytes(entry_offset), target);
|
1 /*
2 * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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 *
107 __ cmp_and_br_short(temp, ref_kind, Assembler::equal, Assembler::pt, L);
108 { char* buf = NEW_C_HEAP_ARRAY(char, 100, mtInternal);
109 jio_snprintf(buf, 100, "verify_ref_kind expected %x", ref_kind);
110 if (ref_kind == JVM_REF_invokeVirtual ||
111 ref_kind == JVM_REF_invokeSpecial)
112 // could do this for all ref_kinds, but would explode assembly code size
113 trace_method_handle(_masm, buf);
114 __ STOP(buf);
115 }
116 BLOCK_COMMENT("} verify_ref_kind");
117 __ bind(L);
118 }
119
120 #endif // ASSERT
121
122 void MethodHandles::jump_from_method_handle(MacroAssembler* _masm, Register method, Register target, Register temp,
123 bool for_compiler_entry) {
124 assert(method == G5_method, "interpreter calling convention");
125 assert_different_registers(method, target, temp);
126
127 {
128 Label ok;
129 __ br_notnull_short(G5_method, Assembler::pt, ok);
130 AddressLiteral icce(StubRoutines::throw_AbstractMethodError_entry());
131 __ jump_to(icce, temp);
132 __ delayed()->nop();
133
134
135 __ should_not_reach_here();
136 __ bind(ok);
137 }
138
139 if (!for_compiler_entry && JvmtiExport::can_post_interpreter_events()) {
140 Label run_compiled_code;
141 // JVMTI events, such as single-stepping, are implemented partly by avoiding running
142 // compiled code in threads for which the event is enabled. Check here for
143 // interp_only_mode if these events CAN be enabled.
144 __ verify_thread();
145 const Address interp_only(G2_thread, JavaThread::interp_only_mode_offset());
146 __ ld(interp_only, temp);
147 __ cmp_and_br_short(temp, 0, Assembler::zero, Assembler::pt, run_compiled_code);
148 __ ld_ptr(G5_method, in_bytes(Method::interpreter_entry_offset()), target);
149 __ jmp(target, 0);
150 __ delayed()->nop();
151 __ BIND(run_compiled_code);
152 // Note: we could fill some delay slots here, but
153 // it doesn't matter, since this is interpreter code.
154 }
155
156 const ByteSize entry_offset = for_compiler_entry ? Method::from_compiled_offset() :
157 Method::from_interpreted_offset();
158 __ ld_ptr(G5_method, in_bytes(entry_offset), target);
|