diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2018-01-17 21:24:41 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2018-01-17 21:24:41 +0000 |
commit | 06b6c6306496e29005a8d34a7232c23846ac564e (patch) | |
tree | dac729920f45521246291f4094a2a88eb51f2f2a /gcc/go/gofrontend/parse.cc | |
parent | 78a5fce0915a9077f814d05b05277c926032cffa (diff) | |
download | gcc-06b6c6306496e29005a8d34a7232c23846ac564e.zip gcc-06b6c6306496e29005a8d34a7232c23846ac564e.tar.gz gcc-06b6c6306496e29005a8d34a7232c23846ac564e.tar.bz2 |
compiler: enable escape analysis for runtime
The runtime package was hard-coded non-escape, and the escape
analysis was not run for the runtime package. This CL removes
the hard-code, and lets the escape analysis decide. It is not
allowed for local variables and closures in the runtime to be
heap allocated. This CL adds the check that make sure that they
indeed do not escape.
The escape analysis is always run when compiling the runtime
now.
Fixes golang/go#17431
Reviewed-on: https://go-review.googlesource.com/86246
From-SVN: r256820
Diffstat (limited to 'gcc/go/gofrontend/parse.cc')
-rw-r--r-- | gcc/go/gofrontend/parse.cc | 15 |
1 files changed, 0 insertions, 15 deletions
diff --git a/gcc/go/gofrontend/parse.cc b/gcc/go/gofrontend/parse.cc index 98f3067..8162abf 100644 --- a/gcc/go/gofrontend/parse.cc +++ b/gcc/go/gofrontend/parse.cc @@ -3059,21 +3059,6 @@ Parse::create_closure(Named_object* function, Enclosing_vars* enclosing_vars, Struct_type* st = closure_var->var_value()->type()->deref()->struct_type(); Expression* cv = Expression::make_struct_composite_literal(st, initializer, location); - - // When compiling the runtime, closures do not escape. When escape - // analysis becomes the default, and applies to closures, this - // should be changed to make it an error if a closure escapes. - if (this->gogo_->compiling_runtime() - && this->gogo_->package_name() == "runtime") - { - Temporary_statement* ctemp = Statement::make_temporary(st, cv, location); - this->gogo_->add_statement(ctemp); - Expression* ref = Expression::make_temporary_reference(ctemp, location); - Expression* addr = Expression::make_unary(OPERATOR_AND, ref, location); - addr->unary_expression()->set_does_not_escape(); - return addr; - } - return Expression::make_heap_expression(cv, location); } |