1. 19 Apr, 2019 15 commits
    • Cherry Zhang's avatar
      cmd/link: apply relocations later · f957a7e3
      Cherry Zhang authored
      Move the phase of applying relocations later, after the sections
      and segments are written to the mmap'd output region. Then apply
      relocations directly in the output region, instead of the input.
      So the input slices we read in don't need to be modified.
      
      This is in preparation for mmap'ing input files read-only.
      
      Change-Id: If9c80657b4469da36aec5a9ab6acf664f5af8fa0
      Reviewed-on: https://go-review.googlesource.com/c/go/+/170739
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAustin Clements <austin@google.com>
      f957a7e3
    • Cherry Zhang's avatar
      cmd/link: apply DWARF relocations while doing compression · 248444d5
      Cherry Zhang authored
      We are preparing for applying relocations to the output buffer.
      However, for DWARF compression, relocations need to be applied
      before compression, but we don't have an output buffer at that
      time. We also cannot delay DWARF compression to when we mmap the
      output file, because we need the size of the DWARF sections to
      compute the file size.
      
      Instead of applying all the relocations together, we apply
      relocations in DWARF sections one symbol at a time, right before
      it is writing out for compression. As the symbol content may be
      in read-only memory (in the future), we use a temporary buffer
      for applying the relocations, and immediately write it out.
      
      If compression is not used, relocations are still applied all
      together.
      
      This is in preparation for mmap'ing input files read-only.
      
      Change-Id: Iae6d2dd71313897d5054bcc458d3bb78075b30c3
      Reviewed-on: https://go-review.googlesource.com/c/go/+/171397
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAustin Clements <austin@google.com>
      248444d5
    • Cherry Zhang's avatar
      cmd/link: apply R_DWARFFILEREF later · 15a31bd9
      Cherry Zhang authored
      Apply R_DWARFFILEREF relocations later, along with other
      relocations, so that we don't modify symbols' contents before
      they are written to the output buffer.
      
      This is in preparation for mmap'ing input files read-only.
      
      Change-Id: I8e9ffb2f05acf8f198589b8770f277beb3847541
      Reviewed-on: https://go-review.googlesource.com/c/go/+/170740
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAustin Clements <austin@google.com>
      15a31bd9
    • Cherry Zhang's avatar
      cmd/link: mmap output file · b2f94d3e
      Cherry Zhang authored
      Use mmap for writing most of the output file content,
      specifically, the sections and segments. After layout, we
      already know the sizes and file offsets for the sections and
      segments. So we can just write the bytes by copying to a mmap'd
      backing store.
      
      The writing of the output file is split into two parts. The first
      part writes the sections and segments to the mmap'd region. The
      second part writes some extra content, for which we don't know
      the size, so we use direct file IO.
      
      This is in preparation for mmap'ing input files read-only.
      
      Change-Id: I9f3b4616a9f96bfd5c940d74c50aacd6d330f7d2
      Reviewed-on: https://go-review.googlesource.com/c/go/+/170738
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAustin Clements <austin@google.com>
      b2f94d3e
    • Bryan C. Mills's avatar
      cmd/go/internal/modfetch: comment on known bug in isVendoredPackage · 47150aaf
      Bryan C. Mills authored
      Fixes #31562
      
      Change-Id: Ida30dd8071eccb6b490ab89a1de087038fe26796
      Reviewed-on: https://go-review.googlesource.com/c/go/+/172977
      Run-TryBot: Bryan C. Mills <bcmills@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarJay Conrod <jayconrod@google.com>
      47150aaf
    • Brad Fitzpatrick's avatar
      internal/goversion: add new package, move Go 1.x constant there out of go/build · 64e29f94
      Brad Fitzpatrick authored
      Found by Josh, who says in the bug that it shrinks cmd/compile by 1.6 MB (6.5%).
      
      Fixes #31563
      
      Change-Id: I35127af539630e628a0a4f2273af519093536c38
      Reviewed-on: https://go-review.googlesource.com/c/go/+/172997Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      Reviewed-by: default avatarJosh Bleecher Snyder <josharian@gmail.com>
      64e29f94
    • Cherry Zhang's avatar
      runtime: suppress thread event prints in gdb test · 97252f62
      Cherry Zhang authored
      Pass "set print thread-events off" to gdb to suppress thread
      event prints, like "[New Thread 0xe7b83b40 (LWP 18609)]". We
      don't check them, and the extra output may confuse our other
      checks, in particular, checkCleanBacktrace.
      
      Hopefully fixes #31569.
      
      Change-Id: I6549e1280da7afa1d2e38da2b2fa7cc18c2f0373
      Reviewed-on: https://go-review.googlesource.com/c/go/+/172980
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      Reviewed-by: default avatarBryan C. Mills <bcmills@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      97252f62
    • Ian Lance Taylor's avatar
      bootstrap.bash: make source writable before cleaning · 4a119141
      Ian Lance Taylor authored
      Otherwise the "git clean" command fails with errors like
          rm: cannot remove '/home/iant/go-linux-ppc64-bootstrap/pkg/mod/golang.org/x/text@v0.0.0-20170915032832-14c0d48ead0c/encoding/simplifiedchinese/all.go': Permission denied
      
      Change-Id: Iecfb1fed6d59819d7fdceb9e391a2b3f81ea620c
      Reviewed-on: https://go-review.googlesource.com/c/go/+/172998
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      4a119141
    • Ian Lance Taylor's avatar
      cmd/link: require cgo support for TestSectionsWithSameName · 4c236b9b
      Ian Lance Taylor authored
      The test doesn't really require cgo, but it does require that we know
      the right flags to use to run the C compiler, and that is not
      necessarily correct if we don't support cgo.
      
      Fixes #31565
      
      Change-Id: I04dc8db26697caa470e91ad712376aa621cf765d
      Reviewed-on: https://go-review.googlesource.com/c/go/+/172981
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      4c236b9b
    • Kai Dong's avatar
      sync: update comment · 5ccaf2c6
      Kai Dong authored
      Comment update.
      
      Change-Id: If0d054216f9953f42df04647b85c38008b85b026
      GitHub-Last-Rev: 133b4670be6dd1c94d16361c3a7a4bbdf8a355ab
      GitHub-Pull-Request: golang/go#31539
      Reviewed-on: https://go-review.googlesource.com/c/go/+/172700Reviewed-by: default avatarAustin Clements <austin@google.com>
      5ccaf2c6
    • Josh Bleecher Snyder's avatar
      runtime, cmd/compile: re-order PCDATA and FUNCDATA indices · 4aeac68c
      Josh Bleecher Snyder authored
      The pclntab encoding supports writing only some PCDATA and FUNCDATA values.
      However, the encoding is dense: The max index in use determines the space used.
      We should thus choose a numbering in which frequently used indices are smaller.
      
      This change re-orders the PCDATA and FUNCDATA indices using that principle,
      using a quick and dirty instrumentation to measure index frequency.
      
      It shrinks binaries by about 0.5%.
      
      Updates #6853
      
      file      before    after     Δ       %       
      go        14745044  14671316  -73728  -0.500% 
      addr2line 4305128   4280552   -24576  -0.571% 
      api       6095800   6058936   -36864  -0.605% 
      asm       4930928   4906352   -24576  -0.498% 
      buildid   2881520   2861040   -20480  -0.711% 
      cgo       4896584   4867912   -28672  -0.586% 
      compile   25868408  25770104  -98304  -0.380% 
      cover     5319656   5286888   -32768  -0.616% 
      dist      3654528   3634048   -20480  -0.560% 
      doc       4719672   4691000   -28672  -0.607% 
      fix       3418312   3393736   -24576  -0.719% 
      link      6137952   6109280   -28672  -0.467% 
      nm        4250536   4225960   -24576  -0.578% 
      objdump   4665192   4636520   -28672  -0.615% 
      pack      2297488   2285200   -12288  -0.535% 
      pprof     14735332  14657508  -77824  -0.528% 
      test2json 2834952   2818568   -16384  -0.578% 
      trace     11679964  11618524  -61440  -0.526% 
      vet       8452696   8403544   -49152  -0.581% 
      
      Change-Id: I30665dce57ec7a52e7d3c6718560b3aa5b83dd0b
      Reviewed-on: https://go-review.googlesource.com/c/go/+/171760
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAustin Clements <austin@google.com>
      4aeac68c
    • Josh Bleecher Snyder's avatar
      cmd/compile: move phi tighten after critical · c1544ff9
      Josh Bleecher Snyder authored
      The phi tighten pass moves rematerializable phi args
      to the immediate predecessor of the phis.
      This reduces value lifetimes for regalloc.
      
      However, the critical edge removal pass can introduce
      new blocks, which can change what a block's
      immediate precedessor is. This can result in tightened
      phi args being spilled unnecessarily.
      
      This change moves the phi tighten pass after the
      critical edge pass, when the block structure is stable.
      
      This improves the code generated for
      
      func f(s string) bool { return s == "abcde" }
      
      Before this change:
      
      "".f STEXT nosplit size=44 args=0x18 locals=0x0
      	0x0000 00000 (x.go:3)	MOVQ	"".s+16(SP), AX
      	0x0005 00005 (x.go:3)	CMPQ	AX, $5
      	0x0009 00009 (x.go:3)	JNE	40
      	0x000b 00011 (x.go:3)	MOVQ	"".s+8(SP), AX
      	0x0010 00016 (x.go:3)	CMPL	(AX), $1684234849
      	0x0016 00022 (x.go:3)	JNE	36
      	0x0018 00024 (x.go:3)	CMPB	4(AX), $101
      	0x001c 00028 (x.go:3)	SETEQ	AL
      	0x001f 00031 (x.go:3)	MOVB	AL, "".~r1+24(SP)
      	0x0023 00035 (x.go:3)	RET
      	0x0024 00036 (x.go:3)	XORL	AX, AX
      	0x0026 00038 (x.go:3)	JMP	31
      	0x0028 00040 (x.go:3)	XORL	AX, AX
      	0x002a 00042 (x.go:3)	JMP	31
      
      Observe the duplicated blocks at the end.
      After this change:
      
      "".f STEXT nosplit size=40 args=0x18 locals=0x0
      	0x0000 00000 (x.go:3)	MOVQ	"".s+16(SP), AX
      	0x0005 00005 (x.go:3)	CMPQ	AX, $5
      	0x0009 00009 (x.go:3)	JNE	36
      	0x000b 00011 (x.go:3)	MOVQ	"".s+8(SP), AX
      	0x0010 00016 (x.go:3)	CMPL	(AX), $1684234849
      	0x0016 00022 (x.go:3)	JNE	36
      	0x0018 00024 (x.go:3)	CMPB	4(AX), $101
      	0x001c 00028 (x.go:3)	SETEQ	AL
      	0x001f 00031 (x.go:3)	MOVB	AL, "".~r1+24(SP)
      	0x0023 00035 (x.go:3)	RET
      	0x0024 00036 (x.go:3)	XORL	AX, AX
      	0x0026 00038 (x.go:3)	JMP	31
      
      Change-Id: I12c81aa53b89456cb5809aa5396378245f3beda9
      Reviewed-on: https://go-review.googlesource.com/c/go/+/172597
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      c1544ff9
    • Bryan C. Mills's avatar
      {,cmd/}vendor: rerun 'go mod vendor' to prune ignored files · d68ac591
      Bryan C. Mills authored
      Updates #31088
      
      Change-Id: Ia126e4e83ac5cb12c2c4151d5e5c975497598f24
      Reviewed-on: https://go-review.googlesource.com/c/go/+/172979Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      d68ac591
    • Bryan C. Mills's avatar
      cmd/go/internal/modcmd: skip files with the "ignore" constraint in 'go mod vendor' · 7f161265
      Bryan C. Mills authored
      'go mod vendor' already drops test files and testdata directories, so
      users should not expect the vendored module to include unnecessary
      files in general.
      
      Files tagged "ignore" are typically only used to refresh or regenerate
      source files within the module to be vendored, so users of that module
      do not need them.
      
      Fixes #31088
      
      Change-Id: I1ce9545e9b37c8e779a1826a9d494ac29d2cbfb8
      Reviewed-on: https://go-review.googlesource.com/c/go/+/172978
      Run-TryBot: Bryan C. Mills <bcmills@google.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      7f161265
    • LE Manh Cuong's avatar
      cmd/compile: remove unused func nodfltconst · bdd7bb55
      LE Manh Cuong authored
      Its only usage was removed in golang.org/cl/103860
      
      Change-Id: I2a230b9475b0aadf3892b89f5e4ee6d4c5b70394
      Reviewed-on: https://go-review.googlesource.com/c/go/+/172917Reviewed-by: default avatarKeith Randall <khr@golang.org>
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      bdd7bb55
  2. 18 Apr, 2019 10 commits
  3. 17 Apr, 2019 11 commits
  4. 16 Apr, 2019 4 commits