Patch: win32 GC changes
Anthony Green
green@redhat.com
Sun Mar 10 11:50:00 GMT 2002
This patch does two things...
(1) It makes sure GC_write_cs is initialized before any possible use.
Without this patch it is possible for GC_write to happen before initializing
the critical section. I don't know what this would do on a real win32
platform, but it causes a hang under wine.
(2) It disables the use of getenv() for win32 targets. I don't know how
Microsoft targets work, but wine's getenv returns empty strings when the
environment variable is not set. This is probably a bug in wine.
These patches are necessary in order to get a mingw HelloWorld running
on Linux with wine.
Ok for trunk and branch?
AG
2002-03-10 Anthony Green <green@redhat.com>
* misc.c (GC_init_inner): Initialize GC_write_cs before use.
* configure.in: Disable use of getenv for win32 targets (some of
which have broken implementations).
* configure: Rebuilt.
Index: boehm-gc/configure.in
===================================================================
RCS file: /cvs/gcc/gcc/boehm-gc/configure.in,v
retrieving revision 1.39
diff -c -r1.39 configure.in
*** configure.in 2002/02/12 18:40:38 1.39
--- configure.in 2002/03/10 18:04:57
***************
*** 109,114 ****
--- 109,115 ----
;;
win32)
AC_DEFINE(GC_WIN32_THREADS)
+ AC_DEFINE(NO_GETENV)
;;
decosf1 | irix | mach | os2 | solaris | dce | vxworks)
AC_MSG_ERROR(thread package $THREADS not yet supported)
Index: boehm-gc/misc.c
===================================================================
RCS file: /cvs/gcc/gcc/boehm-gc/misc.c,v
retrieving revision 1.21
diff -c -r1.21 misc.c
*** misc.c 2002/02/12 04:37:53 1.21
--- misc.c 2002/03/10 18:04:57
***************
*** 499,504 ****
--- 499,508 ----
# ifdef PRINTSTATS
GC_print_stats = 1;
# endif
+ # if defined(MSWIN32) || defined(MSWINCE)
+ InitializeCriticalSection(&GC_write_cs);
+ # endif
+
if (0 != GETENV("GC_PRINT_STATS")) {
GC_print_stats = 1;
}
***************
*** 536,544 ****
if (ALIGNMENT > GC_DS_TAGS && EXTRA_BYTES != 0) {
GC_obj_kinds[NORMAL].ok_descriptor = ((word)(-ALIGNMENT) | GC_DS_LENGTH);
}
- # if defined(MSWIN32) || defined(MSWINCE)
- InitializeCriticalSection(&GC_write_cs);
- # endif
GC_setpagesize();
GC_exclude_static_roots(beginGC_arrays, endGC_arrays);
GC_exclude_static_roots(beginGC_obj_kinds, endGC_obj_kinds);
--- 540,545 ----
More information about the Java-patches
mailing list