Commit 11a80860 authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

cmd/compile: move testdclstack out of the xdcl_list loop

This is a band-aid, but it fixes the problem
until a deeper fix is in place.

Testing with genpkg -n 50000, I see:

Before:

      154.67 real       184.66 user         3.15 sys

After:

       61.82 real        96.99 user         2.17 sys


Fixes #14781.

Change-Id: I24c7822d60c289bdd6a18a7840b984954c95f7d4
Reviewed-on: https://go-review.googlesource.com/20696Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
parent c45c5153
...@@ -2087,10 +2087,6 @@ func (p *parser) xdcl_list() (l []*Node) { ...@@ -2087,10 +2087,6 @@ func (p *parser) xdcl_list() (l []*Node) {
continue continue
} }
if nsyntaxerrors == 0 {
testdclstack()
}
// Reset p.pragma BEFORE advancing to the next token (consuming ';') // Reset p.pragma BEFORE advancing to the next token (consuming ';')
// since comments before may set pragmas for the next function decl. // since comments before may set pragmas for the next function decl.
p.pragma = 0 p.pragma = 0
...@@ -2100,6 +2096,10 @@ func (p *parser) xdcl_list() (l []*Node) { ...@@ -2100,6 +2096,10 @@ func (p *parser) xdcl_list() (l []*Node) {
p.advance(LVAR, LCONST, LTYPE, LFUNC) p.advance(LVAR, LCONST, LTYPE, LFUNC)
} }
} }
if nsyntaxerrors == 0 {
testdclstack()
}
return return
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment