Commit a7006428 by Adam Megacz Committed by Adam Megacz

2002-02-01 Adam Megacz <adam@xwt.org>

        * prims.cc
        (_Jv_CreateJavaVM): We now use WIN32 instead of
        USE_WIN32_SIGNALLING and USE_WINSOCK.
        (win32_exception_handler): Now throws an exception out of
        the signal handler; assumes SJLJ

From-SVN: r49429
parent a70cb11b
2002-02-01 Adam Megacz <adam@xwt.org>
* prims.cc
(_Jv_CreateJavaVM): We now use WIN32 instead of
USE_WIN32_SIGNALLING and USE_WINSOCK.
(win32_exception_handler): Now throws an exception out of
the signal handler; assumes SJLJ
2002-02-01 Adam Megacz 2002-02-01 Adam Megacz
* win32-threads.cc: * win32-threads.cc:
......
...@@ -10,14 +10,14 @@ details. */ ...@@ -10,14 +10,14 @@ details. */
#include <config.h> #include <config.h>
#ifdef USE_WIN32_SIGNALLING #ifdef WIN32
#include <windows.h> #include <windows.h>
#endif /* USE_WIN32_SIGNALLING */ #endif /* WIN32 */
#ifdef USE_WINSOCK #ifdef WIN32
#undef __INSIDE_CYGWIN__ #undef __INSIDE_CYGWIN__
#include <winsock.h> #include <winsock.h>
#endif /* USE_WINSOCK */ #endif /* WIN32 */
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>
...@@ -730,28 +730,19 @@ _Jv_ThisExecutable (const char *name) ...@@ -730,28 +730,19 @@ _Jv_ThisExecutable (const char *name)
} }
} }
#ifdef USE_WIN32_SIGNALLING #ifdef WIN32
extern "C" int* win32_get_restart_frame (void *); extern "C" int* win32_get_restart_frame (void *);
LONG CALLBACK LONG CALLBACK
win32_exception_handler (LPEXCEPTION_POINTERS e) win32_exception_handler (LPEXCEPTION_POINTERS e)
{ {
int* setjmp_buf; if (e->ExceptionRecord->ExceptionCode == EXCEPTION_ACCESS_VIOLATION)
if (e->ExceptionRecord->ExceptionCode == EXCEPTION_ACCESS_VIOLATION) _Jv_ThrowNullPointerException();
setjmp_buf = win32_get_restart_frame (nullp);
else if (e->ExceptionRecord->ExceptionCode == EXCEPTION_INT_DIVIDE_BY_ZERO) else if (e->ExceptionRecord->ExceptionCode == EXCEPTION_INT_DIVIDE_BY_ZERO)
setjmp_buf = win32_get_restart_frame (arithexception); throw new java::lang::ArithmeticException;
else else
return EXCEPTION_CONTINUE_SEARCH; return EXCEPTION_CONTINUE_SEARCH;
e->ContextRecord->Ebp = setjmp_buf[0];
// FIXME: Why does i386-signal.h increment the PC here, do we need to do it?
e->ContextRecord->Eip = setjmp_buf[1];
// FIXME: Is this the stack pointer? Do we need it?
e->ContextRecord->Esp = setjmp_buf[2];
return EXCEPTION_CONTINUE_EXECUTION;
} }
#endif #endif
...@@ -962,14 +953,11 @@ _Jv_CreateJavaVM (void* /*vm_args*/) ...@@ -962,14 +953,11 @@ _Jv_CreateJavaVM (void* /*vm_args*/)
LTDL_SET_PRELOADED_SYMBOLS (); LTDL_SET_PRELOADED_SYMBOLS ();
#endif #endif
#ifdef USE_WINSOCK #ifdef WIN32
// Initialise winsock for networking // Initialise winsock for networking
WSADATA data; WSADATA data;
if (WSAStartup (MAKEWORD (1, 1), &data)) if (WSAStartup (MAKEWORD (1, 1), &data))
MessageBox (NULL, "Error initialising winsock library.", "Error", MB_OK | MB_ICONEXCLAMATION); MessageBox (NULL, "Error initialising winsock library.", "Error", MB_OK | MB_ICONEXCLAMATION);
#endif /* USE_WINSOCK */
#ifdef USE_WIN32_SIGNALLING
// Install exception handler // Install exception handler
SetUnhandledExceptionFilter (win32_exception_handler); SetUnhandledExceptionFilter (win32_exception_handler);
#elif defined(HAVE_SIGACTION) #elif defined(HAVE_SIGACTION)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment