regexp: use Scanner in exec_test

R=rsc
CC=golang-dev
https://codereview.appspot.com/7381046
strconv: use Scanner in fp_test

R=rsc
CC=golang-dev
https://codereview.appspot.com/7385045
A+C: add Robert Dinu (Individual CLA)

R=golang-dev, bradfitz
CC=golang-dev
https://codereview.appspot.com/7386045
fmt: fix width for nil values

Apply width when using Printf with nil values.
Fixes issue 4772.

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

Committer: Rob Pike <r@golang.org>
mime: use Scanner to read mime files during init
Also close the file when we're done.

R=bradfitz
CC=golang-dev
https://codereview.appspot.com/7363045
A+C: Olivier SAINGRE (individual CLA)

Generated by addca.

R=gobot
CC=golang-dev
https://codereview.appspot.com/7400045
encoding/xml: make sure Encoder.Encode reports Write errors.

Fixes issue 4112.

R=remyoudompheng, daniel.morsing, dave, rsc
CC=golang-dev
https://codereview.appspot.com/7085053

Committer: Brad Fitzpatrick <bradfitz@golang.org>
A+C: Steven Elliot Harris (individual CLA)

Generated by addca.

R=gobot
CC=golang-dev
https://codereview.appspot.com/7377045
misc/emacs: Present "godoc" documentation buffers using view-mode.

Mimic the Emacs convention of presenting read-only files meant
for browsing using view-mode, rather than Fundamental mode
which mistakenly allows editing of the "godoc" content.
Fixes issue 4322.

R=golang-dev, bradfitz, sameer
CC=golang-dev
https://codereview.appspot.com/7231055

Committer: Brad Fitzpatrick <bradfitz@golang.org>
runtime: allow cgo callbacks on non-Go threads

Fixes issue 4435.

R=golang-dev, iant, alex.brainman, minux.ma, dvyukov
CC=golang-dev
https://codereview.appspot.com/7304104
database/sql: refcounting and lifetime fixes

Simplifies the contract for Driver.Stmt.Close in
the process of fixing issue 3865.

Fixes issue 3865
Update issue 4459 (maybe fixes it; uninvestigated)

R=golang-dev, rsc
CC=golang-dev
https://codereview.appspot.com/7363043
image/png: use Scanner in reader_test.

R=nigeltao
CC=golang-dev
https://codereview.appspot.com/7399044
net/http: improve test reliability

Fixes issue 4852

R=golang-dev, adg
CC=golang-dev
https://codereview.appspot.com/7374045
go/types: export data result types are always parenthesized

Minor simplification of gcimporter, removed TODO.

R=adonovan
CC=golang-dev
https://codereview.appspot.com/7363044
misc/dashboard/builder: various cleanups

* allow commit watcher to be disabled, useful for small slow builders who will never be the first to notice a commit.
* builders always update their local master working copy before cloning a specific revision.
* refactor hg repo operations into a new type, Repo.

R=adg, shanemhansen, luitvd
CC=golang-dev
https://codereview.appspot.com/7326053
database/sql: clarify that DB.Prepare's stmt is safe for concurrent use

And add a test too, for Alex. :)

Fixes issue 3734

R=golang-dev, adg
CC=golang-dev
https://codereview.appspot.com/7399046
runtime: split minit() to mpreinit() and minit()
mpreinit() is called on the parent thread and with mcache (can allocate memory),
minit() is called on the child thread and can not allocate memory.

R=golang-dev, rsc
CC=golang-dev
https://codereview.appspot.com/7389043
exp/ssa: build fully pruned SSA form.

Overview: Function.finish() now invokes the "lifting" pass which replaces local allocs and loads and stores to such cells by SSA registers.  We use very standard machinery:

(1) we build the dominator tree for the function's control flow graph (CFG) using the "Simple" Lengauer-Tarjan algorithm.  (Very "simple" in fact: even simple path compression is not yet implemented.)

