1. 24 Aug, 2017 8 commits
  2. 23 Aug, 2017 12 commits
  3. 22 Aug, 2017 17 commits
    • Josh Bleecher Snyder's avatar
      runtime: add TestIntendedInlining · f6944c78
      Josh Bleecher Snyder authored
      The intent is to allow more aggressive refactoring
      in the runtime without silent performance changes.
      
      The test would be useful for many functions.
      I've seeded it with the runtime functions tophash and add;
      it will grow organically (or wither!) from here.
      
      Updates #21536 and #17566
      
      Change-Id: Ib26d9cfd395e7a8844150224da0856add7bedc42
      Reviewed-on: https://go-review.googlesource.com/57410Reviewed-by: 's avatarMartin Möhrmann <moehrmann@google.com>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      f6944c78
    • Michael Brandenburg's avatar
      bytes: add examples for TrimLeft and TrimRight · 6cbe5c8a
      Michael Brandenburg authored
      Change-Id: Ib6d94f185dd43568cf97ef267dd51a09f43a402f
      Reviewed-on: https://go-review.googlesource.com/51391Reviewed-by: 's avatarJoe Tsai <thebrokentoaster@gmail.com>
      Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      6cbe5c8a
    • Martin Möhrmann's avatar
      cmd/compile: extend documentation and sync hiter and hmap with runtime · d4dc26c0
      Martin Möhrmann authored
      Change-Id: I71b24dd0293dd1e26a5c799161a7f9af48fb3c7d
      Reviewed-on: https://go-review.googlesource.com/57295
      Run-TryBot: Martin Möhrmann <moehrmann@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarJosh Bleecher Snyder <josharian@gmail.com>
      d4dc26c0
    • Martin Möhrmann's avatar
      cmd/compile: make argument length mismatch in mkcall an error · 8bbae3d5
      Martin Möhrmann authored
      mkcall is used to construct calls to builtin functions.
      
      Instead of silently ignoring any additional arguments to mkcall
      abort compilation with an error.
      
      This protects against accidentally supplying too many arguments to mkcall
      when compiler changes are made.
      
      Change appendslice and copyany to construct calls to
      slicestringcopy and slicecopy explicitly instead of
      relying on the old behavior as a feature.
      
      Change-Id: I3cfe815a57d454a129e3c08aac824f6107779a42
      Reviewed-on: https://go-review.googlesource.com/57770
      Run-TryBot: Martin Möhrmann <moehrmann@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      8bbae3d5
    • Martin Möhrmann's avatar
      cmd/compile: generate makemap calls with int arguments · cbc4e5d9
      Martin Möhrmann authored
      Where possible generate calls to runtime makemap with int hint argument
      during compile time instead of makemap with int64 hint argument.
      
      This eliminates converting the hint argument for calls to makemap with
      int64 hint argument for platforms where int64 values do not fit into
      an argument of type int.
      
      A similar optimization for makeslice was introduced in CL
      golang.org/cl/27851.
      
      386:
      name         old time/op    new time/op    delta
      NewEmptyMap    53.5ns ± 5%    41.9ns ± 5%  -21.56%  (p=0.000 n=10+10)
      NewSmallMap     182ns ± 1%     165ns ± 1%   -8.92%  (p=0.000 n=10+10)
      
      Change-Id: Ibd2b4c57b36f171b173bf7a0602b3a59771e6e44
      Reviewed-on: https://go-review.googlesource.com/55142Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      cbc4e5d9
    • Martin Möhrmann's avatar
      crypto/x509: skip TestSystemRoots · 0fb0f575
      Martin Möhrmann authored
      golang.org/cl/36941 enabled loading of all trusted certs on darwin
      for the non-cgo execSecurityRoots.
      
      The corresponding cgo version golang.org/cl/36942 for systemRootsPool
      has not been merged yet.
      
      This tests fails reliably on some darwin systems:
      --- FAIL: TestSystemRoots (1.28s)
              root_darwin_test.go:31:     cgo sys roots: 353.552363ms
              root_darwin_test.go:32: non-cgo sys roots: 921.85297ms
              root_darwin_test.go:44: got 169 roots
              root_darwin_test.go:44: got 455 roots
              root_darwin_test.go:73: insufficient overlap between cgo and non-cgo roots; want at least 227, have 168
      FAIL
      FAIL    crypto/x509     2.445s
      
      Updates #16532
      Updates #21416
      
      Change-Id: I52c2c847651fb3621fdb6ab858ebe8e28894c201
      Reviewed-on: https://go-review.googlesource.com/57830
      Run-TryBot: Martin Möhrmann <moehrmann@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarJoe Tsai <thebrokentoaster@gmail.com>
      0fb0f575
    • Alberto Donizetti's avatar
      cmd/compile: support placeholder name '$' in code generation tests · 8bca7ef6
      Alberto Donizetti authored
      This change adds to the code-generation harness in asm_test.go support
      for the use of a '$' placeholder name for test functions.
      
      A few of uninformative function names are also changed to use the
      placeholder, to confirm that the change works as expected.
      
      Fixes #21500
      
      Change-Id: Iba168bd85efc9822253305d003b06682cf8a6c5c
      Reviewed-on: https://go-review.googlesource.com/57292
      Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      8bca7ef6
    • Guilherme Rezende's avatar
      io: add example for Pipe · 5e5a1ed8
      Guilherme Rezende authored
      Change-Id: I24374accf48d43edf4bf27ea6ba2245ddca558ad
      Reviewed-on: https://go-review.googlesource.com/50910Reviewed-by: 's avatarGiovanni Bajo <rasky@develer.com>
      Reviewed-by: 's avatarJoe Tsai <thebrokentoaster@gmail.com>
      Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      5e5a1ed8
    • Heschi Kreinick's avatar
      cmd/compile: emit DW_AT_decl_line · 4a1be1e1
      Heschi Kreinick authored
      Some debuggers use the declaration line to avoid showing variables
      before they're declared. Emit them for local variables and function
      parameters.
      
      DW_AT_decl_file would be nice too, but since its value is an index
      into a table built by the linker, that's dramatically harder. In
      practice, with inlining disabled it's safe to assume that all a
      function's variables are declared in the same file, so this should still
      be pretty useful.
      
      Change-Id: I8105818c8940cd71bc5473ec98797cce2f3f9872
      Reviewed-on: https://go-review.googlesource.com/44350Reviewed-by: 's avatarDavid Chase <drchase@google.com>
      4a1be1e1
    • Martin Möhrmann's avatar
      cmd/compile: replace eqstring with memequal · 3216e0ce
      Martin Möhrmann authored
      eqstring is only called for strings with equal lengths.
      Instead of pushing a pointer and length for each argument string
      on the stack we can omit pushing one of the lengths on the stack.
      
      Changing eqstrings signature to eqstring(*uint8, *uint8, int) bool
      to implement the above optimization would make it very similar to the
      existing memequal(*any, *any, uintptr) bool function.
      
      Since string lengths are positive we can avoid code redundancy and
      use memequal instead of using eqstring with an optimized signature.
      
      go command binary size reduced by 4128 bytes on amd64.
      
      name                          old time/op    new time/op    delta
      CompareStringEqual              6.03ns ± 1%    5.71ns ± 1%   -5.23%  (p=0.000 n=19+18)
      CompareStringIdentical          2.88ns ± 1%    3.22ns ± 7%  +11.86%  (p=0.000 n=20+20)
      CompareStringSameLength         4.31ns ± 1%    4.01ns ± 1%   -7.17%  (p=0.000 n=19+19)
      CompareStringDifferentLength    0.29ns ± 2%    0.29ns ± 2%     ~     (p=1.000 n=20+20)
      CompareStringBigUnaligned       64.3µs ± 2%    64.1µs ± 3%     ~     (p=0.164 n=20+19)
      CompareStringBig                61.9µs ± 1%    61.6µs ± 2%   -0.46%  (p=0.033 n=20+19)
      
      Change-Id: Ice15f3b937c981f0d3bc8479a9ea0d10658ac8df
      Reviewed-on: https://go-review.googlesource.com/53650
      Run-TryBot: Martin Möhrmann <moehrmann@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      3216e0ce
    • Kashav Madan's avatar
      cmd/compile: avoid duplicate cast error · d05a1238
      Kashav Madan authored
      If an error was already printed during LHS conversion step, we don't reprint
      the "cannot convert" error.
      
      In particular, this prevents `_ = int("1")` (and all similar casts) from
      resulting in multiple identical error messages being printed.
      
      Fixes #20812.
      
      Change-Id: If6e52c59eab438599d641ecf6f110ebafca740a9
      Reviewed-on: https://go-review.googlesource.com/46912Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      d05a1238
    • Martin Möhrmann's avatar
      strconv: check bitsize range in ParseInt and ParseUint · 63c42843
      Martin Möhrmann authored
      Return an error when a bitSize below 0 or above 64 is specified.
      
      Move bitSize 0 handling in ParseInt after the call to ParseUint
      to avoid a spill.
      
      AMD64:
      name       old time/op  new time/op  delta
      Atoi       28.9ns ± 6%  27.4ns ± 6%  -5.21%  (p=0.002 n=20+20)
      AtoiNeg    24.6ns ± 2%  23.1ns ± 1%  -6.04%  (p=0.000 n=19+18)
      Atoi64     38.8ns ± 1%  38.0ns ± 1%  -2.03%  (p=0.000 n=17+20)
      Atoi64Neg  35.5ns ± 1%  34.3ns ± 1%  -3.42%  (p=0.000 n=19+20)
      
      Updates #21275
      
      Change-Id: I70f0e4a16fa003f7ea929ca4ef56bd1a4181660b
      Reviewed-on: https://go-review.googlesource.com/55139Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      Run-TryBot: Robert Griesemer <gri@golang.org>
      63c42843
    • Lakshay Garg's avatar
      math: implement the erfcinv function · 4c0bba15
      Lakshay Garg authored
      Fixes: #6359
      
      Change-Id: I6c697befd681a253e73a7091faa9f20ff3791201
      Reviewed-on: https://go-review.googlesource.com/57090Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      4c0bba15
    • fanzha02's avatar
      cmd/internal/obj/arm64: fix assemble movk bug · bdd7c01b
      fanzha02 authored
      The current code gets shift arguments value from prog.From3.Offset.
      But prog.From3.Offset is not assigned the shift arguments value in
      instructions assemble process.
      
      The fix calls movcon() function to get the correct value.
      
      Uncomment the movk/movkw  cases.
      
      Fixes #21398
      Change-Id: I78d40c33c24bd4e3688a04622e4af7ddb5333fa6
      Reviewed-on: https://go-review.googlesource.com/54990
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarCherry Zhang <cherryyz@google.com>
      bdd7c01b
    • Thomas Wanielista's avatar
      go/doc: classify function returning slice of T as constructor · 33484a6a
      Thomas Wanielista authored
      Previously, go/doc would only consider functions that return types of
      T or any number of pointers to T: *T, **T, etc. This change expands
      the definition of a constructor to also include functions that return
      slices of a type (or pointer to that type) in its first return.
      
      With this change, the following return types classify a function
      as a constructor of type T:
      
      T
      *T
      **T (and so on)
      []T
      []*T
      []**T (and so on)
      
      Fixes #18063.
      
      Change-Id: I9a1a689933e13c6b8eb80b74ceec85bd4cab236d
      Reviewed-on: https://go-review.googlesource.com/54971Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      33484a6a
    • Brian Kessler's avatar
      math/big: use internal sqr on nats · edaa0ffa
      Brian Kessler authored
      Replace z.mul(x, x) calls on nats in internal code with z.sqr(x)
      that employs optimized squaring routines. Benchmark results:
      
      Exp-4                             12.9ms ± 2%  12.8ms ± 3%     ~     (p=0.165 n=10+10)
      Exp2-4                            13.0ms ± 4%  12.8ms ± 2%   -2.14%  (p=0.015 n=8+9)
      ModSqrt225_Tonelli-4               987µs ± 4%   989µs ± 2%     ~     (p=0.673 n=8+9)
      ModSqrt224_3Mod4-4                 300µs ± 2%   301µs ± 3%     ~     (p=0.546 n=9+9)
      ModSqrt5430_Tonelli-4              4.88s ± 6%   4.82s ± 5%     ~     (p=0.247 n=10+10)
      ModSqrt5430_3Mod4-4                1.62s ±10%   1.57s ± 1%     ~     (p=0.094 n=9+9)
      Exp3Power/0x10-4                   496ns ± 7%   426ns ± 7%  -14.21%  (p=0.000 n=10+10)
      Exp3Power/0x40-4                   575ns ± 5%   470ns ± 7%  -18.20%  (p=0.000 n=9+10)
      Exp3Power/0x100-4                  929ns ±19%   770ns ±10%  -17.13%  (p=0.000 n=10+10)
      Exp3Power/0x400-4                 1.96µs ± 7%  1.79µs ± 5%   -8.68%  (p=0.000 n=10+10)
      Exp3Power/0x1000-4                10.9µs ± 9%   7.9µs ± 5%  -28.02%  (p=0.000 n=10+10)
      Exp3Power/0x4000-4                86.8µs ± 8%  67.3µs ± 8%  -22.41%  (p=0.000 n=10+10)
      Exp3Power/0x10000-4                750µs ± 8%   731µs ± 1%     ~     (p=0.074 n=9+8)
      Exp3Power/0x40000-4               7.07ms ± 7%  7.05ms ± 4%     ~     (p=0.931 n=9+9)
      Exp3Power/0x100000-4              64.7ms ± 2%  65.6ms ± 6%     ~     (p=0.661 n=9+10)
      Exp3Power/0x400000-4               577ms ± 2%   580ms ± 3%     ~     (p=0.931 n=9+9)
      ProbablyPrime/n=0-4               9.08ms ±17%  9.09ms ±16%     ~     (p=0.447 n=9+10)
      ProbablyPrime/n=1-4               10.8ms ± 4%  10.7ms ± 2%     ~     (p=0.243 n=10+9)
      ProbablyPrime/n=5-4               18.5ms ± 3%  18.5ms ± 1%     ~     (p=0.863 n=9+9)
      ProbablyPrime/n=10-4              28.6ms ± 6%  28.2ms ± 1%     ~     (p=0.050 n=9+9)
      ProbablyPrime/n=20-4              48.4ms ± 4%  48.4ms ± 2%     ~     (p=0.739 n=10+10)
      ProbablyPrime/Lucas-4             6.75ms ± 4%  6.75ms ± 2%     ~     (p=0.963 n=9+8)
      ProbablyPrime/MillerRabinBase2-4  2.00ms ± 5%  2.00ms ± 7%     ~     (p=0.931 n=9+9)
      
      Change-Id: Ibe9f58d11dbad25eb369faedf480b666a0250a6b
      Reviewed-on: https://go-review.googlesource.com/56773Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      edaa0ffa
    • Martin Möhrmann's avatar
      cmd/compile: pass stack allocated bucket to makemap inside hmap · 06a78b57
      Martin Möhrmann authored
      name         old time/op    new time/op    delta
      NewEmptyMap    53.2ns ± 7%    48.0ns ± 5%  -9.77%  (p=0.000 n=20+20)
      NewSmallMap     111ns ± 1%     106ns ± 2%  -3.78%  (p=0.000 n=20+19)
      
      Change-Id: I979d21ab16eae9f6893873becca517db57e054b5
      Reviewed-on: https://go-review.googlesource.com/56290
      Run-TryBot: Martin Möhrmann <moehrmann@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarJosh Bleecher Snyder <josharian@gmail.com>
      06a78b57
  4. 21 Aug, 2017 3 commits