And this patch fixes the last patch to *really* only make function descriptors when they are needed. Sigh. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline and 4.8 branch.
Ian
diff -r 3081c3c4d620 go/expressions.cc --- a/go/expressions.cc Thu Jun 20 17:08:43 2013 -0700 +++ b/go/expressions.cc Thu Jun 20 17:16:00 2013 -0700 @@ -1242,24 +1242,6 @@ : Expression::traverse(&this->closure_, traverse)); } -// Lower a function reference. If this reference is not called -// directly, make sure there is a function descriptor. - -Expression* -Func_expression::do_lower(Gogo* gogo, Named_object*, Statement_inserter*, int) -{ - // Make sure that the descriptor exists. FIXME: If the function is - // only ever called, and is never referenced otherwise, then we - // don't need the descriptor. We could do that with another pass - // over the tree. - if (this->closure_ == NULL - && this->function_->is_function() - && !this->function_->func_value()->is_method()) - this->function_->func_value()->descriptor(gogo, this->function_); - - return this; -} - // Return the type of a function expression. Type* diff -r 3081c3c4d620 go/expressions.h --- a/go/expressions.h Thu Jun 20 17:08:43 2013 -0700 +++ b/go/expressions.h Thu Jun 20 17:16:00 2013 -0700 @@ -1524,9 +1524,6 @@ int do_traverse(Traverse*); - Expression* - do_lower(Gogo*, Named_object*, Statement_inserter*, int); - Type* do_type();