1
0
mirror of https://github.com/golang/go synced 2024-09-30 19:28:32 -06:00
Commit Graph

15377 Commits

Author SHA1 Message Date
Brad Fitzpatrick
9c7aa5fea9 mime/multipart: allow unescaped newlines through in quoted-printable
This makes Go's quoted-printable decoder more like other
popular ones, allowing through a bare \r or \n, and also
passes through \r\n which looked like a real bug before.

Fixes #4771

R=minux.ma
CC=golang-dev
https://golang.org/cl/7300092
2013-02-22 10:40:23 -08:00
Russ Cox
ec892be1af runtime: preserve DX during racefuncenter
R=golang-dev, dvyukov
CC=golang-dev
https://golang.org/cl/7382049
2013-02-22 13:06:43 -05:00
Alan Donovan
71c37e1c88 exp/ssa: fixed bug (typo) in findPromotedField.
By appending to the wrong (always empty) list, only the last
anonymous field was being considered for promotion.

Also:
- eliminated "function-local NamedTypes" TODO; nothing to do.
- fixed Function.DumpTo: printing of anon receivers was "( T)",
  now "(T)"; extracted writeSignature into own function.
- eliminated blockNames function;
  thanks to BasicBlock.String, "%s" of []*BasicBlock is fine.
- extracted buildReferrers into own function.

exp/ssa can now build its own transitive closure.

R=gri
CC=golang-dev
https://golang.org/cl/7384054
2013-02-22 12:35:45 -05:00
Russ Cox
0ba5f75513 runtime: avoid closure in parfor test
R=golang-dev, dvyukov
CC=golang-dev
https://golang.org/cl/7395051
2013-02-22 12:11:12 -05:00
Russ Cox
6066fdcf38 cmd/6g, cmd/8g: switch to DX for indirect call block
runtime: add context argument to gogocall

Too many other things use AX, and at least one
(stack zeroing) cannot be moved onto a different
register. Use the less special DX instead.

Preparation for step 2 of http://golang.org/s/go11func.
Nothing interesting here, just split out so that we can
see it's correct before moving on.

R=ken2
CC=golang-dev
https://golang.org/cl/7395050
2013-02-22 10:47:54 -05:00
Alan Donovan
d9001ef012 exp/ssa: cross off a few remaining TODO issues.
- append: nothing to do (nonsemantic change).
- delete: now performs correct conversion (+ test).
- emitCompare: nothing to do.
- emitArith (shifts): nothing to do (+ test).
- "banish untyped types": give up on that.
- real, imag: now do correct conversions.
- added comment to interp.go re zero-size values.

R=gri
CC=golang-dev
https://golang.org/cl/7391046
2013-02-22 00:09:21 -05:00
Anthony Martin
ed1ac05673 cmd/go: don't call ImportDir unnecessarily
This significantly speeds up the go tool on
slow file systems (or those with cold caches).

The following numbers were obtained using
an encrypted ext4 file system running on
Linux 3.7.9.

# Before
$ sudo sysctl -w 'vm.drop_caches=3'
$ time go list code.google.com/p/go.net/... | wc -l
9

real	0m16.921s
user	0m0.637s
sys	0m0.317s

# After
$ sudo sysctl -w 'vm.drop_caches=3'
$ time go list code.google.com/p/go.net/... | wc -l
9

real	0m8.175s
user	0m0.220s
sys	0m0.177s

R=rsc, r
CC=golang-dev
https://golang.org/cl/7369044
2013-02-21 20:09:31 -08:00
Anthony Martin
edc3126e98 exp/ssa/interp: fix build for Plan 9
R=adonovan, minux.ma, alex.brainman, akumar, rminnich
CC=golang-dev, lucio.dere
https://golang.org/cl/7300078
2013-02-21 20:06:26 -08:00
Olivier Duperray
2482ef7233 testing: document that example output must use line comments
Fixes #4812.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7396051
2013-02-22 12:23:19 +11:00
Alex Brainman
6ec551887a runtime: windows callback code to match new func value representation
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7393048
2013-02-22 12:21:42 +11:00
Rob Pike
dbd409afb5 bufio: add examples for Scanner
Mention Scanner in docs for ReadLine etc.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7375045
2013-02-21 15:55:40 -08:00
Dave Cheney
6138e368f8 cmd/gc: fix FreeBSD build
R=jsing, mikioh.mikioh, bradfitz
CC=golang-dev
https://golang.org/cl/7390048
2013-02-22 10:28:03 +11:00
Brad Fitzpatrick
0462aad9a4 net/url: fix URL Opaque notes on making client requests
Fixes #4860

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7375047
2013-02-21 14:39:16 -08:00
Robert Dinu
782cbb4f90 testing: fix output formatting
Revision 5e7fd762f356 has changed the output formatting in a way that
is no longer in line with the format described by the revision
ff0ade0b937b which has introduced this functionality.
When decorating the first line, instead of indenting the whole line,
the current implementation adds indentation right after the "decorate"
part and  before the "log" message.
The fix addresses this issue.

