1. 04 Mar, 2016 1 commit
    • Spencer Nelson's avatar
      cmd/vet: Use function signature to find format string index. · 867910ea
      Spencer Nelson authored
      cmd/vet's printf checker currently uses a hardcoded map of function
      names to expected positions of format strings. We can be a bit more
      precise than this by looking up the signature of the function, which
      helps when libraries implement functions like Errorf or Logf with
      extra arguments like log levels or error codes.
      
      Specifically, the format string param is assumed to be the last string
      parameter of the called function.
      
      Fixes #12294.
      
      Change-Id: Icf10ebb819bba91fa1c4109301417042901e34c7
      Reviewed-on: https://go-review.googlesource.com/20163
      Run-TryBot: Rob Pike <r@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRob Pike <r@golang.org>
      867910ea
  2. 03 Mar, 2016 25 commits
  3. 02 Mar, 2016 14 commits
    • Alex Brainman's avatar
      misc/cgo/test: rewrite windows version of mysleep · 03f3bfc4
      Alex Brainman authored
      Latest version of gcc (tdm-1) 5.1.0 refuses to compile our code
      on windows/386 (see issue for details). Rewrite the code.
      
      Fixes #14328
      
      Change-Id: I70f4f063282bd2958cd2175f3974369dd49dd8dc
      Reviewed-on: https://go-review.googlesource.com/20008Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      03f3bfc4
    • David Crawshaw's avatar
      cmd/link: make Allsym a slice · 4b92cd4e
      David Crawshaw authored
      Looks a tiny bit faster, which is a surprise. Probably noise.
      Motivation is making the LSym structure a little easier to understand.
      
      Linking juju, best of 10:
      
      before: real 0m4.811s user 0m5.582s
      after:  real 0m4.611s user 0m5.267s
      
      Change-Id: Idbedaf4a6e6e199036a1bbb6760e98c94ed2c282
      Reviewed-on: https://go-review.googlesource.com/20142Reviewed-by: default avatarMichael Hudson-Doyle <michael.hudson@canonical.com>
      Run-TryBot: David Crawshaw <crawshaw@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      4b92cd4e
    • Robert Griesemer's avatar
      cmd/compile/internal/gc: export & import function bodies, but don't hook up · 45983827
      Robert Griesemer authored
      Function bodies are not yet hooked up because the node structure is not
      100% correct. This commit establishes that we can correctly write bodies
      out and read them in again.
      
      - export and import all exported inlined function bodies:
        (export GO_GCFLAGS="-newexport"; sh all.bash) working
      - inlined functions are not yet hooked up (just dropped on the floor)
      - improved tracing output and error messages
      - make mkbuiltin.go work for both textual and binary export data
        so we can run tests with the new format
      
      Change-Id: I70dc4de419df1b604389c3747041d6dba8730b0b
      Reviewed-on: https://go-review.googlesource.com/16284Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      45983827
    • David Crawshaw's avatar
      cmd/link: replace custom hashmap in DWARF writer · c0f7195d
      David Crawshaw authored
      Also stop creating a map for each symbol, as it does not seem to help.
      
      Linking juju:
      	tip:  real 0m5.470s user 0m6.131s
      	this: real 0m4.811s user 0m5.582s
      
      Change-Id: Ib3d931c996396a00942581770ff32df1eb8d6615
      Reviewed-on: https://go-review.googlesource.com/20140
      Run-TryBot: David Crawshaw <crawshaw@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      c0f7195d
    • David Chase's avatar
      cmd/compile: trunc(and(x,K)) rewrite to trunc(x) for some K · 97b2295f
      David Chase authored
      uint8(s.b & 0xff) ought to produce same code as uint8(s.b)
      but it did not.  RLH found this one looking for moles to
      whack in the GC code.
      
      Change-Id: I883d68ec7a5746d652712be84a274a11256b3b33
      Reviewed-on: https://go-review.googlesource.com/20141Reviewed-by: default avatarKeith Randall <khr@golang.org>
      97b2295f
    • Robert Griesemer's avatar
      cmd/compile: remove missed int(lineno) conversions · 3a880bae
      Robert Griesemer authored
      Follow-up to https://go-review.googlesource.com/20131 .
      
      Change-Id: Id8351fa39f24e6ea488cdbfcb855b69a31ffff31
      Reviewed-on: https://go-review.googlesource.com/20134
      Run-TryBot: Robert Griesemer <gri@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      3a880bae
    • Martin Möhrmann's avatar
      fmt: optimize string truncation · 83765d13
      Martin Möhrmann authored
      Count only the runes up to the requested precision
      to decide where to truncate a string.
      
      Change the loop within truncate to need fewer jumps.
      
      name                     old time/op  new time/op  delta
      SprintfTruncateString-2   188ns ± 3%   155ns ± 3%  -17.43%  (p=0.000 n=20+20)
      
      Change-Id: I17ca9fc0bb8bf7648599df48e4785251bbc31e99
      Reviewed-on: https://go-review.googlesource.com/20098Reviewed-by: default avatarRob Pike <r@golang.org>
      83765d13
    • Robert Griesemer's avatar
      cmd/compile: introduce linestr helper to simplify line reporting · 2faf5bca
      Robert Griesemer authored
      Change-Id: Ic9ca792b55cc4ebd0ac6cfa2fbdb58030893bacd
      Reviewed-on: https://go-review.googlesource.com/20132
      Run-TryBot: Robert Griesemer <gri@golang.org>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      2faf5bca
    • Russ Cox's avatar
      runtime/pprof: sort counted profiles by count · 6969d9bf
      Russ Cox authored
      This is especially helpful in programs with very large numbers of goroutines:
      the bulk of the goroutines will show up at the top.
      
      Before:
      	1 @ 0x86ab8 0x86893 0x82164 0x8e7ce 0x7b798 0x5b871
      	#	0x86ab8	runtime/pprof.writeRuntimeProfile+0xb8		/Users/rsc/go/src/runtime/pprof/pprof.go:545
      	#	0x86893	runtime/pprof.writeGoroutine+0x93		/Users/rsc/go/src/runtime/pprof/pprof.go:507
      	#	0x82164	runtime/pprof.(*Profile).WriteTo+0xd4		/Users/rsc/go/src/runtime/pprof/pprof.go:236
      	#	0x8e7ce	runtime/pprof_test.TestGoroutineCounts+0x15e	/Users/rsc/go/src/runtime/pprof/pprof_test.go:603
      	#	0x7b798	testing.tRunner+0x98				/Users/rsc/go/src/testing/testing.go:473
      
      	1 @ 0x2d373 0x2d434 0x560f 0x516b 0x7cd42 0x7b861 0x2297 0x2cf90 0x5b871
      	#	0x7cd42	testing.RunTests+0x8d2	/Users/rsc/go/src/testing/testing.go:583
      	#	0x7b861	testing.(*M).Run+0x81	/Users/rsc/go/src/testing/testing.go:515
      	#	0x2297	main.main+0x117		runtime/pprof/_test/_testmain.go:72
      	#	0x2cf90	runtime.main+0x2b0	/Users/rsc/go/src/runtime/proc.go:188
      
      	10 @ 0x2d373 0x2d434 0x560f 0x516b 0x8e5b6 0x5b871
      	#	0x8e5b6	runtime/pprof_test.func1+0x36	/Users/rsc/go/src/runtime/pprof/pprof_test.go:582
      
      	50 @ 0x2d373 0x2d434 0x560f 0x516b 0x8e656 0x5b871
      	#	0x8e656	runtime/pprof_test.func3+0x36	/Users/rsc/go/src/runtime/pprof/pprof_test.go:584
      
      	40 @ 0x2d373 0x2d434 0x560f 0x516b 0x8e606 0x5b871
      	#	0x8e606	runtime/pprof_test.func2+0x36	/Users/rsc/go/src/runtime/pprof/pprof_test.go:583
      
      After:
      
      	50 @ 0x2d373 0x2d434 0x560f 0x516b 0x8ecc6 0x5b871
      	#	0x8ecc6	runtime/pprof_test.func3+0x36	/Users/rsc/go/src/runtime/pprof/pprof_test.go:584
      
      	40 @ 0x2d373 0x2d434 0x560f 0x516b 0x8ec76 0x5b871
      	#	0x8ec76	runtime/pprof_test.func2+0x36	/Users/rsc/go/src/runtime/pprof/pprof_test.go:583
      
      	10 @ 0x2d373 0x2d434 0x560f 0x516b 0x8ec26 0x5b871
      	#	0x8ec26	runtime/pprof_test.func1+0x36	/Users/rsc/go/src/runtime/pprof/pprof_test.go:582
      
      	1 @ 0x2d373 0x2d434 0x560f 0x516b 0x7cd42 0x7b861 0x2297 0x2cf90 0x5b871
      	#	0x7cd42	testing.RunTests+0x8d2	/Users/rsc/go/src/testing/testing.go:583
      	#	0x7b861	testing.(*M).Run+0x81	/Users/rsc/go/src/testing/testing.go:515
      	#	0x2297	main.main+0x117		runtime/pprof/_test/_testmain.go:72
      	#	0x2cf90	runtime.main+0x2b0	/Users/rsc/go/src/runtime/proc.go:188
      
      	1 @ 0x87128 0x86f03 0x82164 0x8ee30 0x7b798 0x5b871
      	#	0x87128	runtime/pprof.writeRuntimeProfile+0xb8		/Users/rsc/go/src/runtime/pprof/pprof.go:566
      	#	0x86f03	runtime/pprof.writeGoroutine+0x93		/Users/rsc/go/src/runtime/pprof/pprof.go:528
      	#	0x82164	runtime/pprof.(*Profile).WriteTo+0xd4		/Users/rsc/go/src/runtime/pprof/pprof.go:236
      	#	0x8ee30	runtime/pprof_test.TestGoroutineCounts+0x150	/Users/rsc/go/src/runtime/pprof/pprof_test.go:603
      	#	0x7b798	testing.tRunner+0x98				/Users/rsc/go/src/testing/testing.go:473
      
      Change-Id: I43de9eee2d96f9c46f7b0fbe099a0571164324f5
      Reviewed-on: https://go-review.googlesource.com/20107Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      6969d9bf
    • Robert Griesemer's avatar
      cmd/compile: use int32 for line numbers consistently · b83f3972
      Robert Griesemer authored
      - removed lots of unnecessary int(x) casts
      - removed parserline() - was inconsistently used anyway
      - minor simplifications in dcl.go
      
      Change-Id: Ibf7de679eea528a31c9692ef1c76a1d9b3239211
      Reviewed-on: https://go-review.googlesource.com/20131Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      b83f3972
    • Ian Lance Taylor's avatar
      go/ast: fix typo in comment · 053aef4f
      Ian Lance Taylor authored
      Change-Id: I719231466286b3c0135314388a7c560ef44d7c35
      Reviewed-on: https://go-review.googlesource.com/20130
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      053aef4f
    • Tamir Duberstein's avatar
      crypto/tls: check errors from (*Conn).writeRecord · 37c28759
      Tamir Duberstein authored
      This promotes a connection hang during TLS handshake to a proper error.
      This doesn't fully address #14539 because the error reported in that
      case is a write-on-socket-not-connected error, which implies that an
      earlier error during connection setup is not being checked, but it is
      an improvement over the current behaviour.
      
      Updates #14539.
      
      Change-Id: I0571a752d32d5303db48149ab448226868b19495
      Reviewed-on: https://go-review.googlesource.com/19990Reviewed-by: default avatarAdam Langley <agl@golang.org>
      37c28759
    • David Crawshaw's avatar
      cmd/link: C is gone, remove check for Go calling C · 1012892f
      David Crawshaw authored
      It looks like the compiler still uses the Cfunc flag for functions
      marked as //go:systemstack, but if I'm reading this right, that
      doesn't apply here and the linker no longer needs Cfunc.
      
      Change-Id: I63b9192c2f52f41401263c29dc8dfd8be8a901a1
      Reviewed-on: https://go-review.googlesource.com/20105
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      1012892f
    • Joe Tsai's avatar
      compress/bzip2: prevent zero-length Huffman codes · 8b360d5f
      Joe Tsai authored
      Unlike RFC 1951 (DEFLATE), bzip2 does not use zero-length Huffman codes
      to indicate that the symbol is missing. Instead, bzip2 uses a sparse
      bitmap to indicate which symbols are present. Thus, it is undefined what
      happens when a length of zero is used. Thus, fix the parsing logic so that
      the length cannot ever go below 1-bit similar to how the C logic does things.
      
      To confirm that the C bzip2 utility chokes on this data:
      	$ echo "425a6836314159265359b1f7404b000000400040002000217d184682ee48
      	a70a12163ee80960" | xxd -r -p | bzip2 -d
      
      	bzip2: Data integrity error when decompressing
      
      For reference see:
      	bzip2-1.0.6/decompress.c:320
      
      Change-Id: Ic1568f8e7f80cdea51d887b4d712cc239c2fe85e
      Reviewed-on: https://go-review.googlesource.com/20119
      Run-TryBot: Joe Tsai <joetsai@digital-static.net>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      8b360d5f