1. 07 Mar, 2019 11 commits
    • 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 29 commits