[AIX] Nil check size threshold control for AIX

Message ID B37989F2852398498001550C29155BE51791C4A3@FRCRPVV9EX3MSX.ww931.my-it-solutions.net
State New
Headers show
Series
  • [AIX] Nil check size threshold control for AIX
Related show

Commit Message

REIX, Tony Dec. 12, 2017, 8:59 a.m.
Description:
 * This patch tells the Go frontend to insert explicit guards (check for nil -> panic) for AIX since relying on a fault does not work on AIX for page 0.

Tests:
 * AIX: Build: SUCCESS
   - build made by means of gmake.

ChangeLog:
  * go-lang.c (go_langhook_init): Handle AIX case for nil_check_size_threshold.


Cordialement,

Tony Reix

ATOS / Bull SAS
ATOS Expert
IBM Coop Architect & Technical Leader

Office : +33 (0) 4 76 29 72 67
1 rue de Provence - 38432 Échirolles - France
www.atos.net

Comments

Ian Lance Taylor Dec. 12, 2017, 5:30 p.m. | #1
On Tue, Dec 12, 2017 at 12:59 AM, REIX, Tony <tony.reix@atos.net> wrote:
> Description:

>  * This patch tells the Go frontend to insert explicit guards (check for nil -> panic) for AIX since relying on a fault does not work on AIX for page 0.

>

> Tests:

>  * AIX: Build: SUCCESS

>    - build made by means of gmake.

>

> ChangeLog:

>   * go-lang.c (go_langhook_init): Handle AIX case for nil_check_size_threshold.


Thanks.  I changed it to avoid #ifdef in the middle of the function,
and committed as follows.

Ian

2017-12-12  Tony Reix  <tony.reix@atos.net>
    Ian Lance Taylor  <iant@golang.org>

* go-lang.c (TARGET_AIX): Define if not defined.
(go_langhook_init): Set nil_check_size_threshold to -1 on AIX.
Index: gcc/go/go-lang.c
===================================================================
--- gcc/go/go-lang.c	(revision 255581)
+++ gcc/go/go-lang.c	(working copy)
@@ -39,6 +39,10 @@ along with GCC; see the file COPYING3.
 #include "go-c.h"
 #include "go-gcc.h"
 
+#ifndef TARGET_AIX
+#define TARGET_AIX 0
+#endif
+
 /* Language-dependent contents of a type.  */
 
 struct GTY(()) lang_type
@@ -112,7 +116,7 @@ go_langhook_init (void)
   args.check_divide_overflow = go_check_divide_overflow;
   args.compiling_runtime = go_compiling_runtime;
   args.debug_escape_level = go_debug_escape_level;
-  args.nil_check_size_threshold = 4096;
+  args.nil_check_size_threshold = TARGET_AIX ? -1 : 4096;
   args.linemap = go_get_linemap();
   args.backend = go_get_backend();
   go_create_gogo (&args);

Patch

Index: gcc/go/go-lang.c
===================================================================
--- ./gcc/go/go-lang.c	(revision 255466)
+++ ./gcc/go/go-lang.c	(working copy)
@@ -112,7 +112,11 @@  go_langhook_init (void)
   args.check_divide_overflow = go_check_divide_overflow;
   args.compiling_runtime = go_compiling_runtime;
   args.debug_escape_level = go_debug_escape_level;
+#ifdef TARGET_AIX
+  args.nil_check_size_threshold = -1;
+#else
   args.nil_check_size_threshold = 4096;
+#endif
   args.linemap = go_get_linemap();
   args.backend = go_get_backend();
   go_create_gogo (&args);