This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[MinGW] Backport VirtualQuery() on Windows 9x/ME fix for BoehmGC (Was: Re: GCJ 4.03 crash on Windows 98 continued)
- From: Ranjit Mathew <rmathew at gmail dot com>
- To: GCJ Patches <java-patches at gcc dot gnu dot org>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Marco Trudel <mtrudel at gmx dot ch>, Jesper Juul / Soup Games <jesper at soupgames dot net>, Hans dot Boehm at hp dot com
- Date: Tue, 20 Jun 2006 08:14:43 +0530
- Subject: [MinGW] Backport VirtualQuery() on Windows 9x/ME fix for BoehmGC (Was: Re: GCJ 4.03 crash on Windows 98 continued)
- Openpgp: url=http://ranjitmathew.hostingzero.com/aa_6C114B8F.txt
- References: <65953E8166311641A685BDF71D865826BC1A71@cacexc12.americas.cpqcorp.net> <449716BC.40609@gmx.ch>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
> Boehm, Hans wrote:
>> Gc6.7 in fact contains the suggested fix. It explicitly distinguishes
>> Windows NT descendants from ME and predecessors, and checks against
>> MEM_PRIVATE for the latter. It would be good to confirm that that
>> solves the problem.
I presume GC 6.7 might not be imported into the GCC mainline
any time soon, so I propose backporting this particular fix
from GC 6.7 to the version in mainline as shown by the attached
patch.
I have tested this patch using an i686-pc-linux-gnu to
i686-pc-mingw32 cross-compiler and simple executables compiled
by GCJ work once again on Windows 98 (at least) whereas
they used to always crash before this patch.
OK to apply?
Thanks,
Ranjit.
- --
Ranjit Mathew Email: rmathew AT gmail DOT com
Bangalore, INDIA. Web: http://rmathew.com/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFEl2EbYb1hx2wRS48RAvLBAKCqhii6QhaXKj2oguF+jx43gKHgvwCeKJO5
Axbrp8gItQK56TiqoaPDxvU=
=2cOv
-----END PGP SIGNATURE-----
Index: ChangeLog
from Ranjit Mathew <rmathew@gcc.gnu.org>
Backport Windows 9x/ME VirtualQuery() fix from GC 6.7.
* os_dep.c (GC_wnt): Define.
(GC_init_win32): Set GC_wnt.
* dyn_load.c (GC_register_dynamic_libraries): Consider MEM_PRIVATE
sections also on Windows 9x/ME.
Index: os_dep.c
===================================================================
--- os_dep.c (revision 114756)
+++ os_dep.c (working copy)
@@ -1181,12 +1181,15 @@ void GC_register_data_segments()
/* This used to be set for gcc, to avoid dealing with */
/* the structured exception handling issues. But we now have */
/* assembly code to do that right. */
+ GC_bool GC_wnt = FALSE;
+ /* This is a Windows NT derivative, i.e. NT, W2K, XP or later. */
void GC_init_win32()
{
/* if we're running under win32s, assume that no DLLs will be loaded */
DWORD v = GetVersion();
- GC_no_win32_dlls |= ((v & 0x80000000) && (v & 0xff) <= 3);
+ GC_wnt = !(v & 0x80000000);
+ GC_no_win32_dlls |= ((!GC_wnt) && (v & 0xff) <= 3);
}
/* Return the smallest address a such that VirtualQuery */
Index: dyn_load.c
===================================================================
--- dyn_load.c (revision 114756)
+++ dyn_load.c (working copy)
@@ -860,6 +860,9 @@ void GC_register_dynamic_libraries()
}
# endif /* DEBUG_VIRTUALQUERY */
+ extern GC_bool GC_wnt; /* Is Windows NT derivative. */
+ /* Defined and set in os_dep.c. */
+
void GC_register_dynamic_libraries()
{
MEMORY_BASIC_INFORMATION buf;
@@ -901,7 +904,12 @@ void GC_register_dynamic_libraries()
* !is_frame_buffer(p, buf.RegionSize, buf.Type)
* instead of just checking for MEM_IMAGE.
* If something breaks, change it back. */
- && buf.Type == MEM_IMAGE) {
+ /* There is some evidence that we cannot always
+ * ignore MEM_PRIVATE sections under Windows ME
+ * and predecessors. Hence we now also check for
+ * that case. */
+ && (buf.Type == MEM_IMAGE ||
+ !GC_wnt && buf.Type == MEM_PRIVATE)) {
# ifdef DEBUG_VIRTUALQUERY
GC_dump_meminfo(&buf);
# endif