R=golang-dev, iant, minux.ma, r, rsc, remyoudompheng
CC=golang-dev
https://golang.org/cl/7304094
2013-02-21 14:17:43 -08:00
Russ Cox
1903ad7189 cmd/gc, reflect, runtime: switch to indirect func value representation
Step 1 of http://golang.org/s/go11func.

R=golang-dev, r, daniel.morsing, remyoudompheng
CC=golang-dev
https://golang.org/cl/7393045
2013-02-21 17:01:13 -05:00
Brad Fitzpatrick
4335e69af6 archive/tar: make test pass on setgid dirs
Fixes #4867

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/7382045
2013-02-21 14:00:03 -08:00
Carl Shapiro
f466617a62 cmd/5g, cmd/5l, cmd/6l, cmd/8l, cmd/gc, cmd/ld, runtime: accurate args and locals information
Previously, the func structure contained an inaccurate value for
the args member and a 0 value for the locals member.

This change populates the func structure with args and locals
values computed by the compiler.  The number of args was
already available in the ATEXT instruction.  The number of
locals is now passed through in the new ALOCALS instruction.

This change also switches the unit of args and locals to be
bytes, just like the frame member, instead of 32-bit words.

R=golang-dev, bradfitz, cshapiro, dave, rsc
CC=golang-dev
https://golang.org/cl/7399045
2013-02-21 12:52:26 -08:00
Brad Fitzpatrick
fb21bca012 net/http, net/url: deal with URL.Opaque beginning with //
Update #4860

R=adg, rsc, campoy
CC=golang-dev
https://golang.org/cl/7369045
2013-02-21 12:01:47 -08:00
Russ Cox
aed05446b4 doc: mention go fix in go1.1 release notes draft
R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/7379045
2013-02-21 14:28:34 -05:00
Rob Pike
6f96a76cd1 unicode: use new Scanner interface in table creation
Update norm and local/collate as well.

R=mpvl
CC=golang-dev
https://golang.org/cl/7395045
2013-02-21 10:47:31 -08:00
Brad Fitzpatrick
bca3f5fca0 database/sql: check for nil Scan pointers
Return nice errors and don't panic.

Fixes #4859

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7383046
2013-02-21 10:43:00 -08:00
Russ Cox
5833c96b0a runtime: better error from TestGcSys when gc is disabled
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7390047
2013-02-21 13:30:31 -05:00
Dmitriy Vyukov
94fab3cad3 runtime: fix heap corruption
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7397049
2013-02-21 21:59:46 +04:00
Russ Cox
0cdc0b3b78 cmd/5g, cmd/6g: fix node dump formats
lvd changed the old %N to %+hN and these
never got updated.

R=ken2
CC=golang-dev
https://golang.org/cl/7391045
2013-02-21 12:53:25 -05:00
Alan Donovan
aa5aaabb0d exp/ssa/interp: (#6 of 5): test interpretation of SSA form of $GOROOT/test/*.go.
The interpreter's os.Exit now triggers a special panic rather
than kill the test process.  (It's semantically dubious, since
it will run deferred routines.)  Interpret now returns its
exit code rather than calling os.Exit.

Also:
- disabled parts of a few $GOROOT/tests via os.Getenv("GOSSAINTERP").
- remove unnecessary 'slots' param to external functions; they
  are never closures.

Most of the tests are disabled until go/types supports shifts.
They can be reenabled if you patch this workaround:
https://golang.org/cl/7312068

R=iant, bradfitz
CC=golang-dev, gri
https://golang.org/cl/7313062
2013-02-21 12:48:38 -05:00
Russ Cox
df93283d56 cmd/fix: delete pre-Go 1 fixes
Assume people who were going to update to Go 1 have done so.
Those with pre-Go 1 trees remaining will need to update first
to Go 1.0 (using its 'go fix') and then to Go 1.1.

Cuts the cmd/fix test time by 99% (3 seconds to 0.03 seconds).

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7402046
2013-02-21 12:19:54 -05:00
Alan Donovan
92cbf82f14 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://golang.org/cl/7403043
2013-02-21 12:14:33 -05:00
Mikio Hara
0ad88a481d 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 #4866.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7368046
2013-02-22 01:19:04 +09:00
Alan Donovan
867121585a 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://golang.org/cl/7229074
2013-02-21 11:11:57 -05:00
Dmitriy Vyukov
a0955a2aa2 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://golang.org/cl/7389043
2013-02-21 16:24:38 +04:00
Brad Fitzpatrick
c53fab969c database/sql: clarify that DB.Prepare's stmt is safe for concurrent use
And add a test too, for Alex. :)

Fixes #3734

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7399046
2013-02-20 22:15:36 -08:00
Dave Cheney
4036d876ea 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://golang.org/cl/7326053
2013-02-21 13:11:58 +11:00
Robert Griesemer
8473b4487c go/types: export data result types are always parenthesized
Minor simplification of gcimporter, removed TODO.

