exp/locale/collate: fixed go vet error.

R=r, dave
CC=golang-dev
https://codereview.appspot.com/7403055
exp/ssa: perform all packages' BUILD phases in parallel.

Details:
- move Builder.nTo1Vars into package => thread-safe.
- add BuildSerially builder mode flag to disable concurrency.
- add Builder.BuildAllPackages method.

Benchmark: BuildAllPackages for $GOROOT/test/append.go drops
to 83ms from 190ms (GOMAXPROCS=8).

R=gri
CC=golang-dev
https://codereview.appspot.com/7371051
exp/ssa: make invokation of deferred procedure calls explicit.

The correct semantics of named result parameters and deferred
procedures cannot be implemented with the existing Ret
instruction alone, since the required sequence is:
(1) evaluate return operands and parallel-assign them to
    named result parameters
(2) invoke deferred procedures
(3) load named result parameters to form result tuple.

We introduce a new 'rundefers' instruction that explicitly
invokes the deferred procedure calls, and we generate code
that follows the sequence above.

Most functions do not use deferred procedures but this cannot
be known in a single pass.  So, we add an optimisation to
eliminate redundant 'rundefers'; it is piggybacked on the
existing pass done for "lifting".

Added tests.

R=gri
CC=golang-dev
https://codereview.appspot.com/7411043
runtime: improve precision of GC_REGION

R=rsc
CC=golang-dev
https://codereview.appspot.com/7383054

Committer: Russ Cox <rsc@golang.org>
exp/ssa: resolve botched merge.

While submitting CL 7371051 I accidentally reverted much of CL
7395052.  This change restores it.

R=gri
TBR=gri
CC=golang-dev
https://codereview.appspot.com/7364051
net/http: add Transport.ResponseHeaderTimeout

Update issue 3362

R=golang-dev, adg, rsc
CC=golang-dev
https://codereview.appspot.com/7369055
sort: use proper mass unit in example

The values for the planet masses are given in
earth mass, not solar mass.

R=golang-dev, dave, r
CC=golang-dev
https://codereview.appspot.com/7368054

Committer: Rob Pike <r@golang.org>
cmd/gc: don't emit type instructions for nonexisting locals

If all locals are optimized away, the type instructions would stay in the instruction stream. Call fixautoused to scrub the output.

Fixes issue 4915.

R=rsc
CC=golang-dev
https://codereview.appspot.com/7385055
runtime: more changes in preparation to the new scheduler
add per-P cache of dead G's
add global runnable queue (not used for now)
add list of idle P's (not used for now)

R=golang-dev, rsc
CC=golang-dev
https://codereview.appspot.com/7397061
net: add DialOpt, the extensible Dial w/ options dialer

Add DialOpt. So we have:

func Dial(net, addr string) (Conn, error)
func DialTimeout(net, addr string, timeout time.Duration) (Conn, error)
func DialOpt(addr string, opts ...DialOption) (Conn, error)

DialTimeout (and Dial) are regrettable in retrospect. Maybe
in a future Go we'll be back down to one Dial, with DialOpt
becoming Dial.

DialOpt looks like:

c, err := net.DialOpt("google.com:80")  // tcp is default
c, err := net.DialOpt("google.com:80", net.Timeout(30 * time.Second))
c, err := net.DialOpt("google.com:80", net.TCPFastOpen())
c, err := net.DialOpt("google.com:80", net.LocalAddr(..))
c, err := net.DialOpt("google.com:53", net.Network("udp6"))

And then: (clustered in godoc)

type DialOption interface { /* private only */ }
  func Deadline(time.Time) DialOption
  func LocalAddr(Addr) DialOption
  func Network(string) DialOption
  func TCPFastOpen() DialOption
  func Timeout(time.Duration) DialOption

I'm pretty confident we could add Happy Eyeballs to this too.

Fixes issue 3097
Update issue 3610
Update issue 4842

R=golang-dev, r, dave, minux.ma, rsc
CC=golang-dev
https://codereview.appspot.com/7365049
net: fix windows build

R=golang-dev, iant
CC=golang-dev
https://codereview.appspot.com/7392054
exp/ssa: a number of bug fixes.

ssadump:
- permit naming a package (not just *.go files) on command line.
- set BuildSerially flag when setting Log* flags
  (Q. should instead the logging functions take a lock?)

Builder:
- fixed bug when calling variadic function with zero '...'-params.
  Added regression test.

interp:
- more external functions:
   the 'error' interface
   bytes.{Equal,IndexByte}
   reflect.(Value).{Bool,NumOut,Out}
   syscall.{Close,Fstat,Read,Open,Stat,Lstat,Fstat,
     Getdents,ParseDirents,Getwd}
- permit comparisons between *Function and *closure.

With this CL, ssadump can now interpret ssadump itself (!),
loading, parsing, typing, SSA-building, and running
println("Hello, World!").  While a fmt-based equivalent still
lacks some external routines, e.g. math/big, I think there are
diminishing returns in expanding the interpreter (and
debugging it is starting to feel like "Inception").

I'm pretty confident this package is now good enough for wider use.

R=gri
CC=golang-dev
https://codereview.appspot.com/7392053
exp/ssa: fix *bsd breakage.

Use portable ReadDirent, not linux Getdents.

R=gri
TBR=gri
CC=golang-dev
https://codereview.appspot.com/7405051
go/types: don't crash when assigning to undefined variables

R=adonovan
CC=golang-dev
https://codereview.appspot.com/7369059
doc/effective_go.html: use correct name in Interface Checks section
Fixes issue 4897.

R=golang-dev, adg
CC=golang-dev
https://codereview.appspot.com/7377061
api: update next.txt

R=golang-dev, adg
CC=golang-dev
https://codereview.appspot.com/7420043
net/http: add Transport.CancelRequest

Permits all sorts of custom HTTP timeout policies without
adding a new Transport timeout Duration for each combination
of HTTP phases.

This keeps track internally of which TCP connection a given
Request is on, and lets callers forcefully close the TCP
connection for a given request, without actually getting
the net.Conn directly.

Additionally, a future CL will implement res.Body.Close (Issue
3672) in terms of this.

Update issue 3362
Update issue 3672

R=golang-dev, rsc, adg
CC=golang-dev
https://codereview.appspot.com/7372054
go/types: don't crash if there are no hints

R=r
CC=golang-dev
https://codereview.appspot.com/7375060
misc/osx: remove legacy packaging scripts

These are superseded by the tool at misc/dist.

R=golang-dev, r
CC=golang-dev
https://codereview.appspot.com/7420044
cmd/vet: continue past first error
Also delete bogus tests for f.pkg (does the file have a package) since all
files have a package attached. The tests for pkg.types and pkg.values
suffice.

R=golang-dev, adg
CC=golang-dev
https://codereview.appspot.com/7418043