[llvm-commits] CVS: llvm-java/runtime/runtime.c
Alkis Evlogimenos
alkis at cs.uiuc.edu
Sat Apr 2 12:17:33 PST 2005
Changes in directory llvm-java/runtime:
runtime.c updated: 1.32 -> 1.33
---
Log message:
Move jni implementation out of the runtime.
---
Diffs of the changes: (+22 -293)
runtime.c | 315 ++++----------------------------------------------------------
1 files changed, 22 insertions(+), 293 deletions(-)
Index: llvm-java/runtime/runtime.c
diff -u llvm-java/runtime/runtime.c:1.32 llvm-java/runtime/runtime.c:1.33
--- llvm-java/runtime/runtime.c:1.32 Sat Apr 2 14:05:11 2005
+++ llvm-java/runtime/runtime.c Sat Apr 2 14:17:22 2005
@@ -74,304 +74,18 @@
abort();
}
-/* The implementation of JNI functions */
+extern struct llvm_java_class_record* llvm_java_class_records;
-extern const struct llvm_java_class_record* llvm_java_class_records;
-
-static jclass llvm_java_find_class(JNIEnv* env, const char* name) {
- const struct llvm_java_class_record** clazz = &llvm_java_class_records;
- while (*clazz)
- if (strcmp((*clazz)->typeinfo.name, name) == 0)
- return (jclass) clazz;
+struct llvm_java_class_record*
+llvm_java_find_class(JNIEnv* env, const char* name) {
+ struct llvm_java_class_record** cr = &llvm_java_class_records;
+ while (*cr)
+ if (strcmp((*cr)->typeinfo.name, name) == 0)
+ return *cr;
return NULL;
}
-static jint llvm_java_get_array_length(JNIEnv* env, jarray array) {
- return ((struct llvm_java_booleanarray*) array)->length;
-}
-
-#define HANDLE_NATIVE_TYPE(TYPE) \
- static j##TYPE* llvm_java_get_##TYPE##_array_elements( \
- JNIEnv* env, \
- jarray array, \
- jboolean* isCopy) { \
- if (isCopy) \
- *isCopy = JNI_FALSE; \
- return ((struct llvm_java_##TYPE##array*) array)->data; \
- }
-#include "types.def"
-
-#define HANDLE_NATIVE_TYPE(TYPE) \
- static void llvm_java_release_##TYPE##_array_elements( \
- JNIEnv* env, \
- jarray array, \
- j##TYPE* elements, \
- jint mode) { \
- switch (mode) { \
- case 0: \
- case JNI_COMMIT: \
- case JNI_ABORT: \
- return; \
- default: \
- abort(); \
- } \
- }
-#include "types.def"
-
-/* The JNI interface definition */
-static const struct JNINativeInterface llvm_java_JNINativeInterface = {
- NULL, /* 0 */
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- &llvm_java_find_class,
- NULL,
- NULL,
- NULL,
- NULL, /* 10 */
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL, /* 20 */
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL, /* 30 */
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL, /* 40 */
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL, /* 50 */
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL, /* 60 */
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL, /* 70 */
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL, /* 80 */
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL, /* 90 */
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL, /* 100 */
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL, /* 110 */
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL, /* 120 */
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL, /* 130 */
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL, /* 140 */
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL, /* 150 */
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL, /* 160 */
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL, /* 170 */
- &llvm_java_get_array_length,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL, /* 180 */
- NULL,
- NULL,
- &llvm_java_get_boolean_array_elements,
- &llvm_java_get_byte_array_elements,
- &llvm_java_get_char_array_elements,
- &llvm_java_get_short_array_elements,
- &llvm_java_get_int_array_elements,
- &llvm_java_get_long_array_elements,
- &llvm_java_get_float_array_elements,
- &llvm_java_get_double_array_elements,
- &llvm_java_release_boolean_array_elements,
- &llvm_java_release_byte_array_elements,
- &llvm_java_release_char_array_elements,
- &llvm_java_release_short_array_elements,
- &llvm_java_release_int_array_elements,
- &llvm_java_release_long_array_elements,
- &llvm_java_release_float_array_elements,
- &llvm_java_release_double_array_elements,
- NULL,
- NULL, /* 200 */
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL, /* 210 */
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL, /* 220 */
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL, /* 230 */
- NULL,
-};
-
-const JNIEnv llvm_java_JNIEnv = &llvm_java_JNINativeInterface;
-
-typedef void (*ClassInitializerFunction)(void);
-
-extern const ClassInitializerFunction llvm_java_class_initializers;
-
-extern void llvm_java_main(int, char**);
-
-int main(int argc, char** argv) {
- const ClassInitializerFunction* classInit = &llvm_java_class_initializers;
- while (*classInit)
- (*classInit++)();
-
- llvm_java_main(argc, argv);
- return 0;
-}
-
void Java_java_lang_VMSystem_arraycopy(JNIEnv *env, jobject clazz,
jobject srcObj, jint srcStart,
jobject dstObj, jint dstStart,
@@ -398,3 +112,18 @@
jobject properties) {
}
+
+typedef void (*ClassInitializerFunction)(void);
+
+extern const ClassInitializerFunction llvm_java_class_initializers;
+
+extern void llvm_java_main(int, char**);
+
+int main(int argc, char** argv) {
+ const ClassInitializerFunction* classInit = &llvm_java_class_initializers;
+ while (*classInit)
+ (*classInit++)();
+
+ llvm_java_main(argc, argv);
+ return 0;
+}
More information about the llvm-commits
mailing list