From: Ian Lance Taylor <iant@golang.org>
To: gcc-patches <gcc-patches@gcc.gnu.org>,
"gofrontend-dev@googlegroups.com"
<gofrontend-dev@googlegroups.com>
Subject: Go patch committed: Omit nil check when dereferencing closure variable
Date: Tue, 05 Dec 2017 02:03:00 -0000 [thread overview]
Message-ID: <CAOyqgcWGVa3T=Ap0GjHQp0HJUX7tp71J5Hwxx5d1HKXXyK015w@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 372 bytes --]
This patch to the Go frontend by Than McIntosh adds the "no nil check
needed" annotation to the dereference operations created in
Parse::enclosing_var_reference (this is safe since the closure object
is under control of the compiler, and pointer fields in it will always
be non-nil). Bootstrapped and ran Go testsuite on
x86_64-pc-linux-gnu. Committed to mainline.
Ian
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1466 bytes --]
Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE (revision 255347)
+++ gcc/go/gofrontend/MERGE (working copy)
@@ -1,4 +1,4 @@
-338f7434175bb71f3c8905e9ad7f480aec3afee6
+297cf346f2400274946650ab9ecd039427fc986b
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
Index: gcc/go/gofrontend/parse.cc
===================================================================
--- gcc/go/gofrontend/parse.cc (revision 255340)
+++ gcc/go/gofrontend/parse.cc (working copy)
@@ -2747,7 +2747,7 @@ Parse::enclosing_var_reference(Named_obj
location);
closure_ref =
Expression::make_dereference(closure_ref,
- Expression::NIL_CHECK_DEFAULT,
+ Expression::NIL_CHECK_NOT_NEEDED,
location);
// The closure structure holds pointers to the variables, so we need
@@ -2755,7 +2755,8 @@ Parse::enclosing_var_reference(Named_obj
Expression* e = Expression::make_field_reference(closure_ref,
ins.first->index(),
location);
- e = Expression::make_dereference(e, Expression::NIL_CHECK_DEFAULT, location);
+ e = Expression::make_dereference(e, Expression::NIL_CHECK_NOT_NEEDED,
+ location);
return Expression::make_enclosing_var_reference(e, var, location);
}
reply other threads:[~2017-12-05 2:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAOyqgcWGVa3T=Ap0GjHQp0HJUX7tp71J5Hwxx5d1HKXXyK015w@mail.gmail.com' \
--to=iant@golang.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=gofrontend-dev@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).