1. 05 Oct, 2016 11 commits
    • Michael Munday's avatar
      crypto/{aes,cipher}: add optimized implementation of AES-GCM for s390x · fb4f4f4e
      Michael Munday authored
      Also adds two tests: one to exercise the counter incrementing code
      and one which checks the output of the optimized implementation
      against that of the generic implementation for large/unaligned data
      sizes.
      
      Uses the KIMD instruction for GHASH and the KMCTR instruction for AES
      in counter mode.
      
      AESGCMSeal1K  75.0MB/s ± 2%  1008.7MB/s ± 1%  +1245.71%  (p=0.000 n=10+10)
      AESGCMOpen1K  75.3MB/s ± 1%  1006.0MB/s ± 1%  +1235.59%   (p=0.000 n=10+9)
      AESGCMSeal8K  78.5MB/s ± 1%  1748.4MB/s ± 1%  +2127.34%   (p=0.000 n=9+10)
      AESGCMOpen8K  78.5MB/s ± 0%  1752.7MB/s ± 0%  +2134.07%   (p=0.000 n=10+9)
      
      Change-Id: I88dbcfcb5988104bfd290ae15a60a2721c1338be
      Reviewed-on: https://go-review.googlesource.com/30361Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      fb4f4f4e
    • Michael Munday's avatar
      runtime/testdata/testprogcgo: add explicit return value to signalThread · f15f1ff4
      Michael Munday authored
      Should fix the clang builder.
      
      Change-Id: I3ee34581b6a7ec902420de72a8a08a2426997782
      Reviewed-on: https://go-review.googlesource.com/30363
      Run-TryBot: Michael Munday <munday@ca.ibm.com>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      f15f1ff4
    • Brad Fitzpatrick's avatar
      sort: fix a slice benchmark not using the stable variant, add another · aad29eba
      Brad Fitzpatrick authored
      Change-Id: I9783d8023d453a72c4605a308064bef98168bcb8
      Reviewed-on: https://go-review.googlesource.com/30360Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      aad29eba
    • Aliaksandr Valialkin's avatar
      cmd/vet: skip printf check for non-constant format string during failed import · ee8ec429
      Aliaksandr Valialkin authored
      Fixes #17006
      
      Change-Id: I3c2060ca5384a4b9782a7d804305d2cf4388dd5a
      Reviewed-on: https://go-review.googlesource.com/29014
      Run-TryBot: Rob Pike <r@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarRob Pike <r@golang.org>
      ee8ec429
    • Ian Lance Taylor's avatar
      runtime: don't call cgocallback from signal handler · 6c13a1db
      Ian Lance Taylor authored
      Calling cgocallback from a signal handler can fail when using the race
      detector. Calling cgocallback will lead to a call to newextram which
      will call oneNewExtraM which will call racegostart. The racegostart
      function will set up some race detector data structures, and doing that
      will sometimes call the C memory allocator. If we are running the signal
      handler from a signal that interrupted the C memory allocator, we will
      crash or hang.
      
      Instead, change the signal handler code to call needm and dropm. The
      needm function will grab allocated m and g structures and initialize the
      g to use the current stack--the signal stack. That is all we need to
      safely call code that allocates memory and checks whether it needs to
      split the stack. This may temporarily leave us with no m available to
      run a cgo callback, but that is OK in this case since the code we call
      will quickly either crash or call dropm to return the m.
      
      Implementing this required changing some of the setSignalstackSP
      functions to avoid a write barrier. These functions never need a write
      barrier but in some cases generated one anyhow because on some systems
      the ss_sp field is a pointer.
      
      Change-Id: I3893f47c3a66278f85eab7f94c1ab11d4f3be133
      Reviewed-on: https://go-review.googlesource.com/30218
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarDmitry Vyukov <dvyukov@google.com>
      6c13a1db
    • Ian Lance Taylor's avatar
      runtime: avoid endless loop if printing the panic value panics · 7faf7023
      Ian Lance Taylor authored
      Change-Id: I56de359a5ccdc0a10925cd372fa86534353c6ca0
      Reviewed-on: https://go-review.googlesource.com/30358
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      7faf7023
    • Brad Fitzpatrick's avatar
      encoding/csv: update and add CSV reading benchmarks · efaa3601
      Brad Fitzpatrick authored
      Benchmarks broken off from https://golang.org/cl/24723 and modified to
      allocate less in the places we're not trying to measure.
      
      Updates #16791
      
      Change-Id: I508e4cfeac60322d56f1d71ff1912f6a6f183a63
      Reviewed-on: https://go-review.googlesource.com/30357
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      efaa3601
    • Jeff R. Allen's avatar
      image/gif: check handling of truncated GIF files · d1d798dd
      Jeff R. Allen authored
      All the prefixes of the testGIF produce errors today,
      but they differ wildly in which errors: some are io.EOF,
      others are io.ErrUnexpectedEOF, and others are gif-specific.
      Make them all gif-specific to explain context, and make
      any complaining about EOF be sure to mention the EOF
      is unexpected.
      
      Fixes #11390.
      
      Change-Id: I742c39c88591649276268327ea314e68d1de1845
      Reviewed-on: https://go-review.googlesource.com/17493
      Run-TryBot: Russ Cox <rsc@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      d1d798dd
    • Russ Cox's avatar
      math: fix Gamma(x) for x < -170.5 and other corner cases · a39920fd
      Russ Cox authored
      Fixes #11441.
      
      Test tables generated by
      
      	package main
      
      	import (
      		"bytes"
      		"fmt"
      		"log"
      		"os/exec"
      		"strconv"
      		"strings"
      	)
      
      	var inputs = []float64{
      		0.5,
      		1.5,
      		2.5,
      		3.5,
      		-0.5,
      		-1.5,
      		-2.5,
      		-3.5,
      		0.1,
      		0.01,
      		1e-8,
      		1e-16,
      		1e-3,
      		1e-16,
      		1e-308,
      		5.6e-309,
      		5.5e-309,
      		1e-309,
      		1e-323,
      		5e-324,
      		-0.1,
      		-0.01,
      		-1e-8,
      		-1e-16,
      		-1e-3,
      		-1e-16,
      		-1e-308,
      		-5.6e-309,
      		-5.5e-309,
      		-1e-300 / 1e9,
      		-1e-300 / 1e23,
      		-5e-300 / 1e24,
      		-0.9999999999999999,
      		-1.0000000000000002,
      		-1.9999999999999998,
      		-2.0000000000000004,
      		-100.00000000000001,
      		-99.999999999999986,
      		17,
      		171,
      		171.6,
      		171.624,
      		171.625,
      		172,
      		2000,
      		-100.5,
      		-160.5,
      		-170.5,
      		-171.5,
      		-176.5,
      		-177.5,
      		-178.5,
      		-179.5,
      		-201.0001,
      		-202.9999,
      		-1000.5,
      		-1000000000.3,
      		-4503599627370495.5,
      		-63.349078729022985,
      		-127.45117632943295,
      	}
      
      	func main() {
      		var buf bytes.Buffer
      		for _, v := range inputs {
      			fmt.Fprintf(&buf, "gamma(%.1000g)\n", v)
      		}
      		cmd := exec.Command("gp", "-q")
      		cmd.Stdin = &buf
      		out, err := cmd.CombinedOutput()
      		if err != nil {
      			log.Fatalf("gp: %v", err)
      		}
      		f := strings.Split(string(out), "\n")
      		if len(f) > 0 && f[len(f)-1] == "" {
      			f = f[:len(f)-1]
      		}
      		if len(f) != len(inputs) {
      			log.Fatalf("gp: wrong output count\n%s\n", out)
      		}
      		for i, g := range f {
      			gf, err := strconv.ParseFloat(strings.Replace(g, " E", "e", -1), 64)
      			if err != nil {
      				if strings.Contains(err.Error(), "value out of range") {
      					if strings.HasPrefix(g, "-") {
      						fmt.Printf("\t{%g, Inf(-1)},\n", inputs[i])
      					} else {
      						fmt.Printf("\t{%g, Inf(1)},\n", inputs[i])
      					}
      					continue
      				}
      				log.Fatal(err)
      			}
      			if gf == 0 && strings.HasPrefix(g, "-") {
      				fmt.Printf("\t{%g, Copysign(0, -1)},\n", inputs[i])
      				continue
      			}
      			fmt.Printf("\t{%g, %g},\n", inputs[i], gf)
      		}
      	}
      
      Change-Id: Ie98c7751d92b8ffb40e8313f5ea10df0890e2feb
      Reviewed-on: https://go-review.googlesource.com/30146
      Run-TryBot: Russ Cox <rsc@golang.org>
      Reviewed-by: 's avatarQuentin Smith <quentin@golang.org>
      a39920fd
    • Russ Cox's avatar
      math: use portable Exp instead of 387 instructions on 386 · aab849e4
      Russ Cox authored
      The 387 implementation is less accurate and slower.
      
      name     old time/op  new time/op  delta
      Exp-8    29.7ns ± 2%  24.0ns ± 2%  -19.08%  (p=0.000 n=10+10)
      
      This makes Gamma more accurate too.
      
      Change-Id: Iad33b9cce0b087ccbce3e08ba7a6d285c4999d02
      Reviewed-on: https://go-review.googlesource.com/30230
      Run-TryBot: Russ Cox <rsc@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarQuentin Smith <quentin@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      aab849e4
    • Joe Tsai's avatar
      cmd/doc: ensure summaries truly are only one line · 84743c34
      Joe Tsai authored
      The documentation for doc says:
      > Doc prints the documentation comments associated with the item identified by its
      > arguments (a package, const, func, type, var, or method) followed by a one-line
      > summary of each of the first-level items "under" that item (package-level
      > declarations for a package, methods for a type, etc.).
      
      Certain variables (and constants, functions, and types) have value specifications
      that are multiple lines long. Prior to this change, doc would print out all of the
      lines necessary to display the value. This is inconsistent with the documented
      behavior, which guarantees a one-line summary for all first-level items.
      We fix this here by writing a general oneLineNode method that always returns
      a one-line summary (guaranteed!) of any input node.
      
      Packages like image/color/palette and unicode now become much
      more readable since large slices are now a single line.
      
      $ go doc image/color/palette
      <<<
      // Before:
      var Plan9 = []color.Color{
      	color.RGBA{0x00, 0x00, 0x00, 0xff},
      	color.RGBA{0x00, 0x00, 0x44, 0xff},
      	color.RGBA{0x00, 0x00, 0x88, 0xff},
      	... // Hundreds of more lines!
      }
      var WebSafe = []color.Color{
      	color.RGBA{0x00, 0x00, 0x00, 0xff},
      	color.RGBA{0x00, 0x00, 0x33, 0xff},
      	color.RGBA{0x00, 0x00, 0x66, 0xff},
      	... // Hundreds of more lines!
      }
      
      // After:
      var Plan9 = []color.Color{ ... }
      var WebSafe = []color.Color{ ... }
      >>>
      
      In order to test this, I ran `go doc` and `go doc -u` on all of the
      standard library packages and diff'd the output with and without the
      change to ensure that all differences were intended.
      
      Fixes #13072
      
      Change-Id: Ida10b7796b7e4e174a929b55c60813a9eb7158fe
      Reviewed-on: https://go-review.googlesource.com/25420
      Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarRob Pike <r@golang.org>
      84743c34
  2. 04 Oct, 2016 27 commits
  3. 03 Oct, 2016 2 commits