* src/vm/vm.cpp (vm_abort_errnum, vm_abort_errno): Removed obsolete functions.
authorMichael Starzinger <michi@complang.tuwien.ac.at>
Tue, 10 Mar 2009 10:23:15 +0000 (11:23 +0100)
committerMichael Starzinger <michi@complang.tuwien.ac.at>
Tue, 10 Mar 2009 10:23:15 +0000 (11:23 +0100)
* src/vm/vm.hpp: Likewise.
* src/mm/memory.cpp: Adapted to use os::abort_errnum() instead.
* src/native/vm/cldc1.1/com_sun_cldc_io_j2me_socket_Protocol.cpp: Likewise.
* src/threads/posix/thread-posix.cpp: Likewise.
* src/threads/posix/thread-posix.hpp: Likewise.
* src/vm/jit/oprofile-agent.cpp: Likewise.
* src/vm/options.c: Likewise.
* src/vm/signal.cpp: Likewise.

src/mm/memory.cpp
src/native/vm/cldc1.1/com_sun_cldc_io_j2me_socket_Protocol.cpp
src/threads/posix/thread-posix.cpp
src/threads/posix/thread-posix.hpp
src/vm/jit/oprofile-agent.cpp
src/vm/options.c
src/vm/signal.cpp
src/vm/vm.cpp
src/vm/vm.hpp

index f074e1d208e23b2db716635eee2c5eac0cd9ea9e..8c0c5b2a552e51ef553efb3d182f352e0f4fc449 100644 (file)
@@ -69,7 +69,7 @@
 void memory_mprotect(void *addr, size_t len, int prot)
 {
        if (os::mprotect(addr, len, prot) != 0)
-               vm_abort_errno("memory_mprotect: os::mprotect failed");
+               os::abort_errno("memory_mprotect: os::mprotect failed");
 }
 
 
index 16bebd345efc6aa23b3d1d82550b4c612853c676..860d88d5db12af0a314284eaac379749b583af06 100644 (file)
@@ -45,6 +45,7 @@
 #endif
 
 #include "vm/global.h"
+#include "vm/os.hpp"
 #include "vm/vm.hpp" /* REMOVE ME: temporarily */
 
 
@@ -116,7 +117,7 @@ JNIEXPORT jint JNICALL Java_com_sun_cldc_io_j2me_socket_Protocol_readBuf(JNIEnv
                return -1;
        }
        else if (result < 0) {
-               vm_abort_errno("Java_com_sun_cldc_io_j2me_socket_Protocol_readBuf: recv failed");
+               os::abort_errno("Java_com_sun_cldc_io_j2me_socket_Protocol_readBuf: recv failed");
        }
 
        return result;
@@ -141,7 +142,7 @@ JNIEXPORT jint JNICALL Java_com_sun_cldc_io_j2me_socket_Protocol_readByte(JNIEnv
        }
        else if (result < 0) {
                // TODO Should throw an IOException.
-               vm_abort_errno("Java_com_sun_cldc_io_j2me_socket_Protocol_readByte: recv failed");
+               os::abort_errno("Java_com_sun_cldc_io_j2me_socket_Protocol_readByte: recv failed");
        }
 
        return byte;
