More robust fix for PR target/66488

Message ID 5525269.MjqfCIikzZ@polaris
State New
Headers show
Series
  • More robust fix for PR target/66488
Related show

Commit Message

Eric Botcazou Dec. 15, 2017, 9:38 a.m.
Hi,

this PR was about the blow-up of the garbage collector on x86_64-w64-mingw32 
when more than 3 GB are allocated.  The fix was to set HOST_BITS_PER_PTR to 
the appropriate value (64) in config/i386/xm-mingw32.h.

This means that the same issue can happen on other P64 hosts so the attached 
patch replaces the fix by a more robust variant.  And I'm proposing that it be 
installed on all active branches (the original fix is not on the 6 branch).

Tested on x86_64-w64-mingw32 (6 branch) and x86_64-suse-linux (mainline), OK?


2017-12-15  Eric Botcazou  <ebotcazou@adacore.com>

	PR target/66488
	* ggc-page.c (HOST_BITS_PER_PTR): Do not define here...
	* hwint.h (HOST_BITS_PER_PTR): ...but here instead.
	* config/i386/xm-mingw32.h (HOST_BITS_PER_PTR): Delete.

-- 
Eric Botcazou

Comments

Richard Biener Dec. 15, 2017, 10:51 a.m. | #1
On Fri, Dec 15, 2017 at 10:38 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
> Hi,

>

> this PR was about the blow-up of the garbage collector on x86_64-w64-mingw32

> when more than 3 GB are allocated.  The fix was to set HOST_BITS_PER_PTR to

> the appropriate value (64) in config/i386/xm-mingw32.h.

>

> This means that the same issue can happen on other P64 hosts so the attached

> patch replaces the fix by a more robust variant.  And I'm proposing that it be

> installed on all active branches (the original fix is not on the 6 branch).

>

> Tested on x86_64-w64-mingw32 (6 branch) and x86_64-suse-linux (mainline), OK?


Ok.

Thanks,
Richard.

>

> 2017-12-15  Eric Botcazou  <ebotcazou@adacore.com>

>

>         PR target/66488

>         * ggc-page.c (HOST_BITS_PER_PTR): Do not define here...

>         * hwint.h (HOST_BITS_PER_PTR): ...but here instead.

>         * config/i386/xm-mingw32.h (HOST_BITS_PER_PTR): Delete.

>

> --

> Eric Botcazou

Patch

Index: config/i386/xm-mingw32.h
===================================================================
--- config/i386/xm-mingw32.h	(revision 255622)
+++ config/i386/xm-mingw32.h	(working copy)
@@ -37,8 +37,3 @@  along with GCC; see the file COPYING3.
    "long long" values.  Instead, we use "I64".  */
 #define HOST_LONG_LONG_FORMAT "I64"
 #endif
-
-/* this is to prevent gcc-heap.c from assuming sizeof(long) == sizeof(intptr_t) */
-#ifdef __x86_64__
-#	define HOST_BITS_PER_PTR 64
-#endif
Index: ggc-page.c
===================================================================
--- ggc-page.c	(revision 255622)
+++ ggc-page.c	(working copy)
@@ -92,11 +92,6 @@  along with GCC; see the file COPYING3.
      4: Object marks as well.  */
 #define GGC_DEBUG_LEVEL (0)
 
-#ifndef HOST_BITS_PER_PTR
-#define HOST_BITS_PER_PTR  HOST_BITS_PER_LONG
-#endif
-
-
 /* A two-level tree is used to look up the page-entry for a given
    pointer.  Two chunks of the pointer's bits are extracted to index
    the first and second levels of the tree, as follows:
Index: hwint.h
===================================================================
--- hwint.h	(revision 255622)
+++ hwint.h	(working copy)
@@ -14,6 +14,7 @@ 
 #define HOST_BITS_PER_SHORT (CHAR_BIT * SIZEOF_SHORT)
 #define HOST_BITS_PER_INT   (CHAR_BIT * SIZEOF_INT)
 #define HOST_BITS_PER_LONG  (CHAR_BIT * SIZEOF_LONG)
+#define HOST_BITS_PER_PTR   (CHAR_BIT * SIZEOF_VOID_P)
 
 /* The string that should be inserted into a printf style format to
    indicate a "long" operand.  */