1 /*
2 * Copyright (c) 1997, 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 *
178
179 }
180
181 //------------------------------------------------------------------------------------------------------------------------
182 // Entry points
183
184 AbstractInterpreter::MethodKind AbstractInterpreter::method_kind(methodHandle m) {
185 // Abstract method?
186 if (m->is_abstract()) return abstract;
187
188 // Method handle primitive?
189 if (m->is_method_handle_intrinsic()) {
190 vmIntrinsics::ID id = m->intrinsic_id();
191 assert(MethodHandles::is_signature_polymorphic(id), "must match an intrinsic");
192 MethodKind kind = (MethodKind)( method_handle_invoke_FIRST +
193 ((int)id - vmIntrinsics::FIRST_MH_SIG_POLY) );
194 assert(kind <= method_handle_invoke_LAST, "parallel enum ranges");
195 return kind;
196 }
197
198 // Native method?
199 // Note: This test must come _before_ the test for intrinsic
200 // methods. See also comments below.
201 if (m->is_native()) {
202 assert(!m->is_method_handle_intrinsic(), "overlapping bits here, watch out");
203 return m->is_synchronized() ? native_synchronized : native;
204 }
205
206 // Synchronized?
207 if (m->is_synchronized()) {
208 return zerolocals_synchronized;
209 }
210
211 if (RegisterFinalizersAtInit && m->code_size() == 1 &&
212 m->intrinsic_id() == vmIntrinsics::_Object_init) {
213 // We need to execute the special return bytecode to check for
214 // finalizer registration so create a normal frame.
215 return zerolocals;
216 }
217
280 }
281
282
283 #ifndef PRODUCT
284 void AbstractInterpreter::print_method_kind(MethodKind kind) {
285 switch (kind) {
286 case zerolocals : tty->print("zerolocals" ); break;
287 case zerolocals_synchronized: tty->print("zerolocals_synchronized"); break;
288 case native : tty->print("native" ); break;
289 case native_synchronized : tty->print("native_synchronized" ); break;
290 case empty : tty->print("empty" ); break;
291 case accessor : tty->print("accessor" ); break;
292 case abstract : tty->print("abstract" ); break;
293 case java_lang_math_sin : tty->print("java_lang_math_sin" ); break;
294 case java_lang_math_cos : tty->print("java_lang_math_cos" ); break;
295 case java_lang_math_tan : tty->print("java_lang_math_tan" ); break;
296 case java_lang_math_abs : tty->print("java_lang_math_abs" ); break;
297 case java_lang_math_sqrt : tty->print("java_lang_math_sqrt" ); break;
298 case java_lang_math_log : tty->print("java_lang_math_log" ); break;
299 case java_lang_math_log10 : tty->print("java_lang_math_log10" ); break;
300 default:
301 if (kind >= method_handle_invoke_FIRST &&
302 kind <= method_handle_invoke_LAST) {
303 const char* kind_name = vmIntrinsics::name_at(method_handle_intrinsic(kind));
304 if (kind_name[0] == '_') kind_name = &kind_name[1]; // '_invokeExact' => 'invokeExact'
305 tty->print("method_handle_%s", kind_name);
306 break;
307 }
308 ShouldNotReachHere();
309 break;
310 }
311 }
312 #endif // PRODUCT
313
314
315 //------------------------------------------------------------------------------------------------------------------------
316 // Deoptimization support
317
318 // If deoptimization happens, this function returns the point of next bytecode to continue execution
319 address AbstractInterpreter::deopt_continue_after_entry(Method* method, address bcp, int callee_parameters, bool is_top_frame) {
|
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 *
178
179 }
180
181 //------------------------------------------------------------------------------------------------------------------------
182 // Entry points
183
184 AbstractInterpreter::MethodKind AbstractInterpreter::method_kind(methodHandle m) {
185 // Abstract method?
186 if (m->is_abstract()) return abstract;
187
188 // Method handle primitive?
189 if (m->is_method_handle_intrinsic()) {
190 vmIntrinsics::ID id = m->intrinsic_id();
191 assert(MethodHandles::is_signature_polymorphic(id), "must match an intrinsic");
192 MethodKind kind = (MethodKind)( method_handle_invoke_FIRST +
193 ((int)id - vmIntrinsics::FIRST_MH_SIG_POLY) );
194 assert(kind <= method_handle_invoke_LAST, "parallel enum ranges");
195 return kind;
196 }
197
198 #ifndef CC_INTERP
199 if (UseCRC32Intrinsics && m->is_native()) {
200 // Use optimized stub code for CRC32 native methods.
201 switch (m->intrinsic_id()) {
202 case vmIntrinsics::_updateCRC32 : return java_util_zip_CRC32_update;
203 case vmIntrinsics::_updateBytesCRC32 : return java_util_zip_CRC32_updateBytes;
204 case vmIntrinsics::_updateByteBufferCRC32 : return java_util_zip_CRC32_updateByteBuffer;
205 }
206 }
207 #endif
208
209 // Native method?
210 // Note: This test must come _before_ the test for intrinsic
211 // methods. See also comments below.
212 if (m->is_native()) {
213 assert(!m->is_method_handle_intrinsic(), "overlapping bits here, watch out");
214 return m->is_synchronized() ? native_synchronized : native;
215 }
216
217 // Synchronized?
218 if (m->is_synchronized()) {
219 return zerolocals_synchronized;
220 }
221
222 if (RegisterFinalizersAtInit && m->code_size() == 1 &&
223 m->intrinsic_id() == vmIntrinsics::_Object_init) {
224 // We need to execute the special return bytecode to check for
225 // finalizer registration so create a normal frame.
226 return zerolocals;
227 }
228
291 }
292
293
294 #ifndef PRODUCT
295 void AbstractInterpreter::print_method_kind(MethodKind kind) {
296 switch (kind) {
297 case zerolocals : tty->print("zerolocals" ); break;
298 case zerolocals_synchronized: tty->print("zerolocals_synchronized"); break;
299 case native : tty->print("native" ); break;
300 case native_synchronized : tty->print("native_synchronized" ); break;
301 case empty : tty->print("empty" ); break;
302 case accessor : tty->print("accessor" ); break;
303 case abstract : tty->print("abstract" ); break;
304 case java_lang_math_sin : tty->print("java_lang_math_sin" ); break;
305 case java_lang_math_cos : tty->print("java_lang_math_cos" ); break;
306 case java_lang_math_tan : tty->print("java_lang_math_tan" ); break;
307 case java_lang_math_abs : tty->print("java_lang_math_abs" ); break;
308 case java_lang_math_sqrt : tty->print("java_lang_math_sqrt" ); break;
309 case java_lang_math_log : tty->print("java_lang_math_log" ); break;
310 case java_lang_math_log10 : tty->print("java_lang_math_log10" ); break;
311 case java_util_zip_CRC32_update : tty->print("java_util_zip_CRC32_update"); break;
312 case java_util_zip_CRC32_updateBytes : tty->print("java_util_zip_CRC32_updateBytes"); break;
313 case java_util_zip_CRC32_updateByteBuffer : tty->print("java_util_zip_CRC32_updateByteBuffer"); break;
314 default:
315 if (kind >= method_handle_invoke_FIRST &&
316 kind <= method_handle_invoke_LAST) {
317 const char* kind_name = vmIntrinsics::name_at(method_handle_intrinsic(kind));
318 if (kind_name[0] == '_') kind_name = &kind_name[1]; // '_invokeExact' => 'invokeExact'
319 tty->print("method_handle_%s", kind_name);
320 break;
321 }
322 ShouldNotReachHere();
323 break;
324 }
325 }
326 #endif // PRODUCT
327
328
329 //------------------------------------------------------------------------------------------------------------------------
330 // Deoptimization support
331
332 // If deoptimization happens, this function returns the point of next bytecode to continue execution
333 address AbstractInterpreter::deopt_continue_after_entry(Method* method, address bcp, int callee_parameters, bool is_top_frame) {
|