aboutsummaryrefslogtreecommitdiff
path: root/gcc/go/gofrontend/expressions.h
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2018-09-13 00:45:55 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2018-09-13 00:45:55 +0000
commit8a90f559d727a993b5a3c5c9c5d5cd5520a7503a (patch)
treef2ea2103f31f5a039dac854bf39c87a5c9daa85d /gcc/go/gofrontend/expressions.h
parent6201be94cd3da234ea9a6a0b767083328b885488 (diff)
downloadgcc-8a90f559d727a993b5a3c5c9c5d5cd5520a7503a.zip
gcc-8a90f559d727a993b5a3c5c9c5d5cd5520a7503a.tar.gz
gcc-8a90f559d727a993b5a3c5c9c5d5cd5520a7503a.tar.bz2
compiler: omit a couple of write barriers
Omit a write barrier for s = s[0:] for a slice s. In this case the pointer is not changing and no write barrier is required. Omit a write barrier for s = append(s, v) in the case where len(s) < cap(s) (and similarly when appending more values). When the slice has enough capacity the pointer is not changing and no write barrier is required. These changes are required to avoid write barriers in the method randomOrder.reset in the runtime package. That method is called from procresize, at a point where we do not want to allocate memory. Otherwise that method can use a write barrier, allocate memory, and break TestReadMemStats. Reviewed-on: https://go-review.googlesource.com/134219 From-SVN: r264259
Diffstat (limited to 'gcc/go/gofrontend/expressions.h')
-rw-r--r--gcc/go/gofrontend/expressions.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/go/gofrontend/expressions.h b/gcc/go/gofrontend/expressions.h
index 5fa4171..f53cc6e 100644
--- a/gcc/go/gofrontend/expressions.h
+++ b/gcc/go/gofrontend/expressions.h
@@ -869,6 +869,11 @@ class Expression
bool
is_local_variable() const;
+ // Return true if two expressions refer to the same variable or
+ // struct field.
+ static bool
+ is_same_variable(Expression*, Expression*);
+
// Make the builtin function descriptor type, so that it can be
// converted.
static void
@@ -2402,6 +2407,10 @@ class Builtin_call_expression : public Call_expression
static bool
array_len_is_constant(Expression* expr);
+ Expression*
+ flatten_append(Gogo*, Named_object*, Statement_inserter*, Expression*,
+ Block*);
+
protected:
// This overrides Call_expression::do_lower.
Expression*
@@ -2459,8 +2468,6 @@ class Builtin_call_expression : public Call_expression
Expression*
lower_make(Statement_inserter*);
- Expression* flatten_append(Gogo*, Named_object*, Statement_inserter*);
-
bool
check_int_value(Expression*, bool is_length, bool* small);