This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
WIN-15: boehm-gc support for libgcj-win32 -- supersedes WIN-04, WIN-05, WIN-07
- From: Adam Megacz <patches at lists dot megacz dot com>
- To: java-patches at gcc dot gnu dot org
- Cc: tromey at redhat dot com
- Date: 06 Feb 2002 12:34:32 -0800
- Subject: WIN-15: boehm-gc support for libgcj-win32 -- supersedes WIN-04, WIN-05, WIN-07
- Organization: Myself
Boehm> Unfortunately I've been sick for the past few days. In general
Boehm> if someone else who has libgcj approval privileges and is
Boehm> comfortable with the GC code (Tom?) wants to approve such
Boehm> changes, that's fine with me.
Tom: ok to commit?
- a
2002-02-06 Adam Megacz <adam@xwt.org>
* boehm-gc/include/gc.h: (GC_CreateThread) This function is
now exposed on all Win32 platforms.
* boehm-gc/win32_threads.c: (GC_CreateThread) This function
now compiles on WIN32 iff libgcjgc is NOT being built as a DLL
* boehm-gc/misc.c (GC_init): Initialize GC_allocate_ml in case
libgcjgc was not built as a DLL.
Index: include/gc.h
===================================================================
RCS file: /cvs/gcc/gcc/boehm-gc/include/gc.h,v
retrieving revision 1.7
diff -u -r1.7 gc.h
--- gc.h 2002/02/02 04:23:13 1.7
+++ gc.h 2002/02/06 20:33:35
@@ -849,10 +849,20 @@
#endif /* THREADS && !SRC_M3 */
-#if defined(GC_WIN32_THREADS) && defined(_WIN32_WCE)
+#if defined(GC_WIN32_THREADS)
# include <windows.h>
/*
+ * All threads must be created using GC_CreateThread, so that they will be
+ * recorded in the thread table.
+ */
+ HANDLE WINAPI GC_CreateThread(
+ LPSECURITY_ATTRIBUTES lpThreadAttributes,
+ DWORD dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress,
+ LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId );
+
+# if defined(_WIN32_WCE)
+ /*
* win32_threads.c implements the real WinMain, which will start a new thread
* to call GC_WinMain after initializing the garbage collector.
*/
@@ -861,22 +871,14 @@
HINSTANCE hPrevInstance,
LPWSTR lpCmdLine,
int nCmdShow );
-
- /*
- * All threads must be created using GC_CreateThread, so that they will be
- * recorded in the thread table.
- */
- HANDLE WINAPI GC_CreateThread(
- LPSECURITY_ATTRIBUTES lpThreadAttributes,
- DWORD dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress,
- LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId );
-# ifndef GC_BUILD
-# define WinMain GC_WinMain
-# define CreateThread GC_CreateThread
-# endif
+# ifndef GC_BUILD
+# define WinMain GC_WinMain
+# define CreateThread GC_CreateThread
+# endif
+# endif /* defined(_WIN32_WCE) */
-#endif
+#endif /* defined(GC_WIN32_THREADS) */
/*
* If you are planning on putting
Index: win32_threads.c
===================================================================
RCS file: /cvs/gcc/gcc/boehm-gc/win32_threads.c,v
retrieving revision 1.7
diff -u -r1.7 win32_threads.c
--- win32_threads.c 2001/10/16 09:01:36 1.7
+++ win32_threads.c 2002/02/06 20:33:36
@@ -332,7 +332,7 @@
}
-# ifdef MSWINCE
+#if defined(MSWINCE) || (defined(__MINGW32__) && !defined(_DLL))
typedef struct {
HANDLE child_ready_h, parent_ready_h;
@@ -450,6 +450,9 @@
return ret;
}
+#endif
+
+#ifdef MSWINCE
typedef struct {
HINSTANCE hInstance;
Index: misc.c
===================================================================
RCS file: /cvs/gcc/gcc/boehm-gc/misc.c,v
retrieving revision 1.18
diff -u -r1.18 misc.c
--- misc.c 2001/10/16 09:01:35 1.18
+++ misc.c 2002/02/06 20:33:36
@@ -436,6 +436,11 @@
DCL_LOCK_STATE;
DISABLE_SIGNALS();
+
+#ifdef MSWIN32
+ if (!GC_is_initialized) InitializeCriticalSection(&GC_allocate_ml);
+#endif /* MSWIN32 */
+
LOCK();
GC_init_inner();
UNLOCK();