Killed panic's.
authortwisti <none@none>
Mon, 23 May 2005 10:33:06 +0000 (10:33 +0000)
committertwisti <none@none>
Mon, 23 May 2005 10:33:06 +0000 (10:33 +0000)
src/cacaoh/headers.c
src/threads/green/threads.c
src/threads/native/threads.c

index 79c3274156494a1d502e07fc6ee7aac433318bb6..661eb4fb706ea262e4f25faaa8be407ee1d412c3 100644 (file)
             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"
 
@@ -385,16 +385,18 @@ static char *printtype(char *utf_ptr)
                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;
                
@@ -405,7 +407,9 @@ static char *printtype(char *utf_ptr)
                fprintf (file, "*");
                break;
                                        
-       default:  panic ("Unknown type in field descriptor");
+       default:
+               log_text("Unknown type in field descriptor");
+               assert(0);
        }
        
        return utf_ptr;
@@ -568,10 +572,12 @@ void headerfile_generate(classinfo *c, char *opt_directory)
        }
 
        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++) {
index 2867ba5c8864e56ae2cfe68e74d568fd65db0407..f29b958f6bcc9ff2cc5f169872116339570bf5a5 100644 (file)
@@ -178,8 +178,11 @@ initThreads(u1 *stackbottom)
        }
 
     /* 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);
@@ -269,15 +272,18 @@ startThread (thread* tid)
                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);*/
     }
 
@@ -371,8 +377,11 @@ firstStartThread(void)
        /* 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);
 
@@ -602,7 +611,10 @@ killThread(thread* tid)
                                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;
 
index 9294ebb8d061e797a001f6816d076a5cb3e2aa9f..0c62c57445dc262abac7c72310ae8fb4773e7d9b 100644 (file)
@@ -28,7 +28,7 @@
 
    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 $
 
 */
 
@@ -301,20 +301,26 @@ static void cast_darwinstop()
                        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);
@@ -333,8 +339,10 @@ static void cast_darwinresume()
                        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);
@@ -668,8 +676,10 @@ void startThread(thread *t)
 
        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);