R=adonovan
CC=golang-dev
https://golang.org/cl/7363044
2013-02-20 17:37:13 -08:00
Brad Fitzpatrick
a2ade45205 net/http: improve test reliability
Fixes #4852

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7374045
2013-02-20 16:39:33 -08:00
Rob Pike
c6f23bb7c1 image/png: use Scanner in reader_test.
R=nigeltao
CC=golang-dev
https://golang.org/cl/7399044
2013-02-20 15:57:18 -08:00
Brad Fitzpatrick
f7a7716317 database/sql: refcounting and lifetime fixes
Simplifies the contract for Driver.Stmt.Close in
the process of fixing issue 3865.

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

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7363043
2013-02-20 15:35:27 -08:00
Russ Cox
6c976393ae runtime: allow cgo callbacks on non-Go threads
Fixes #4435.

R=golang-dev, iant, alex.brainman, minux.ma, dvyukov
CC=golang-dev
https://golang.org/cl/7304104
2013-02-20 17:48:23 -05:00
Steven Elliot Harris
43da336b15 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 #4322.

R=golang-dev, bradfitz, sameer
CC=golang-dev
https://golang.org/cl/7231055
2013-02-20 14:42:37 -08:00
Brad Fitzpatrick
93ae46eae9 A+C: Steven Elliot Harris (individual CLA)
Generated by addca.

R=gobot
CC=golang-dev
https://golang.org/cl/7377045
2013-02-20 14:42:13 -08:00
Olivier Saingre
afde71cfbd encoding/xml: make sure Encoder.Encode reports Write errors.
Fixes #4112.

R=remyoudompheng, daniel.morsing, dave, rsc
CC=golang-dev
https://golang.org/cl/7085053
2013-02-20 14:41:23 -08:00
Brad Fitzpatrick
8eb80914ca A+C: Olivier SAINGRE (individual CLA)
Generated by addca.

R=gobot
CC=golang-dev
https://golang.org/cl/7400045
2013-02-20 14:40:41 -08:00
Rob Pike
35367cc641 mime: use Scanner to read mime files during init
Also close the file when we're done.

R=bradfitz
CC=golang-dev
https://golang.org/cl/7363045
2013-02-20 14:34:03 -08:00
Robert Dinu
cbd2c7a283 fmt: fix width for nil values
Apply width when using Printf with nil values.
Fixes #4772.

R=r, adg
CC=golang-dev
https://golang.org/cl/7314114
2013-02-20 14:30:15 -08:00
Rob Pike
d8682f9922 A+C: add Robert Dinu (Individual CLA)
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7386045
2013-02-20 14:30:09 -08:00
Rob Pike
f574371544 strconv: use Scanner in fp_test
R=rsc
CC=golang-dev
https://golang.org/cl/7385045
2013-02-20 13:38:19 -08:00
Rob Pike
f913830148 regexp: use Scanner in exec_test
R=rsc
CC=golang-dev
https://golang.org/cl/7381046
2013-02-20 13:37:45 -08:00
Robert Griesemer
9dcf3eee41 cmd/godoc: better console error message for example error
(per r's suggestion)

R=r
CC=golang-dev
https://golang.org/cl/7376045
2013-02-20 12:28:12 -08:00
Rob Pike
55ad7b9bfe bufio: new Scanner interface
Add a new, simple interface for scanning (probably textual) data,
based on a new type called Scanner. It does its own internal buffering,
so should be plausibly efficient even without injecting a bufio.Reader.
The format of the input is defined by a "split function", by default
splitting into lines. Other implemented split functions include single
bytes, single runes, and space-separated words.

Here's the loop to scan stdin as a file of lines:

        s := bufio.NewScanner(os.Stdin)
        for s.Scan() {
                fmt.Printf("%s\n", s.Bytes())
        }
        if s.Err() != nil {
                log.Fatal(s.Err())
        }

While we're dealing with spaces, define what space means to strings.Fields.

Fixes #4802.

R=adg, rogpeppe, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/7322088
2013-02-20 12:14:31 -08:00
Robert Griesemer
75e7308be8 go/types: support for customizable Alignof, Sizeof
(Offsetof is a function of Alignof and Sizeof.)

- removed IntSize, PtrSize from Context (set Sizeof instead)
- GcImporter needs a Context now (it needs to have
  access to Sizeof/Alignof)
- removed exported Size field from Basic (use Sizeof)
- added Offset to Field
- added Alignment, Size to Struct

R=adonovan
CC=golang-dev
https://golang.org/cl/7357046
2013-02-20 11:10:17 -08:00
Dmitriy Vyukov
1e063eea38 runtime: prepare for M's running w/o mcache
Can not happen ATM. In preparation for the new scheduler.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7388043
2013-02-20 21:17:56 +04:00