1. 06 Nov, 2018 1 commit
    • Josh Bleecher Snyder's avatar
      cmd/compile: shrink specialized convT2x call sites · 5848b6c9
      Josh Bleecher Snyder authored
      convT2E16 and other specialized type-to-interface routines
      accept a type/itab argument and return a complete interface value.
      However, we know enough in the routine to do without the type.
      And the caller can construct the interface value using the type.
      
      Doing so shrinks the call sites of ten of the specialized convT2x routines.
      It also lets us unify the empty and non-empty interface routines.
      
      Cuts 12k off cmd/go.
      
      name                         old time/op  new time/op  delta
      ConvT2ESmall-8               2.96ns ± 2%  2.34ns ± 4%  -21.01%  (p=0.000 n=175+189)
      ConvT2EUintptr-8             3.00ns ± 3%  2.34ns ± 4%  -22.02%  (p=0.000 n=189+187)
      ConvT2ELarge-8               21.3ns ± 7%  21.5ns ± 5%   +1.02%  (p=0.000 n=200+197)
      ConvT2ISmall-8               2.99ns ± 4%  2.33ns ± 3%  -21.95%  (p=0.000 n=193+184)
      ConvT2IUintptr-8             3.02ns ± 3%  2.33ns ± 3%  -22.82%  (p=0.000 n=198+190)
      ConvT2ILarge-8               21.7ns ± 5%  22.2ns ± 4%   +2.31%  (p=0.000 n=199+198)
      ConvT2Ezero/zero/16-8        2.96ns ± 2%  2.33ns ± 3%  -21.11%  (p=0.000 n=174+187)
      ConvT2Ezero/zero/32-8        2.96ns ± 1%  2.35ns ± 4%  -20.62%  (p=0.000 n=163+193)
      ConvT2Ezero/zero/64-8        2.99ns ± 2%  2.34ns ± 4%  -21.78%  (p=0.000 n=183+188)
      ConvT2Ezero/zero/str-8       3.27ns ± 3%  2.54ns ± 3%  -22.32%  (p=0.000 n=195+192)
      ConvT2Ezero/zero/slice-8     3.46ns ± 4%  2.81ns ± 3%  -18.96%  (p=0.000 n=197+164)
      ConvT2Ezero/zero/big-8       88.4ns ±20%  90.0ns ±20%   +1.84%  (p=0.000 n=196+198)
      ConvT2Ezero/nonzero/16-8     12.6ns ± 3%  12.3ns ± 3%   -2.34%  (p=0.000 n=167+196)
      ConvT2Ezero/nonzero/32-8     12.3ns ± 4%  11.9ns ± 3%   -2.95%  (p=0.000 n=187+193)
      ConvT2Ezero/nonzero/64-8     14.2ns ± 6%  13.8ns ± 5%   -2.94%  (p=0.000 n=198+199)
      ConvT2Ezero/nonzero/str-8    27.2ns ± 5%  26.8ns ± 5%   -1.33%  (p=0.000 n=200+198)
      ConvT2Ezero/nonzero/slice-8  33.3ns ± 8%  33.1ns ± 6%   -0.82%  (p=0.000 n=199+200)
      ConvT2Ezero/nonzero/big-8    88.8ns ±22%  90.2ns ±18%   +1.58%  (p=0.000 n=200+199)
      
      
      Neligible toolspeed impact.
      
      name        old alloc/op      new alloc/op      delta
      Template         35.4MB ± 0%       35.3MB ± 0%  -0.06%  (p=0.008 n=5+5)
      Unicode          29.1MB ± 0%       29.1MB ± 0%    ~     (p=0.310 n=5+5)
      GoTypes           122MB ± 0%        122MB ± 0%  -0.08%  (p=0.008 n=5+5)
      Compiler          514MB ± 0%        513MB ± 0%  -0.02%  (p=0.008 n=5+5)
      SSA              1.94GB ± 0%       1.94GB ± 0%  -0.01%  (p=0.008 n=5+5)
      Flate            24.2MB ± 0%       24.2MB ± 0%    ~     (p=0.548 n=5+5)
      GoParser         28.5MB ± 0%       28.5MB ± 0%  -0.05%  (p=0.016 n=5+5)
      Reflect          86.3MB ± 0%       86.2MB ± 0%  -0.02%  (p=0.008 n=5+5)
      Tar              34.9MB ± 0%       34.9MB ± 0%    ~     (p=0.095 n=5+5)
      XML              47.1MB ± 0%       47.1MB ± 0%  -0.05%  (p=0.008 n=5+5)
      [Geo mean]       81.0MB            81.0MB       -0.03%
      
      name        old allocs/op     new allocs/op     delta
      Template           349k ± 0%         349k ± 0%  -0.08%  (p=0.008 n=5+5)
      Unicode            340k ± 0%         340k ± 0%    ~     (p=0.111 n=5+5)
      GoTypes           1.28M ± 0%        1.28M ± 0%  -0.09%  (p=0.008 n=5+5)
      Compiler          4.92M ± 0%        4.92M ± 0%  -0.08%  (p=0.008 n=5+5)
      SSA               15.3M ± 0%        15.3M ± 0%  -0.03%  (p=0.008 n=5+5)
      Flate              233k ± 0%         233k ± 0%    ~     (p=0.500 n=5+5)
      GoParser           292k ± 0%         292k ± 0%  -0.06%  (p=0.008 n=5+5)
      Reflect           1.05M ± 0%        1.05M ± 0%  -0.02%  (p=0.008 n=5+5)
      Tar                344k ± 0%         343k ± 0%  -0.06%  (p=0.008 n=5+5)
      XML                430k ± 0%         429k ± 0%  -0.08%  (p=0.008 n=5+5)
      [Geo mean]         809k              809k       -0.05%
      
      name        old object-bytes  new object-bytes  delta
      Template          507kB ± 0%        507kB ± 0%  -0.04%  (p=0.008 n=5+5)
      Unicode           225kB ± 0%        225kB ± 0%    ~     (all equal)
      GoTypes          1.85MB ± 0%       1.85MB ± 0%  -0.08%  (p=0.008 n=5+5)
      Compiler         6.75MB ± 0%       6.75MB ± 0%  +0.01%  (p=0.008 n=5+5)
      SSA              21.4MB ± 0%       21.4MB ± 0%  -0.02%  (p=0.008 n=5+5)
      Flate             328kB ± 0%        328kB ± 0%  -0.03%  (p=0.008 n=5+5)
      GoParser          403kB ± 0%        402kB ± 0%  -0.06%  (p=0.008 n=5+5)
      Reflect          1.41MB ± 0%       1.41MB ± 0%  -0.03%  (p=0.008 n=5+5)
      Tar               457kB ± 0%        457kB ± 0%  -0.05%  (p=0.008 n=5+5)
      XML               601kB ± 0%        600kB ± 0%  -0.16%  (p=0.008 n=5+5)
      [Geo mean]       1.05MB            1.04MB       -0.05%
      
      
      Change-Id: I677a4108c0ecd32617549294036aa84f9214c4fe
      Reviewed-on: https://go-review.googlesource.com/c/147360
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      Reviewed-by: 's avatarMartin Möhrmann <moehrmann@google.com>
      5848b6c9
  2. 05 Nov, 2018 21 commits
  3. 04 Nov, 2018 2 commits
  4. 03 Nov, 2018 6 commits
  5. 02 Nov, 2018 10 commits
    • Carl Mastrangelo's avatar
      net/http: speed up ServeMux matching · 1645dfa2
      Carl Mastrangelo authored
      Scanning through all path patterns is not necessary, since the
      paths do not change frequently.  Instead, maintain a sorted list
      of path prefixes and return the first match.
      
      name            old time/op  new time/op  delta
      ServerMatch-12   134ns ± 3%    17ns ± 4%  -86.95%  (p=0.000 n=19+20)
      
      Change-Id: I15b4483dc30db413321435ee6815fc9bf2bcc546
      Reviewed-on: https://go-review.googlesource.com/c/144937Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      1645dfa2
    • Brad Fitzpatrick's avatar
      all: use "reports whether" consistently in the few places that didn't · 3813edf2
      Brad Fitzpatrick authored
      Go documentation style for boolean funcs is to say:
      
          // Foo reports whether ...
          func Foo() bool
      
      (rather than "returns true if")
      
      This CL also replaces 4 uses of "iff" with the same "reports whether"
      wording, which doesn't lose any meaning, and will prevent people from
      sending typo fixes when they don't realize it's "if and only if". In
      the past I think we've had the typo CLs updated to just say "reports
      whether". So do them all at once.
      
      (Inspired by the addition of another "returns true if" in CL 146938
      in fd_plan9.go)
      
      Created with:
      
      $ perl -i -npe 's/returns true if/reports whether/' $(git grep -l "returns true iff" | grep -v vendor)
      $ perl -i -npe 's/returns true if/reports whether/' $(git grep -l "returns true if" | grep -v vendor)
      
      Change-Id: Ided502237f5ab0d25cb625dbab12529c361a8b9f
      Reviewed-on: https://go-review.googlesource.com/c/147037Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      3813edf2
    • Robert Griesemer's avatar
      cmd/compile/internal/gc: add tracing support to debug type checking · e25823ed
      Robert Griesemer authored
      The compiler must first be built with the constant enableTrace set
      to true (typecheck.go). After that, the -t flag becomes available
      which enables tracing output of type-checking functions.
      
      With enableTrace == false, the tracing code becomes dead code
      and won't affect the compiler.
      
      Typical output might look like this:
      
      path/y.go:4:6: typecheck 0xc00033e180 DCLTYPE <node DCLTYPE> tc=0
      path/y.go:4:6: . typecheck1 0xc00033e180 DCLTYPE <node DCLTYPE> tc=2
      path/y.go:4:6: . . typecheck 0xc000331a40 TYPE T tc=1
      path/y.go:4:6: . . . typecheck1 0xc000331a40 TYPE T tc=2
      path/y.go:4:6: . . . . typecheckdef 0xc000331a40 TYPE T tc=2
      path/y.go:4:6: . . . . => 0xc000331a40 TYPE T tc=2 type=*T
      path/y.go:4:6: . . . => 0xc000331a40 TYPE T tc=2 type=*T
      path/y.go:4:6: . . => 0xc000331a40 TYPE T tc=1 type=*T
      path/y.go:4:6: . => 0xc00033e180 DCLTYPE <node DCLTYPE> tc=2 type=<T>
      path/y.go:4:6: => 0xc00033e180 DCLTYPE <node DCLTYPE> tc=1 type=<T>
      
      Disabled by default.
      
      Change-Id: Ifd8385290d1cf0d3fc5e8468b2f4ab84e8eff338
      Reviewed-on: https://go-review.googlesource.com/c/146782Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
      e25823ed
    • Filippo Valsorda's avatar
      crypto/tls: implement TLS 1.3 server handshake (base) · c21ba09b
      Filippo Valsorda authored
      Implement a basic TLS 1.3 server handshake, only enabled if explicitly
      requested with MaxVersion.
      
      This CL intentionally leaves for future CLs:
        - PSK modes and resumption
        - client authentication
        - compatibility mode ChangeCipherSpecs
        - early data skipping
        - post-handshake messages
        - downgrade protection
        - KeyLogWriter support
        - TLS_FALLBACK_SCSV processing
      
      It also leaves a few areas up for a wider refactor (maybe in Go 1.13):
        - the certificate selection logic can be significantly improved,
          including supporting and surfacing signature_algorithms_cert, but
          this isn't new in TLS 1.3 (see comment in processClientHello)
        - handshake_server_tls13.go can be dried up and broken into more
          meaningful, smaller functions, but it felt premature to do before
          PSK and client auth support
        - the monstrous ClientHello equality check in doHelloRetryRequest can
          get both cleaner and more complete with collaboration from the
          parsing layer, which can come at the same time as extension
          duplicates detection
      
      Updates #9671
      
      Change-Id: Id9db2b6ecc2eea21bf9b59b6d1d9c84a7435151c
      Reviewed-on: https://go-review.googlesource.com/c/147017
      Run-TryBot: Filippo Valsorda <filippo@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarAdam Langley <agl@golang.org>
      c21ba09b
    • Filippo Valsorda's avatar
      crypto/tls: implement TLS 1.3 client handshake (base) · 4caa1276
      Filippo Valsorda authored
      Implement a basic TLS 1.3 client handshake, only enabled if explicitly
      requested with MaxVersion.
      
      This CL intentionally leaves for future CLs:
        - PSK modes and resumption
        - client authentication
        - post-handshake messages
        - downgrade protection
        - KeyLogWriter support
      
      Updates #9671
      
      Change-Id: Ieb6130fb6f25aea4f0d39e3a2448dfc942e1de7a
      Reviewed-on: https://go-review.googlesource.com/c/146559
      Run-TryBot: Filippo Valsorda <filippo@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarAdam Langley <agl@golang.org>
      4caa1276
    • Filippo Valsorda's avatar
      crypto/tls: advertise and accept rsa_pss_rsae signature algorithms · ee7e4433
      Filippo Valsorda authored
      crypto/x509 already supports PSS signatures (with rsaEncryption OID),
      and crypto/tls support was added in CL 79736. Advertise support for the
      algorithms and accept them as a peer.
      
      Note that this is about PSS signatures from regular RSA public keys.
      RSA-PSS only public keys (with RSASSA-PSS OID) are supported in neither
      crypto/tls nor crypto/x509. See RFC 8446, Section 4.2.3.
      
      testdata/Server-TLSv12-ClientAuthRequested* got modified because the
      CertificateRequest carries the supported signature algorithms.
      
      The net/smtp tests changed because 512 bits keys are too small for PSS.
      
      Based on Peter Wu's CL 79738, who did all the actual work in CL 79736.
      
      Updates #9671
      
      Change-Id: I4a31e9c6e152ff4c50a5c8a274edd610d5fff231
      Reviewed-on: https://go-review.googlesource.com/c/146258
      Run-TryBot: Filippo Valsorda <filippo@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarAdam Langley <agl@golang.org>
      ee7e4433
    • Filippo Valsorda's avatar
      crypto/tls: implement TLS 1.3 version negotiation · 7f5dce08
      Filippo Valsorda authored
      RFC 8446 recommends using the supported_versions extension to negotiate
      lower versions as well, so begin by implementing it to negotiate the
      currently supported versions.
      
      Note that pickTLSVersion was incorrectly negotiating the ServerHello
      version down on the client. If the server had illegally sent a version
      higher than the ClientHello version, the client would have just
      downgraded it, hopefully failing later in the handshake.
      
      In TestGetConfigForClient, we were hitting the record version check
      because the server would select TLS 1.1, the handshake would fail on the
      client which required TLS 1.2, which would then send a TLS 1.0 record
      header on its fatal alert (not having negotiated a version), while the
      server would expect a TLS 1.1 header at that point. Now, the client gets
      to communicate the minimum version through the extension and the
      handshake fails on the server.
      
      Updates #9671
      
      Change-Id: Ie33c7124c0c769f62e10baad51cbed745c424e5b
      Reviewed-on: https://go-review.googlesource.com/c/146217
      Run-TryBot: Filippo Valsorda <filippo@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarAdam Langley <agl@golang.org>
      7f5dce08
    • Filippo Valsorda's avatar
      crypto/tls: implement TLS 1.3 version-specific messages · 0663fe98
      Filippo Valsorda authored
      Note that there is significant code duplication due to extensions with
      the same format appearing in different messages in TLS 1.3. This will be
      cleaned up in a future refactor once CL 145317 is merged.
      
      Enforcing the presence/absence of each extension in each message is left
      to the upper layer, based on both protocol version and extensions
      advertised in CH and CR. Duplicated extensions and unknown extensions in
      SH, EE, HRR, and CT will be tightened up in a future CL.
      
      The TLS 1.2 CertificateStatus message was restricted to accepting only
      type OCSP as any other type (none of which are specified so far) would
      have to be negotiated.
      
      Updates #9671
      
      Change-Id: I7c42394c5cc0af01faa84b9b9f25fdc6e7cfbb9e
      Reviewed-on: https://go-review.googlesource.com/c/145477Reviewed-by: 's avatarAdam Langley <agl@golang.org>
      0663fe98
    • Filippo Valsorda's avatar
      crypto/tls: implement TLS 1.3 cryptographic computations · 84d6a7ab
      Filippo Valsorda authored
      Vendors golang.org/x/crypto/hkdf at e84da0312774c21d64ee2317962ef669b27ffb41
      
      Updates #9671
      
      Change-Id: I2610c4a66756e2a6f21f9823dcbe39edd9c9ea21
      Reviewed-on: https://go-review.googlesource.com/c/145298Reviewed-by: 's avatarAdam Langley <agl@golang.org>
      84d6a7ab
    • Filippo Valsorda's avatar
      crypto/tls: implement TLS 1.3 record layer and cipher suites · ef21689a
      Filippo Valsorda authored
      Updates #9671
      
      Change-Id: I1ea7b724975c0841d01f4536eebb23956b30d5ea
      Reviewed-on: https://go-review.googlesource.com/c/145297Reviewed-by: 's avatarAdam Langley <agl@golang.org>
      ef21689a