In sanity-checking mode, we cross check the dominator tree against an alternative implementation using a simple iterative dataflow algorithm.
This all lives in dom.go, along with some diagnostic printing routines.

(2) we build the dominance frontier for the entire CFG using the Cytron et al algorithm.  The DF is represented as a slice of slices, keyed by block index.  See buildDomFrontier() in lift.go.

(3) we determine for each Alloc whether it can be lifted: is it only subject to loads and stores?  If so, we traverse the iterated dominance frontier (IDF) creating φ-nodes; they are not prepended to the blocks yet.
See liftAlloc() in lift.go.

(4) we perform the SSA renaming algorithm from Cytron et al, replacing all loads to lifted Alloc cells by the value stored by the dominating store operation, and deleting the stores and allocs.  See rename() in lift.go.

(5) we eliminate unneeded φ-nodes, then concatenate the remaining ones with the non-deleted instructions of the block into a new slice.  We eliminate any lifted allocs from Function.Locals.

To ease reviewing, I have avoided almost all optimisations at this point, though there are many opportunities to explore.  These will be easier to understand as follow-up changes.

All the existing tests (pending CL 7313062) pass.  (Faster!)

Details:

"NaiveForm" BuilderMode flag suppresses all the new logic.
Exposed as 'ssadump -build=N'.

BasicBlock:
- add .Index field (b.Func[b.Index]==b), simplifying
  algorithms such as Kildall-style dataflow with bitvectors.
- rename the Name field to Comment to better reflect its
  reduced purpose.  It now has a String() method.
- 'dom' field holds dominator tree node; private for now.
- new predIndex method.
- hasPhi is now a method

dom.go:
- domTree: a new struct for a node in a dominator tree.
- buildDomTree builds the dominator tree using the simple
  variant Lengauer/Tarjan algorithm with Georgiadis'
  bucket optimizations.
- sanityCheckDomTree builds dominance relation using
  Kildall-style dataflow and ensures the same result is
  obtained.
- printDomTreeDot prints the CFG/DomTree in GraphViz format.

blockopt.go:
- perform a mark/sweep pass to eliminate unreachable
  cycles; the previous prune() opt would only eliminate
  trivially dead blocks.  (Needed for LT algo.)
- using .Index, fuseblocks can now delete fused blocks directly.
- delete prune().

sanity.go: more consistency checks:
- Phi with missing edge value
- local Alloc instructions must appear in Function.Locals.
- BasicBlock.Index, Func consistency
- CFG edges are all intraprocedural.
- detect nils in BasicBlock.Instrs.
- detect Function.Locals with Heap flag set.
- check fn.Blocks is nil if empty.

Also:
- Phi now has Comment field for debugging.
- Fixed bug in Select.Operands()
  (took address of temporary copy of field)
- new Literal constructor zeroLiteral().
- algorithms steal private fields Alloc.index,
  BasicBlock.gaps to avoid allocating maps.
- We print Function.Locals in DumpTo.
- added profiling support to ssadump.

R=iant, gri
CC=golang-dev
https://codereview.appspot.com/7229074
net: add benchmarks for network interface identification

Current results on linux/amd64:
BenchmarkInterfaces                      20000             80902 ns/op
BenchmarkInterfaceByIndex                50000             71591 ns/op
BenchmarkInterfaceByName                 20000             79908 ns/op
BenchmarkInterfaceAddrs                   2000            836413 ns/op
BenchmarkInterfacesAndAddrs               5000            605946 ns/op
BenchmarkInterfacesAndMulticastAddrs     10000            169029 ns/op

Update issue 4866.

R=golang-dev, bradfitz
CC=golang-dev
https://codereview.appspot.com/7368046
exp/ssa: add dedicated Panic instruction.

By avoiding the need for self-loops following calls to panic,
we reduce the number of basic blocks considerably.

R=gri
CC=golang-dev, iant
https://codereview.appspot.com/7403043