comparison src/share/vm/c1/c1_Runtime1.cpp @ 6135:8f37087fc13f

7171890: C1: add Class.isInstance intrinsic Summary: Class.cast which calls Class.isInstance is heavily used by the new JSR 292 implementation Reviewed-by: roland Contributed-by: Krystal Mok <rednaxelafx@gmail.com>
author roland
date Tue, 05 Jun 2012 10:15:27 +0200
parents 0105f367a14c
children 957c266d8bc5 da91efe96a93
comparison
equal deleted inserted replaced
6134:7bc2d5136f54 6135:8f37087fc13f
292 FUNCTION_CASE(entry, SharedRuntime::lmul); 292 FUNCTION_CASE(entry, SharedRuntime::lmul);
293 FUNCTION_CASE(entry, SharedRuntime::lrem); 293 FUNCTION_CASE(entry, SharedRuntime::lrem);
294 FUNCTION_CASE(entry, SharedRuntime::lrem); 294 FUNCTION_CASE(entry, SharedRuntime::lrem);
295 FUNCTION_CASE(entry, SharedRuntime::dtrace_method_entry); 295 FUNCTION_CASE(entry, SharedRuntime::dtrace_method_entry);
296 FUNCTION_CASE(entry, SharedRuntime::dtrace_method_exit); 296 FUNCTION_CASE(entry, SharedRuntime::dtrace_method_exit);
297 FUNCTION_CASE(entry, is_instance_of);
297 FUNCTION_CASE(entry, trace_block_entry); 298 FUNCTION_CASE(entry, trace_block_entry);
298 #ifdef TRACE_HAVE_INTRINSICS 299 #ifdef TRACE_HAVE_INTRINSICS
299 FUNCTION_CASE(entry, TRACE_TIME_METHOD); 300 FUNCTION_CASE(entry, TRACE_TIME_METHOD);
300 #endif 301 #endif
301 302
1268 } 1269 }
1269 bs->write_ref_array(dst, num); 1270 bs->write_ref_array(dst, num);
1270 JRT_END 1271 JRT_END
1271 1272
1272 1273
1274 JRT_LEAF(int, Runtime1::is_instance_of(oopDesc* mirror, oopDesc* obj))
1275 // had to return int instead of bool, otherwise there may be a mismatch
1276 // between the C calling convention and the Java one.
1277 // e.g., on x86, GCC may clear only %al when returning a bool false, but
1278 // JVM takes the whole %eax as the return value, which may misinterpret
1279 // the return value as a boolean true.
1280
1281 assert(mirror != NULL, "should null-check on mirror before calling");
1282 klassOop k = java_lang_Class::as_klassOop(mirror);
1283 return (k != NULL && obj != NULL && obj->is_a(k)) ? 1 : 0;
1284 JRT_END
1285
1286
1273 #ifndef PRODUCT 1287 #ifndef PRODUCT
1274 void Runtime1::print_statistics() { 1288 void Runtime1::print_statistics() {
1275 tty->print_cr("C1 Runtime statistics:"); 1289 tty->print_cr("C1 Runtime statistics:");
1276 tty->print_cr(" _resolve_invoke_virtual_cnt: %d", SharedRuntime::_resolve_virtual_ctr); 1290 tty->print_cr(" _resolve_invoke_virtual_cnt: %d", SharedRuntime::_resolve_virtual_ctr);
1277 tty->print_cr(" _resolve_invoke_opt_virtual_cnt: %d", SharedRuntime::_resolve_opt_virtual_ctr); 1291 tty->print_cr(" _resolve_invoke_opt_virtual_cnt: %d", SharedRuntime::_resolve_opt_virtual_ctr);