]> Cypherpunks repositories - gostls13.git/commit
cmd/link: mmap object data
authorCherry Zhang <cherryyz@google.com>
Thu, 4 Apr 2019 04:29:16 +0000 (00:29 -0400)
committerCherry Zhang <cherryyz@google.com>
Fri, 19 Apr 2019 18:25:56 +0000 (18:25 +0000)
commitdbe32284ff4fb96906cdb121508eba668dbc5bae
treefa09a2d433fc587b5d90f5c7868dc5a2c24de5a5
parentf957a7e3572435c7d7031df8c58f63ebb633ecf7
cmd/link: mmap object data

This resurrects CL 121198, except that this time we map read-only.

In case that we need to apply relocations to the symbol's
content that is backed by read-only memory, we do our own copy-
on-write. This can happen if we failed to mmap the output file,
or we build for Wasm.

Memory profile for building k8s.io/kubernetes/cmd/kube-apiserver
on Linux/AMD64:

Old (before this sequence of CLs):
inuse_space 1598.75MB total
669.87MB 41.90% 41.90%   669.87MB 41.90%  cmd/link/internal/objfile.(*objReader).readSlices

New:
inuse_space 1280.45MB total
441.18MB 34.46% 34.46%   441.18MB 34.46%  cmd/link/internal/objfile.(*objReader).readSlices

Change-Id: I6b4d29d6eee9828089ea3120eb38c212db21330b
Reviewed-on: https://go-review.googlesource.com/c/go/+/170741
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/cmd/internal/bio/buf.go
src/cmd/internal/bio/buf_mmap.go [new file with mode: 0644]
src/cmd/internal/bio/buf_nommap.go [new file with mode: 0644]
src/cmd/link/internal/ld/data.go
src/cmd/link/internal/ld/outbuf.go
src/cmd/link/internal/objfile/objfile.go
src/cmd/link/internal/sym/attribute.go