1 /*
2 * Copyright (c) 1997, 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 *
158 // Size of java_to_interp stub, this doesn't need to be accurate but it must
159 // be larger or equal to the real size of the stub.
160 // Used for optimization in Compile::Shorten_branches.
161 int CompiledStaticCall::to_interp_stub_size() {
162 return 12 * BytesPerInstWord;
163 }
164
165 // Relocation entries for call stub, compiled java to interpreter.
166 // Used for optimization in Compile::Shorten_branches.
167 int CompiledStaticCall::reloc_to_interp_stub() {
168 return 5;
169 }
170
171 void CompiledStaticCall::set_to_interpreted(methodHandle callee, address entry) {
172 address stub = find_stub();
173 guarantee(stub != NULL, "stub not found");
174
175 if (TraceICs) {
176 ResourceMark rm;
177 tty->print_cr("CompiledStaticCall@" INTPTR_FORMAT ": set_to_interpreted %s",
178 instruction_address(),
179 callee->name_and_sig_as_C_string());
180 }
181
182 // Creation also verifies the object.
183 NativeMovConstReg* method_holder = nativeMovConstReg_at(stub + IC_pos_in_java_to_interp_stub);
184 NativeJump* jump = nativeJump_at(method_holder->next_instruction_address());
185
186 assert(method_holder->data() == 0 || method_holder->data() == (intptr_t)callee(),
187 "a) MT-unsafe modification of inline cache");
188 assert(jump->jump_destination() == (address)-1 || jump->jump_destination() == entry,
189 "b) MT-unsafe modification of inline cache");
190
191 // Update stub.
192 method_holder->set_data((intptr_t)callee());
193 jump->set_jump_destination(entry);
194
195 // Update jump to call.
196 set_destination_mt_safe(stub);
197 }
198
|
1 /*
2 * Copyright (c) 1997, 2014, 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 *
158 // Size of java_to_interp stub, this doesn't need to be accurate but it must
159 // be larger or equal to the real size of the stub.
160 // Used for optimization in Compile::Shorten_branches.
161 int CompiledStaticCall::to_interp_stub_size() {
162 return 12 * BytesPerInstWord;
163 }
164
165 // Relocation entries for call stub, compiled java to interpreter.
166 // Used for optimization in Compile::Shorten_branches.
167 int CompiledStaticCall::reloc_to_interp_stub() {
168 return 5;
169 }
170
171 void CompiledStaticCall::set_to_interpreted(methodHandle callee, address entry) {
172 address stub = find_stub();
173 guarantee(stub != NULL, "stub not found");
174
175 if (TraceICs) {
176 ResourceMark rm;
177 tty->print_cr("CompiledStaticCall@" INTPTR_FORMAT ": set_to_interpreted %s",
178 p2i(instruction_address()),
179 callee->name_and_sig_as_C_string());
180 }
181
182 // Creation also verifies the object.
183 NativeMovConstReg* method_holder = nativeMovConstReg_at(stub + IC_pos_in_java_to_interp_stub);
184 NativeJump* jump = nativeJump_at(method_holder->next_instruction_address());
185
186 assert(method_holder->data() == 0 || method_holder->data() == (intptr_t)callee(),
187 "a) MT-unsafe modification of inline cache");
188 assert(jump->jump_destination() == (address)-1 || jump->jump_destination() == entry,
189 "b) MT-unsafe modification of inline cache");
190
191 // Update stub.
192 method_holder->set_data((intptr_t)callee());
193 jump->set_jump_destination(entry);
194
195 // Update jump to call.
196 set_destination_mt_safe(stub);
197 }
198
|