* src/native/vm/java_lang_reflect_Method.c: New file.
authortwisti <none@none>
Mon, 11 Jun 2007 15:11:01 +0000 (15:11 +0000)
committertwisti <none@none>
Mon, 11 Jun 2007 15:11:01 +0000 (15:11 +0000)
* src/native/vm/java_lang_reflect_Method.h: Likewise.

* src/native/vm/Makefile.am [ENABLE_JAVASE]
(JAVA_LANG_REFLECT_METHOD_SOURCES): Added
(libnativevm_la_SOURCES): Added JAVA_LANG_REFLECT_METHOD_SOURCES.

* src/native/vm/gnu/java_lang_reflect_Method.c
(native/vm/java_lang_reflect_Method.h): Added.
(invokeNative): Use _Jv_java_lang_reflect_Method_invoke.

src/native/vm/Makefile.am
src/native/vm/gnu/java_lang_reflect_Method.c
src/native/vm/java_lang_reflect_Method.c [new file with mode: 0644]
src/native/vm/java_lang_reflect_Method.h [new file with mode: 0644]

index 1705453c092ab00e04e9dcdd2db051a155d49e81..d10fb54ff2701d777e19ed496cfebab82390e0fd 100644 (file)
@@ -59,6 +59,10 @@ JAVA_LANG_REFLECT_CONSTRUCTOR_SOURCES = \
        java_lang_reflect_Constructor.c \
        java_lang_reflect_Constructor.h
 
+JAVA_LANG_REFLECT_METHOD_SOURCES = \
+       java_lang_reflect_Method.c \
+       java_lang_reflect_Method.h
+
 SUN_MISC_UNSAFE_SOURCES = \
        sun_misc_Unsafe.c
 endif
@@ -82,6 +86,7 @@ libnativevm_la_SOURCES = \
        java_lang_Thread.c \
        java_lang_Thread.h \
        $(JAVA_LANG_REFLECT_CONSTRUCTOR_SOURCES) \
+       $(JAVA_LANG_REFLECT_METHOD_SOURCES) \
        $(SUN_MISC_UNSAFE_SOURCES)
 
 libnativevm_la_LIBADD = \
index a7c07964a784e9d66178ff433a909416351d77f0..9b365b42dca1ea4f97f52ce1ab62acfdc5460bc5 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: java_lang_reflect_Method.c 8063 2007-06-11 14:44:58Z twisti $
+   $Id: java_lang_reflect_Method.c 8064 2007-06-11 15:11:01Z twisti $
 
 */
 
@@ -42,6 +42,8 @@
 
 #include "native/include/java_lang_reflect_Method.h"
 
+#include "native/vm/java_lang_reflect_Method.h"
+
 #include "vm/access.h"
 #include "vm/global.h"
 #include "vm/builtin.h"
@@ -159,30 +161,7 @@ JNIEXPORT java_objectarray* JNICALL Java_java_lang_reflect_Method_getExceptionTy
  */
 JNIEXPORT java_lang_Object* JNICALL Java_java_lang_reflect_Method_invokeNative(JNIEnv *env, java_lang_reflect_Method *this, java_lang_Object *o, java_objectarray *args, java_lang_Class *declaringClass, s4 slot)
 {
-       classinfo        *c;
-       methodinfo       *m;
-
-       c = (classinfo *) declaringClass;
-       m = &(c->methods[slot]);
-
-       /* check method access */
-
-       /* check if we should bypass security checks (AccessibleObject) */
-
-       if (this->flag == false) {
-               if (!access_check_method(m, 1))
-                       return NULL;
-       }
-
-       /* check if method class is initialized */
-
-       if (!(c->state & CLASS_INITIALIZED))
-               if (!initialize_class(c))
-                       return NULL;
-
-       /* call the Java method via a helper function */
-
-       return (java_lang_Object *) _Jv_jni_invokeNative(m, (jobject) o, args);
+       return _Jv_java_lang_reflect_Method_invoke(this, o, args);
 }
 
 
diff --git a/src/native/vm/java_lang_reflect_Method.c b/src/native/vm/java_lang_reflect_Method.c
new file mode 100644 (file)
index 0000000..9d3f3d1
--- /dev/null
@@ -0,0 +1,96 @@
+/* src/native/vm/java_lang_reflect_Method.c
+
+   Copyright (C) 2007 R. Grafl, A. Krall, C. Kruegel,
+   C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
+   E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
+   J. Wenninger, Institut f. Computersprachen - TU Wien
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
+
+   $Id: java_lang_reflect_Method.c 8063 2007-06-11 14:44:58Z twisti $
+
+*/
+
+
+#include "config.h"
+
+#include <assert.h>
+
+#include "vm/types.h"
+
+#include "native/jni.h"
+#include "native/native.h"
+
+#include "native/include/java_lang_Object.h"
+
+#include "native/include/java_lang_reflect_Method.h"
+
+#include "vm/access.h"
+#include "vm/builtin.h"
+#include "vm/initialize.h"
+
+#include "vmcore/class.h"
+#include "vmcore/method.h"
+
+
+/*
+ * Class:     java/lang/reflect/Method
+ * Method:    invoke
+ * Signature: (Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
+ */
+java_lang_Object *_Jv_java_lang_reflect_Method_invoke(java_lang_reflect_Method *this, java_lang_Object *o, java_objectarray *args)
+{
+       classinfo  *c;
+       methodinfo *m;
+
+       c = (classinfo *) this->declaringClass;
+       m = &(c->methods[this->slot]);
+
+       /* check method access */
+
+       /* check if we should bypass security checks (AccessibleObject) */
+
+       if (this->flag == false) {
+               if (!access_check_method(m, 1))
+                       return NULL;
+       }
+
+       /* check if method class is initialized */
+
+       if (!(c->state & CLASS_INITIALIZED))
+               if (!initialize_class(c))
+                       return NULL;
+
+       /* call the Java method via a helper function */
+
+       return (java_lang_Object *) _Jv_jni_invokeNative(m, (jobject) o, args);
+}
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
diff --git a/src/native/vm/java_lang_reflect_Method.h b/src/native/vm/java_lang_reflect_Method.h
new file mode 100644 (file)
index 0000000..516591b
--- /dev/null
@@ -0,0 +1,64 @@
+/* src/native/vm/java_lang_reflect_Method.h
+
+   Copyright (C) 2007 R. Grafl, A. Krall, C. Kruegel, C. Oates,
+   R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
+   C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
+   Institut f. Computersprachen - TU Wien
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
+
+   $Id: java_lang_VMObject.c 6213 2006-12-18 17:36:06Z twisti $
+
+*/
+
+
+#ifndef _JV_JAVA_LANG_REFLECT_METHOD_H
+#define _JV_JAVA_LANG_REFLECT_METHOD_H
+
+#include "config.h"
+#include "vm/types.h"
+
+#include "native/jni.h"
+
+#include "native/include/java_lang_Object.h"
+#include "native/include/java_lang_reflect_Method.h"
+
+#include "native/vm/java_lang_reflect_Method.h"
+
+#include "vm/global.h"
+
+
+/* function prototypes ********************************************************/
+
+java_lang_Object *_Jv_java_lang_reflect_Method_invoke(java_lang_reflect_Method *this, java_lang_Object *o, java_objectarray *args);
+
+#endif /* _JV_JAVA_LANG_REFLECT_METHOD_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */