aboutsummaryrefslogtreecommitdiff
path: root/gcc/go/go-lang.c
diff options
context:
space:
mode:
authorThan McIntosh <thanm@google.com>2017-12-01 23:12:13 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2017-12-01 23:12:13 +0000
commit92f0112cab96a60bb777b81e93a5d10437c5fa60 (patch)
tree90ebd983c790cf1c3455070065240bae31afec39 /gcc/go/go-lang.c
parent19041dad9b7f03b32775864c41649a81ebca8092 (diff)
downloadgcc-92f0112cab96a60bb777b81e93a5d10437c5fa60.zip
gcc-92f0112cab96a60bb777b81e93a5d10437c5fa60.tar.gz
gcc-92f0112cab96a60bb777b81e93a5d10437c5fa60.tar.bz2
compiler: introduce size threshold for nil checks
Add a new control variable to the Gogo class that stores the size threshold for nil checks. This value can be used to control the policy for deciding when a given deference operation needs a check and when it does not. A size threshold of -1 means that every potentially faulting dereference needs an explicit check (and branch to error call). A size threshold of K (where K > 0) means that if the size of the object being dereferenced is >= K, then we need a check. Reviewed-on: https://go-review.googlesource.com/80996 * go-c.h (go_create_gogo_args): Add nil_check_size_threshold field. * go-lang.c (go_langhook_init): Set nil_check_size_threshold. From-SVN: r255340
Diffstat (limited to 'gcc/go/go-lang.c')
-rw-r--r--gcc/go/go-lang.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/go/go-lang.c b/gcc/go/go-lang.c
index 81eeb5c..fda069a 100644
--- a/gcc/go/go-lang.c
+++ b/gcc/go/go-lang.c
@@ -112,6 +112,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.linemap = go_get_linemap();
args.backend = go_get_backend();
go_create_gogo (&args);