This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Go patch committed: Add size threshold for nil checks


This patch to the Go frontend by Than McIntosh adds 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.  Currently for gccgo we
keep the same policy: do a nil check for an offset more than 4096.
Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.  Committed
to mainline.

Ian


2017-12-01  Than McIntosh  <thanm@google.com>

* go-c.h (go_create_gogo_args): Add nil_check_size_threshold
field.
* go-lang.c (go_langhook_init): Set nil_check_size_threshold.

Attachment: patch.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]