aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2016-09-30 13:45:08 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2016-09-30 13:45:08 +0000
commitc0401cf78c555ef38d2d2fba94ebffeaef7c6bc9 (patch)
treed1646c0c4bb59624dfdc04420f835270129cc18e /gcc
parent9e28a77462f81a9a2ab9064d768bd7c9484047e1 (diff)
downloadgcc-c0401cf78c555ef38d2d2fba94ebffeaef7c6bc9.zip
gcc-c0401cf78c555ef38d2d2fba94ebffeaef7c6bc9.tar.gz
gcc-c0401cf78c555ef38d2d2fba94ebffeaef7c6bc9.tar.bz2
runtime: copy internal locking code from Go 1.7 runtime
Remove the old locking code written in C. Add a shell script mkrsysinfo.sh to generate the runtime_sysinfo.go file, so that we can get Go copies of the system time structures and other types. Tweak the compiler so that when compiling the runtime package the address operator does not cause local variables to escape. When the gc compiler compiles the runtime, an escaping local variable is treated as an error. We should implement that, instead of this change, when escape analysis is turned on. Tweak the compiler so that the generated C header does not include names that start with an underscore followed by a non-upper-case letter, except for the special cases of _defer and _panic. Otherwise we translate C types to Go in runtime_sysinfo.go and then generate those Go types back as C types in runtime.inc, which is useless and painful for the C code. Change entersyscall and friends to take a dummy argument, as the gc versions do, to simplify calls from the shared code. Reviewed-on: https://go-review.googlesource.com/30079 From-SVN: r240657
Diffstat (limited to 'gcc')
-rw-r--r--gcc/go/gofrontend/MERGE2
-rw-r--r--gcc/go/gofrontend/expressions.cc7
-rw-r--r--gcc/go/gofrontend/gogo.cc13
3 files changed, 21 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index 6e5d3c4..092baa2 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-e51657a576367c7a498c94baf985b79066fc082a
+f3fb9bf2d5a009a707962a416fcd1a8435756218
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc
index 5342e45..64b0d3c 100644
--- a/gcc/go/gofrontend/expressions.cc
+++ b/gcc/go/gofrontend/expressions.cc
@@ -3787,6 +3787,13 @@ Unary_expression::do_flatten(Gogo* gogo, Named_object*,
if ((n->encoding() & ESCAPE_MASK) == int(Node::ESCAPE_NONE))
this->escapes_ = false;
+ // When compiling the runtime, the address operator does not
+ // cause local variables to escapes. When escape analysis
+ // becomes the default, this should be changed to make it an
+ // error if we have an address operator that escapes.
+ if (gogo->compiling_runtime() && gogo->package_name() == "runtime")
+ this->escapes_ = false;
+
Named_object* var = NULL;
if (this->expr_->var_expression() != NULL)
var = this->expr_->var_expression()->named_object();
diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc
index 587ebd4..30392f7 100644
--- a/gcc/go/gofrontend/gogo.cc
+++ b/gcc/go/gofrontend/gogo.cc
@@ -4480,6 +4480,19 @@ Gogo::write_c_header()
++p)
{
Named_object* no = *p;
+
+ // Skip names that start with underscore followed by something
+ // other than an uppercase letter, as when compiling the runtime
+ // package they are mostly types defined by mkrsysinfo.sh based
+ // on the C system header files. We don't need to translate
+ // types to C and back to Go. But do accept the special cases
+ // _defer and _panic.
+ std::string name = Gogo::unpack_hidden_name(no->name());
+ if (name[0] == '_'
+ && (name[1] < 'A' || name[1] > 'Z')
+ && (name != "_defer" && name != "_panic"))
+ continue;
+
if (no->is_type() && no->type_value()->struct_type() != NULL)
types.push_back(no);
if (no->is_const() && no->const_value()->type()->integer_type() != NULL)