From 524f99aedb293bb25fe5bfdbbb12360ea8bcd823 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Sat, 16 Apr 2011 06:16:59 +0000 Subject: [PATCH] changes --- Robust/src/Runtime/garbage.c | 2 +- Robust/src/Runtime/jni/jni-private.h | 118 +++++++++++++++------------ Robust/src/Runtime/jni/jni-stuff.c | 62 ++++++++------ Robust/src/Runtime/jni/jni.c | 1 - Robust/src/Runtime/thread.c | 2 + 5 files changed, 110 insertions(+), 75 deletions(-) diff --git a/Robust/src/Runtime/garbage.c b/Robust/src/Runtime/garbage.c index 7312a6fc..3f5ab8a6 100644 --- a/Robust/src/Runtime/garbage.c +++ b/Robust/src/Runtime/garbage.c @@ -328,7 +328,7 @@ void searchjnitable(struct jnireferences *jniptr) { int i; //update table for(i=0;iindex;i++) { - ENQUEUE(jniptr->array[i]->ref, jniptr->array[i]->ref); + ENQUEUE((struct ___Object___ *)jniptr->array[i].ref, *((struct ___Object___**)&jniptr->array[i].ref)); } //go to next table jniptr=jniptr->next; diff --git a/Robust/src/Runtime/jni/jni-private.h b/Robust/src/Runtime/jni/jni-private.h index bd12d6c7..77b82992 100644 --- a/Robust/src/Runtime/jni/jni-private.h +++ b/Robust/src/Runtime/jni/jni-private.h @@ -46,7 +46,7 @@ jint RC_GetVersion(JNIEnv * env); jclass RC_DefineClass(JNIEnv * env, const char * c, jobject loader, const jbyte * buf, jsize bufLen); jclass RC_FindClass(JNIEnv * env, const char *classname); jmethodID RC_FromReflectedMethod(JNIEnv * env, jobject mthdobj); -jmethodID RC_FromReflectedField(JNIEnv * env, jobject fldobj); +jfieldID RC_FromReflectedField(JNIEnv * env, jobject fldobj); jobject RC_ToReflectedMethod(JNIEnv * env, jclass classobj, jmethodID methodobj, jboolean flag); jclass RC_GetSuperclass(JNIEnv * env, jclass classobj); jboolean RC_IsAssignableFrom(JNIEnv *, jclass, jclass); @@ -76,81 +76,99 @@ jclass RC_GetObjectClass(JNIEnv * env, jobject obj); jboolean RC_IsInstanceOf(JNIEnv * env, jobject obj, jclass cls); jmethodID RC_GetMethodID(JNIEnv * env, jclass cls, const char * str1, const char * str2); -#define CALLMETHOD(R, T) R RC_Call ## T ## Method(JNIEnv *env, jobject obj, jmethodID mid, ...); +#define DCALLMETHOD(R, T) R RC_Call ## T ## Method(JNIEnv *env, jobject obj, jmethodID mid, ...); -#define CALLMETHODV(R, T) R RC_Call ## T ## MethodV(JNIEnv * env, jobject obj, jmethodID mid, va_list va); +#define DCALLMETHODV(R, T) R RC_Call ## T ## MethodV(JNIEnv * env, jobject obj, jmethodID mid, va_list va); -#define CALLMETHODA(R, T) R RC_Call ## T ## MethodA(JNIEnv * env, jobject obj, jmethodID mid, const jvalue * valarray); +#define DCALLMETHODA(R, T) R RC_Call ## T ## MethodA(JNIEnv * env, jobject obj, jmethodID mid, const jvalue * valarray); -#define CALLNVMETHOD(R, T) R RC_CallNonvirtual ## T ## Method(JNIEnv *env, jobject obj, jmethodID mid, ...); +#define DCALLNVMETHOD(R, T) R RC_CallNonvirtual ## T ## Method(JNIEnv *env, jobject obj, jclass cls, jmethodID mid, ...); -#define CALLNVMETHODV(R, T) R RC_CallNonvirtual ## T ## MethodV(JNIEnv * env, jobject obj, jmethodID mid, va_list va); +#define DCALLNVMETHODV(R, T) R RC_CallNonvirtual ## T ## MethodV(JNIEnv * env, jobject obj, jclass cls, jmethodID mid, va_list va); -#define CALLNVMETHODA(R, T) R RC_CallNonvirtual ## T ## MethodA(JNIEnv * env, jobject obj, jmethodID mid, const jvalue * valarray); +#define DCALLNVMETHODA(R, T) R RC_CallNonvirtual ## T ## MethodA(JNIEnv * env, jobject obj, jclass cls, jmethodID mid, const jvalue * valarray); -#define GETFIELD(R, T) R RC_Get ## T ## Field(JNIEnv *env, jobject obj, jfieldID fld); +#define DGETFIELD(R, T) R RC_Get ## T ## Field(JNIEnv *env, jobject obj, jfieldID fld); -#define SETFIELD(R, T) void RC_Set ## T ## Field(JNIEnv *env, jobject obj, jfieldID fld, R src); +#define DSETFIELD(R, T) void RC_Set ## T ## Field(JNIEnv *env, jobject obj, jfieldID fld, R src); -#define CALLSTMETHOD(R, T) R RC_CallStatic ## T ## Method(JNIEnv *env, jobject obj, jmethodID mid, ...); +#define DCALLSTMETHOD(R, T) R RC_CallStatic ## T ## Method(JNIEnv *env, jobject obj, jmethodID mid, ...); -#define CALLSTMETHODV(R, T) R RC_CallStatic ## T ## MethodV(JNIEnv * env, jobject obj, jmethodID mid, va_list va); +#define DCALLSTMETHODV(R, T) R RC_CallStatic ## T ## MethodV(JNIEnv * env, jobject obj, jmethodID mid, va_list va); -#define CALLSTMETHODA(R, T) R RC_CallStatic ## T ## MethodA(JNIEnv * env, jobject obj, jmethodID mid, const jvalue * valarray); +#define DCALLSTMETHODA(R, T) R RC_CallStatic ## T ## MethodA(JNIEnv * env, jobject obj, jmethodID mid, const jvalue * valarray); -#define GETSTFIELD(R, T) R RC_GetStatic ## T ## Field(JNIEnv *env, jclass cls, jfieldID fld); +#define DGETSTFIELD(R, T) R RC_GetStatic ## T ## Field(JNIEnv *env, jclass cls, jfieldID fld); -#define SETSTFIELD(R, T) void RC_SetStatic ## T ## Field(JNIEnv *env, jclass cls, jfieldID fld, R src); +#define DSETSTFIELD(R, T) void RC_SetStatic ## T ## Field(JNIEnv *env, jclass cls, jfieldID fld, R src); -#define NEWARRAY(R, T) R ## Array RC_New ## T ## Array(JNIEnv *env, jsize size); +#define DNEWARRAY(R, T) R ## Array RC_New ## T ## Array(JNIEnv *env, jsize size); -#define GETARRAY(R, T) R * RC_Get ## T ## ArrayElements(JNIEnv *env, R ## Array array, jboolean * b); +#define DGETARRAY(R, T) R * RC_Get ## T ## ArrayElements(JNIEnv *env, R ## Array array, jboolean * b); -#define RELEASEARRAY(R, T) void RC_Release ## T ## ArrayElements(JNIEnv *env, R ## Array array, R * ptr, jint num); +#define DRELEASEARRAY(R, T) void RC_Release ## T ## ArrayElements(JNIEnv *env, R ## Array array, R * ptr, jint num); -#define GETARRAYREGION(R, T) void RC_Get ## T ## ArrayRegion(JNIEnv *env, R ## Array array, jsize size1, jsize size2, R * ptr); +#define DGETARRAYREGION(R, T) void RC_Get ## T ## ArrayRegion(JNIEnv *env, R ## Array array, jsize size1, jsize size2, R * ptr); -#define SETARRAYREGION(R, T) void RC_Set ## T ## ArrayRegion(JNIEnv *env, R ## Array array, jsize size1, jsize size2, const R * ptr); +#define DSETARRAYREGION(R, T) void RC_Set ## T ## ArrayRegion(JNIEnv *env, R ## Array array, jsize size1, jsize size2, const R * ptr); -#define CALLSET(R, T) \ - CALLMETHODV(R, T) \ - CALLMETHOD(R, T) \ - CALLMETHODA(R, T) \ - CALLNVMETHODV(R, T) \ - CALLNVMETHOD(R, T) \ - CALLNVMETHODA(R, T) \ - GETFIELD(R, T) \ - SETFIELD(R, T) \ - CALLSTMETHODV(R, T) \ - CALLSTMETHOD(R, T) \ - CALLSTMETHODA(R, T) \ - GETSTFIELD(R, T) \ - SETSTFIELD(R, T) \ - NEWARRAY(R, T) \ - GETARRAY(R, T) \ - RELEASEARRAY(R, T) \ - GETARRAYREGION(R, T) \ - SETARRAYREGION(R, T) +#define DCALLSET(R, T) \ + DCALLMETHODV(R, T) \ + DCALLMETHOD(R, T) \ + DCALLMETHODA(R, T) \ + DCALLNVMETHODV(R, T) \ + DCALLNVMETHOD(R, T) \ + DCALLNVMETHODA(R, T) \ + DGETFIELD(R, T) \ + DSETFIELD(R, T) \ + DCALLSTMETHODV(R, T) \ + DCALLSTMETHOD(R, T) \ + DCALLSTMETHODA(R, T) \ + DGETSTFIELD(R, T) \ + DSETSTFIELD(R, T) \ + DNEWARRAY(R, T) \ + DGETARRAY(R, T) \ + DRELEASEARRAY(R, T) \ + DGETARRAYREGION(R, T) \ + DSETARRAYREGION(R, T) -CALLSET(jobject, Object); -CALLSET(jboolean, Boolean); -CALLSET(jbyte, Byte); -CALLSET(jchar, Char); -CALLSET(jshort, Short); -CALLSET(jint, Int); -CALLSET(jlong, Long); -CALLSET(jfloat, Float); -CALLSET(jdouble, Double); +DCALLMETHODV(jobject, Object) +DCALLMETHOD(jobject, Object) +DCALLMETHODA(jobject, Object) +DCALLNVMETHODV(jobject, Object) +DCALLNVMETHOD(jobject, Object) +DCALLNVMETHODA(jobject, Object) +DGETFIELD(jobject, Object) +DSETFIELD(jobject, Object) +DCALLSTMETHODV(jobject, Object) +DCALLSTMETHOD(jobject, Object) +DCALLSTMETHODA(jobject, Object) +DGETSTFIELD(jobject, Object) +DSETSTFIELD(jobject, Object) +DGETARRAY(jobject, Object) +DRELEASEARRAY(jobject, Object) +DGETARRAYREGION(jobject, Object) +DSETARRAYREGION(jobject, Object) +DCALLSET(jboolean, Boolean); +DCALLSET(jbyte, Byte); +DCALLSET(jchar, Char); +DCALLSET(jshort, Short); +DCALLSET(jint, Int); +DCALLSET(jlong, Long); +DCALLSET(jfloat, Float); +DCALLSET(jdouble, Double); + +jobjectArray RC_NewObjectArray(JNIEnv *env, jsize size, jclass cls, jobject obj); void RC_CallVoidMethodV(JNIEnv * env, jobject obj, jmethodID mid, va_list va); void RC_CallVoidMethod(JNIEnv *env, jobject obj, jmethodID mid, ...); void RC_CallVoidMethodA(JNIEnv * env, jobject obj, jmethodID mid, const jvalue * valarray); void RC_CallStaticVoidMethod(JNIEnv *env, jclass cls, jmethodID mid, ...); void RC_CallStaticVoidMethodV(JNIEnv * env, jclass cls, jmethodID mid, va_list va); void RC_CallStaticVoidMethodA(JNIEnv * env, jclass cls, jmethodID mid, const jvalue * valarray); -void RC_CallNonvirtualVoidMethod(JNIEnv *env, jobject obj, jmethodID mid, ...); -void RC_CallNonvirtualVoidMethodV(JNIEnv * env, jobject obj, jmethodID mid, va_list va); -void RC_CallNonvirtualVoidMethodA(JNIEnv * env, jobject obj, jmethodID mid, const jvalue * valarray); +void RC_CallNonvirtualVoidMethod(JNIEnv *env, jobject obj, jclass cls, jmethodID mid, ...); +void RC_CallNonvirtualVoidMethodV(JNIEnv * env, jobject obj, jclass cls, jmethodID mid, va_list va); +void RC_CallNonvirtualVoidMethodA(JNIEnv * env, jobject obj, jclass cls, jmethodID mid, const jvalue * valarray); jfieldID RC_GetFieldID(JNIEnv * env, jclass cls, const char * str1, const char * str2); jmethodID RC_GetStaticMethodID(JNIEnv * env, jclass cls, const char * str1, const char * str2); jfieldID RC_GetStaticFieldID(JNIEnv * env, jclass cls, const char * str1, const char * str2); diff --git a/Robust/src/Runtime/jni/jni-stuff.c b/Robust/src/Runtime/jni/jni-stuff.c index 1c991712..648989f4 100644 --- a/Robust/src/Runtime/jni/jni-stuff.c +++ b/Robust/src/Runtime/jni/jni-stuff.c @@ -1,5 +1,7 @@ #include #include +#include +#include #ifndef MAC __thread struct jnireferences * jnirefs; @@ -47,7 +49,7 @@ jmethodID RC_FromReflectedMethod(JNIEnv * env, jobject mthdobj) { return NULL; } -jmethodID RC_FromReflectedField(JNIEnv * env, jobject fldobj) { +jfieldID RC_FromReflectedField(JNIEnv * env, jobject fldobj) { printf("MISSING FEATURE IN %d\n",__LINE__); return NULL; } @@ -197,18 +199,18 @@ jmethodID RC_GetMethodID(JNIEnv * env, jclass cls, const char * str1, const char return (R)0; \ } -#define CALLNVMETHOD(R, T) R RC_CallNonvirtual ## T ## Method(JNIEnv *env, jobject obj, jmethodID mid, ...) { \ +#define CALLNVMETHOD(R, T) R RC_CallNonvirtual ## T ## Method(JNIEnv *env, jobject obj, jclass cls, jmethodID mid, ...) { \ va_list va; \ va_start(va, mid); \ - return RC_CallNonvirtual ## T ## MethodV(env, obj, mid, va); \ + return RC_CallNonvirtual ## T ## MethodV(env, obj, cls, mid, va); \ } -#define CALLNVMETHODV(R, T) R RC_CallNonvirtual ## T ## MethodV(JNIEnv * env, jobject obj, jmethodID mid, va_list va) { \ +#define CALLNVMETHODV(R, T) R RC_CallNonvirtual ## T ## MethodV(JNIEnv * env, jobject obj, jclass cls, jmethodID mid, va_list va) { \ printf("MISSING FEATURE IN %d\n",__LINE__); \ return (R)0; \ } -#define CALLNVMETHODA(R, T) R RC_CallNonvirtual ## T ## MethodA(JNIEnv * env, jobject obj, jmethodID mid, const jvalue * valarray) { \ +#define CALLNVMETHODA(R, T) R RC_CallNonvirtual ## T ## MethodA(JNIEnv * env, jobject obj, jclass cls, jmethodID mid, const jvalue * valarray) { \ printf("MISSING FEATURE IN %d\n",__LINE__); \ return (R)0; \ } @@ -289,22 +291,36 @@ jmethodID RC_GetMethodID(JNIEnv * env, jclass cls, const char * str1, const char GETARRAYREGION(R, T) \ SETARRAYREGION(R, T) -CALLSET(jobject, Object); +jobjectArray RC_NewObjectArray(JNIEnv *env, jsize size, jclass cls, jobject obj) { + printf("MISSING FEATURE IN %d\n",__LINE__); + return NULL; +} -CALLSET(jboolean, Boolean); +CALLMETHODV(jobject, Object) +CALLMETHOD(jobject, Object) +CALLMETHODA(jobject, Object) +CALLNVMETHODV(jobject, Object) +CALLNVMETHOD(jobject, Object) +CALLNVMETHODA(jobject, Object) +GETFIELD(jobject, Object) +SETFIELD(jobject, Object) +CALLSTMETHODV(jobject, Object) +CALLSTMETHOD(jobject, Object) +CALLSTMETHODA(jobject, Object) +GETSTFIELD(jobject, Object) +SETSTFIELD(jobject, Object) +GETARRAY(jobject, Object) +RELEASEARRAY(jobject, Object) +GETARRAYREGION(jobject, Object) +SETARRAYREGION(jobject, Object) +CALLSET(jboolean, Boolean); CALLSET(jbyte, Byte); - CALLSET(jchar, Char); - CALLSET(jshort, Short); - CALLSET(jint, Int); - CALLSET(jlong, Long); - CALLSET(jfloat, Float); - CALLSET(jdouble, Double); void RC_CallVoidMethodV(JNIEnv * env, jobject obj, jmethodID mid, va_list va) { @@ -321,30 +337,30 @@ void RC_CallVoidMethodA(JNIEnv * env, jobject obj, jmethodID mid, const jvalue * printf("MISSING FEATURE IN %d\n",__LINE__); } -void RC_CallNonvirtualVoidMethod(JNIEnv *env, jobject obj, jmethodID mid, ...) { +void RC_CallNonvirtualVoidMethod(JNIEnv *env, jobject obj, jclass cls, jmethodID mid, ...) { va_list va; va_start(va, mid); - RC_CallNonvirtualVoidMethodV(env, obj, mid, va); + RC_CallNonvirtualVoidMethodV(env, obj, cls, mid, va); } -void RC_CallNonvirtualVoidMethodV(JNIEnv * env, jobject obj, jmethodID mid, va_list va) { +void RC_CallNonvirtualVoidMethodV(JNIEnv * env, jobject obj, jclass cls, jmethodID mid, va_list va) { printf("MISSING FEATURE IN %d\n",__LINE__); } -void RC_CallNonvirtualVoidMethodA(JNIEnv * env, jobject obj, jmethodID mid, const jvalue * valarray) { +void RC_CallNonvirtualVoidMethodA(JNIEnv * env, jobject obj, jclass cls, jmethodID mid, const jvalue * valarray) { printf("MISSING FEATURE IN %d\n",__LINE__); } +void RC_CallStaticVoidMethodV(JNIEnv * env, jclass cls, jmethodID mid, va_list va) { + printf("MISSING FEATURE IN %d\n",__LINE__); +} + void RC_CallStaticVoidMethod(JNIEnv *env, jclass cls, jmethodID mid, ...) { va_list va; va_start(va, mid); - RC_CallStaticVoidMethodV(env, obj, mid, va); + RC_CallStaticVoidMethodV(env, cls, mid, va); } -void RC_CallStaticVoidMethodV(JNIEnv * env, jclass cls, jmethodID mid, va_list va) { - printf("MISSING FEATURE IN %d\n",__LINE__); -} - void RC_CallStaticVoidMethodA(JNIEnv * env, jclass cls, jmethodID mid, const jvalue * valarray) { printf("MISSING FEATURE IN %d\n",__LINE__); } @@ -408,7 +424,7 @@ void RC_ReleaseStringChars(JNIEnv * env, jstring str, const jchar * str2) { printf("MISSING FEATURE IN %d\n",__LINE__); } -jstring RC_NewStringUTF(JNIEnv * env, const char *str) +jstring RC_NewStringUTF(JNIEnv * env, const char *str) { printf("MISSING FEATURE IN %d\n",__LINE__); return NULL; } diff --git a/Robust/src/Runtime/jni/jni.c b/Robust/src/Runtime/jni/jni.c index 0e570d5c..7c0f3e2f 100644 --- a/Robust/src/Runtime/jni/jni.c +++ b/Robust/src/Runtime/jni/jni.c @@ -1,4 +1,3 @@ -#include #include struct JNINativeInterface_ JNI_vtable = { diff --git a/Robust/src/Runtime/thread.c b/Robust/src/Runtime/thread.c index f3b01829..85ad761a 100644 --- a/Robust/src/Runtime/thread.c +++ b/Robust/src/Runtime/thread.c @@ -303,6 +303,7 @@ void initializethreads() { #if defined(THREADS)||defined(STM) int threadcounter=0; +#ifdef D___Thread______nativeCreate____ void initthread(struct ___Thread___ * ___this___) { #ifdef AFFINITY set_affinity(); @@ -423,6 +424,7 @@ void initthread(struct ___Thread___ * ___this___) { pthread_mutex_unlock(&gclistlock); } #endif +#endif #ifdef D___Thread______sleep____J void CALL11(___Thread______sleep____J, long long ___millis___, long long ___millis___) { -- 2.34.1