1. 07 Mar, 2019 16 commits
    • Robert Griesemer's avatar
      cmd/compile: remove work-arounds for 0o/0O octals · a77f85a6
      Robert Griesemer authored
      With math/big supporting the new octal prefixes directly,
      the compiler doesn't have to manually convert such numbers
      into old-style 0-prefix octals anymore.
      
      Updates #12711.
      
      Change-Id: I300bdd095836595426a1478d68da179f39e5531a
      Reviewed-on: https://go-review.googlesource.com/c/go/+/165861Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      a77f85a6
    • Robert Griesemer's avatar
      math/big: support new octal prefixes 0o and 0O · 129c6e44
      Robert Griesemer authored
      This CL extends the various SetString and Parse methods for
      Ints, Rats, and Floats to accept the new octal prefixes.
      
      The main change is in natconv.go, all other changes are
      documentation and test updates.
      
      Finally, this CL also fixes TestRatSetString which silently
      dropped certain failures.
      
      Updates #12711.
      
      Change-Id: I5ee5879e25013ba1e6eda93ff280915f25ab5d55
      Reviewed-on: https://go-review.googlesource.com/c/go/+/165898Reviewed-by: default avatarEmmanuel Odeke <emm.odeke@gmail.com>
      129c6e44
    • Raul Silvera's avatar
      test: improve test coverage for heap sampling · 2dd066d4
      Raul Silvera authored
      Update the test in test/heapsampling.go to more thoroughly validate heap sampling.
      Lower the sampling rate on the test to ensure allocations both smaller and
      larger than the sampling rate are tested.
      
      Tighten up the validation check to a 10% difference between the unsampled and correct value.
      Because of the nature of random sampling, it is possible that the unsampled value fluctuates
      over that range. To avoid flakes, run the experiment three times and only report an issue if the
      same location consistently falls out of range on all experiments.
      
      This tests the sampling fix in cl/158337.
      
      Change-Id: I54a709e5c75827b8b1c2d87cdfb425ab09759677
      GitHub-Last-Rev: 7c04f126034f9e323efc220c896d75e7984ffd39
      GitHub-Pull-Request: golang/go#26944
      Reviewed-on: https://go-review.googlesource.com/c/go/+/129117
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAustin Clements <austin@google.com>
      2dd066d4
    • Chris Marchesi's avatar
      net/http: let Transport request body writes use sendfile · 6ebfbbaa
      Chris Marchesi authored
      net.TCPConn has the ability to send data out using system calls such as
      sendfile when the source data comes from an *os.File. However, the way
      that I/O has been laid out in the transport means that the File is
      actually wrapped behind two outer io.Readers, and as such the TCP stack
      cannot properly type-assert the reader, ensuring that it falls back to
      genericReadFrom.
      
      This commit does the following:
      
      * Removes transferBodyReader and moves its functionality to a new
      doBodyCopy helper. This is not an io.Reader implementation, but no
      functionality is lost this way, and it allows us to unwrap one layer
      from the body.
      
      * The second layer of the body is unwrapped if the original reader
      was wrapped with ioutil.NopCloser, which is what NewRequest wraps the
      body in if it's not a ReadCloser on its own. The unwrap operation
      passes through the existing body if there's no nopCloser.
      
      Note that this depends on change https://golang.org/cl/163737 to
      properly function, as the lack of ReaderFrom implementation otherwise
      means that this functionality is essentially walled off.
      
      Benchmarks between this commit and https://golang.org/cl/163862,
      incorporating https://golang.org/cl/163737:
      
      linux/amd64:
      name                        old time/op    new time/op    delta
      FileAndServer_1KB/NoTLS-4     53.2µs ± 0%    53.3µs ± 0%      ~     (p=0.075 n=10+9)
      FileAndServer_1KB/TLS-4       61.2µs ± 0%    60.7µs ± 0%    -0.77%  (p=0.000 n=10+9)
      FileAndServer_16MB/NoTLS-4    25.3ms ± 5%     3.8ms ± 6%   -84.95%  (p=0.000 n=10+10)
      FileAndServer_16MB/TLS-4      33.2ms ± 2%    13.4ms ± 2%   -59.57%  (p=0.000 n=10+10)
      FileAndServer_64MB/NoTLS-4     106ms ± 4%      16ms ± 2%   -84.45%  (p=0.000 n=10+10)
      FileAndServer_64MB/TLS-4       129ms ± 1%      54ms ± 3%   -58.32%  (p=0.000 n=8+10)
      
      name                        old speed      new speed      delta
      FileAndServer_1KB/NoTLS-4   19.2MB/s ± 0%  19.2MB/s ± 0%      ~     (p=0.095 n=10+9)
      FileAndServer_1KB/TLS-4     16.7MB/s ± 0%  16.9MB/s ± 0%    +0.78%  (p=0.000 n=10+9)
      FileAndServer_16MB/NoTLS-4   664MB/s ± 5%  4415MB/s ± 6%  +565.27%  (p=0.000 n=10+10)
      FileAndServer_16MB/TLS-4     505MB/s ± 2%  1250MB/s ± 2%  +147.32%  (p=0.000 n=10+10)
      FileAndServer_64MB/NoTLS-4   636MB/s ± 4%  4090MB/s ± 2%  +542.81%  (p=0.000 n=10+10)
      FileAndServer_64MB/TLS-4     522MB/s ± 1%  1251MB/s ± 3%  +139.95%  (p=0.000 n=8+10)
      
      darwin/amd64:
      name                        old time/op    new time/op     delta
      FileAndServer_1KB/NoTLS-8     93.0µs ± 5%     96.6µs ±11%      ~     (p=0.190 n=10+10)
      FileAndServer_1KB/TLS-8        105µs ± 7%      100µs ± 5%    -5.14%  (p=0.002 n=10+9)
      FileAndServer_16MB/NoTLS-8    87.5ms ±19%     10.0ms ± 6%   -88.57%  (p=0.000 n=10+10)
      FileAndServer_16MB/TLS-8      52.7ms ±11%     17.4ms ± 5%   -66.92%  (p=0.000 n=10+10)
      FileAndServer_64MB/NoTLS-8     363ms ±54%       39ms ± 7%   -89.24%  (p=0.000 n=10+10)
      FileAndServer_64MB/TLS-8       209ms ±13%       73ms ± 5%   -65.37%  (p=0.000 n=9+10)
      
      name                        old speed      new speed       delta
      FileAndServer_1KB/NoTLS-8   11.0MB/s ± 5%   10.6MB/s ±10%      ~     (p=0.184 n=10+10)
      FileAndServer_1KB/TLS-8     9.75MB/s ± 7%  10.27MB/s ± 5%    +5.26%  (p=0.003 n=10+9)
      FileAndServer_16MB/NoTLS-8   194MB/s ±16%   1680MB/s ± 6%  +767.83%  (p=0.000 n=10+10)
      FileAndServer_16MB/TLS-8     319MB/s ±10%    963MB/s ± 4%  +201.36%  (p=0.000 n=10+10)
      FileAndServer_64MB/NoTLS-8   180MB/s ±31%   1719MB/s ± 7%  +853.61%  (p=0.000 n=9+10)
      FileAndServer_64MB/TLS-8     321MB/s ±12%    926MB/s ± 5%  +188.24%  (p=0.000 n=9+10)
      
      Updates #30377.
      
      Change-Id: I631a73cea75371dfbb418c9cd487c4aa35e73fcd
      GitHub-Last-Rev: 4a77dd1b80140274bf3ed20ad7465ff3cc06febf
      GitHub-Pull-Request: golang/go#30378
      Reviewed-on: https://go-review.googlesource.com/c/go/+/163599
      Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarEmmanuel Odeke <emm.odeke@gmail.com>
      6ebfbbaa
    • Komu Wairagu's avatar
      runtime/pprof: document labels bug · 9a710158
      Komu Wairagu authored
      Currently only CPU profile utilizes tag information.
      This change documents that fact
      
      Updates #23458
      
      Change-Id: Ic893e85f63af0da9100d8cba7d3328c294e8c810
      GitHub-Last-Rev: be99a126296493b3085aa5ade91895b36fb1de73
      GitHub-Pull-Request: golang/go#27198
      Reviewed-on: https://go-review.googlesource.com/c/go/+/131275Reviewed-by: default avatarHyang-Ah Hana Kim <hyangah@gmail.com>
      9a710158
    • royeo's avatar
      log: make the name of error clearer · 91170d72
      royeo authored
      Change-Id: Id0398b51336cc74f2172d9b8e18cb1dcb520b9a0
      GitHub-Last-Rev: b5cf80bf9d7f79eab1a398ad3c03f3b424aafdf1
      GitHub-Pull-Request: golang/go#29931
      Reviewed-on: https://go-review.googlesource.com/c/go/+/159537Reviewed-by: default avatarEmmanuel Odeke <emm.odeke@gmail.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      91170d72
    • erifan01's avatar
      cmd/compile: eliminate unnecessary type conversions in TrailingZeros(16|8) for arm64 · 4e2b0dda
      erifan01 authored
      This CL eliminates unnecessary type conversion operations: OpZeroExt16to64 and OpZeroExt8to64.
      If the input argrument is a nonzero value, then ORconst operation can also be eliminated.
      
      Benchmarks:
      
      name               old time/op  new time/op  delta
      TrailingZeros-8    2.75ns ± 0%  2.75ns ± 0%     ~     (all equal)
      TrailingZeros8-8   3.49ns ± 1%  2.93ns ± 0%  -16.00%  (p=0.000 n=10+10)
      TrailingZeros16-8  3.49ns ± 1%  2.93ns ± 0%  -16.05%  (p=0.000 n=9+10)
      TrailingZeros32-8  2.67ns ± 1%  2.68ns ± 1%     ~     (p=0.468 n=10+10)
      TrailingZeros64-8  2.67ns ± 1%  2.65ns ± 0%   -0.62%  (p=0.022 n=10+9)
      
      code:
      
      func f16(x uint) { z = bits.TrailingZeros16(uint16(x)) }
      
      Before:
      
      "".f16 STEXT size=48 args=0x8 locals=0x0 leaf
              0x0000 00000 (test.go:7)        TEXT    "".f16(SB), LEAF|NOFRAME|ABIInternal, $0-8
              0x0000 00000 (test.go:7)        FUNCDATA        ZR, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB)
              0x0000 00000 (test.go:7)        FUNCDATA        $1, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB)
              0x0000 00000 (test.go:7)        FUNCDATA        $3, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB)
              0x0000 00000 (test.go:7)        PCDATA  $2, ZR
              0x0000 00000 (test.go:7)        PCDATA  ZR, ZR
              0x0000 00000 (test.go:7)        MOVD    "".x(FP), R0
              0x0004 00004 (test.go:7)        MOVHU   R0, R0
              0x0008 00008 (test.go:7)        ORR     $65536, R0, R0
              0x000c 00012 (test.go:7)        RBIT    R0, R0
              0x0010 00016 (test.go:7)        CLZ     R0, R0
              0x0014 00020 (test.go:7)        MOVD    R0, "".z(SB)
              0x0020 00032 (test.go:7)        RET     (R30)
      
      This line of code is unnecessary:
              0x0004 00004 (test.go:7)        MOVHU   R0, R0
      
      After:
      
      "".f16 STEXT size=32 args=0x8 locals=0x0 leaf
              0x0000 00000 (test.go:7)        TEXT    "".f16(SB), LEAF|NOFRAME|ABIInternal, $0-8
              0x0000 00000 (test.go:7)        FUNCDATA        ZR, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB)
              0x0000 00000 (test.go:7)        FUNCDATA        $1, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB)
              0x0000 00000 (test.go:7)        FUNCDATA        $3, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB)
              0x0000 00000 (test.go:7)        PCDATA  $2, ZR
              0x0000 00000 (test.go:7)        PCDATA  ZR, ZR
              0x0000 00000 (test.go:7)        MOVD    "".x(FP), R0
              0x0004 00004 (test.go:7)        ORR     $65536, R0, R0
              0x0008 00008 (test.go:7)        RBITW   R0, R0
              0x000c 00012 (test.go:7)        CLZW    R0, R0
              0x0010 00016 (test.go:7)        MOVD    R0, "".z(SB)
              0x001c 00028 (test.go:7)        RET     (R30)
      
      The situation of TrailingZeros8 is similar to TrailingZeros16.
      
      Change-Id: I473bdca06be8460a0be87abbae6fe640017e4c9d
      Reviewed-on: https://go-review.googlesource.com/c/go/+/156999Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      4e2b0dda
    • erifan01's avatar
      cmd/compile: add an optimization rule for math/bits.ReverseBytes16 on arm · fee84cc9
      erifan01 authored
      This CL adds two rules to turn patterns like ((x<<8) | (x>>8)) (the type of
      x is uint16, "|" can also be "+" or "^") to a REV16 instruction on arm v6+.
      This optimization rule can be used for math/bits.ReverseBytes16.
      
      Benchmarks on arm v6:
      name               old time/op  new time/op  delta
      ReverseBytes-32    2.86ns ± 0%  2.86ns ± 0%   ~     (all equal)
      ReverseBytes16-32  2.86ns ± 0%  2.86ns ± 0%   ~     (all equal)
      ReverseBytes32-32  1.29ns ± 0%  1.29ns ± 0%   ~     (all equal)
      ReverseBytes64-32  1.43ns ± 0%  1.43ns ± 0%   ~     (all equal)
      
      Change-Id: I819e633c9a9d308f8e476fb0c82d73fb73dd019f
      Reviewed-on: https://go-review.googlesource.com/c/go/+/159019Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      fee84cc9
    • Chris Marchesi's avatar
      net/http: unfurl persistConnWriter's underlying writer · a2ace8ec
      Chris Marchesi authored
      Make persistConnWriter implement io.ReaderFrom, via an io.Copy on the
      underlying net.Conn. This in turn enables it to use OS level
      optimizations such as sendfile.
      
      This has been observed giving performance gains even in the absence
      of ReaderFrom, more than likely due to the difference in io's default
      buffer (32 KB) versus bufio's (4 KB).
      
      Speedups on linux/amd64:
      benchmark                               old MB/s     new MB/s     speedup
      BenchmarkFileAndServer_16MB/NoTLS-4     662.96       2703.74      4.08x
      BenchmarkFileAndServer_16MB/TLS-4       552.76       1420.72      2.57x
      
      Speedups on darwin/amd64:
      benchmark                               old MB/s     new MB/s     speedup
      BenchmarkFileAndServer_16MB/NoTLS-8     357.58       1972.86      5.52x
      BenchmarkFileAndServer_16MB/TLS-8       346.20       1067.41      3.08x
      
      Updates #30377.
      
      Change-Id: Ic88d4ac254f665223536fcba4d551fc32ae105b6
      GitHub-Last-Rev: a6f67cda2ed63ac61a1dffc87f0ea396363f72c6
      GitHub-Pull-Request: golang/go#30390
      Reviewed-on: https://go-review.googlesource.com/c/go/+/163737
      Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarEmmanuel Odeke <emm.odeke@gmail.com>
      a2ace8ec
    • alkesh26's avatar
      misc: fix typos in various docs · c7f69a28
      alkesh26 authored
      Change-Id: Ib03d7e5686e510152042e403b00fb2d65572f393
      GitHub-Last-Rev: 57aeedf077cb4f82af68cc5cb2de5d53a447565e
      GitHub-Pull-Request: golang/go#30156
      Reviewed-on: https://go-review.googlesource.com/c/go/+/161723Reviewed-by: default avatarEmmanuel Odeke <emm.odeke@gmail.com>
      c7f69a28
    • Martin Möhrmann's avatar
      runtime: remove CPU capability workarounds for unsupported FreeBSD versions · 3b6216ed
      Martin Möhrmann authored
      This CL removes runtime code working around missing ARM processor capability
      information in the auxiliary vector in older FreeBSD versions.
      
      As announced in the Go 1.12 release notes Go 1.13 will require FreeBSD 11.2+
      or FreeBSD 12.0+. These FreeBSD versions support CPU capability detection
      through AT_HWCAP and AT_HWCAP2 values stored in the auxiliary vector.
      
      Updates #27619
      
      Change-Id: I2a457b578d35101a7a5fd56ae9b81b300ad17da4
      Reviewed-on: https://go-review.googlesource.com/c/go/+/165799Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: default avatarYuval Pavel Zholkover <paulzhol@gmail.com>
      Reviewed-by: default avatarTobias Klauser <tobias.klauser@gmail.com>
      Run-TryBot: Martin Möhrmann <martisch@uos.de>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      3b6216ed
    • Andrei Matei's avatar
      database/sql: fix comment grammar · 9e72e604
      Andrei Matei authored
      Change-Id: I92d8c93967c5ec57f07151affd0041f00e405057
      GitHub-Last-Rev: 2dea977d938a504604aed6a9ae87986001f96acd
      GitHub-Pull-Request: golang/go#30551
      Reviewed-on: https://go-review.googlesource.com/c/go/+/164970Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      9e72e604
    • Rob Pike's avatar
      doc: add missing paragraph break in Effective Go · fd19bc64
      Rob Pike authored
      A recent edit broke the flow; add a paragraph break when the subject
      switches from maps to structs.
      
      No changes in wording.
      
      Change-Id: I5df88ec36b9d81931cfdbc684424440d01ac06d1
      Reviewed-on: https://go-review.googlesource.com/c/go/+/165917Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      fd19bc64
    • Russ Cox's avatar
      cmd/go: add notary simulation and GONOVERIFY support · fe954ea1
      Russ Cox authored
      As an experiment to better understand the impact of
      having an authoritative source of truth for module hashes
      before the real notary is available, this CL adds the basic
      notary authorization checks using a partial whitelist of
      known go.sum values for popular modules.
      
      In addition to the temporary whitelist, this CL adds code
      implementing $GONOVERIFY, a new 'go help modules-auth',
      and clearer error messages for verification mismatches.
      
      See #25530 for notary proposal.
      Filed #30601 to remove whitelist when notary lands.
      
      Change-Id: Ibcb6ac39c5e60455edf003d8c20af6932aeb7e88
      Reviewed-on: https://go-review.googlesource.com/c/go/+/165380Reviewed-by: default avatarBryan C. Mills <bcmills@google.com>
      fe954ea1
    • Ian Lance Taylor's avatar
      cmd/cgo: use explicit type for arg with bad pointer typedef · a6436a56
      Ian Lance Taylor authored
      Fixes #30646
      
      Change-Id: I5b7e986b0588e87b9781cce01445e3c55c06b6fc
      Reviewed-on: https://go-review.googlesource.com/c/go/+/165897
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      a6436a56
    • Keith Randall's avatar
      reflect: fix more issues with StructOf GC programs · 9dc3b8b7
      Keith Randall authored
      First the insidious bug:
      
        var n uintptr
        for n := elemPtrs; n > 120; n -= 120 {
          prog = append(prog, 120)
          prog = append(prog, mask[:15]...)
          mask = mask[15:]
        }
        prog = append(prog, byte(n))
        prog = append(prog, mask[:(n+7)/8]...)
      
      The := breaks this code, because the n after the loop is always 0!
      
      We also do need to handle field padding correctly. In particular
      the old padding code doesn't correctly handle fields that are not
      a multiple of a pointer in size.
      
      Fixes #30606.
      
      Change-Id: Ifcab9494dc25c20116753c5d7e0145d6c2053ed8
      Reviewed-on: https://go-review.googlesource.com/c/go/+/165860
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      9dc3b8b7
  2. 06 Mar, 2019 24 commits
    • Rebecca Stambler's avatar
      go/constant: add Val accessor and Make constructor to handle varied types · e269f4ce
      Rebecca Stambler authored
      This change adds a Val accessor that returns the underlying type for a
      given constant.Value. This change also adds a Make constructor that builds a
      constant.Value given a value of a specific type.
      
      Fixes #29820
      
      Change-Id: I4fc3f5221408e24af42ffecd21ce4099ee75b47a
      Reviewed-on: https://go-review.googlesource.com/c/go/+/164538Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      e269f4ce
    • Alessandro Arzilli's avatar
      cmd/link: fix contents of debug_pubnames/debug_pubtypes · 4d8a37a6
      Alessandro Arzilli authored
      The contents of debug_pubnames and debug_pubtypes have been wrong since
      Go 1.12.
      CL golang.org/cl/137235 moved global variables DIE to their respective
      compilation unit, unfortunately writepub can't emit correct sections
      for anything but the first compilation unit.
      
      This commit moves the code generating debug_pubnames and debug_pubtypes
      inside writeinfo and fixes it.
      Gets rid of a number of unnecessary relocations as well as a hack that
      writeinfo used to communicate to writepub the size of each compilation
      unit.
      
      Fixes #30573
      
      Change-Id: Ibdaa80c02746ae81661c2cfe1d218092c5ae9236
      Reviewed-on: https://go-review.googlesource.com/c/go/+/165337
      Run-TryBot: Alessandro Arzilli <alessandro.arzilli@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarHeschi Kreinick <heschi@google.com>
      4d8a37a6
    • Dmitri Shuralyov's avatar
      cmd/go: document GoVersion field in Module struct · 1a6c0c6b
      Dmitri Shuralyov authored
      The 'go version' statement was added during Go 1.11 development in
      CL 125940. That CL added the GoVersion field to modinfo.ModulePublic
      struct, but did not document it in cmd/go documentation. This was
      consistent with the CL description, which stated "We aren't planning
      to use this or advertise it much yet".
      
      CL 147281, applied during Go 1.12 development, was a change to start
      adding the 'go version' statement when initializing go.mod. The 'go
      version' statement is now being used, and it has been documented in
      the Go 1.12 release notes at https://golang.org/doc/go1.12#modules.
      It's now due time to documement the GoVersion field in cmd/go as well.
      
      Keep the Error field bottom-most, both because it makes sense not to
      place it in the middle of other fields, and for consistency with the
      field order in struct Package, where the Error information is located
      at the very bottom.
      
      Regenerate alldocs.go by running mkalldocs.sh.
      
      Updates #28221
      Updates #23969
      
      Change-Id: Iaf43a0da4f6a2489d861092a1d4e002a532952cb
      Reviewed-on: https://go-review.googlesource.com/c/go/+/164878
      Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBryan C. Mills <bcmills@google.com>
      1a6c0c6b
    • Ian Lance Taylor's avatar
      runtime: align first persistentalloc chunk as requested · c5babcc4
      Ian Lance Taylor authored
      Change-Id: Ib391e019b1a7513d234fb1c8ff802efe8fa7c950
      Reviewed-on: https://go-review.googlesource.com/c/go/+/163859
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAustin Clements <austin@google.com>
      c5babcc4
    • Rémy Oudompheng's avatar
      cmd/cgo: simplify and fix handling of untyped constants · 711ea1e7
      Rémy Oudompheng authored
      Instead of trying to guess type of constants in the AST,
      which is hard, use the "var cgo%d Type = Constant"
      so that typechecking is left to the Go compiler.
      
      The previous code could still fail in some cases
      for constants imported from other modules
      or defined in other, non-cgo files.
      
      Fixes #30527
      
      Change-Id: I2120cd90e90a74b9d765eeec53f6a3d2cfc1b642
      Reviewed-on: https://go-review.googlesource.com/c/go/+/164897
      Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      711ea1e7
    • Bryan C. Mills's avatar
      cmd/go: run the 'go build' command in TestACL in the temp directory · edf8539f
      Bryan C. Mills authored
      Otherwise, when the 'cmd' module is added the test will run as if in module 'cmd'.
      
      While we're here, remove an unnecessary os.Chdir in TestAbsolutePath:
      we can instead set the Dir on the 'go build' command instead. Then we
      can run the tests in this file in parallel with everything else.
      
      Updates #30228
      
      Change-Id: I13ecd7ec93bc1041010daec14d76bac10e0c89be
      Reviewed-on: https://go-review.googlesource.com/c/go/+/165744
      Run-TryBot: Bryan C. Mills <bcmills@google.com>
      Reviewed-by: default avatarJay Conrod <jayconrod@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      edf8539f
    • Than McIntosh's avatar
      go/internal/gccgoimporter: test case for issue 30628 · 88d719f8
      Than McIntosh authored
      Test case for a panic/crash in gccgoimporter caused by incorrect gccgo
      export data emission. Note that the *.gox file checked in contains the
      correct export data; the main intent of the test is to make sure that
      gccgo produces the right export data when run on the Go source.
      
      Updates #30628
      
      Change-Id: I29c0c17b81a43f92ff64fbfcdc58fdb46a5be370
      Reviewed-on: https://go-review.googlesource.com/c/go/+/165739
      Run-TryBot: Than McIntosh <thanm@google.com>
      Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      88d719f8
    • Keith Randall's avatar
      reflect: fix StructOf GC programs · 05b3db24
      Keith Randall authored
      They are missing a stop byte at the end.
      
      Normally this doesn't matter, but when including a GC program
      in another GC program, we strip the last byte. If that last byte
      wasn't a stop byte, then we've thrown away part of the program
      we actually need.
      
      Fixes #30606
      
      Change-Id: Ie9604beeb84f7f9442e77d31fe64c374ca132cce
      Reviewed-on: https://go-review.googlesource.com/c/go/+/165857
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      05b3db24
    • Jay Conrod's avatar
      cmd/go: drop support for binary-only packages · 1650f1ba
      Jay Conrod authored
      Fixes #28152
      
      Change-Id: I98db923bdf8de7acf2df452313427bfea43b63c9
      Reviewed-on: https://go-review.googlesource.com/c/go/+/165746
      Run-TryBot: Jay Conrod <jayconrod@google.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      1650f1ba
    • Bryan C. Mills's avatar
      cmd/vet/all: build the vet tool within the golang.org/x/tools repository · a30421a3
      Bryan C. Mills authored
      When running cmd/vet/all on multiple builders, the coordinator places
      a copy of golang.org/x/tools at a consistent revision in the builders'
      GOPATHs. Keep using the consistent revision in module mode by
      executing the build from a working directory within that repository.
      
      When not running on a builder, use 'go vet' directly instead of
      building an arbitrarily stale vet tool from the user's GOPATH.
      
      Updates #30228
      
      Change-Id: I19bc809247378da98f3e6ac8572f61bda4518143
      Reviewed-on: https://go-review.googlesource.com/c/go/+/165740
      Run-TryBot: Bryan C. Mills <bcmills@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      a30421a3
    • Keith Randall's avatar
      cmd/compile: fix ordering for short-circuiting ops · 4a9064ef
      Keith Randall authored
      Make sure the side effects inside short-circuited operations (&& and ||)
      happen correctly.
      
      Before this CL, we attached the side effects to the node itself using
      exprInPlace. That caused other side effects in sibling expressions
      to get reordered with respect to the short circuit side effect.
      
      Instead, rewrite a && b like:
      
      r := a
      if r {
        r = b
      }
      
      That code we can keep correctly ordered with respect to other
      side-effects extracted from part of a big expression.
      
      exprInPlace seems generally unsafe. But this was the only case where
      exprInPlace is called not at the top level of an expression, so I
      don't think the other uses can actually trigger an issue (there can't
      be a sibling expression). TODO: maybe those cases don't need "in
      place", and we can retire that function generally.
      
      This CL needed a small tweak to the SSA generation of OIF so that the
      short circuit optimization still triggers. The short circuit optimization
      looks for triangle but not diamonds, so don't bother allocating a block
      if it will be empty.
      
      Go 1 benchmarks are in the noise.
      
      Fixes #30566
      
      Change-Id: I19c04296bea63cbd6ad05f87a63b005029123610
      Reviewed-on: https://go-review.googlesource.com/c/go/+/165617
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDavid Chase <drchase@google.com>
      4a9064ef
    • Bryan C. Mills's avatar
      cmd/go: clear GOPROXY in TestGoGetInsecure · 7778b5ab
      Bryan C. Mills authored
      TestGoGetInsecure verifies that 'go get -insecure' can fetch a
      particular package. However, the GOPROXY protocol does not provide a
      means for proxies to indicate packages as insecure; thus, proxies
      cannot safely serve those packages.
      
      Updates #30571
      
      Change-Id: I447776dff98bd8ee6eb5055b897b9c7d293e3423
      Reviewed-on: https://go-review.googlesource.com/c/go/+/165745
      Run-TryBot: Bryan C. Mills <bcmills@google.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      7778b5ab
    • Bryan C. Mills's avatar
      runtime: do not use a relative import in testdata · 52e2126a
      Bryan C. Mills authored
      Relative imports do not work in module mode. Use a fully-qualified
      import path instead.
      
      Updates #30228
      
      Change-Id: I0a42ffa521a7b513395e7e1788022d24cbb1f31a
      Reviewed-on: https://go-review.googlesource.com/c/go/+/165817
      Run-TryBot: Bryan C. Mills <bcmills@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarJay Conrod <jayconrod@google.com>
      52e2126a
    • Bryan C. Mills's avatar
      test/bench/go1: add go.mod file · b1a783df
      Bryan C. Mills authored
      cmd/dist executes 'go test' within this directory, so it needs a
      go.mod file to tell the compiler what package path to use in
      diagnostic and debug information.
      
      Updates #30228
      
      Change-Id: Ia313ac06bc0ec4631d415faa20c56cce2ac8dbc5
      Reviewed-on: https://go-review.googlesource.com/c/go/+/165498
      Run-TryBot: Bryan C. Mills <bcmills@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      b1a783df
    • erifan01's avatar
      cmd/asm: add arm64 v8.1 atomic instructions · 44808985
      erifan01 authored
      This change adds several arm64 v8.1 atomic instructions and test cases.
      They are LDADDAx, LDADDLx, LDANDAx, LDANDALx, LDANDLx, LDEORAx, LDEORALx,
      LDEORLx, LDORAx, LDORALx, LDORLx, SWPAx and SWPLx. Their form is consistent
      with the form of the existing atomic instructions.
      
      For instructions STXRx, STLXRx, STXPx and STLXPx, the second destination
      register can't be RSP. This CL also adds a check for this.
      
      LDADDx Rs, (Rb), Rt: *Rb -> Rt, Rs + *Rb -> *Rb
      LDANDx Rs, (Rb), Rt: *Rb -> Rt, Rs AND NOT(*Rb) -> *Rb
      LDEORx Rs, (Rb), Rt: *Rb -> Rt, Rs EOR *Rb -> *Rb
      LDORx  Rs, (Rb), Rt: *Rb -> Rt, Rs OR *Rb -> *Rb
      
      Change-Id: I9f9b0245958cb57ab7d88c66fb9159b23b9017fd
      Reviewed-on: https://go-review.googlesource.com/c/go/+/157001Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      44808985
    • Wèi Cōngruì's avatar
      internal/poll: fix deadlock in Write if len(buf) > maxRW · 40d8c3d3
      Wèi Cōngruì authored
      fd.l.Lock shouldn't be called in a loop.
      
      Change-Id: I3afbc184aa06a60175c9a39319985b5810ecb144
      Reviewed-on: https://go-review.googlesource.com/c/go/+/165598
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      40d8c3d3
    • Wèi Cōngruì's avatar
      internal/poll: make FD.isFile mean whether it isn't socket on Windows · a60b56ad
      Wèi Cōngruì authored
      Before this change, if a directory was closed twice on Windows,
      the returning error would be "use of closed network connection".
      
      Some code assumes FD.isFile means whether the fd isn't a network
      socket, which is true on Unix. But isFile reports whether
      the fd is a normal file rather than directory or console on Windows.
      
      With this change, isFile will have the same meaning on different
      platforms. And the change adds a new field kind to replace isConsole
      and isDir.
      
      Change-Id: Ib12265f1e12fa3d0239ae925291128a84be59cc2
      GitHub-Last-Rev: 3f031756de6ce0b96c1f102ad280950f4adbf6c2
      GitHub-Pull-Request: golang/go#30589
      Reviewed-on: https://go-review.googlesource.com/c/go/+/165257
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      a60b56ad
    • Tobias Klauser's avatar
      internal/bytealg: use word-wise comparison for Compare on arm · 029a5af6
      Tobias Klauser authored
      Use word-wise comparison for aligned buffers, otherwise fall back to the
      current byte-wise comparison.
      
      name                           old time/op    new time/op    delta
      BytesCompare/1-4                 41.3ns ± 0%    36.4ns ± 1%   -11.73%  (p=0.008 n=5+5)
      BytesCompare/2-4                 39.5ns ± 0%    39.5ns ± 1%      ~     (p=0.960 n=5+5)
      BytesCompare/4-4                 45.3ns ± 0%    41.0ns ± 1%    -9.40%  (p=0.008 n=5+5)
      BytesCompare/8-4                 64.8ns ± 1%    44.7ns ± 0%   -31.12%  (p=0.008 n=5+5)
      BytesCompare/16-4                86.3ns ± 0%    55.1ns ± 0%   -36.21%  (p=0.008 n=5+5)
      BytesCompare/32-4                 135ns ± 0%      70ns ± 1%   -47.73%  (p=0.008 n=5+5)
      BytesCompare/64-4                 231ns ± 1%      99ns ± 0%   -57.27%  (p=0.016 n=5+4)
      BytesCompare/128-4                424ns ± 0%     147ns ± 0%   -65.31%  (p=0.000 n=4+5)
      BytesCompare/256-4                810ns ± 0%     243ns ± 0%   -69.96%  (p=0.008 n=5+5)
      BytesCompare/512-4               1.59µs ± 0%    0.44µs ± 0%   -72.43%  (p=0.008 n=5+5)
      BytesCompare/1024-4              3.14µs ± 1%    0.83µs ± 1%   -73.56%  (p=0.008 n=5+5)
      BytesCompare/2048-4              6.23µs ± 0%    1.61µs ± 1%   -74.21%  (p=0.008 n=5+5)
      CompareBytesEqual-4              79.4ns ± 0%    52.2ns ± 0%   -34.23%  (p=0.008 n=5+5)
      CompareBytesToNil-4              31.0ns ± 0%    30.3ns ± 0%    -2.32%  (p=0.008 n=5+5)
      CompareBytesEmpty-4              25.7ns ± 0%    25.7ns ± 0%      ~     (p=0.556 n=4+5)
      CompareBytesIdentical-4          25.7ns ± 0%    25.7ns ± 0%      ~     (p=1.000 n=5+5)
      CompareBytesSameLength-4         49.1ns ± 0%    48.5ns ± 0%    -1.26%  (p=0.008 n=5+5)
      CompareBytesDifferentLength-4    49.8ns ± 1%    49.3ns ± 0%    -1.08%  (p=0.008 n=5+5)
      CompareBytesBigUnaligned-4       5.71ms ± 1%    5.68ms ± 1%      ~     (p=0.222 n=5+5)
      CompareBytesBig-4                4.95ms ± 0%    2.28ms ± 1%   -53.81%  (p=0.008 n=5+5)
      CompareBytesBigIdentical-4       27.2ns ± 1%    27.3ns ± 1%      ~     (p=0.310 n=5+5)
      
      name                           old speed      new speed      delta
      CompareBytesBigUnaligned-4      184MB/s ± 1%   185MB/s ± 1%      ~     (p=0.222 n=5+5)
      CompareBytesBig-4               212MB/s ± 0%   459MB/s ± 1%  +116.51%  (p=0.008 n=5+5)
      CompareBytesBigIdentical-4     38.5TB/s ± 0%  38.4TB/s ± 1%      ~     (p=0.421 n=5+5)
      
      Also, this reduces time for TestCompareBytes by about 20 sec on a
      linux-arm builder via gomote.
      
      Updates #29001
      
      Change-Id: I25f148739b9ccb7cb1fc97b3d8763549b0a66c16
      Reviewed-on: https://go-review.googlesource.com/c/go/+/165338
      Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      029a5af6
    • Clément Chigot's avatar
      cmd/link: fix moduledata symbols for aix/ppc64 and external linking · f0749c74
      Clément Chigot authored
      Moduledata symbols like runtime.data or runtime.text must have the
      same position in the final executable (as some symbol accesses are made
      by offset from them).
      ld on AIX might move them randomly if there are nil size symbols.
      
      ld will also remove unreachable symbols like runtime.epclntab or
      runtime.rodata. In order to keep them, R_REF relocations are created
      between firstmoduledata and these symbols. This relocation tells ld to
      keep these symbols even if there aren't reachable.
      
      Change-Id: Ie5a28cf406977131cec6442f7f5b6fd89fb775a3
      Reviewed-on: https://go-review.googlesource.com/c/go/+/164004
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      f0749c74
    • Clément Chigot's avatar
      cmd/link, runtime: allow external linking for aix/ppc64 · 80f10965
      Clément Chigot authored
      This commit adds external linking in cmd/link for aix/ppc64.
      As relocations on .text data aren't possible on AIX, Segrelrodata is
      used to move all these datas to .data section.
      
      Change-Id: I4d1361c1fc9290e11e6f5560864460c76551dbeb
      Reviewed-on: https://go-review.googlesource.com/c/go/+/164003
      Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      80f10965
    • Motkov.Kirill's avatar
      fmt: rewrite if-else-if-else chain to switch statement · 0ff0df8b
      Motkov.Kirill authored
      This commit rewrites if-else-if-else chain in scanBasePrefix function as a switch.
      
      Based on Go style guide https://golang.org/doc/effective_go.html#switch
      
      Change-Id: I6392bfd4ad0384f3dc8896de4763bb2164c3eead
      GitHub-Last-Rev: 9bd8dfdac03c466bf8cacf3119f6245dfb61c009
      GitHub-Pull-Request: golang/go#30621
      Reviewed-on: https://go-review.googlesource.com/c/go/+/165619
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      0ff0df8b
    • Michael Stapelberg's avatar
      syscall: fix hang when using Unshareflags: CLONE_NEWUSER with uid/gid mapping (linux) · 958e212d
      Michael Stapelberg authored
      Note that this particular combination of properties still fails (EPERM), but it
      no longer hangs.
      
      Updates #29789
      
      Change-Id: I29b15b85a25a7acd7ae89ffc5fed074bcdfe0a12
      Reviewed-on: https://go-review.googlesource.com/c/go/+/158297
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      958e212d
    • Daniel Martí's avatar
      net/mail: better error in ParseAddress when missing "@domain" · 178a2c42
      Daniel Martí authored
      If the input was "John Doe", we're definitely missing "<email>", as
      "John Doe@domain" isn't a valid email address.
      
      However, if the input was "john.doe", it's possible that the user meant
      "john.doe@domain", and not just "john.doe <email>". Make it clear in the
      error that either could be the source of the problem.
      
      Fixes #27064.
      
      Change-Id: I1b8f1342775d711823dffc3db974898ee62d3a34
      Reviewed-on: https://go-review.googlesource.com/c/go/+/165517
      Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      178a2c42
    • Kshitij Saraogi's avatar
      net/http: remove discrepancies between the MIME Sniffing Spec and its implementation · 583fddf3
      Kshitij Saraogi authored
      The change fixes the following deviations between the existing implementation and the Spec:
      1. Using pattern instead of "mask" for assertion and iteration in the Pattern Matching Algorithm.
      2. Rename "image/vnd.microsoft.icon" to "image/x-icon" and add another signature for the same.
      3. Using named strings instead of hexadecimal representation in "application/zip" and "application/x-rar-compressed".
      4. Reordering "sniffSignatures" in accordance with the Spec section "Identifying a resource with an unknown MIME type".
      
      In addition to the above fixes, unit tests for Image MIME type group are added.
      
      Fixes #30570
      
      Change-Id: I97d2ae22b426c3c57bf8efd2ed9396c0be983688
      Reviewed-on: https://go-review.googlesource.com/c/go/+/165277Reviewed-by: default avatarEmmanuel Odeke <emm.odeke@gmail.com>
      Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      583fddf3