Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
- P. Tomsich, J. Wenninger
+ P. Tomsich, J. Wenninger, M. Platter
This file is part of CACAO.
Authors: ?
- Changes: Joseph Wenninger
+ Changes: Joseph Wenninger, Martin Platter
- $Id: jni.c 1030 2004-04-26 16:03:01Z twisti $
+ $Id: jni.c 1384 2004-08-02 11:41:26Z motse $
*/
#include <string.h>
+#include "exceptions.h"
#include "main.h"
#include "jni.h"
#include "global.h"
#include "tables.h"
#include "native.h"
#include "builtin.h"
+#include "options.h"
+#include "statistics.h"
#include "threads/thread.h"
-#include "toolbox/loging.h"
+#include "toolbox/logging.h"
#include "toolbox/memory.h"
#include "nat/java_lang_Byte.h"
#include "nat/java_lang_Character.h"
jmethodID get_nonvirtual(jclass clazz,jmethodID methodID) {
if (clazz==methodID->class) return methodID;
+/*class_resolvemethod -> classfindmethod? (JOWENN)*/
return class_resolvemethod (clazz, methodID->name, methodID->descriptor);
}
jni_callblock *blk;
jlong ret;
- /*
+/*
log_text("JNI-Call: CallObjectMethodV");
utf_display(methodID->name);
utf_display(methodID->descriptor);
printf("\nParmaeter count: %d\n",argcount);
utf_display(obj->vftbl->class->name);
printf("\n");
- */
+*/
if (methodID == 0) {
*exceptionptr = new_exception(string_java_lang_NoSuchMethodError);
return 0;
blk = MNEW(jni_callblock, 4 /*argcount+2*/);
- fill_callblock(obj, methodID->descriptor, blk, args, 'L');
+ fill_callblock(obj, methodID->descriptor, blk, args, 'J');
/* printf("parameter: obj: %p",blk[0].item); */
ret = asm_calljavafunction2long(methodID,
);
if (!m) *exceptionptr = new_exception(string_java_lang_NoSuchMethodError);
-
+ else if (m->flags & ACC_STATIC) {
+ m=0;
+ *exceptionptr = new_exception(string_java_lang_NoSuchMethodError);
+ }
return m;
}
jlong CallLongMethod(JNIEnv *env, jobject obj, jmethodID methodID, ...)
{
- log_text("JNI-Call: CallLongMethod");
+ jlong ret;
+ va_list vaargs;
+
+ va_start(vaargs,methodID);
+ ret = callLongMethod(obj,get_virtual(obj, methodID),vaargs);
+ va_end(vaargs);
- return 0;
+ return ret;
}
jlong CallLongMethodV(JNIEnv *env, jobject obj, jmethodID methodID, va_list args)
{
- log_text("JNI-Call: CallLongMethodV");
-
- return 0;
+ return callLongMethod(obj,get_virtual(obj, methodID),args);
}
utf_new_char((char *) sig));
if (!m) *exceptionptr = new_exception(string_java_lang_NoSuchMethodError);
+ else if (!(m->flags & ACC_STATIC)) {
+ m=0;
+ *exceptionptr = new_exception(string_java_lang_NoSuchMethodError);
+ }
return m;
}
jobject CallStaticObjectMethod(JNIEnv *env, jclass clazz, jmethodID methodID, ...)
{
- log_text("JNI-Call: CallStaticObjectMethod");
+ jobject ret;
+ va_list vaargs;
- return NULL;
+ /* log_text("JNI-Call: CallStaticObjectMethod");*/
+
+ va_start(vaargs, methodID);
+ ret = callObjectMethod(0, methodID, vaargs);
+ va_end(vaargs);
+
+ return ret;
}
jobject CallStaticObjectMethodV(JNIEnv *env, jclass clazz, jmethodID methodID, va_list args)
{
- log_text("JNI-Call: CallStaticObjectMethodV");
-
- return NULL;
+ /* log_text("JNI-Call: CallStaticObjectMethodV"); */
+
+ return callObjectMethod(0,methodID,args);
}