[llvm-commits] CVS: llvm-java/runtime/jni.c

Alkis Evlogimenos alkis at cs.uiuc.edu
Sun Apr 3 16:06:13 PDT 2005



Changes in directory llvm-java/runtime:

jni.c updated: 1.3 -> 1.4
---
Log message:

Group method implemenations in sections as they are described in the
JNI specification. Add implementation of Throw and GetSuperclass.


---
Diffs of the changes:  (+56 -17)

 jni.c |   73 ++++++++++++++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 56 insertions(+), 17 deletions(-)


Index: llvm-java/runtime/jni.c
diff -u llvm-java/runtime/jni.c:1.3 llvm-java/runtime/jni.c:1.4
--- llvm-java/runtime/jni.c:1.3	Sat Apr  2 20:49:44 2005
+++ llvm-java/runtime/jni.c	Sun Apr  3 18:06:02 2005
@@ -4,15 +4,33 @@
 
 /* The implementation of JNI functions */
 
+/* Class operations */
+
 static jclass find_class(JNIEnv* env, const char* name) {
   return GET_CLASS(llvm_java_find_class_record(name));
 }
 
+static jclass get_superclass(JNIEnv* env, jclass clazz) {
+  return GET_CLASS(llvm_java_get_superclass_record(GET_CLASS_RECORD(clazz)));
+}
+
 static jboolean is_assignable_from(JNIEnv* env, jclass c1, jclass c2) {
   return llvm_java_is_assignable_from(GET_CLASS_RECORD(c1),
                                       GET_CLASS_RECORD(c2));
 }
 
+/* Exceptions */
+
+static jint throw(JNIEnv* env, jthrowable obj) {
+  return llvm_java_throw(obj);
+}
+
+/* Global and local references */
+
+/* Weak global references */
+
+/* Object operations */
+
 static jboolean is_same_object(JNIEnv* env, jobject o1, jobject o2) {
   return o1 == o2;
 }
@@ -25,6 +43,8 @@
   return llvm_java_is_instance_of(obj, GET_CLASS_RECORD(c));
 }
 
+/* Accessing fields of objects */
+
 static jfieldID get_fieldid(JNIEnv *env,
                             jclass clazz,
                             const char *name,
@@ -45,6 +65,27 @@
   return 0;
 }
 
+#define HANDLE_TYPE(TYPE) \
+  static j##TYPE get_##TYPE##_field(JNIEnv* env, \
+                                    jobject obj, \
+                                    jfieldID fid) { \
+    return *(j##TYPE*) (((char*)obj) + fid); \
+  }
+#include "types.def"
+
+#define HANDLE_TYPE(TYPE) \
+  static void set_##TYPE##_field(JNIEnv* env, \
+                                 jobject obj, \
+                                 jfieldID fid, \
+                                 j##TYPE value) { \
+    *(j##TYPE*) (((char*)obj) + fid) = value; \
+  }
+#include "types.def"
+
+/* Calling instance methods */
+
+/* Accessing static fields */
+
 static jfieldID get_static_fieldid(JNIEnv *env,
                                    jclass clazz,
                                    const char *name,
@@ -84,23 +125,11 @@
   }
 #include "types.def"
 
-#define HANDLE_TYPE(TYPE) \
-  static j##TYPE get_##TYPE##_field(JNIEnv* env, \
-                                    jobject obj, \
-                                    jfieldID fid) { \
-    return *(j##TYPE*) (((char*)obj) + fid); \
-  }
-#include "types.def"
+/* Calling static methods */
 
-#define HANDLE_TYPE(TYPE) \
-  static void set_##TYPE##_field(JNIEnv* env, \
-                                 jobject obj, \
-                                 jfieldID fid, \
-                                 j##TYPE value) { \
-    *(j##TYPE*) (((char*)obj) + fid) = value; \
-  }
-#include "types.def"
+/* String operations */
 
+/* Array operations */
 
 static jint get_array_length(JNIEnv* env, jarray array) {
   return ((struct llvm_java_booleanarray*) array)->length;
@@ -134,6 +163,16 @@
   }
 #include "types.def"
 
+/* Register native methods */
+
+/* Monitor operations */
+
+/* NIO support */
+
+/* Reflection support */
+
+/* Java VM interface */
+
 /* The JNI interface definition */
 static const struct JNINativeInterface llvm_java_JNINativeInterface = {
   NULL, /* 0 */
@@ -146,10 +185,10 @@
   NULL,
   NULL,
   NULL,
-  NULL, /* 10 */
+  &get_superclass,
   &is_assignable_from,
   NULL,
-  NULL,
+  &throw,
   NULL,
   NULL,
   NULL,






More information about the llvm-commits mailing list