diff options
author | Ian Lance Taylor <iant@golang.org> | 2022-03-25 17:23:50 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2022-04-15 14:27:05 -0700 |
commit | d00dd52ea15f9026c327d2f591eb456d6f11df2c (patch) | |
tree | 278f15dc95ab9f1cebaa975bece1cbd395f127de /libgo/go/runtime/mpagecache.go | |
parent | 7e76cef873342a66408c126abceaf7dbddd3f477 (diff) | |
download | gcc-d00dd52ea15f9026c327d2f591eb456d6f11df2c.zip gcc-d00dd52ea15f9026c327d2f591eb456d6f11df2c.tar.gz gcc-d00dd52ea15f9026c327d2f591eb456d6f11df2c.tar.bz2 |
compiler: revert `for package-scope "a = b; b = x" just set "a = x"`
Revert CL 245098. It caused incorrect initialization ordering.
Adjust the runtime package to work even with the CL reverted.
Original description of CL 245098:
This avoids requiring an init function to initialize the variable.
This can only be done if x is a static initializer.
The go1.15rc1 runtime package relies on this optimization.
The package has a variable "var maxSearchAddr = maxOffAddr".
The maxSearchAddr variable is used by code that runs before package
initialization is complete.
For golang/go#51913
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/395994
Diffstat (limited to 'libgo/go/runtime/mpagecache.go')
-rw-r--r-- | libgo/go/runtime/mpagecache.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libgo/go/runtime/mpagecache.go b/libgo/go/runtime/mpagecache.go index 7206e2d..5bad4f7 100644 --- a/libgo/go/runtime/mpagecache.go +++ b/libgo/go/runtime/mpagecache.go @@ -143,7 +143,7 @@ func (p *pageAlloc) allocToCache() pageCache { if addr == 0 { // We failed to find adequate free space, so mark the searchAddr as OoM // and return an empty pageCache. - p.searchAddr = maxSearchAddr + p.searchAddr = maxSearchAddr() return pageCache{} } ci := chunkIndex(addr) |