Philipp Tomsich
Christian Thalinger
- $Id: headers.c 2464 2005-05-12 23:55:10Z twisti $
+ $Id: headers.c 2517 2005-05-23 10:33:06Z twisti $
*/
#include <assert.h>
+#include <ctype.h>
#include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include "config.h"
case 'F': fprintf (file, "java_floatarray*"); break;
case 'D': fprintf (file, "java_doublearray*"); break;
- case '[': fprintf (file, "java_objectarray*");
- while ((c = utf_nextu2(&utf_ptr)) == '[') ;
- if (c=='L')
+ case '[': fprintf(file, "java_objectarray*");
+ while ((c = utf_nextu2(&utf_ptr)) == '[');
+ if (c == 'L')
while (utf_nextu2(&utf_ptr) != ';');
break;
- case 'L': fprintf (file, "java_objectarray*");
- while ( utf_nextu2(&utf_ptr) != ';');
+ case 'L': fprintf(file, "java_objectarray*");
+ while (utf_nextu2(&utf_ptr) != ';');
break;
- default: panic ("invalid type descriptor");
+ default:
+ log_text("invalid type descriptor");
+ assert(0);
}
break;
fprintf (file, "*");
break;
- default: panic ("Unknown type in field descriptor");
+ default:
+ log_text("Unknown type in field descriptor");
+ assert(0);
}
return utf_ptr;
}
file = fopen(header_filename, "w");
- if (!file)
- panic("Can not open file to store header information");
+ if (!file) {
+ log_text("Can not open file to store header information");
+ assert(0);
+ }
- fprintf(file, "/* This file is machine generated, don't edit it !*/\n\n");
+ fprintf(file, "/* This file is machine generated, don't edit it! */\n\n");
/* convert to uppercase */
for (i = 0; classname[i]; i++) {
}
/* Allocate a thread to be the main thread */
- if (!load_class_bootstrap(utf_new_char("java/lang/Thread"),&c))
- panic("Could not load java/lang/Thread");
+ if (!load_class_bootstrap(utf_new_char("java/lang/Thread"),&c)) {
+ log_text("Could not load java/lang/Thread");
+ assert(0);
+ }
+
liveThreads = the_main_thread =
(thread *) builtin_new(c);
the_main_thread->vmThread=init_vmthread(the_main_thread);
if (contexts[i]==0)
break;
- if (i == MAXTHREADS)
- panic("Too many threads");
+ if (i == MAXTHREADS) {
+ log_text("Too many threads");
+ assert(0);
+ }
assert(tid->priority >= MIN_THREAD_PRIO && tid->priority <= MAX_THREAD_PRIO);
contexts[i]=tid->vmThread;
/* tid->PrivateInfo = i + 1;
CONTEXT(tid).free = false;*/
if (tid->vmThread==0) {
- panic("vmThread field not set");
+ log_text("vmThread field not set");
+ assert(0);
/* tid->vmThread=init_vmthread(tid);*/
}
/* Find the run()V method and call it */
method = class_findmethod(currentThread->vmThread->header.vftbl->class,
utf_new_char("run"), utf_new_char("()V"));
- if (method == 0)
- panic("Cannot find method \'void run ()\'");
+
+ if (method == 0) {
+ log_text("Cannot find method \'void run ()\'");
+ assert(0);
+ }
asm_calljavafunction(method, currentThread->vmThread, NULL, NULL, NULL);
break;
}
}
- if (i1==MAXTHREADS) panic("Thread not found in killThread");
+ if (i1==MAXTHREADS) {
+ log_text("Thread not found in killThread");
+ assert(0);
+ }
} else context=tid->vmThread;
Changes: Christian Thalinger
- $Id: threads.c 2417 2005-04-29 19:17:55Z twisti $
+ $Id: threads.c 2517 2005-05-23 10:33:06Z twisti $
*/
kern_return_t r;
r = thread_suspend(thread);
- if (r != KERN_SUCCESS)
- panic("thread_suspend failed");
+ if (r != KERN_SUCCESS) {
+ log_text("thread_suspend failed");
+ assert(0);
+ }
r = thread_get_state(thread, flavor,
(natural_t*)&thread_state, &thread_state_count);
- if (r != KERN_SUCCESS)
- panic("thread_get_state failed");
+ if (r != KERN_SUCCESS) {
+ log_text("thread_get_state failed");
+ assert(0);
+ }
thread_restartcriticalsection(&thread_state);
r = thread_set_state(thread, flavor,
(natural_t*)&thread_state, thread_state_count);
- if (r != KERN_SUCCESS)
- panic("thread_set_state failed");
+ if (r != KERN_SUCCESS) {
+ log_text("thread_set_state failed");
+ assert(0);
+ }
}
tobj = tobj->info.next;
} while (tobj != mainthreadobj);
kern_return_t r;
r = thread_resume(thread);
- if (r != KERN_SUCCESS)
- panic("thread_resume failed");
+ if (r != KERN_SUCCESS) {
+ log_text("thread_resume failed");
+ assert(0);
+ }
}
tobj = tobj->info.next;
} while (tobj != mainthreadobj);
sem_init(&sem, 0, 0);
- if (pthread_create(&info->tid, &threadattr, threadstartup, &startup))
- panic("pthread_create failed");
+ if (pthread_create(&info->tid, &threadattr, threadstartup, &startup)) {
+ log_text("pthread_create failed");
+ assert(0);
+ }
/* Wait here until the thread has entered itself into the thread list */
sem_wait(&sem);