aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2016-10-14 22:51:46 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2016-10-14 22:51:46 +0000
commit1f0be9ee86f63bac9c4541a9cfaf52cb5ae5e89a (patch)
tree584ab0cd64a2743fa7198ca34c7b13282c1c0ad7 /gcc
parent2045acd902fd8028514a72c58c98dba11749b8ad (diff)
downloadgcc-1f0be9ee86f63bac9c4541a9cfaf52cb5ae5e89a.zip
gcc-1f0be9ee86f63bac9c4541a9cfaf52cb5ae5e89a.tar.gz
gcc-1f0be9ee86f63bac9c4541a9cfaf52cb5ae5e89a.tar.bz2
runtime: copy mprof code from Go 1.7 runtime
Also create a gccgo version of some of the traceback code in traceback_gccgo.go, replacing some code currently in C. This required modifying the compiler so that when compiling the runtime package a slice expression does not cause a local array variable to escape to the heap. Reviewed-on: https://go-review.googlesource.com/31230 From-SVN: r241189
Diffstat (limited to 'gcc')
-rw-r--r--gcc/go/gofrontend/MERGE2
-rw-r--r--gcc/go/gofrontend/expressions.cc15
2 files changed, 14 insertions, 3 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index b2f0413..2e09ec1 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-993840643e27e52cda7e86e6a775f54443ea5d07
+ec3dc927da71d15cac48a13c0fb0c1f94572d0d2
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 daa1c92..261129f 100644
--- a/gcc/go/gofrontend/expressions.cc
+++ b/gcc/go/gofrontend/expressions.cc
@@ -10308,7 +10308,7 @@ Array_index_expression::do_determine_type(const Type_context*)
// Check types of an array index.
void
-Array_index_expression::do_check_types(Gogo*)
+Array_index_expression::do_check_types(Gogo* gogo)
{
Numeric_constant nc;
unsigned long v;
@@ -10427,7 +10427,18 @@ Array_index_expression::do_check_types(Gogo*)
if (!this->array_->is_addressable())
this->report_error(_("slice of unaddressable value"));
else
- this->array_->address_taken(true);
+ {
+ bool escapes = true;
+
+ // When compiling the runtime, a slice operation does not
+ // cause local variables to escape. When escape analysis
+ // becomes the default, this should be changed to make it an
+ // error if we have a slice operation that escapes.
+ if (gogo->compiling_runtime() && gogo->package_name() == "runtime")
+ escapes = false;
+
+ this->array_->address_taken(escapes);
+ }
}
}