@@ -164,7 +165,7 @@ JNIEXPORT jint JNICALL Java_com_sun_cldc_io_j2me_socket_Protocol_writeBuf(JNIEnv
 
        if (result < 0) {
                // TODO Should throw an IOException.
-               vm_abort_errno("Java_com_sun_cldc_io_j2me_socket_Protocol_writeBuf: send failed");
+               os::abort_errno("Java_com_sun_cldc_io_j2me_socket_Protocol_writeBuf: send failed");
        }
 
        return result;
@@ -184,7 +185,7 @@ JNIEXPORT jint JNICALL Java_com_sun_cldc_io_j2me_socket_Protocol_writeByte(JNIEn
        ssize_t result = send(handle, &byte, 1, 0);
 
        if (result < 0)
-               vm_abort_errno("Java_com_sun_cldc_io_j2me_socket_Protocol_writeByte: send failed");
+               os::abort_errno("Java_com_sun_cldc_io_j2me_socket_Protocol_writeByte: send failed");
 
        return result;
 }
@@ -213,7 +214,7 @@ JNIEXPORT void JNICALL Java_com_sun_cldc_io_j2me_socket_Protocol_close0(JNIEnv *
        int result = close(handle);
 
        if (result < 0)
-               vm_abort_errno("Java_com_sun_cldc_io_j2me_socket_Protocol_close0: close failed");
+               os::abort_errno("Java_com_sun_cldc_io_j2me_socket_Protocol_close0: close failed");
 }
 
 } // extern "C"
index bcc25c9f137b8f6d765ab08195506ab18080b46f..b91e50f1d6725fb3149f1a49ff4fb6d9922417da 100644 (file)
@@ -68,6 +68,7 @@
 #include "vm/globals.hpp"
 #include "vm/javaobjects.hpp"
 #include "vm/options.h"
+#include "vm/os.hpp"
 #include "vm/signallocal.hpp"
 #include "vm/string.hpp"
 #include "vm/vm.hpp"
@@ -547,21 +548,21 @@ void threads_impl_thread_free(threadobject *t)
        result = pthread_cond_destroy(&(t->flc_cond));
 
        if (result != 0)
-               vm_abort_errnum(result, "threads_impl_thread_free: pthread_cond_destroy failed");
+               os::abort_errnum(result, "threads_impl_thread_free: pthread_cond_destroy failed");
 
        delete t->waitmutex;
 
        result = pthread_cond_destroy(&(t->waitcond));
 
        if (result != 0)
-               vm_abort_errnum(result, "threads_impl_thread_free: pthread_cond_destroy failed");
+               os::abort_errnum(result, "threads_impl_thread_free: pthread_cond_destroy failed");
 
        delete t->suspendmutex;
 
        result = pthread_cond_destroy(&(t->suspendcond));
 
        if (result != 0)
-               vm_abort_errnum(result, "threads_impl_thread_free: pthread_cond_destroy failed");
+               os::abort_errnum(result, "threads_impl_thread_free: pthread_cond_destroy failed");
 }
 #endif
 
@@ -597,7 +598,7 @@ void threads_impl_preinit(void)
 #if !defined(HAVE___THREAD)
        result = pthread_key_create(&thread_current_key, NULL);
        if (result != 0)
-               vm_abort_errnum(result, "threads_impl_preinit: pthread_key_create failed");
+               os::abort_errnum(result, "threads_impl_preinit: pthread_key_create failed");
 #endif
 }
 
@@ -671,12 +672,12 @@ void threads_impl_init(void)
        result = pthread_attr_init(&attr);
 
        if (result != 0)
-               vm_abort_errnum(result, "threads_impl_init: pthread_attr_init failed");
+               os::abort_errnum(result, "threads_impl_init: pthread_attr_init failed");
 
        result = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 
        if (result != 0)
-               vm_abort_errnum(result, "threads_impl_init: pthread_attr_setdetachstate failed");
+               os::abort_errnum(result, "threads_impl_init: pthread_attr_setdetachstate failed");
 }
 
 
@@ -927,33 +928,33 @@ void threads_impl_thread_start(threadobject *thread, functionptr f)
        result = pthread_attr_init(&attr);
 
        if (result != 0)
-               vm_abort_errnum(result, "threads_impl_thread_start: pthread_attr_init failed");
+               os::abort_errnum(result, "threads_impl_thread_start: pthread_attr_init failed");
 
     result = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 
     if (result != 0)
-               vm_abort_errnum(result, "threads_impl_thread_start: pthread_attr_setdetachstate failed");
+               os::abort_errnum(result, "threads_impl_thread_start: pthread_attr_setdetachstate failed");
 
        /* initialize thread stacksize */
 
        result = pthread_attr_setstacksize(&attr, opt_stacksize);
 
        if (result != 0)
