[kaffe] CVS kaffe (doogie): Lots and lots of warnings fixed(over 350 this time around).
Kaffe CVS
Kaffe Mailing List <kaffe@kaffe.org>
Fri Apr 2 19:12:03 2004
PatchSet 4610
Date: 2004/04/03 02:57:44
Author: doogie
Branch: HEAD
Tag: (none)
Log:
Lots and lots of warnings fixed(over 350 this time around).
Members:
ChangeLog:1.2187->1.2188
kaffe/kaffe/main.c:1.50->1.51
kaffe/kaffevm/exception.h:1.24->1.25
kaffe/kaffevm/external.c:1.54->1.55
kaffe/kaffevm/external.h:1.6->1.7
kaffe/kaffevm/hashtab.c:1.10->1.11
kaffe/kaffevm/jni.c:1.106->1.107
kaffe/kaffevm/sha-1.c:1.1->1.2
kaffe/kaffevm/soft.h:1.15->1.16
kaffe/kaffevm/string.c:1.29->1.30
kaffe/kaffevm/thread.c:1.59->1.60
kaffe/kaffevm/systems/unix-jthreads/config-jthreads.h:1.10->1.11
kaffe/kaffevm/systems/unix-jthreads/jthread.c:1.110->1.111
kaffe/kaffevm/systems/unix-jthreads/jthread.h:1.55->1.56
libraries/clib/native/Class.c:1.70->1.71
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2187 kaffe/ChangeLog:1.2188
--- kaffe/ChangeLog:1.2187 Sat Apr 3 00:06:12 2004
+++ kaffe/ChangeLog Sat Apr 3 02:57:44 2004
@@ -1,5 +1,18 @@
2004-04-02 Adam Heath <doogie@debian.org>
+ * kaffe/kaffe/main.c, kaffe/kaffevm/exception.h,
+ kaffe/kaffevm/external.c, kaffe/kaffevm/external.h,
+ kaffe/kaffevm/hashtab.c, kaffe/kaffevm/jni.c,
+ kaffe/kaffevm/sha-1.c, kaffe/kaffevm/soft.h,
+ kaffe/kaffevm/string.c, kaffe/kaffevm/thread.c,
+ kaffe/kaffevm/systems/unix-jthreads/config-jthreads.h,
+ kaffe/kaffevm/systems/unix-jthreads/jthread.c,
+ kaffe/kaffevm/systems/unix-jthreads/jthread.h,
+ libraries/clib/native/Class.c:
+ Lots and lots of warnings fixed(over 350 this time around).
+
+2004-04-02 Adam Heath <doogie@debian.org>
+
* kaffe/kaffevm/soft.c, kaffe/kaffevm/stackTrace.c,
kaffe/kaffevm/string.c, kaffe/kaffevm/mem/gc-incremental.c,
kaffe/kaffevm/mem/gc-mem.c, libraries/clib/awt/X/cbd.c,
Index: kaffe/kaffe/kaffe/main.c
diff -u kaffe/kaffe/kaffe/main.c:1.50 kaffe/kaffe/kaffe/main.c:1.51
--- kaffe/kaffe/kaffe/main.c:1.50 Thu Jan 15 02:29:29 2004
+++ kaffe/kaffe/kaffe/main.c Sat Apr 3 02:57:44 2004
@@ -42,12 +42,12 @@
#include "jni.h"
JavaVMInitArgs vmargs;
-JNIEnv* env;
-JavaVM* vm;
+JNIEnv* global_env;
+JavaVM* global_vm;
static int isJar = 0;
static char *jvm_onload;
-static int options(char**);
+static int options(char**, int);
static void usage(void);
static size_t parseSize(char*);
static int checkException(void);
@@ -69,7 +69,7 @@
main(int argc, char* argv[])
{
int farg;
- char* cp;
+ const char* cp;
#if defined(MAIN_MD)
/* Machine specific main first */
@@ -121,7 +121,7 @@
vmargs.classhome = cp;
/* Process program options */
- farg = options(argv);
+ farg = options(argv, argc);
argc = argc - farg;
#if defined(KAFFE_XPROFILER)
@@ -144,14 +144,14 @@
}
/* Initialise */
- JNI_CreateJavaVM(&vm, &env, &vmargs);
+ JNI_CreateJavaVM(&global_vm, &global_env, &vmargs);
/* Handle the '-Xrun' argument. */
if( jvm_onload != NULL )
{
char *libpath, *libargs;
char errbuf[512];
- int index;
+ int i;
/* XXX Pull findLibrary() from the JanosVM. */
libpath = &jvm_onload[2];
@@ -165,15 +165,15 @@
libargs += 1;
}
- index = loadNativeLibrary(libpath, errbuf, sizeof(errbuf));
- if( index > 0 )
+ i = loadNativeLibrary(libpath, errbuf, sizeof(errbuf));
+ if( i > 0 )
{
jint (*onload_func)(JavaVM *jvm, char *, void *);
if( (onload_func =
loadNativeLibrarySym("JVM_OnLoad")) != NULL )
{
- (void)onload_func(vm, libargs, NULL);
+ (void)onload_func(global_vm, libargs, NULL);
}
}
else
@@ -186,7 +186,7 @@
}
}
- return (main2(env, argv, farg, argc));
+ return (main2(global_env, argv, farg, argc));
}
/*
@@ -236,7 +236,7 @@
jobject str;
jobject loader;
int i;
- char* exec;
+ const char* exec;
/* make sure no compiler optimizes this away */
gc_safe_zone[0] = gc_safe_zone[sizeof gc_safe_zone - 1] = 0;
@@ -306,14 +306,14 @@
cls = (*env)->FindClass(env, "java/lang/String");
if (checkException())
goto done;
- args = (*env)->NewObjectArray(env, argc, cls, 0);
+ args = (*env)->NewObjectArray(env, (unsigned)argc, cls, 0);
if (checkException())
goto done;
for (i = 0; i < argc; i++) {
str = (*env)->NewStringUTF(env, argv[farg+i]);
if (checkException())
goto done;
- (*env)->SetObjectArrayElement(env, args, i, str);
+ (*env)->SetObjectArrayElement(env, args, (unsigned)i, str);
if (checkException())
goto done;
}
@@ -325,7 +325,7 @@
done:
/* We're done. We are the "main thread" and so are required to call
(*vm)->DestroyJavaVM() instead of (*vm)->DetachCurrentThread() */
- (*vm)->DestroyJavaVM(vm);
+ (*global_vm)->DestroyJavaVM(global_vm);
return (0);
}
@@ -336,27 +336,27 @@
jclass eiic;
/* Display exception stack trace */
- if ((e = (*env)->ExceptionOccurred(env)) == NULL)
+ if ((e = (*global_env)->ExceptionOccurred(global_env)) == NULL)
return (0);
- (*env)->ExceptionDescribe(env);
- (*env)->ExceptionClear(env);
+ (*global_env)->ExceptionDescribe(global_env);
+ (*global_env)->ExceptionClear(global_env);
/* Display inner exception in ExceptionInInitializerError case */
- eiic = (*env)->FindClass(env, "java/lang/ExceptionInInitializerError");
- if ((*env)->ExceptionOccurred(env) != NULL) {
- (*env)->ExceptionClear(env);
+ eiic = (*global_env)->FindClass(global_env, "java/lang/ExceptionInInitializerError");
+ if ((*global_env)->ExceptionOccurred(global_env) != NULL) {
+ (*global_env)->ExceptionClear(global_env);
return (1);
}
- if ((*env)->IsInstanceOf(env, e, eiic)) {
- e = (*env)->CallObjectMethod(env, e,
- (*env)->GetMethodID(env, (*env)->GetObjectClass(env, e),
+ if ((*global_env)->IsInstanceOf(global_env, e, eiic)) {
+ e = (*global_env)->CallObjectMethod(global_env, e,
+ (*global_env)->GetMethodID(global_env, (*global_env)->GetObjectClass(global_env, e),
"getException", "()Ljava/lang/Throwable;"));
- if ((*env)->ExceptionOccurred(env) != NULL) {
- (*env)->ExceptionClear(env);
+ if ((*global_env)->ExceptionOccurred(global_env) != NULL) {
+ (*global_env)->ExceptionClear(global_env);
return (1);
}
if (e != NULL) {
- (*env)->Throw(env, e);
+ (*global_env)->Throw(global_env, e);
return (checkException());
}
}
@@ -368,13 +368,14 @@
*/
static
int
-options(char** argv)
+options(char** argv, int argc)
{
- int i,j;
- int sz;
+ int i;
+ unsigned int j;
+ size_t sz;
userProperty* prop;
- for (i = 1; argv[i] != 0; i++) {
+ for (i = 1; i < argc; i++) {
if (argv[i][0] != '-') {
break;
}
@@ -401,7 +402,7 @@
|| (strcmp(argv[i], "-classpath") == 0)
|| (strcmp(argv[i], "-cp") == 0)) {
char *newcpath;
- int cpathlength;
+ unsigned int cpathlength;
i++;
if (argv[i] == 0) {
@@ -435,7 +436,7 @@
}
else if (strncmp(argv[i], "-Xbootclasspath/p:", (j=18)) == 0) {
char *newbootcpath;
- int bootcpathlength;
+ unsigned int bootcpathlength;
bootcpathlength = strlen(&argv[i][j])
+ strlen(path_separator)
Index: kaffe/kaffe/kaffevm/exception.h
diff -u kaffe/kaffe/kaffevm/exception.h:1.24 kaffe/kaffe/kaffevm/exception.h:1.25
--- kaffe/kaffe/kaffevm/exception.h:1.24 Mon Mar 29 20:24:30 2004
+++ kaffe/kaffe/kaffevm/exception.h Sat Apr 3 02:57:43 2004
@@ -105,8 +105,8 @@
extern void initExceptions(void);
static inline bool vmExcept_isJNIFrame(VmExceptHandler* eh) __UNUSED__;
-static inline bool vmExcept_JNIContains(VmExceptHandler* eh, uintp pc) __UNUSED__;
-static inline void vmExcept_setJNIFrame(VmExceptHandler* eh, uintp fp) __UNUSED__;
+static inline bool vmExcept_JNIContains(VmExceptHandler* eh, void *pc) __UNUSED__;
+static inline void vmExcept_setJNIFrame(VmExceptHandler* eh, void *fp) __UNUSED__;
static inline struct _methods* vmExcept_getMeth(VmExceptHandler* eh) __UNUSED__;
static inline void vmExcept_setMeth(VmExceptHandler* eh, struct _methods* m) __UNUSED__;
static inline void vmExcept_setSyncObj(VmExceptHandler* eh, struct Hjava_lang_Object* syncobj) __UNUSED__;
@@ -123,7 +123,7 @@
}
static inline bool
-vmExcept_JNIContains(VmExceptHandler* eh, uintp fp)
+vmExcept_JNIContains(VmExceptHandler* eh, void *fp)
{
assert(eh);
assert(eh->meth == VMEXCEPTHANDLER_KAFFEJNI_HANDLER);
@@ -133,7 +133,7 @@
}
static inline void
-vmExcept_setJNIFrame(VmExceptHandler* eh, uintp fp)
+vmExcept_setJNIFrame(VmExceptHandler* eh, void *fp)
{
assert(eh);
assert(fp != 0);
Index: kaffe/kaffe/kaffevm/external.c
diff -u kaffe/kaffe/kaffevm/external.c:1.54 kaffe/kaffe/kaffevm/external.c:1.55
--- kaffe/kaffe/kaffevm/external.c:1.54 Mon Mar 29 21:39:14 2004
+++ kaffe/kaffe/kaffevm/external.c Sat Apr 3 02:57:43 2004
@@ -389,7 +389,7 @@
* Get pointer to symbol from symbol name.
*/
void*
-loadNativeLibrarySym(char* name)
+loadNativeLibrarySym(const char* name)
{
void* func;
Index: kaffe/kaffe/kaffevm/external.h
diff -u kaffe/kaffe/kaffevm/external.h:1.6 kaffe/kaffe/kaffevm/external.h:1.7
--- kaffe/kaffe/kaffevm/external.h:1.6 Tue May 23 17:55:35 2000
+++ kaffe/kaffe/kaffevm/external.h Sat Apr 3 02:57:43 2004
@@ -29,7 +29,7 @@
int loadNativeLibrary(char*, char*, size_t);
int loadNativeLibrary2(char*, int, char*, size_t);
void unloadNativeLibrary(int);
-void* loadNativeLibrarySym(char*);
+void* loadNativeLibrarySym(const char*);
bool native(struct _methods*, struct _errorInfo*);
void addNativeFunc(char*, void*);
char* getLibraryPath(void);
Index: kaffe/kaffe/kaffevm/hashtab.c
diff -u kaffe/kaffe/kaffevm/hashtab.c:1.10 kaffe/kaffe/kaffevm/hashtab.c:1.11
--- kaffe/kaffe/kaffevm/hashtab.c:1.10 Tue Jan 21 11:28:16 2003
+++ kaffe/kaffe/kaffevm/hashtab.c Sat Apr 3 02:57:43 2004
@@ -246,12 +246,12 @@
if (ptr != NULL && ptr != DELETED) {
const int hash = (*tab->hash)(ptr);
const int step = LIST_STEP(hash);
- int index;
+ int i;
- for (index = hash & (newSize - 1);
- newList[index] != NULL;
- index = (index + step) & (newSize - 1));
- newList[index] = ptr;
+ for (i = hash & (newSize - 1);
+ newList[i] != NULL;
+ i = (i + step) & (newSize - 1));
+ newList[i] = ptr;
}
}
Index: kaffe/kaffe/kaffevm/jni.c
diff -u kaffe/kaffe/kaffevm/jni.c:1.106 kaffe/kaffe/kaffevm/jni.c:1.107
--- kaffe/kaffe/kaffevm/jni.c:1.106 Fri Apr 2 21:27:45 2004
+++ kaffe/kaffe/kaffevm/jni.c Sat Apr 3 02:57:43 2004
@@ -103,7 +103,7 @@
*/
#if defined(TRANSLATOR)
#define KAFFE_JNI_SETEXCEPTFP(ebufp) { \
- vmExcept_setJNIFrame(ebufp,(uintp)__builtin_frame_address(0));\
+ vmExcept_setJNIFrame(ebufp, __builtin_frame_address(0));\
}
#else
/*
@@ -113,7 +113,7 @@
* a JNIFrame so the stack trace code can ignore it.
*/
#define KAFFE_JNI_SETEXCEPTFP(ebufp) { \
- vmExcept_setJNIFrame(ebufp, (uintp)ebufp); \
+ vmExcept_setJNIFrame(ebufp, ebufp); \
}
#endif
@@ -3574,12 +3574,12 @@
}
static jint
+NONRETURNING
Kaffe_DestroyJavaVM(JavaVM* vm UNUSED)
{
/* Right now, calling this from main2 is what prevents us from
exiting there */
exitThread();
- return (0);
}
static jint
Index: kaffe/kaffe/kaffevm/sha-1.c
diff -u kaffe/kaffe/kaffevm/sha-1.c:1.1 kaffe/kaffe/kaffevm/sha-1.c:1.2
--- kaffe/kaffe/kaffevm/sha-1.c:1.1 Thu Jul 22 02:19:11 1999
+++ kaffe/kaffe/kaffevm/sha-1.c Sat Apr 3 02:57:43 2004
@@ -122,7 +122,6 @@
}
else
{
- int ew,ec;
c->num+=(int)len;
if ((sc+len) < 4) /* ugly, add char's to a word */
Index: kaffe/kaffe/kaffevm/soft.h
diff -u kaffe/kaffe/kaffevm/soft.h:1.15 kaffe/kaffe/kaffevm/soft.h:1.16
--- kaffe/kaffe/kaffevm/soft.h:1.15 Mon Mar 29 21:13:33 2004
+++ kaffe/kaffe/kaffevm/soft.h Sat Apr 3 02:57:43 2004
@@ -29,7 +29,7 @@
void* soft_checkcast(struct Hjava_lang_Class*, struct Hjava_lang_Object*);
jint soft_instanceof(struct Hjava_lang_Class*, struct Hjava_lang_Object*);
-void soft_athrow(struct Hjava_lang_Object*);
+void soft_athrow(struct Hjava_lang_Object*) NONRETURNING;
void soft_badarrayindex(void) NONRETURNING;
void soft_nullpointer(void) NONRETURNING;
void soft_divzero(void) NONRETURNING;
Index: kaffe/kaffe/kaffevm/string.c
diff -u kaffe/kaffe/kaffevm/string.c:1.29 kaffe/kaffe/kaffevm/string.c:1.30
--- kaffe/kaffe/kaffevm/string.c:1.29 Sat Apr 3 00:06:10 2004
+++ kaffe/kaffe/kaffevm/string.c Sat Apr 3 02:57:43 2004
@@ -429,7 +429,7 @@
/* Look for it already in the intern hash table */
if (hashTable != NULL) {
- Hjava_lang_String *string, fakeString;
+ Hjava_lang_String fakeString;
HArrayOfChar *fakeAry;
unsigned char buf[200];
Index: kaffe/kaffe/kaffevm/thread.c
diff -u kaffe/kaffe/kaffevm/thread.c:1.59 kaffe/kaffe/kaffevm/thread.c:1.60
--- kaffe/kaffe/kaffevm/thread.c:1.59 Mon Mar 29 21:13:33 2004
+++ kaffe/kaffe/kaffevm/thread.c Sat Apr 3 02:57:43 2004
@@ -44,7 +44,7 @@
extern struct JNINativeInterface Kaffe_JNINativeInterface;
-static int threadStackSize; /* native stack size */
+static size_t threadStackSize; /* native stack size */
/* referenced by native/Runtime.c */
jbool runFinalizerOnExit; /* should we run finalizers? */
@@ -152,12 +152,12 @@
static jthread_t
-createThread(Hjava_lang_Thread* tid, void* func, size_t stacksize,
+createThread(Hjava_lang_Thread* tid, void (*func)(void *), size_t stacksize,
struct _errorInfo *einfo)
{
jthread_t nativeThread;
- nativeThread = jthread_create(unhand(tid)->priority,
+ nativeThread = jthread_create((unsigned char)unhand(tid)->priority,
func,
unhand(tid)->daemon,
tid,
@@ -285,7 +285,7 @@
*/
static
void
-startSpecialThread(void *arg)
+startSpecialThread(void *arg UNUSED)
{
void (*func)(void *);
void *argument;
@@ -358,7 +358,8 @@
*/
static
void
-firstStartThread(void* arg)
+NONRETURNING
+firstStartThread(void* arg UNUSED)
{
Hjava_lang_Thread* tid;
jthread_t cur;
@@ -651,10 +652,10 @@
* Return the name of a java thread, given its native thread pointer.
*/
char*
-nameNativeThread(void* native)
+nameNativeThread(void* native_data)
{
return nameThread((Hjava_lang_Thread*)
- jthread_get_data((jthread_t)native)->jlThread);
+ jthread_get_data((jthread_t)native_data)->jlThread);
}
/*
@@ -713,7 +714,7 @@
* Since everything is stored in the threadData struct now, we can simply
* attach a faked java.lang.Thread instance later on.
*/
- jthread_createfirst(MAINSTACKSIZE, java_lang_Thread_NORM_PRIORITY, 0);
+ jthread_createfirst(MAINSTACKSIZE, (unsigned char)java_lang_Thread_NORM_PRIORITY, 0);
/*
* initialize some things that are absolutely necessary:
Index: kaffe/kaffe/kaffevm/systems/unix-jthreads/config-jthreads.h
diff -u kaffe/kaffe/kaffevm/systems/unix-jthreads/config-jthreads.h:1.10 kaffe/kaffe/kaffevm/systems/unix-jthreads/config-jthreads.h:1.11
--- kaffe/kaffe/kaffevm/systems/unix-jthreads/config-jthreads.h:1.10 Mon Mar 29 21:13:34 2004
+++ kaffe/kaffe/kaffevm/systems/unix-jthreads/config-jthreads.h Sat Apr 3 02:57:45 2004
@@ -137,9 +137,6 @@
return (((jlong)tm.tv_sec * 1000L) + ((jlong)tm.tv_usec / 1000L));
}
-/* let main thread loop until all threads finish, for tests */
-void jthread_exit_when_done() NONRETURNING;
-
/* debug.h stuff */
#ifdef KAFFE_VMDEBUG
#define DBG(x, y) y
Index: kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.c
diff -u kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.c:1.110 kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.c:1.111
--- kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.c:1.110 Mon Mar 29 21:13:35 2004
+++ kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.c Sat Apr 3 02:57:45 2004
@@ -14,6 +14,7 @@
* Tim Wilkinson <tim@transvirtual.com>
*/
+#include "config.h"
#include "jthread.h"
#include "jsignal.h"
#include "xprofiler.h"
@@ -538,7 +539,7 @@
* priority.
*/
static void
-handleVtAlarm(int sig, SIGNAL_CONTEXT_POINTER(sc))
+handleVtAlarm(int sig UNUSED, SIGNAL_CONTEXT_POINTER(sc UNUSED))
{
static int c;
@@ -570,11 +571,11 @@
alarmException(void)
{
jthread* jtid;
- jlong time;
+ jlong curTime;
/* Wake all the threads which need waking */
- time = currentTime();
- while (alarmList != 0 && JTHREADQ(alarmList)->time <= time) {
+ curTime = currentTime();
+ while (alarmList != 0 && JTHREADQ(alarmList)->time <= curTime) {
KaffeNodeQueue* node = alarmList;
/* Restart thread - this will tidy up the alarm and blocked
* queues.
@@ -588,7 +589,7 @@
/* Restart alarm */
if (alarmList != 0) {
- MALARM(JTHREADQ(alarmList)->time - time);
+ MALARM(JTHREADQ(alarmList)->time - curTime);
}
}
@@ -601,7 +602,7 @@
static char b[256]; /* plenty */
struct {
int flagvalue;
- char *flagname;
+ const char *flagname;
} flags[] = {
{ THREAD_FLAGS_GENERAL, "GENERAL" },
{ THREAD_FLAGS_NOSTACKALLOC, "NOSTACKALLOC" },
@@ -858,14 +859,14 @@
* Return true if thread was interrupted.
*/
static int
-suspendOnQThread(jthread* jtid, KaffeNodeQueue** queue, jlong timeout)
+suspendOnQThread(jthread* jtid, KaffeNodeQueue** queue, long timeout)
{
int rc = false;
KaffeNodeQueue** ntid;
KaffeNodeQueue* last;
DBG(JTHREAD, dprintf("suspendOnQThread %p %p (%ld) bI %d\n",
- jtid, queue, (long) timeout, blockInts); )
+ jtid, queue, timeout, blockInts); )
assert(timeout >= 0 || timeout == NOTIMEOUT);
assert(intsDisabled());
@@ -902,7 +903,7 @@
/* If I have a timeout, insert into alarmq */
if (timeout != NOTIMEOUT) {
- addToAlarmQ(jtid, timeout);
+ addToAlarmQ(jtid, (jlong)timeout);
}
/* If I was running, reschedule */
@@ -1010,7 +1011,7 @@
* Allocate a new thread context and stack.
*/
static jthread*
-newThreadCtx(int stackSize)
+newThreadCtx(size_t stackSize)
{
jthread *ct;
@@ -1083,7 +1084,7 @@
* XXX this is supposed to count the number of stack frames
*/
int
-jthread_frames(jthread *thrd)
+jthread_frames(jthread *thrd UNUSED)
{
return (0);
}
@@ -1470,7 +1471,7 @@
* create a new jthread
*/
jthread *
-jthread_create(unsigned char pri, void (*func)(void *), int daemon,
+jthread_create(unsigned char pri, void (*func)(void *), int isDaemon,
void *jlThread, size_t threadStackSize)
{
KaffeNodeQueue *liveQ;
@@ -1513,11 +1514,11 @@
liveThreads = liveQ;
talive++;
- if ((jtid->daemon = daemon) != 0) {
+ if ((jtid->daemon = isDaemon) != 0) {
tdaemon++;
}
DBG(JTHREAD,
- dprintf("creating thread %p, daemon=%d\n", jtid, daemon); )
+ dprintf("creating thread %p, daemon=%d\n", jtid, isDaemon); )
jmutex_unlock(&threadLock);
assert(func != 0);
@@ -1700,14 +1701,14 @@
/* Spinlocks: simple since we're uniprocessor */
/* ARGSUSED */
void
-jthread_spinon(void *arg)
+jthread_spinon(void *arg UNUSED)
{
jthread_suspendall();
}
/* ARGSUSED */
void
-jthread_spinoff(void *arg)
+jthread_spinoff(void *arg UNUSED)
{
jthread_unsuspendall();
}
@@ -1727,14 +1728,14 @@
* sleep for time milliseconds
*/
void
-jthread_sleep(jlong time)
+jthread_sleep(jlong millis)
{
- if (time == 0) {
+ if (millis == 0) {
return;
}
intsDisable();
BLOCKED_ON_EXTERNAL(currentJThread);
- suspendOnQThread(currentJThread, 0, time);
+ suspendOnQThread(currentJThread, 0, (long)millis);
intsRestore();
}
@@ -1905,7 +1906,7 @@
intsDisable();
for (;;) {
killThread(currentJThread);
- jthread_sleep(1000);
+ jthread_sleep((jlong) 1000);
}
}
@@ -2077,13 +2078,13 @@
*/
static
void
-handleIO(int sleep)
+handleIO(int canSleep)
{
int r;
/* NB: both pollarray and rd, wr are thread-local */
#if USE_POLL
/* for poll(2) */
- int nfd;
+ unsigned int nfd, i;
#if DONT_USE_ALLOCA
struct pollfd pollarray[FD_SETSIZE]; /* huge (use alloca?) */
#else
@@ -2094,19 +2095,20 @@
fd_set rd;
fd_set wr;
struct timeval zero = { 0, 0 };
+ int i;
#endif
- int i, b = 0;
+ int b = 0;
assert(intsDisabled());
DBG(JTHREADDETAIL,
- dprintf("handleIO(sleep=%d)\n", sleep); )
+ dprintf("handleIO(sleep=%d)\n", canSleep); )
#if USE_POLL
/* Build pollarray from fd_sets.
* This is probably not the most efficient way to handle this.
*/
- for (nfd = 0, i = 0; i <= maxFd; i++) {
+ for (nfd = 0, i = 0; (int)i <= maxFd; i++) {
short ev = 0;
if (readQ[i] != 0) { /* FD_ISSET(i, &readsPending) */
/* Check for POLLIN and POLLHUP for portability.
@@ -2134,7 +2136,7 @@
* figure out which fds are ready
*/
retry:
- if (sleep) {
+ if (canSleep) {
b = blockInts;
/* NB: BEGIN unprotected region */
blockInts = 0;
@@ -2148,14 +2150,14 @@
#endif
}
#if USE_POLL
- r = poll(pollarray, nfd, sleep ? -1 : 0);
+ r = poll(pollarray, nfd, canSleep ? -1 : 0);
#else
- r = select(maxFd+1, &rd, &wr, 0, sleep ? 0 : &zero);
+ r = select(maxFd+1, &rd, &wr, 0, canSleep ? 0 : &zero);
#endif
/* Reset wouldlosewakeup here */
wouldlosewakeup = 0;
- if (sleep) {
+ if (canSleep) {
int can_read_from_pipe = 0;
blockInts = b;
/* NB: END unprotected region */
@@ -2366,7 +2368,7 @@
/* wait to be signaled */
current->flags |= THREAD_FLAGS_WAIT_CONDVAR;
- r = suspendOnQThread(current, cv, timeout);
+ r = suspendOnQThread(current, cv, (long) timeout);
current->flags &= ~THREAD_FLAGS_WAIT_CONDVAR;
/* reacquire mutex */
current->flags |= THREAD_FLAGS_WAIT_MUTEX;
@@ -2554,7 +2556,7 @@
}
}
-static void
+static void NONRETURNING
restore_fds_and_exit()
{
restore_fds();
@@ -2710,7 +2712,7 @@
intsDisable();
SET_DEADLINE(deadline, timeout)
for (;;) {
- r = connect(fd, addr, len);
+ r = connect(fd, addr, (socklen_t)len);
if (r == 0 || !(errno == EINPROGRESS
|| errno == EINTR || errno == EISCONN)) {
break; /* success or real error */
@@ -2821,7 +2823,7 @@
ssize_t r = 1;
/* absolute time at which timeout is reached */
jlong deadline = 0;
- const void *ptr = buf;
+ const char *ptr = buf;
assert(timeout >= 0 || timeout == NOTIMEOUT);
intsDisable();
@@ -2829,9 +2831,9 @@
while (len > 0 && r > 0) {
r = write(fd, ptr, len);
if (r >= 0) {
- (char *) ptr += r;
+ ptr += r;
len -= r;
- r = (char *) ptr - (char *) buf;
+ r = ptr - (const char *) buf;
continue;
}
if (!(errno == EWOULDBLOCK || errno == EINTR
@@ -2845,7 +2847,7 @@
if (blockOnFile(fd, TH_WRITE, timeout)) {
/* interrupted by jthread_interrupt() */
errno = EINTR;
- *out = (char *) ptr - (char *) buf;
+ *out = ptr - (const char *) buf;
break;
}
BREAK_IF_LATE(deadline, timeout)
@@ -2872,7 +2874,7 @@
jthreadedWrite(int fd, const void* buf, size_t len, ssize_t *out)
{
ssize_t r = 1;
- const void* ptr;
+ const char* ptr;
ptr = buf;
@@ -2880,9 +2882,9 @@
while (len > 0 && r > 0) {
r = (ssize_t)write(fd, ptr, len);
if (r >= 0) {
- (char *) ptr += r;
+ ptr += r;
len -= r;
- r = (char *) ptr - (char *) buf;
+ r = ptr - (const char *) buf;
continue;
}
if (errno == EINTR) {
@@ -2897,13 +2899,13 @@
/* must be EWOULDBLOCK or EAGAIN */
if (!blockingFD[fd]) {
errno = EWOULDBLOCK;
- *out = (char *) ptr - (char *) buf;
+ *out = ptr - (const char *) buf;
break;
}
if (blockOnFile(fd, TH_WRITE, NOTIMEOUT)) {
/* interrupted by jthread_interrupt() */
errno = EINTR;
- *out = (char *) ptr - (char *) buf;
+ *out = ptr - (const char *) buf;
break;
}
r = 1;
@@ -3166,7 +3168,7 @@
int rc = 0;
struct timeval tval;
int i;
- jlong time_milli;
+ long time_milli;
int second_time = 0;
assert(a < FD_SETSIZE);
Index: kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.h
diff -u kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.h:1.55 kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.h:1.56
--- kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.h:1.55 Fri Apr 2 20:14:42 2004
+++ kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.h Sat Apr 3 02:57:46 2004
@@ -348,6 +348,9 @@
int jthread_has_run(jthread_t jt);
+/* let main thread loop until all threads finish, for tests */
+void jthread_exit_when_done(void) NONRETURNING;
+
static inline
bool jthread_attach_current_thread(bool isDaemon UNUSED)
{
Index: kaffe/libraries/clib/native/Class.c
diff -u kaffe/libraries/clib/native/Class.c:1.70 kaffe/libraries/clib/native/Class.c:1.71
--- kaffe/libraries/clib/native/Class.c:1.70 Sat Mar 27 16:07:33 2004
+++ kaffe/libraries/clib/native/Class.c Sat Apr 3 02:57:46 2004
@@ -861,7 +861,6 @@
do {
Field* fld = CLASS_FIELDS(clas);
int n = CLASS_NFIELDS(clas);
- int i;
for (i = 0; i < n; ++fld, ++i) {
if (((fld->accflags & ACC_PUBLIC) || declared)
&& utf8ConstEqualJavaString(fld->name, name)) {