[kaffe] CVS kaffe (guilhem): Added support for JNI call NewWeakRef/DeleteWeakRef.
Kaffe CVS
cvs-commits at kaffe.org
Tue Jul 5 10:25:45 PDT 2005
PatchSet 6698
Date: 2005/07/05 17:20:35
Author: guilhem
Branch: HEAD
Tag: (none)
Log:
Added support for JNI call NewWeakRef/DeleteWeakRef.
* WHATSNEW: Added changes to JNI interface.
* kaffe/kaffevm/gc.h,
kaffe/kaffevm/gcFuncs.c: Added new type KGC_ALLOC_VMWEAKREF.
* kaffe/kaffevm/javacall.c
(KaffeVM_classMethodA, KaffeVM_callMethodV):
Unveil an object reference passed into
arguments if needed.
* kaffe/kaffevm/intrp/methodcalls.c
(engine_callMethod): Unveil the return value if it is an object
reference.
* kaffe/kaffevm/jit/native-wrapper.c
(Kaffe_wrapper): Added some JIT pseudo-code to unveil object
stored into weak references.
* kaffe/kaffevm/jni/Makefile.am: Added jni-refs.c
* kaffe/kaffevm/jni/Makefile.in: Regenerated.
* kaffe/kaffevm/jni/jni-arrays.c,
kaffe/kaffevm/jni/jni-callmethod.c,
kaffe/kaffevm/jni/jni-fields.c,
kaffe/kaffevm/jni/jni-helpers.c,
kaffe/kaffevm/jni/jni-string.c: Updated to unveil all object
references passed as arguments.
* kaffe/kaffevm/jni/jni.c: Moved out references handling.
* kaffe/kaffevm/jni/jni_funcs.h: Added new JNI exported functions.
* kaffe/kaffevm/jni/jni_i.h
(unveil): New function.
* kaffe/kaffevm/jni/jni-refs.c: New file.
Members:
ChangeLog:1.4222->1.4223
WHATSNEW:1.43->1.44
kaffe/kaffevm/gc.h:1.32->1.33
kaffe/kaffevm/gcFuncs.c:1.76->1.77
kaffe/kaffevm/javacall.c:1.1->1.2
kaffe/kaffevm/intrp/methodcalls.c:1.9->1.10
kaffe/kaffevm/jit/native-wrapper.c:1.10->1.11
kaffe/kaffevm/jni/Makefile.am:1.6->1.7
kaffe/kaffevm/jni/Makefile.in:1.40->1.41
kaffe/kaffevm/jni/jni-arrays.c:1.8->1.9
kaffe/kaffevm/jni/jni-callmethod.c:1.7->1.8
kaffe/kaffevm/jni/jni-fields.c:1.5->1.6
kaffe/kaffevm/jni/jni-helpers.c:1.6->1.7
kaffe/kaffevm/jni/jni-refs.c:INITIAL->1.1
kaffe/kaffevm/jni/jni-string.c:1.11->1.12
kaffe/kaffevm/jni/jni.c:1.34->1.35
kaffe/kaffevm/jni/jni_funcs.h:1.9->1.10
kaffe/kaffevm/jni/jni_i.h:1.8->1.9
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4222 kaffe/ChangeLog:1.4223
--- kaffe/ChangeLog:1.4222 Mon Jul 4 15:46:14 2005
+++ kaffe/ChangeLog Tue Jul 5 17:20:35 2005
@@ -1,3 +1,43 @@
+2005-07-05 Guilhem Lavaux <guilhem at kaffe.org>
+
+ * WHATSNEW: Added changes to JNI interface.
+
+ * kaffe/kaffevm/gc.h,
+ kaffe/kaffevm/gcFuncs.c: Added new type KGC_ALLOC_VMWEAKREF.
+
+ * kaffe/kaffevm/javacall.c
+ (KaffeVM_classMethodA, KaffeVM_callMethodV):
+ Unveil an object reference passed into
+ arguments if needed.
+
+ * kaffe/kaffevm/intrp/methodcalls.c
+ (engine_callMethod): Unveil the return value if it is an object
+ reference.
+
+ * kaffe/kaffevm/jit/native-wrapper.c
+ (Kaffe_wrapper): Added some JIT pseudo-code to unveil object
+ stored into weak references.
+
+ * kaffe/kaffevm/jni/Makefile.am: Added jni-refs.c
+
+ * kaffe/kaffevm/jni/Makefile.in: Regenerated.
+
+ * kaffe/kaffevm/jni/jni-arrays.c,
+ kaffe/kaffevm/jni/jni-callmethod.c,
+ kaffe/kaffevm/jni/jni-fields.c,
+ kaffe/kaffevm/jni/jni-helpers.c,
+ kaffe/kaffevm/jni/jni-string.c: Updated to unveil all object
+ references passed as arguments.
+
+ * kaffe/kaffevm/jni/jni.c: Moved out references handling.
+
+ * kaffe/kaffevm/jni/jni_funcs.h: Added new JNI exported functions.
+
+ * kaffe/kaffevm/jni/jni_i.h
+ (unveil): New function.
+
+ * kaffe/kaffevm/jni/jni-refs.c: New file.
+
2005-07-04 Dalibor Topic <robilad at kaffe.org>
Resynced with GNU Classpath.
Index: kaffe/WHATSNEW
diff -u kaffe/WHATSNEW:1.43 kaffe/WHATSNEW:1.44
--- kaffe/WHATSNEW:1.43 Wed Jun 15 15:35:26 2005
+++ kaffe/WHATSNEW Tue Jul 5 17:20:38 2005
@@ -7,6 +7,7 @@
for the Java Extension Mechanism and the Java security
model.
* Force double precision on x86 FPU for Linux OS.
+* JIT3/PowerPC operational on Darwin/OSX.
What's New in Kaffe 1.1.5
------------------------------------------------------
Index: kaffe/kaffe/kaffevm/gc.h
diff -u kaffe/kaffe/kaffevm/gc.h:1.32 kaffe/kaffe/kaffevm/gc.h:1.33
--- kaffe/kaffe/kaffevm/gc.h:1.32 Thu Jun 23 16:43:58 2005
+++ kaffe/kaffe/kaffevm/gc.h Tue Jul 5 17:20:40 2005
@@ -46,6 +46,7 @@
KGC_ALLOC_REFARRAY,
KGC_ALLOC_FINALIZEOBJECT,
KGC_ALLOC_JAVALOADER,
+ KGC_ALLOC_VMWEAKREF,
/* allocation types related to the translator engines */
KGC_ALLOC_JITCODE,
Index: kaffe/kaffe/kaffevm/gcFuncs.c
diff -u kaffe/kaffe/kaffevm/gcFuncs.c:1.76 kaffe/kaffe/kaffevm/gcFuncs.c:1.77
--- kaffe/kaffe/kaffevm/gcFuncs.c:1.76 Mon Jun 13 15:44:44 2005
+++ kaffe/kaffe/kaffevm/gcFuncs.c Tue Jul 5 17:20:40 2005
@@ -747,6 +747,7 @@
KGC_registerFixedTypeByIndex(gc, KGC_ALLOC_JIT_SLOTS, "jit-slots");
KGC_registerFixedTypeByIndex(gc, KGC_ALLOC_JIT_CODEBLOCK, "jit-codeblock");
KGC_registerFixedTypeByIndex(gc, KGC_ALLOC_JIT_LABELS, "jit-labels");
+ KGC_registerFixedTypeByIndex(gc, KGC_ALLOC_VMWEAKREF, "vm-weak-ref");
DBG(INIT, dprintf("initCollector() done\n"); );
return (gc);
Index: kaffe/kaffe/kaffevm/javacall.c
diff -u kaffe/kaffe/kaffevm/javacall.c:1.1 kaffe/kaffe/kaffevm/javacall.c:1.2
--- kaffe/kaffe/kaffevm/javacall.c:1.1 Thu Jun 23 16:43:58 2005
+++ kaffe/kaffe/kaffevm/javacall.c Tue Jul 5 17:20:40 2005
@@ -40,6 +40,7 @@
#include "jthread.h"
#include "methodcalls.h"
#include "native.h"
+#include "jni_i.h"
/* This is defined in the alpha port. It causes all integer arguments
to be promoted to jlong, and all jfloats to be promoted to jdouble,
@@ -222,7 +223,7 @@
/* fall through */
case 'L':
call.callsize[i] = PTR_TYPE_SIZE / SIZEOF_INT;
- call.args[i] = args[j];
+ call.args[i].l = unveil(args[j].l);
break;
default:
KAFFEVM_ABORT();
@@ -364,6 +365,7 @@
case 'L':
call.callsize[i] = PTR_TYPE_SIZE / SIZEOF_INT;
call.args[i].l = va_arg(args, jref);
+ call.args[i].l = unveil(call.args[i].l);
break;
default:
KAFFEVM_ABORT();
Index: kaffe/kaffe/kaffevm/intrp/methodcalls.c
diff -u kaffe/kaffe/kaffevm/intrp/methodcalls.c:1.9 kaffe/kaffe/kaffevm/intrp/methodcalls.c:1.10
--- kaffe/kaffe/kaffevm/intrp/methodcalls.c:1.9 Sat May 7 16:20:11 2005
+++ kaffe/kaffe/kaffevm/intrp/methodcalls.c Tue Jul 5 17:20:40 2005
@@ -25,6 +25,7 @@
#include "slots.h"
#include "soft.h"
#include "external.h"
+#include "jni_i.h"
void *
engine_buildTrampoline (Method *meth, void **where, errorInfo *einfo UNUSED)
@@ -177,6 +178,8 @@
/* If we have a pending exception and this is JNI, throw it */
if ((meth->accflags & ACC_JNI) != 0) {
+ if (call->rettype == 'L')
+ call->ret->l = unveil(call->ret->l);
finishJNIcall();
thread_data->exceptObj = save_except;
}
Index: kaffe/kaffe/kaffevm/jit/native-wrapper.c
diff -u kaffe/kaffe/kaffevm/jit/native-wrapper.c:1.10 kaffe/kaffe/kaffevm/jit/native-wrapper.c:1.11
--- kaffe/kaffe/kaffevm/jit/native-wrapper.c:1.10 Mon May 30 09:24:00 2005
+++ kaffe/kaffe/kaffevm/jit/native-wrapper.c Tue Jul 5 17:20:41 2005
@@ -86,6 +86,7 @@
int count;
nativeCodeInfo ncode;
SlotInfo* tmp = NULL;
+ SlotInfo* tmp2 = NULL;
bool success = true;
int j;
int an;
@@ -319,6 +320,32 @@
mon_exit(xmeth, local(0));
}
if (use_JNI) {
+ slot_alloctmp(tmp2);
+
+#if SIZEOF_VOID_P == SIZEOF_INT
+ and_int_const(tmp2, tmp, 1);
+#elif SIZEOF_VOID_P == SIZEOF_LONG
+ and_long_const(tmp2, tmp, 1);
+#else
+#error "Unsupported size of pointer"
+#endif
+ end_sub_block();
+ begin_sync();
+ cbranch_int_const_eq(tmp2, 0, reference_label(1, 1));
+ end_sync();
+
+ start_sub_block();
+#if SIZEOF_VOID_P == SIZEOF_INT
+ and_int_const(tmp2, tmp, ~(uintp)1);
+#elif SIZEOF_VOID_P == SIZEOF_LONG
+ and_long_const(tmp2, tmp, ~(uintp)1);
+#else
+#error "Unsupported size of pointer"
+#endif
+ load_ref(tmp, tmp2);
+ slot_freetmp(tmp2);
+ end_sub_block();
+ set_label(1, 1);
end_sub_block();
call_soft(finishJNIcall);
start_sub_block();
@@ -437,6 +464,7 @@
globalMethod = NULL;
leaveTranslator();
+
#if defined(KAFFE_FEEDBACK)
if( kaffe_feedback_file )
unlockMutex(kaffe_feedback_file);
Index: kaffe/kaffe/kaffevm/jni/Makefile.am
diff -u kaffe/kaffe/kaffevm/jni/Makefile.am:1.6 kaffe/kaffe/kaffevm/jni/Makefile.am:1.7
--- kaffe/kaffe/kaffevm/jni/Makefile.am:1.6 Mon Jul 5 16:40:46 2004
+++ kaffe/kaffe/kaffevm/jni/Makefile.am Tue Jul 5 17:20:41 2005
@@ -31,7 +31,8 @@
jni-fields.c \
jni-arrays.c \
jni-string.c \
- jni-helpers.c
+ jni-helpers.c \
+ jni-refs.c
noinst_HEADERS= \
jni_i.h \
Index: kaffe/kaffe/kaffevm/jni/Makefile.in
diff -u kaffe/kaffe/kaffevm/jni/Makefile.in:1.40 kaffe/kaffe/kaffevm/jni/Makefile.in:1.41
--- kaffe/kaffe/kaffevm/jni/Makefile.in:1.40 Sat May 14 21:46:35 2005
+++ kaffe/kaffe/kaffevm/jni/Makefile.in Tue Jul 5 17:20:41 2005
@@ -80,7 +80,8 @@
LTLIBRARIES = $(noinst_LTLIBRARIES)
libkaffejni_la_LIBADD =
am_libkaffejni_la_OBJECTS = jni.lo jni-base.lo jni-callmethod.lo \
- jni-fields.lo jni-arrays.lo jni-string.lo jni-helpers.lo
+ jni-fields.lo jni-arrays.lo jni-string.lo jni-helpers.lo \
+ jni-refs.lo
libkaffejni_la_OBJECTS = $(am_libkaffejni_la_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/config
depcomp = $(SHELL) $(top_srcdir)/scripts/depcomp
@@ -397,7 +398,8 @@
jni-fields.c \
jni-arrays.c \
jni-string.c \
- jni-helpers.c
+ jni-helpers.c \
+ jni-refs.c
noinst_HEADERS = \
jni_i.h \
@@ -460,6 +462,7 @@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/jni-callmethod.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/jni-fields.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/jni-helpers.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/jni-refs.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/jni-string.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/jni.Plo at am__quote@
Index: kaffe/kaffe/kaffevm/jni/jni-arrays.c
diff -u kaffe/kaffe/kaffevm/jni/jni-arrays.c:1.8 kaffe/kaffe/kaffevm/jni/jni-arrays.c:1.9
--- kaffe/kaffe/kaffevm/jni/jni-arrays.c:1.8 Mon May 30 09:24:01 2005
+++ kaffe/kaffe/kaffevm/jni/jni-arrays.c Tue Jul 5 17:20:41 2005
@@ -28,6 +28,7 @@
BEGIN_EXCEPTION_HANDLING(NULL);
+ arr = unveil(arr);
if (elem >= (jsize)obj_length((HArrayOfObject*)arr)) {
throwException(ArrayIndexOutOfBoundsException);
}
@@ -43,6 +44,9 @@
{
BEGIN_EXCEPTION_HANDLING_VOID();
+ arr = unveil(arr);
+ val = unveil(val);
+
if (elem >= (jsize)obj_length((HArrayOfObject*)arr)) {
throwException(ArrayIndexOutOfBoundsException);
}
@@ -59,6 +63,8 @@
BEGIN_EXCEPTION_HANDLING(NULL);
+ cls = unveil(cls);
+ init = unveil(init);
obj = (HArrayOfObject*)newArray((Hjava_lang_Class*)cls, len);
/* I assume this is what init is for */
@@ -189,6 +195,7 @@
jboolean* array;
BEGIN_EXCEPTION_HANDLING(NULL);
+ arr = unveil(arr);
if (iscopy != NULL) {
*iscopy = JNI_FALSE;
}
@@ -204,6 +211,7 @@
jbyte* array;
BEGIN_EXCEPTION_HANDLING(NULL);
+ arr = unveil(arr);
if (iscopy != NULL) {
*iscopy = JNI_FALSE;
}
@@ -224,7 +232,8 @@
{
jchar* array;
BEGIN_EXCEPTION_HANDLING(NULL);
-
+
+ arr = unveil(arr);
if (iscopy != NULL) {
*iscopy = JNI_FALSE;
}
@@ -240,6 +249,7 @@
jshort* array;
BEGIN_EXCEPTION_HANDLING(NULL);
+ arr = unveil(arr);
if (iscopy != NULL) {
*iscopy = JNI_FALSE;
}
@@ -255,6 +265,7 @@
jint* array;
BEGIN_EXCEPTION_HANDLING(NULL);
+ arr = unveil(arr);
if (iscopy != NULL) {
*iscopy = JNI_FALSE;
}
@@ -270,6 +281,7 @@
jlong* array;
BEGIN_EXCEPTION_HANDLING(NULL);
+ arr = unveil(arr);
if (iscopy != NULL) {
*iscopy = JNI_FALSE;
}
@@ -285,6 +297,7 @@
jfloat* array;
BEGIN_EXCEPTION_HANDLING(NULL);
+ arr = unveil(arr);
if (iscopy != NULL) {
*iscopy = JNI_FALSE;
}
@@ -300,6 +313,7 @@
jdouble* array;
BEGIN_EXCEPTION_HANDLING(NULL);
+ arr = unveil(arr);
if (iscopy != NULL) {
*iscopy = JNI_FALSE;
}
@@ -314,6 +328,7 @@
{
BEGIN_EXCEPTION_HANDLING_VOID();
+ arr = unveil(arr);
if (elems != unhand_array((HArrayOfBoolean*)arr)->body) {
switch (mode) {
case JNI_COMMIT:
@@ -338,6 +353,7 @@
{
BEGIN_EXCEPTION_HANDLING_VOID();
+ arr = unveil(arr);
if (elems != unhand_array((HArrayOfByte*)arr)->body) {
switch (mode) {
case JNI_COMMIT:
@@ -368,6 +384,7 @@
{
BEGIN_EXCEPTION_HANDLING_VOID();
+ arr = unveil(arr);
if (elems != unhand_array((HArrayOfChar*)arr)->body) {
switch (mode) {
case JNI_COMMIT:
@@ -392,6 +409,7 @@
{
BEGIN_EXCEPTION_HANDLING_VOID();
+ arr = unveil(arr);
if (elems != unhand_array((HArrayOfShort*)arr)->body) {
switch (mode) {
case JNI_COMMIT:
@@ -416,6 +434,7 @@
{
BEGIN_EXCEPTION_HANDLING_VOID();
+ arr = unveil(arr);
if (elems != unhand_array((HArrayOfInt*)arr)->body) {
switch (mode) {
case JNI_COMMIT:
@@ -440,6 +459,7 @@
{
BEGIN_EXCEPTION_HANDLING_VOID();
+ arr = unveil(arr);
if (elems != unhand_array((HArrayOfLong*)arr)->body) {
switch (mode) {
case JNI_COMMIT:
@@ -464,6 +484,7 @@
{
BEGIN_EXCEPTION_HANDLING_VOID();
+ arr = unveil(arr);
if (elems != unhand_array((HArrayOfFloat*)arr)->body) {
switch (mode) {
case JNI_COMMIT:
@@ -488,6 +509,7 @@
{
BEGIN_EXCEPTION_HANDLING_VOID();
+ arr = unveil(arr);
if (elems != unhand_array((HArrayOfDouble*)arr)->body) {
switch (mode) {
case JNI_COMMIT:
@@ -512,6 +534,7 @@
{
BEGIN_EXCEPTION_HANDLING_VOID();
+ arr = unveil(arr);
if (start >= obj_length((HArrayOfBoolean*)arr) || start + len > obj_length((HArrayOfBoolean*)arr)) {
throwException(ArrayIndexOutOfBoundsException);
}
@@ -525,6 +548,7 @@
{
BEGIN_EXCEPTION_HANDLING_VOID();
+ arr = unveil(arr);
if (start >= obj_length((HArrayOfByte*)arr) || start + len > obj_length((HArrayOfByte*)arr)) {
throwException(ArrayIndexOutOfBoundsException);
}
@@ -538,6 +562,7 @@
{
BEGIN_EXCEPTION_HANDLING_VOID();
+ arr = unveil(arr);
if (start >= obj_length((HArrayOfChar*)arr) || start + len > obj_length((HArrayOfChar*)arr)) {
throwException(ArrayIndexOutOfBoundsException);
}
@@ -551,6 +576,7 @@
{
BEGIN_EXCEPTION_HANDLING_VOID();
+ arr = unveil(arr);
if (start >= obj_length((HArrayOfShort*)arr) || start + len > obj_length((HArrayOfShort*)arr)) {
throwException(ArrayIndexOutOfBoundsException);
}
@@ -564,6 +590,7 @@
{
BEGIN_EXCEPTION_HANDLING_VOID();
+ arr = unveil(arr);
if (start >= obj_length((HArrayOfInt*)arr) || start + len > obj_length((HArrayOfInt*)arr)) {
throwException(ArrayIndexOutOfBoundsException);
}
@@ -577,6 +604,7 @@
{
BEGIN_EXCEPTION_HANDLING_VOID();
+ arr = unveil(arr);
if (start >= obj_length((HArrayOfLong*)arr) || start + len > obj_length((HArrayOfLong*)arr)) {
throwException(ArrayIndexOutOfBoundsException);
}
@@ -590,6 +618,7 @@
{
BEGIN_EXCEPTION_HANDLING_VOID();
+ arr = unveil(arr);
if (start >= obj_length((HArrayOfFloat*)arr) || start + len > obj_length((HArrayOfFloat*)arr)) {
throwException(ArrayIndexOutOfBoundsException);
}
@@ -603,6 +632,7 @@
{
BEGIN_EXCEPTION_HANDLING_VOID();
+ arr = unveil(arr);
if (start >= obj_length((HArrayOfDouble*)arr) || start + len > obj_length((HArrayOfDouble*)arr)) {
throwException(ArrayIndexOutOfBoundsException);
}
@@ -616,6 +646,7 @@
{
BEGIN_EXCEPTION_HANDLING_VOID();
+ arr = unveil(arr);
if (start >= obj_length((HArrayOfBoolean*)arr) || start+len > obj_length((HArrayOfBoolean*)arr)) {
throwException(ArrayIndexOutOfBoundsException);
}
@@ -629,6 +660,7 @@
{
BEGIN_EXCEPTION_HANDLING_VOID();
+ arr = unveil(arr);
if (start >= obj_length((HArrayOfByte*)arr) || start+len > obj_length((HArrayOfByte*)arr)) {
throwException(ArrayIndexOutOfBoundsException);
}
@@ -642,6 +674,7 @@
{
BEGIN_EXCEPTION_HANDLING_VOID();
+ arr = unveil(arr);
if (start >= obj_length((HArrayOfChar*)arr) || start+len > obj_length((HArrayOfChar*)arr)) {
throwException(ArrayIndexOutOfBoundsException);
}
@@ -655,6 +688,7 @@
{
BEGIN_EXCEPTION_HANDLING_VOID();
+ arr = unveil(arr);
if (start >= obj_length((HArrayOfShort*)arr) || start+len > obj_length((HArrayOfShort*)arr)) {
throwException(ArrayIndexOutOfBoundsException);
}
@@ -668,6 +702,7 @@
{
BEGIN_EXCEPTION_HANDLING_VOID();
+ arr = unveil(arr);
if (start >= obj_length((HArrayOfInt*)arr) || start+len > obj_length((HArrayOfInt*)arr)) {
throwException(ArrayIndexOutOfBoundsException);
}
@@ -681,6 +716,7 @@
{
BEGIN_EXCEPTION_HANDLING_VOID();
+ arr = unveil(arr);
if (start >= obj_length((HArrayOfLong*)arr) || start+len > obj_length((HArrayOfLong*)arr)) {
throwException(ArrayIndexOutOfBoundsException);
}
@@ -693,7 +729,8 @@
KaffeJNI_SetFloatArrayRegion(JNIEnv* env UNUSED, jfloatArray arr, jsize start, jsize len, jfloat* data)
{
BEGIN_EXCEPTION_HANDLING_VOID();
-
+
+ arr = unveil(arr);
if (start >= obj_length((HArrayOfFloat*)arr) || start+len > obj_length((HArrayOfFloat*)arr)) {
throwException(ArrayIndexOutOfBoundsException);
}
@@ -707,6 +744,7 @@
{
BEGIN_EXCEPTION_HANDLING_VOID();
+ arr = unveil(arr);
if (start >= obj_length((HArrayOfDouble*)arr) || start+len > obj_length((HArrayOfDouble*)arr)) {
throwException(ArrayIndexOutOfBoundsException);
}
Index: kaffe/kaffe/kaffevm/jni/jni-callmethod.c
diff -u kaffe/kaffe/kaffevm/jni/jni-callmethod.c:1.7 kaffe/kaffe/kaffevm/jni/jni-callmethod.c:1.8
--- kaffe/kaffe/kaffevm/jni/jni-callmethod.c:1.7 Sat May 7 16:20:12 2005
+++ kaffe/kaffe/kaffevm/jni/jni-callmethod.c Tue Jul 5 17:20:41 2005
@@ -57,7 +57,7 @@
void
KaffeJNI_CallVoidMethodV(JNIEnv* env UNUSED, jobject obj, jmethodID meth, va_list args)
{
- Hjava_lang_Object* o = (Hjava_lang_Object*)obj;
+ Hjava_lang_Object* o = (Hjava_lang_Object*)unveil(obj);
Method* m = (Method*)meth;
BEGIN_EXCEPTION_HANDLING_VOID();
@@ -66,7 +66,12 @@
throwException(NoSuchMethodError(m->name->data));
}
- KaffeVM_callMethodV(m, getMethodFunc (m, o), obj, args, NULL);
+ /*
+ * callMethodA will have to unveil the objects contained in the argument lists.
+ * This is not really pretty but more efficient because we do not parse the signature
+ * twice.
+ */
+ KaffeVM_callMethodV(m, getMethodFunc (m, o), o, args, NULL);
END_EXCEPTION_HANDLING();
}
@@ -88,7 +93,7 @@
void
KaffeJNI_CallVoidMethodA(JNIEnv* env UNUSED, jobject obj, jmethodID meth, jvalue* args)
{
- Hjava_lang_Object* o = (Hjava_lang_Object*)obj;
+ Hjava_lang_Object* o = (Hjava_lang_Object*)unveil(obj);
Method* m = (Method*)meth;
BEGIN_EXCEPTION_HANDLING_VOID();
@@ -97,7 +102,12 @@
throwException(NoSuchMethodError(m->name->data));
}
- KaffeVM_callMethodA(m, getMethodFunc (m, o), obj, args, NULL, 0);
+ /*
+ * callMethodA will have to unveil the objects contained in the argument lists.
+ * This is not really pretty but more efficient because we do not parse the signature
+ * twice.
+ */
+ KaffeVM_callMethodA(m, getMethodFunc (m, o), o, args, NULL, 0);
END_EXCEPTION_HANDLING();
}
@@ -119,6 +129,7 @@
throwException(NoSuchMethodError(m->name->data));
}
+ obj = unveil(obj);
KaffeVM_callMethodV(m, METHOD_NATIVECODE(m), obj, args, &retval);
ADD_REF(retval.l);
@@ -149,7 +160,8 @@
Method* m = (Method*)meth;
BEGIN_EXCEPTION_HANDLING(NULL);
-
+
+ obj = unveil(obj);
if (METHOD_IS_STATIC(m)) {
throwException(NoSuchMethodError(m->name->data));
}
@@ -174,6 +186,7 @@
BEGIN_EXCEPTION_HANDLING(0);
+ obj = unveil(obj);
if (METHOD_IS_STATIC(m)) {
throwException(NoSuchMethodError(m->name->data));
}
@@ -208,6 +221,7 @@
BEGIN_EXCEPTION_HANDLING(0);
+ obj = unveil(obj);
if (METHOD_IS_STATIC(m)) {
throwException(NoSuchMethodError(m->name->data));
}
@@ -230,6 +244,7 @@
BEGIN_EXCEPTION_HANDLING(0);
+ obj = unveil(obj);
if (METHOD_IS_STATIC(m)) {
throwException(NoSuchMethodError(m->name->data));
}
@@ -264,6 +279,7 @@
BEGIN_EXCEPTION_HANDLING(0);
+ obj = unveil(obj);
if (METHOD_IS_STATIC(m)) {
throwException(NoSuchMethodError(m->name->data));
}
@@ -287,6 +303,7 @@
BEGIN_EXCEPTION_HANDLING(0);
+ obj = unveil(obj);
if (METHOD_IS_STATIC(m)) {
throwException(NoSuchMethodError(m->name->data));
}
@@ -321,6 +338,7 @@
BEGIN_EXCEPTION_HANDLING(0);
+ obj = unveil(obj);
if (METHOD_IS_STATIC(m)) {
throwException(NoSuchMethodError(m->name->data));
}
@@ -344,6 +362,7 @@
BEGIN_EXCEPTION_HANDLING(0);
+ obj = unveil(obj);
if (METHOD_IS_STATIC(m)) {
throwException(NoSuchMethodError(m->name->data));
}
@@ -378,6 +397,7 @@
BEGIN_EXCEPTION_HANDLING(0);
+ obj = unveil(obj);
if (METHOD_IS_STATIC(m)) {
throwException(NoSuchMethodError(m->name->data));
}
@@ -401,6 +421,7 @@
BEGIN_EXCEPTION_HANDLING(0);
+ obj = unveil(obj);
if (METHOD_IS_STATIC(m)) {
throwException(NoSuchMethodError(m->name->data));
}
@@ -435,6 +456,7 @@
BEGIN_EXCEPTION_HANDLING(0);
+ obj = unveil(obj);
if (METHOD_IS_STATIC(m)) {
throwException(NoSuchMethodError(m->name->data));
}
@@ -454,7 +476,7 @@
KaffeJNI_CallObjectMethodV(JNIEnv* env UNUSED, jobject obj, jmethodID meth, va_list args)
{
jvalue retval;
- Hjava_lang_Object* o = (Hjava_lang_Object*)obj;
+ Hjava_lang_Object* o = (Hjava_lang_Object*)unveil(obj);
Method* m = (Method*)meth;
BEGIN_EXCEPTION_HANDLING(NULL);
@@ -463,7 +485,7 @@
throwException(NoSuchMethodError(m->name->data));
}
- KaffeVM_callMethodV(m, getMethodFunc (m, o), obj, args, &retval);
+ KaffeVM_callMethodV(m, getMethodFunc (m, o), o, args, &retval);
ADD_REF(retval.l);
END_EXCEPTION_HANDLING();
@@ -491,7 +513,7 @@
KaffeJNI_CallObjectMethodA(JNIEnv* env UNUSED, jobject obj, jmethodID meth, jvalue* args)
{
jvalue retval;
- Hjava_lang_Object* o = (Hjava_lang_Object*)obj;
+ Hjava_lang_Object* o = (Hjava_lang_Object*)unveil(obj);
Method* m = (Method*)meth;
BEGIN_EXCEPTION_HANDLING(NULL);
@@ -500,7 +522,7 @@
throwException(NoSuchMethodError(m->name->data));
}
- KaffeVM_callMethodA(m, getMethodFunc (m, o), obj, args, &retval, 0);
+ KaffeVM_callMethodA(m, getMethodFunc (m, o), o, args, &retval, 0);
END_EXCEPTION_HANDLING();
return (retval.l);
@@ -515,7 +537,7 @@
KaffeJNI_CallBooleanMethodV(JNIEnv* env UNUSED, jobject obj, jmethodID meth, va_list args)
{
jvalue retval;
- Hjava_lang_Object* o = (Hjava_lang_Object*)obj;
+ Hjava_lang_Object* o = (Hjava_lang_Object*)unveil(obj);
Method* m = (Method*)meth;
BEGIN_EXCEPTION_HANDLING(0);
@@ -524,7 +546,7 @@
throwException(NoSuchMethodError(m->name->data));
}
- KaffeVM_callMethodV(m, getMethodFunc (m, o), obj, args, &retval);
+ KaffeVM_callMethodV(m, getMethodFunc (m, o), o, args, &retval);
END_EXCEPTION_HANDLING();
return ((jboolean) retval.i);
@@ -550,7 +572,7 @@
KaffeJNI_CallBooleanMethodA(JNIEnv* env UNUSED, jobject obj, jmethodID meth, jvalue* args)
{
jvalue retval;
- Hjava_lang_Object* o = (Hjava_lang_Object*)obj;
+ Hjava_lang_Object* o = (Hjava_lang_Object*)unveil(obj);
Method* m = (Method*)meth;
BEGIN_EXCEPTION_HANDLING(0);
@@ -559,7 +581,7 @@
throwException(NoSuchMethodError(m->name->data));
}
- KaffeVM_callMethodA(m, getMethodFunc (m, o), obj, args, &retval, 0);
+ KaffeVM_callMethodA(m, getMethodFunc (m, o), o, args, &retval, 0);
END_EXCEPTION_HANDLING();
return ((jboolean) retval.i);
@@ -574,7 +596,7 @@
KaffeJNI_CallByteMethodV(JNIEnv* env UNUSED, jobject obj, jmethodID meth, va_list args)
{
jvalue retval;
- Hjava_lang_Object* o = (Hjava_lang_Object*)obj;
+ Hjava_lang_Object* o = (Hjava_lang_Object*)unveil(obj);
Method* m = (Method*)meth;
BEGIN_EXCEPTION_HANDLING(0);
@@ -583,7 +605,7 @@
throwException(NoSuchMethodError(m->name->data));
}
- KaffeVM_callMethodV(m, getMethodFunc (m, o), obj, args, &retval);
+ KaffeVM_callMethodV(m, getMethodFunc (m, o), o, args, &retval);
END_EXCEPTION_HANDLING();
return ((jbyte) retval.i);
@@ -609,7 +631,7 @@
KaffeJNI_CallByteMethodA(JNIEnv* env UNUSED, jobject obj, jmethodID meth, jvalue* args)
{
jvalue retval;
- Hjava_lang_Object* o = (Hjava_lang_Object*)obj;
+ Hjava_lang_Object* o = (Hjava_lang_Object*)unveil(obj);
Method* m = (Method*)meth;
BEGIN_EXCEPTION_HANDLING(0);
@@ -633,7 +655,7 @@
KaffeJNI_CallCharMethodV(JNIEnv* env UNUSED, jobject obj, jmethodID meth, va_list args)
{
jvalue retval;
- Hjava_lang_Object* o = (Hjava_lang_Object*)obj;
+ Hjava_lang_Object* o = (Hjava_lang_Object*)unveil(obj);
Method* m = (Method*)meth;
BEGIN_EXCEPTION_HANDLING(0);
@@ -642,7 +664,7 @@
throwException(NoSuchMethodError(m->name->data));
}
- KaffeVM_callMethodV(m, getMethodFunc (m, o), obj, args, &retval);
+ KaffeVM_callMethodV(m, getMethodFunc (m, o), o, args, &retval);
END_EXCEPTION_HANDLING();
return ((jchar) retval.i);
@@ -668,7 +690,7 @@
KaffeJNI_CallCharMethodA(JNIEnv* env UNUSED, jobject obj, jmethodID meth, jvalue* args)
{
jvalue retval;
- Hjava_lang_Object* o = (Hjava_lang_Object*)obj;
+ Hjava_lang_Object* o = (Hjava_lang_Object*)unveil(obj);
Method* m = (Method*)meth;
BEGIN_EXCEPTION_HANDLING(0);
@@ -677,7 +699,7 @@
throwException(NoSuchMethodError(m->name->data));
}
- KaffeVM_callMethodA(m, getMethodFunc (m, o), obj, args, &retval, 0);
+ KaffeVM_callMethodA(m, getMethodFunc (m, o), o, args, &retval, 0);
END_EXCEPTION_HANDLING();
return ((jchar) retval.i);
@@ -692,7 +714,7 @@
KaffeJNI_CallShortMethodV(JNIEnv* env UNUSED, jobject obj, jmethodID meth, va_list args)
{
jvalue retval;
- Hjava_lang_Object* o = (Hjava_lang_Object*)obj;
+ Hjava_lang_Object* o = (Hjava_lang_Object*)unveil(obj);
Method* m = (Method*)meth;
BEGIN_EXCEPTION_HANDLING(0);
@@ -701,7 +723,7 @@
throwException(NoSuchMethodError(m->name->data));
}
- KaffeVM_callMethodV(m, getMethodFunc (m, o), obj, args, &retval);
+ KaffeVM_callMethodV(m, getMethodFunc (m, o), o, args, &retval);
END_EXCEPTION_HANDLING();
return ((jshort) retval.i);
@@ -727,7 +749,7 @@
KaffeJNI_CallShortMethodA(JNIEnv* env UNUSED, jobject obj, jmethodID meth, jvalue* args)
{
jvalue retval;
- Hjava_lang_Object* o = (Hjava_lang_Object*)obj;
+ Hjava_lang_Object* o = (Hjava_lang_Object*)unveil(obj);
Method* m = (Method*)meth;
BEGIN_EXCEPTION_HANDLING(0);
@@ -736,7 +758,7 @@
throwException(NoSuchMethodError(m->name->data));
}
- KaffeVM_callMethodA(m, getMethodFunc (m, o), obj, args, &retval, 0);
+ KaffeVM_callMethodA(m, getMethodFunc (m, o), o, args, &retval, 0);
END_EXCEPTION_HANDLING();
return ((jshort) retval.i);
@@ -751,7 +773,7 @@
KaffeJNI_CallIntMethodV(JNIEnv* env UNUSED, jobject obj, jmethodID meth, va_list args)
{
jvalue retval;
- Hjava_lang_Object* o = (Hjava_lang_Object*)obj;
+ Hjava_lang_Object* o = (Hjava_lang_Object*)unveil(obj);
Method* m = (Method*)meth;
BEGIN_EXCEPTION_HANDLING(0);
@@ -760,7 +782,7 @@
throwException(NoSuchMethodError(m->name->data));
}
- KaffeVM_callMethodV(m, getMethodFunc (m, o), obj, args, &retval);
+ KaffeVM_callMethodV(m, getMethodFunc (m, o), o, args, &retval);
END_EXCEPTION_HANDLING();
return (retval.i);
@@ -786,7 +808,7 @@
KaffeJNI_CallIntMethodA(JNIEnv* env UNUSED, jobject obj, jmethodID meth, jvalue* args)
{
jvalue retval;
- Hjava_lang_Object* o = (Hjava_lang_Object*)obj;
+ Hjava_lang_Object* o = (Hjava_lang_Object*)unveil(obj);
Method* m = (Method*)meth;
BEGIN_EXCEPTION_HANDLING(0);
@@ -795,7 +817,7 @@
throwException(NoSuchMethodError(m->name->data));
}
- KaffeVM_callMethodA(m, getMethodFunc (m, o), obj, args, &retval, 0);
+ KaffeVM_callMethodA(m, getMethodFunc (m, o), o, args, &retval, 0);
END_EXCEPTION_HANDLING();
return (retval.i);
@@ -810,7 +832,7 @@
KaffeJNI_CallLongMethodV(JNIEnv* env UNUSED, jobject obj, jmethodID meth, va_list args)
{
jvalue retval;
- Hjava_lang_Object* o = (Hjava_lang_Object*)obj;
+ Hjava_lang_Object* o = (Hjava_lang_Object*)unveil(obj);
Method* m = (Method*)meth;
BEGIN_EXCEPTION_HANDLING(0);
@@ -819,7 +841,7 @@
throwException(NoSuchMethodError(m->name->data));
}
- KaffeVM_callMethodV(m, getMethodFunc (m, o), obj, args, &retval);
+ KaffeVM_callMethodV(m, getMethodFunc (m, o), o, args, &retval);
END_EXCEPTION_HANDLING();
return (retval.j);
@@ -845,7 +867,7 @@
KaffeJNI_CallLongMethodA(JNIEnv* env UNUSED, jobject obj, jmethodID meth, jvalue* args)
{
jvalue retval;
- Hjava_lang_Object* o = (Hjava_lang_Object*)obj;
+ Hjava_lang_Object* o = (Hjava_lang_Object*)unveil(obj);
Method* m = (Method*)meth;
BEGIN_EXCEPTION_HANDLING(0);
@@ -854,7 +876,7 @@
throwException(NoSuchMethodError(m->name->data));
}
- KaffeVM_callMethodA(m, getMethodFunc (m, o), obj, args, &retval, 0);
+ KaffeVM_callMethodA(m, getMethodFunc (m, o), o, args, &retval, 0);
END_EXCEPTION_HANDLING();
return (retval.j);
@@ -869,7 +891,7 @@
KaffeJNI_CallFloatMethodV(JNIEnv* env UNUSED, jobject obj, jmethodID meth, va_list args)
{
jvalue retval;
- Hjava_lang_Object* o = (Hjava_lang_Object*)obj;
+ Hjava_lang_Object* o = (Hjava_lang_Object*)unveil(obj);
Method* m = (Method*)meth;
BEGIN_EXCEPTION_HANDLING(0);
@@ -878,7 +900,7 @@
throwException(NoSuchMethodError(m->name->data));
}
- KaffeVM_callMethodV(m, getMethodFunc (m, o), obj, args, &retval);
+ KaffeVM_callMethodV(m, getMethodFunc (m, o), o, args, &retval);
END_EXCEPTION_HANDLING();
return (retval.f);
@@ -904,7 +926,7 @@
*** Patch too long, truncated ***
More information about the kaffe
mailing list