aboutsummaryrefslogtreecommitdiff
path: root/gcc/go
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2016-04-28 19:43:20 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2016-04-28 19:43:20 +0000
commitf22693cb96ef3b6b2006fb644a11267ccea845a6 (patch)
tree924e1d6fc2b0c90546f930da66281a6a2b2e8d07 /gcc/go
parent6181bc30ab7b986f2de6119fc846cf0d58d3328a (diff)
downloadgcc-f22693cb96ef3b6b2006fb644a11267ccea845a6.zip
gcc-f22693cb96ef3b6b2006fb644a11267ccea845a6.tar.gz
gcc-f22693cb96ef3b6b2006fb644a11267ccea845a6.tar.bz2
compiler: Mark concurrent calls.
If a call expression is executed in an independent goroutine via use of a Go statement, mark it as concurrent. Reviewed-on: https://go-review.googlesource.com/18700 From-SVN: r235608
Diffstat (limited to 'gcc/go')
-rw-r--r--gcc/go/gofrontend/MERGE2
-rw-r--r--gcc/go/gofrontend/expressions.h16
-rw-r--r--gcc/go/gofrontend/statements.cc6
3 files changed, 20 insertions, 4 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index ced2068..8dc8dc0 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-b17e404f5b8954e008b512741296d238ab7b2ef9
+50b2b468a85045c66d60112dc094c31ec4897123
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.h b/gcc/go/gofrontend/expressions.h
index a953bbd..339cb5d 100644
--- a/gcc/go/gofrontend/expressions.h
+++ b/gcc/go/gofrontend/expressions.h
@@ -1985,8 +1985,8 @@ class Call_expression : public Expression
fn_(fn), args_(args), type_(NULL), results_(NULL), call_(NULL),
call_temp_(NULL), expected_result_count_(0), is_varargs_(is_varargs),
varargs_are_lowered_(false), types_are_determined_(false),
- is_deferred_(false), issued_error_(false), is_multi_value_arg_(false),
- is_flattened_(false)
+ is_deferred_(false), is_concurrent_(false), issued_error_(false),
+ is_multi_value_arg_(false), is_flattened_(false)
{ }
// The function to call.
@@ -2057,6 +2057,16 @@ class Call_expression : public Expression
set_is_deferred()
{ this->is_deferred_ = true; }
+ // Whether this call is concurrently executed.
+ bool
+ is_concurrent() const
+ { return this->is_concurrent_; }
+
+ // Note that the call is concurrently executed.
+ void
+ set_is_concurrent()
+ { this->is_concurrent_ = true; }
+
// We have found an error with this call expression; return true if
// we should report it.
bool
@@ -2170,6 +2180,8 @@ class Call_expression : public Expression
bool types_are_determined_;
// True if the call is an argument to a defer statement.
bool is_deferred_;
+ // True if the call is an argument to a go statement.
+ bool is_concurrent_;
// True if we reported an error about a mismatch between call
// results and uses. This is to avoid producing multiple errors
// when there are multiple Call_result_expressions.
diff --git a/gcc/go/gofrontend/statements.cc b/gcc/go/gofrontend/statements.cc
index a84203a..ba77fd6 100644
--- a/gcc/go/gofrontend/statements.cc
+++ b/gcc/go/gofrontend/statements.cc
@@ -2532,7 +2532,9 @@ Thunk_statement::build_thunk(Gogo* gogo, const std::string& thunk_name)
gogo->flatten_block(function, b);
- if (may_call_recover || recover_arg != NULL)
+ if (may_call_recover
+ || recover_arg != NULL
+ || this->classification() == STATEMENT_GO)
{
// Dig up the call expression, which may have been changed
// during lowering.
@@ -2546,6 +2548,8 @@ Thunk_statement::build_thunk(Gogo* gogo, const std::string& thunk_name)
{
if (may_call_recover)
ce->set_is_deferred();
+ if (this->classification() == STATEMENT_GO)
+ ce->set_is_concurrent();
if (recover_arg != NULL)
ce->set_recover_arg(recover_arg);
}