-               vm_abort_errnum(result, "threads_impl_thread_start: pthread_attr_setstacksize failed");
+               os::abort_errnum(result, "threads_impl_thread_start: pthread_attr_setstacksize failed");
 
        /* create the thread */
 
        result = pthread_create(&(thread->tid), &attr, threads_startup_thread, &startup);
 
        if (result != 0)
-               vm_abort_errnum(result, "threads_impl_thread_start: pthread_create failed");
+               os::abort_errnum(result, "threads_impl_thread_start: pthread_create failed");
 
        /* destroy the thread attributes */
 
        result = pthread_attr_destroy(&attr);
 
        if (result != 0)
-               vm_abort_errnum(result, "threads_impl_thread_start: pthread_attr_destroy failed");
+               os::abort_errnum(result, "threads_impl_thread_start: pthread_attr_destroy failed");
 
        /* signal that pthread_create has returned, so thread->tid is valid */
 
index 8f0e55c71ad5fac2115d5143259408dfe0a8b1e1..7dafeae304d82d8c1c0a4f6ecabc181e920b26b9 100644 (file)
@@ -266,7 +266,9 @@ inline static void thread_set_current(threadobject* t)
        result = pthread_setspecific(thread_current_key, t);
 
        if (result != 0)
-               vm_abort_errnum(result, "thread_set_current: pthread_setspecific failed");
+#warning Use below method instead!
+               //os::abort_errnum(result, "thread_set_current: pthread_setspecific failed");
+               vm_abort("thread_set_current: pthread_setspecific failed");
 #endif
 }
 
index 9c6f44ee4c3b264e94da04b39ef6c4be4c4040d2..0846f99410d49e11d2a06a40c7b0323ab6877997 100644 (file)
@@ -43,7 +43,7 @@ void OprofileAgent::initialize(void)
 {
        _handle = op_open_agent();
        if (!_handle)
-               vm_abort_errno("unable to open opagent handle:");
+               os::abort_errno("unable to open opagent handle:");
 }
 
 /**
index b5b88a710336ff78ef428488af5da03a10489230..3c8ff46a57d4d6c684c6a07cc82899cc456095c5 100644 (file)
@@ -743,7 +743,9 @@ void options_xx(JavaVMInitArgs *vm_args)
                        file = fopen(filename, "w");
 
                        if (file == NULL)
-                               vm_abort_errno("options_xx: fopen failed");
+#warning Use below method instead!
+                               //os::abort_errno("options_xx: fopen failed");
+                               vm_abort("options_xx: fopen failed");
 
                        opt_ProfileMemoryUsageGNUPlot = file;
                        break;
index 15d6263b6cd2d9d798fdf36886853843f6b981d1..9bfe3da3de9a83abfa6f80b206bd960e0a2adc39 100644 (file)
@@ -50,6 +50,7 @@
 #include "vm/globals.hpp"
 #include "vm/method.hpp"
 #include "vm/options.h"
+#include "vm/os.hpp"
 #include "vm/signallocal.hpp"
 #include "vm/vm.hpp"
 
@@ -86,22 +87,22 @@ bool signal_init(void)
           this thread. */
 
        if (sigemptyset(&mask) != 0)
-               vm_abort_errno("signal_init: sigemptyset failed");
+               os::abort_errno("signal_init: sigemptyset failed");
 
 #if !defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
        /* Let OpenJDK handle SIGINT itself. */
 
        if (sigaddset(&mask, SIGINT) != 0)
-               vm_abort_errno("signal_init: sigaddset failed");
+               os::abort_errno("signal_init: sigaddset failed");
 #endif
 
 #if !defined(__FREEBSD__)
        if (sigaddset(&mask, SIGQUIT) != 0)
