compiler: introduce size threshold for nil checks
commitf614ea8bcf798a8081f1b0a1cffd04f0ff2179bd
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 1 Dec 2017 23:12:13 +0000 (1 23:12 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 1 Dec 2017 23:12:13 +0000 (1 23:12 +0000)
tree90ebd983c790cf1c3455070065240bae31afec39
parent88129254677ce76b2bdf5c44d9e36914f5bdaef1
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@255340 138bc75d-0d04-0410-961f-82ee72b054a4
13 files changed:
gcc/go/ChangeLog
gcc/go/go-c.h
gcc/go/go-lang.c
gcc/go/gofrontend/MERGE
gcc/go/gofrontend/expressions.cc
gcc/go/gofrontend/expressions.h
gcc/go/gofrontend/go.cc
gcc/go/gofrontend/gogo.cc
gcc/go/gofrontend/gogo.h
gcc/go/gofrontend/parse.cc
gcc/go/gofrontend/statements.cc
gcc/go/gofrontend/types.cc
gcc/go/gofrontend/wb.cc