1. 12 Apr, 2016 9 commits
    • Michael Munday's avatar
      cmd/compile/internal/s390x: add s390x support · a223ccae
      Michael Munday authored
      s390x does not require duffzero/duffcopy since it has
      storage-to-storage instructions that can copy/clear up to 256
      bytes at a time.
      
      peep contains several new passes to optimize instruction
      sequences that match s390x instructions such as the
      compare-and-branch and load/store multiple instructions.
      
      copyprop and subprop have been extended to work with moves that
      require sign/zero extension. This work could be ported to other
      architectures that do not used sized math however it does add
      complexity and will probably be rendered unnecessary by ssa in
      the near future.
      
      Change-Id: I1b64b281b452ed82a85655a0df69cb224d2a6941
      Reviewed-on: https://go-review.googlesource.com/20873
      Run-TryBot: Michael Munday <munday@ca.ibm.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarBill O'Farrell <billotosyr@gmail.com>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      a223ccae
    • Dmitry Vyukov's avatar
      internal/trace: fix int overflow in timestamps · 944a0859
      Dmitry Vyukov authored
      Fixes #15102
      
      Change-Id: I7fdb6464afd0b7af9b6652051416f0fddd34dc9a
      Reviewed-on: https://go-review.googlesource.com/21730Reviewed-by: 's avatarAustin Clements <austin@google.com>
      944a0859
    • Dmitri Shuralyov's avatar
      cmd/go: fix vcsFromDir returning bad root on Windows · b6cd6d7d
      Dmitri Shuralyov authored
      Apply golang/tools@5804fef4c0556d3e5e7d2440740a3d7aced7d58b.
      
      In the context of cmd/go build tool, import path is a '/'-separated path.
      This can be inferred from `go help importpath` and `go help packages`.
      vcsFromDir documentation says on return, root is the import path
      corresponding to the root of the repository. On Windows and other
      OSes where os.PathSeparator is not '/', that wasn't true since root
      would contain characters other than '/', and therefore it wasn't a
      valid import path corresponding to the root of the repository.
      Fix that by using filepath.ToSlash.
      
      Add test coverage for vcsFromDir, it was previously not tested.
      It's taken from golang.org/x/tools/go/vcs tests, and modified to
      improve style.
      
      Additionally, remove an unneccessary statement from the documentation
      "(thus root is a prefix of importPath)". There is no variable
      importPath that is being referred to (it's possible p.ImportPath
      was being referred to). Without it, the description of root value
      matches the documentation of repoRoot.root struct field:
      
      	// root is the import path corresponding to the root of the
      	// repository
      	root string
      
      Rename and change signature of vcsForDir(p *Package) to
      vcsFromDir(dir, srcRoot string). This is more in sync with the x/tools
      version. It's also simpler, since vcsFromDir only needs those two
      values from Package, and nothing more. Change "for" to "from" in name
      because it's more consistent and clear.
      
      Update usage of vcsFromDir to match the new signature, and respect
      that returned root is a '/'-separated path rather than a os.PathSeparator
      separated path.
      
      Fixes #15040.
      Updates #7723.
      Helps #11490.
      
      Change-Id: Idf51b9239f57248739daaa200aa1c6e633cb5f7f
      Reviewed-on: https://go-review.googlesource.com/21345Reviewed-by: 's avatarAlex Brainman <alex.brainman@gmail.com>
      Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      b6cd6d7d
    • Martin Möhrmann's avatar
      cmd/compile: cleanup pragcgo · 07669d27
      Martin Möhrmann authored
      Removes dynimport, dynexport, dynlinker cases since they can not
      be reached due to prefix check for "go:cgo_" in getlinepragma.
      
      Replaces the if chains for verb distinction by a switch statement.
      Replaces fmt.Sprintf by fmt.Sprintln for string concatenation.
      
      Removes the more, getimpsym and getquoted functions by introducing a
      pragmaFields function that partitions a pragma into its components.
      
      Adds tests for cgo pragmas.
      
      Change-Id: I43c7b9550feb3ddccaff7fb02198a3f994444123
      Reviewed-on: https://go-review.googlesource.com/21607Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      07669d27
    • Brad Fitzpatrick's avatar
      src: split nacltest.bash into naclmake.bash and keep nacltest.bash · e569b10e
      Brad Fitzpatrick authored
      Needed by the build system to shard tests. nacl was the last unsharded
      builder.
      
      (I considered also adding a -make-only flag to nacltest.bash, but that
      wouldn't fail fast when the file didn't exist.)
      
      Updates #15242
      
      Change-Id: I6afc1c1fe4268ab98c0724b5764c67d3784caebe
      Reviewed-on: https://go-review.googlesource.com/21851Reviewed-by: 's avatarAndrew Gerrand <adg@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      e569b10e
    • David Benjamin's avatar
      crypto/tls: Enforce that version and cipher match on resume. · 73a0185a
      David Benjamin authored
      Per RFC 5246, 7.4.1.3:
      
         cipher_suite
            The single cipher suite selected by the server from the list in
            ClientHello.cipher_suites.  For resumed sessions, this field is
            the value from the state of the session being resumed.
      
      The specifications are not very clearly written about resuming sessions
      at the wrong version (i.e. is the TLS 1.0 notion of "session" the same
      type as the TLS 1.1 notion of "session"?). But every other
      implementation enforces this check and not doing so has some odd
      semantics.
      
      Change-Id: I6234708bd02b636c25139d83b0d35381167e5cad
      Reviewed-on: https://go-review.googlesource.com/21153Reviewed-by: 's avatarAdam Langley <agl@golang.org>
      73a0185a
    • Dan Peterson's avatar
      io: document WriteString calls Write exactly once · c9b66bb3
      Dan Peterson authored
      Fixes #13849
      
      Change-Id: Idd7f06b547a0179fe15571807a8c48b7c3b78d7c
      Reviewed-on: https://go-review.googlesource.com/21852Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      c9b66bb3
    • Mikio Hara's avatar
      net: make IP.{String,MarshalText} return helpful information on address error · 1f54410a
      Mikio Hara authored
      This change makes String and MarshalText methods of IP return a
      hexadecial form of IP with no punctuation as part of error
      notification. It doesn't affect the existing behavior of ParseIP.
      
      Also fixes bad shadowing in ipToSockaddr and makes use of reserved
      IP address blocks for documnetation.
      
      Fixes #15052.
      Updates #15228.
      
      Change-Id: I9e9ecce308952ed5683066c3d1bb6a7b36458c65
      Reviewed-on: https://go-review.googlesource.com/21642Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      1f54410a
    • Alan Donovan's avatar
      go/importer: make For("gccgo", nil) not panic · a119f88f
      Alan Donovan authored
      Apparently we forgot to test this.
      
      Fixes #15092
      
      Change-Id: I33d4fef0f659dfbdfc1ebf8401e96610c8215592
      Reviewed-on: https://go-review.googlesource.com/21860Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      a119f88f
  2. 11 Apr, 2016 25 commits
  3. 10 Apr, 2016 6 commits
    • Martin Möhrmann's avatar
      runtime: speed up makeslice by avoiding divisions · ad7448fe
      Martin Möhrmann authored
      Only compute the number of maximum allowed elements per slice once.
      
      name         old time/op  new time/op  delta
      MakeSlice-2  55.5ns ± 1%  45.6ns ± 2%  -17.88%  (p=0.000 n=99+100)
      
      Change-Id: I951feffda5d11910a75e55d7e978d306d14da2c5
      Reviewed-on: https://go-review.googlesource.com/21801
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      ad7448fe
    • Andrew Gerrand's avatar
      cmd/go: remove special case that puts godoc in $GOROOT/bin · 5b3e5766
      Andrew Gerrand authored
      Updates golang/go#15106
      
      Change-Id: I4214b841d63bb7e9c3c5ede2abe21a8a68f06c41
      Reviewed-on: https://go-review.googlesource.com/21701Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      5b3e5766
    • Andrew Gerrand's avatar
      text/template: emit field error over nil pointer error where appropriate · 0fd270ab
      Andrew Gerrand authored
      When evaluating "{{.MissingField}}" on a nil *T, Exec returns
      "can't evaluate field MissingField in type *T" instead of
      "nil pointer evaluating *T.MissingField".
      
      Fixes golang/go#15125
      
      Change-Id: I6e73f61b8a72c694179c1f8cdc808766c90b6f57
      Reviewed-on: https://go-review.googlesource.com/21705Reviewed-by: 's avatarRob Pike <r@golang.org>
      0fd270ab
    • Keith Randall's avatar
      cmd/compile: regalloc enforces 2-address instructions · 0004f34c
      Keith Randall authored
      Instead of being a hint, resultInArg0 is now enforced by regalloc.
      This allows us to delete all the code from amd64/ssa.go which
      deals with converting from a semantically three-address instruction
      into some copies plus a two-address instruction.
      
      Change-Id: Id4f39a80be4b678718bfd42a229f9094ab6ecd7c
      Reviewed-on: https://go-review.googlesource.com/21816Reviewed-by: 's avatarJosh Bleecher Snyder <josharian@gmail.com>
      0004f34c
    • Josh Bleecher Snyder's avatar
      cmd/compile: avoid a spill in append fast path · 6b33b0e9
      Josh Bleecher Snyder authored
      Instead of spilling newlen, recalculate it.
      This removes a spill from the fast path,
      at the cost of a cheap recalculation
      on the (rare) growth path.
      This uses 8 bytes less of stack space.
      It generates two more bytes of code,
      but that is due to suboptimal register allocation;
      see far below.
      
      Runtime append microbenchmarks are all over the map,
      presumably due to incidental code movement.
      
      Sample code:
      
      func s(b []byte) []byte {
      	b = append(b, 1, 2, 3)
      	return b
      }
      
      Before:
      
      "".s t=1 size=160 args=0x30 locals=0x48
      	0x0000 00000 (append.go:8)	TEXT	"".s(SB), $72-48
      	0x0000 00000 (append.go:8)	MOVQ	(TLS), CX
      	0x0009 00009 (append.go:8)	CMPQ	SP, 16(CX)
      	0x000d 00013 (append.go:8)	JLS	149
      	0x0013 00019 (append.go:8)	SUBQ	$72, SP
      	0x0017 00023 (append.go:8)	FUNCDATA	$0, gclocals·6432f8c6a0d23fa7bee6c5d96f21a92a(SB)
      	0x0017 00023 (append.go:8)	FUNCDATA	$1, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB)
      	0x0017 00023 (append.go:9)	MOVQ	"".b+88(FP), CX
      	0x001c 00028 (append.go:9)	LEAQ	3(CX), DX
      	0x0020 00032 (append.go:9)	MOVQ	DX, "".autotmp_0+64(SP)
      	0x0025 00037 (append.go:9)	MOVQ	"".b+96(FP), BX
      	0x002a 00042 (append.go:9)	CMPQ	DX, BX
      	0x002d 00045 (append.go:9)	JGT	$0, 86
      	0x002f 00047 (append.go:8)	MOVQ	"".b+80(FP), AX
      	0x0034 00052 (append.go:9)	MOVB	$1, (AX)(CX*1)
      	0x0038 00056 (append.go:9)	MOVB	$2, 1(AX)(CX*1)
      	0x003d 00061 (append.go:9)	MOVB	$3, 2(AX)(CX*1)
      	0x0042 00066 (append.go:10)	MOVQ	AX, "".~r1+104(FP)
      	0x0047 00071 (append.go:10)	MOVQ	DX, "".~r1+112(FP)
      	0x004c 00076 (append.go:10)	MOVQ	BX, "".~r1+120(FP)
      	0x0051 00081 (append.go:10)	ADDQ	$72, SP
      	0x0055 00085 (append.go:10)	RET
      	0x0056 00086 (append.go:9)	LEAQ	type.[]uint8(SB), AX
      	0x005d 00093 (append.go:9)	MOVQ	AX, (SP)
      	0x0061 00097 (append.go:9)	MOVQ	"".b+80(FP), BP
      	0x0066 00102 (append.go:9)	MOVQ	BP, 8(SP)
      	0x006b 00107 (append.go:9)	MOVQ	CX, 16(SP)
      	0x0070 00112 (append.go:9)	MOVQ	BX, 24(SP)
      	0x0075 00117 (append.go:9)	MOVQ	DX, 32(SP)
      	0x007a 00122 (append.go:9)	PCDATA	$0, $0
      	0x007a 00122 (append.go:9)	CALL	runtime.growslice(SB)
      	0x007f 00127 (append.go:9)	MOVQ	40(SP), AX
      	0x0084 00132 (append.go:9)	MOVQ	56(SP), BX
      	0x0089 00137 (append.go:8)	MOVQ	"".b+88(FP), CX
      	0x008e 00142 (append.go:9)	MOVQ	"".autotmp_0+64(SP), DX
      	0x0093 00147 (append.go:9)	JMP	52
      	0x0095 00149 (append.go:9)	NOP
      	0x0095 00149 (append.go:8)	CALL	runtime.morestack_noctxt(SB)
      	0x009a 00154 (append.go:8)	JMP	0
      
      After:
      
      "".s t=1 size=176 args=0x30 locals=0x40
      	0x0000 00000 (append.go:8)	TEXT	"".s(SB), $64-48
      	0x0000 00000 (append.go:8)	MOVQ	(TLS), CX
      	0x0009 00009 (append.go:8)	CMPQ	SP, 16(CX)
      	0x000d 00013 (append.go:8)	JLS	151
      	0x0013 00019 (append.go:8)	SUBQ	$64, SP
      	0x0017 00023 (append.go:8)	FUNCDATA	$0, gclocals·6432f8c6a0d23fa7bee6c5d96f21a92a(SB)
      	0x0017 00023 (append.go:8)	FUNCDATA	$1, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB)
      	0x0017 00023 (append.go:9)	MOVQ	"".b+80(FP), CX
      	0x001c 00028 (append.go:9)	LEAQ	3(CX), DX
      	0x0020 00032 (append.go:9)	MOVQ	"".b+88(FP), BX
      	0x0025 00037 (append.go:9)	CMPQ	DX, BX
      	0x0028 00040 (append.go:9)	JGT	$0, 81
      	0x002a 00042 (append.go:8)	MOVQ	"".b+72(FP), AX
      	0x002f 00047 (append.go:9)	MOVB	$1, (AX)(CX*1)
      	0x0033 00051 (append.go:9)	MOVB	$2, 1(AX)(CX*1)
      	0x0038 00056 (append.go:9)	MOVB	$3, 2(AX)(CX*1)
      	0x003d 00061 (append.go:10)	MOVQ	AX, "".~r1+96(FP)
      	0x0042 00066 (append.go:10)	MOVQ	DX, "".~r1+104(FP)
      	0x0047 00071 (append.go:10)	MOVQ	BX, "".~r1+112(FP)
      	0x004c 00076 (append.go:10)	ADDQ	$64, SP
      	0x0050 00080 (append.go:10)	RET
      	0x0051 00081 (append.go:9)	LEAQ	type.[]uint8(SB), AX
      	0x0058 00088 (append.go:9)	MOVQ	AX, (SP)
      	0x005c 00092 (append.go:9)	MOVQ	"".b+72(FP), BP
      	0x0061 00097 (append.go:9)	MOVQ	BP, 8(SP)
      	0x0066 00102 (append.go:9)	MOVQ	CX, 16(SP)
      	0x006b 00107 (append.go:9)	MOVQ	BX, 24(SP)
      	0x0070 00112 (append.go:9)	MOVQ	DX, 32(SP)
      	0x0075 00117 (append.go:9)	PCDATA	$0, $0
      	0x0075 00117 (append.go:9)	CALL	runtime.growslice(SB)
      	0x007a 00122 (append.go:9)	MOVQ	40(SP), AX
      	0x007f 00127 (append.go:9)	MOVQ	48(SP), CX
      	0x0084 00132 (append.go:9)	MOVQ	56(SP), BX
      	0x0089 00137 (append.go:9)	ADDQ	$3, CX
      	0x008d 00141 (append.go:9)	MOVQ	CX, DX
      	0x0090 00144 (append.go:8)	MOVQ	"".b+80(FP), CX
      	0x0095 00149 (append.go:9)	JMP	47
      	0x0097 00151 (append.go:9)	NOP
      	0x0097 00151 (append.go:8)	CALL	runtime.morestack_noctxt(SB)
      	0x009c 00156 (append.go:8)	JMP	0
      
      Observe that in the following sequence,
      we should use DX directly instead of using
      CX as a temporary register, which would make
      the new code a strict improvement on the old:
      
      	0x007f 00127 (append.go:9)	MOVQ	48(SP), CX
      	0x0084 00132 (append.go:9)	MOVQ	56(SP), BX
      	0x0089 00137 (append.go:9)	ADDQ	$3, CX
      	0x008d 00141 (append.go:9)	MOVQ	CX, DX
      	0x0090 00144 (append.go:8)	MOVQ	"".b+80(FP), CX
      
      Change-Id: I4ee50b18fa53865901d2d7f86c2cbb54c6fa6924
      Reviewed-on: https://go-review.googlesource.com/21812
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      6b33b0e9
    • Josh Bleecher Snyder's avatar
      runtime: avoid unnecessary map iteration write barrier · 974c201f
      Josh Bleecher Snyder authored
      Update #14921
      
      Change-Id: I5c5816d0193757bf7465b1e09c27ca06897df4bf
      Reviewed-on: https://go-review.googlesource.com/21814
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      974c201f