[llvm-commits] CVS: llvm-java/runtime/runtime.c
Alkis Evlogimenos
alkis at cs.uiuc.edu
Tue Sep 21 15:13:48 PDT 2004
Changes in directory llvm-java/runtime:
runtime.c updated: 1.5 -> 1.6
---
Log message:
Add some more defines from jni.h.
---
Diffs of the changes: (+12 -1)
Index: llvm-java/runtime/runtime.c
diff -u llvm-java/runtime/runtime.c:1.5 llvm-java/runtime/runtime.c:1.6
--- llvm-java/runtime/runtime.c:1.5 Tue Sep 21 17:06:05 2004
+++ llvm-java/runtime/runtime.c Tue Sep 21 17:13:37 2004
@@ -20,6 +20,11 @@
typedef float jfloat;
typedef double jdouble;
+/* Used for jboolean type */
+/* FIXME: this should really be picked up from jni.h */
+#define JNI_TRUE 1
+#define JNI_FALSE 0
+
struct llvm_java_object_header {
/* gc info, hash info, locking */
};
@@ -50,9 +55,15 @@
jint llvm_java_IsInstanceOf(jobject obj,
struct llvm_java_object_vtable* clazz) {
+ /* trivial case 1: a null object can be cast to any type */
+ if (!obj)
+ return JNI_TRUE;
+
struct llvm_java_object_vtable* objClazz = obj->vtable;
+ /* trivial case 2: this object is of class clazz */
if (objClazz == clazz)
- return 1;
+ return JNI_TRUE;
+
/* we are checking against a class' typeinfo */
if (clazz->typeinfo.interfaceFlag != (unsigned)-1)
return objClazz->typeinfo.depth > clazz->typeinfo.depth &&
More information about the llvm-commits
mailing list