--- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp Fri Jun 01 11:25:12 2012 -0700
+++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp Tue Jun 05 10:15:27 2012 +0200
@@ -294,6 +294,7 @@
FUNCTION_CASE(entry, SharedRuntime::lrem);
FUNCTION_CASE(entry, SharedRuntime::dtrace_method_entry);
FUNCTION_CASE(entry, SharedRuntime::dtrace_method_exit);
+ FUNCTION_CASE(entry, is_instance_of);
FUNCTION_CASE(entry, trace_block_entry);
#ifdef TRACE_HAVE_INTRINSICS
FUNCTION_CASE(entry, TRACE_TIME_METHOD);
@@ -1270,6 +1271,19 @@
JRT_END
+JRT_LEAF(int, Runtime1::is_instance_of(oopDesc* mirror, oopDesc* obj))
+ // had to return int instead of bool, otherwise there may be a mismatch
+ // between the C calling convention and the Java one.
+ // e.g., on x86, GCC may clear only %al when returning a bool false, but
+ // JVM takes the whole %eax as the return value, which may misinterpret
+ // the return value as a boolean true.
+
+ assert(mirror != NULL, "should null-check on mirror before calling");
+ klassOop k = java_lang_Class::as_klassOop(mirror);
+ return (k != NULL && obj != NULL && obj->is_a(k)) ? 1 : 0;
+JRT_END
+
+
#ifndef PRODUCT
void Runtime1::print_statistics() {
tty->print_cr("C1 Runtime statistics:");