* 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.
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");
}
#endif
#include "vm/global.h"
+#include "vm/os.hpp"
#include "vm/vm.hpp" /* REMOVE ME: temporarily */
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;
}
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;
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;
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;
}
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"
#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"
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
#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
}
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");
}
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 */
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
}
{
_handle = op_open_agent();
if (!_handle)
- vm_abort_errno("unable to open opagent handle:");
+ os::abort_errno("unable to open opagent handle:");
}
/**
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;
#include "vm/globals.hpp"
#include "vm/method.hpp"
#include "vm/options.h"
+#include "vm/os.hpp"
#include "vm/signallocal.hpp"
#include "vm/vm.hpp"
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. */
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");
}
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 (;;) {
} 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);
{
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();
}
}
// 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
}