-               vm_abort_errno("signal_init: sigaddset failed");
+               os::abort_errno("signal_init: sigaddset failed");
 #endif
 
        if (sigprocmask(SIG_BLOCK, &mask, NULL) != 0)
-               vm_abort_errno("signal_init: sigprocmask failed");
+               os::abort_errno("signal_init: sigprocmask failed");
 
 #if defined(__LINUX__) && defined(ENABLE_THREADS)
        /* XXX Remove for exact-GC. */
@@ -229,13 +230,13 @@ void signal_register_signal(int signum, functionptr handler, int flags)
        function = (void (*)(int, siginfo_t *, void *)) handler;
 
        if (sigemptyset(&act.sa_mask) != 0)
-               vm_abort_errno("signal_register_signal: sigemptyset failed");
+               os::abort_errno("signal_register_signal: sigemptyset failed");
 
        act.sa_sigaction = function;
        act.sa_flags     = flags;
 
        if (sigaction(signum, &act, NULL) != 0)
-               vm_abort_errno("signal_register_signal: sigaction failed");
+               os::abort_errno("signal_register_signal: sigaction failed");
 }
 
 
@@ -257,18 +258,18 @@ static void signal_thread(void)
        t = THREADOBJECT;
 
        if (sigemptyset(&mask) != 0)
-               vm_abort_errno("signal_thread: sigemptyset failed");
+               os::abort_errno("signal_thread: sigemptyset failed");
 
 #if !defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
        /* Let OpenJDK handle SIGINT itself. */
 
        if (sigaddset(&mask, SIGINT) != 0)
-               vm_abort_errno("signal_thread: sigaddset failed");
+               os::abort_errno("signal_thread: sigaddset failed");
 #endif
 
 #if !defined(__FREEBSD__)
        if (sigaddset(&mask, SIGQUIT) != 0)
-               vm_abort_errno("signal_thread: sigaddset failed");
+               os::abort_errno("signal_thread: sigaddset failed");
 #endif
 
        for (;;) {
@@ -285,7 +286,7 @@ static void signal_thread(void)
                } while (result == EINTR);
 
                if (result != 0)
-                       vm_abort_errnum(result, "signal_thread: sigwait failed");
+                       os::abort_errnum(result, "signal_thread: sigwait failed");
 
 #if defined(ENABLE_THREADS)
                thread_set_state_runnable(t);
index cc60d2b68cec5f51ef74505252cb9ff77a6f1359..c4ab5f40cf756795a98fad0d1ed4d8c5b372cdc7 100644 (file)
@@ -2562,27 +2562,22 @@ void vm_abort(const char* text, ...)
 {
        va_list ap;
 
-       va_start(ap, text);
-       os::abort(text, ap);
-       va_end(ap);
-}
+       log_println("vm_abort: WARNING, port me to C++ and use os::abort() instead.");
 
-void vm_abort_errnum(int errnum, const char* text, ...)
-{
-       va_list ap;
+       // Print the log message.
+       log_start();
 
        va_start(ap, text);
-       os::abort_errnum(errnum, text, ap);
+       log_vprint(text, ap);
        va_end(ap);
-}
 
-void vm_abort_errno(const char* text, ...)
-{
-       va_list ap;
+       log_finish();
 
-       va_start(ap, text);
-       os::abort_errno(text, ap);
-       va_end(ap);
+       // Print a backtrace.
+       os::print_backtrace();
+
+       // Now abort the VM.
+       os::abort();
 }
 
 }
index 22a355083dbb3889cc3edcab4b828c647ef9b5af..30242d4f07e6b604d212c121d4f6059b27269307 100644 (file)
@@ -193,8 +193,6 @@ java_handle_t *vm_call_method_objectarray(methodinfo *m, java_handle_t *o, java_
 
 // Legacy C interface.
 void vm_abort(const char* text, ...);
-void vm_abort_errnum(int errnum, const char* text, ...);
-void vm_abort_errno(const char* text, ...);
 
 #ifdef __cplusplus
 }