1
0
mirror of https://github.com/golang/go synced 2024-10-03 13:21:22 -06:00
Commit Graph

15448 Commits

Author SHA1 Message Date
Russ Cox
d340a89d9c encoding/json: roll back Unmarshal optimization + test
The second attempt at the Unmarshal optimization allowed
panics to get out of the json package. Add test for that bug
and remove the optimization.

Let's stop trying to optimize Unmarshal.

Fixes #4784.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7300108
2013-02-14 14:46:15 -05:00
Russ Cox
da6207f7a4 go/types: avoid os.Getwd if not necessary
Getwd can be very expensive.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7312100
2013-02-14 14:46:03 -05:00
Michael Matloob
2cd96806f4 go/parser: stop ParseFile after ten errors.
There wil be a panic if more than ten errors are encountered. ParseFile
will recover and return the ErrorList.

Fixes #3943.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/7307085
2013-02-14 11:26:21 -08:00
Robert Griesemer
208c83096a C: add Michael Matloob (Google CLA)
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7343043
2013-02-14 11:25:33 -08:00
Brad Fitzpatrick
248d1446b5 syscall: don't make //sys lines be doc comments
Cleans up godoc and makes it consistent. (some had it, some
didn't)

This still keeps the information there, though, for people
looking at the source directly.

R=golang-dev, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/7324056
2013-02-14 11:23:58 -08:00
Russ Cox
357a18a2c6 cmd/go: set $PWD when running commands
This makes os.Getwd inside those commands much faster.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7324055
2013-02-14 14:21:44 -05:00
Russ Cox
551f3f27aa test/run: use correct $PWD to make os.Getwd less expensive
The commands being run are 'go tool this' and 'go tool that',
and the go command will call Getwd during its init.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7336045
2013-02-14 14:21:26 -05:00
Russ Cox
89fde30fbd os: cache Getwd result as hint for next time
Avoids the dot-dot-based algorithm on repeated calls
when the directory hasn't changed.

R=golang-dev, iant, bradfitz
CC=golang-dev
https://golang.org/cl/7340043
2013-02-14 14:21:09 -05:00
Brad Fitzpatrick
158a0353f7 net: document OpError
Fixes #4797

R=adg, rsc
CC=golang-dev
https://golang.org/cl/7300099
2013-02-14 09:29:34 -08:00
Volker Dobler
8e7d156237 exp/cookiejar: implement Cookies and provided tests
This CL provides the implementation of Cookies and
the complete test suite. Several tests have been ported
from the Chromium project as a cross check.

R=nigeltao, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/7311073
2013-02-14 19:41:58 +11:00
Dmitriy Vyukov
691455f780 runtime: move stack management related code to stack.c
No code changes.
This is mainly in preparation to scheduler changes,
oldstack/newstack are not related to scheduling.

R=golang-dev, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/7311085
2013-02-14 12:37:55 +04:00
Dave Cheney
2803744b86 net/textproto: more efficient header parsing
A co creation with bradfitz

* add fast path for header lines which are not continuations
* pass hint to better size initial mime header map

lucky(~/go/src/pkg/net/http) % ~/go/misc/benchcmp {golden,new}.txt
benchmark                          old ns/op    new ns/op    delta
BenchmarkReadRequestChrome             10073         8348  -17.12%
BenchmarkReadRequestCurl                4368         4350   -0.41%
BenchmarkReadRequestApachebench         4412         4397   -0.34%
BenchmarkReadRequestSiege               6431         5924   -7.88%
BenchmarkReadRequestWrk                 2820         3146  +11.56%

benchmark                           old MB/s     new MB/s  speedup
BenchmarkReadRequestChrome             60.66        73.18    1.21x
BenchmarkReadRequestCurl               17.85        17.93    1.00x
BenchmarkReadRequestApachebench        18.58        18.65    1.00x
BenchmarkReadRequestSiege              23.48        25.49    1.09x
BenchmarkReadRequestWrk                14.18        12.71    0.90x

benchmark                         old allocs   new allocs    delta
BenchmarkReadRequestChrome                32           26  -18.75%
BenchmarkReadRequestCurl                  15           15    0.00%
BenchmarkReadRequestApachebench           16           15   -6.25%
BenchmarkReadRequestSiege                 22           19  -13.64%
BenchmarkReadRequestWrk                   11           11    0.00%

benchmark                          old bytes    new bytes    delta
BenchmarkReadRequestChrome              3148         2216  -29.61%
BenchmarkReadRequestCurl                 905         1413   56.13%
BenchmarkReadRequestApachebench          956         1413   47.80%
BenchmarkReadRequestSiege               1397         1522    8.95%
BenchmarkReadRequestWrk                  757         1369   80.85%

R=bradfitz
CC=golang-dev
https://golang.org/cl/7300098
2013-02-14 19:35:38 +11:00
Robin Eklind
44d38ae3c0 archive/tar: add Header.FileInfo method. Add more cases to FileInfoHeader.
FileInfoHeader can now handle fifo, setuid, setgid and sticky bits.

Fixes #4695.

R=golang-dev, donovanhide, r.eklind.87, minux.ma, adg
CC=golang-dev
https://golang.org/cl/7305072
2013-02-14 17:32:48 +11:00
David Symonds
78cee8b3bb sort: use fewer comparisons when choosing pivot.
This is based on rsc's code posted to issue 2585.

Benchmark results are greatly improved:
        benchmark                old ns/op    new ns/op    delta
        BenchmarkSortString1K       564397       445897  -21.00%
        BenchmarkSortInt1K          270889       221249  -18.32%
        BenchmarkSortInt64K       26850765     21351967  -20.48%

Eyeballing a sampling of the raw number of comparisons shows a drop
on the order of 20-30% almost everywhere. The test input data that
doesn't match that are some of sawtooth/rand/plateau distributions,
where there is no change in the number of comparisons; that is,
there are no situations where this makes *more* comparisons.

Fixes #2585.

R=iant, rsc
CC=golang-dev
https://golang.org/cl/7306098
2013-02-14 15:04:22 +11:00
Russ Cox
7f284f85f9 cmd/vet: drop column information from error
The column information can be misleading.

R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/7300100
2013-02-13 22:34:37 -05:00
Russ Cox
e5dae3baaa runtime: tweak addfinroots to preserve original pointer
Use local variable so that stack trace will show value of v.

Fixes #4790.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7300106
2013-02-13 22:31:45 -05:00
Brad Fitzpatrick
0c8ed71079 database/sql: fix doc references to old package name
It used to be package "db" but was long ago renamed
to be "sql".

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7322075
2013-02-13 18:47:25 -08:00
Brad Fitzpatrick
cd566958e9 net/http: test that we preserve Go 1.0 Request.Write Host behavior
Fixes #4792

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7314093
2013-02-13 18:33:15 -08:00
Russ Cox
594360cb1b cmd/8c: disable use of prefetch with GO386=387
Fixes #4798.

R=ken2
CC=golang-dev
https://golang.org/cl/7323061
2013-02-13 21:13:07 -05:00
Julien Schmidt
2968e239b0 database/sql: Add an optional Queryer-Interface (like Execer)
Completly the same like the Execer-Interface, just for Queries.
This allows Drivers to execute Queries without preparing them first

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7085056
2013-02-13 15:25:39 -08:00
Dave Cheney
8c30b3f038 net: remove noisy test for issue 3590
The test for issue 3590 causes an error to be printed to stderr when run (although the error is obscured during go test std). This is confusing for people who get breakage in the net package as the error is harmless and most likely unrelated to their build breakage.

Given the way the test works, by reaching into the guts of the netFD, I can't see a way to silence the error without adding a bunch of code to support the test, therefore I am suggesting the test be removed before Go 1.1 ships.

R=alex.brainman, mikioh.mikioh, rsc
CC=golang-dev
https://golang.org/cl/7307110
2013-02-14 10:11:16 +11:00
Mikio Hara
ee9d148ce1 net: add test for Dial and Listen arguments
R=dave, bradfitz
CC=golang-dev
https://golang.org/cl/7305081
2013-02-14 07:02:32 +09:00
Brad Fitzpatrick
d6331b447f io: document and test new CopyN return behavior
Changed accidentally in 28966b7b2f0c (CopyN using Copy).
Updating docs to be consistent with 29bf5ff5064e (ReadFull & ReadAtLeast)

R=rsc
CC=golang-dev
https://golang.org/cl/7314069
2013-02-13 13:52:00 -08:00
Lucio De Re
a3855013a2 cmd/5l: fix print format
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/7304065
2013-02-13 16:47:33 -05:00
Brad Fitzpatrick
8f2430a533 database/sql: add currently-disabled broken test
Update #3865

R=golang-dev, alex.brainman, nightlyone
CC=golang-dev
https://golang.org/cl/7324051
2013-02-13 12:00:03 -08:00
Robert Griesemer
f6fe3271f7 go/types: adjust gcimporter to actual gc export data
Unexported field and method names that appear in the
export data (as part of some exported type) are fully
qualified with a package id (path). In some cases, a
package with that id was never exported for any other
use (i.e. only the path is of interest).

We must not create a "real" package in those cases
because we don't have a package name. Entering an
unnamed package into the map of imported packages
makes that package accessible for other imports.
Such a subsequent import may find the unnamed
package in the map, and reuse it. That reused and
imported package is then entered into the importing
file scope, still w/o a name. References to that
package cannot resolved after that. Was bug.

R=adonovan
CC=golang-dev
https://golang.org/cl/7307112
2013-02-13 10:21:24 -08:00
Dmitriy Vyukov
4a524311f4 runtime: instrument slicebytetostring for race detection
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7322068
2013-02-13 18:29:59 +04:00
Christian Himpel
96082a6953 archive/tar: append a slash when deriving header info from a directory
This behavior is identical to GNU tar 1.26.

R=dsymonds, dave
CC=golang-dev
https://golang.org/cl/7307101
2013-02-13 19:23:28 +11:00
David Symonds
4101469ccc doc: adjust indentation in Effective Go commentary example.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7225080
2013-02-13 16:43:55 +11:00
Alex Brainman
ea1f7b8380 net: change server_test.go so we could see failure messages
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/7323051
2013-02-13 16:17:47 +11:00
Alan Donovan
928fe51661 exp/ssa: add Instruction.Operands and Value.Referrers methods.
Operands returns the SSA values used by an instruction.
Referrers returns the SSA instructions that use a value, for
some values.  These will be used for SSA renaming, to follow.

R=iant, gri
CC=golang-dev
https://golang.org/cl/7312090
2013-02-13 00:15:07 -05:00
Robert Griesemer
27970af5c9 go/types: print, println accept 0 or more arguments
R=adonovan
CC=golang-dev
https://golang.org/cl/7304089
2013-02-12 19:40:20 -08:00
Alex Brainman
17377ab651 os: do not use hosts file for windows tests
Not everyone has the file (http://golang.org/issue/4723#c4).

Update #4723.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7311091
2013-02-13 13:19:06 +11:00
Alan Donovan
be5deb93fb exp/ssa: omit Function's package name when printing intra-package references.
R=iant
CC=golang-dev
https://golang.org/cl/7307105
2013-02-12 16:13:14 -05:00
Shenghou Ma
83da2014a8 encoding/xml: fix htmlAutoClose and its generating script
Thanks Mitică for reporting this.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7308081
2013-02-13 02:27:42 +08:00
Alan Donovan
052c942e20 test: ensure all failing tests exit nonzero.
Previously merely printing an error would cause the golden
file comparison (in 'bash run') to fail, but that is no longer
the case with the new run.go driver.

R=iant
CC=golang-dev
https://golang.org/cl/7310087
2013-02-12 13:17:49 -05:00
Shenghou Ma
2fdd60b9b6 go/build, runtime/cgo: cgo support for NetBSD/ARM
R=golang-dev, rsc, dave
CC=golang-dev
https://golang.org/cl/7229082
2013-02-13 01:06:52 +08:00
Shenghou Ma
4d8b1feb79 sync/atomic: support NetBSD/ARM (ARM11 or above)
R=golang-dev, rsc, dave
CC=golang-dev
https://golang.org/cl/7287044
2013-02-13 01:04:13 +08:00
Shenghou Ma
8311697792 syscall: NetBSD/ARM support
R=golang-dev, rsc, dave
CC=golang-dev
https://golang.org/cl/7288050
2013-02-13 01:03:25 +08:00
Shenghou Ma
37aba1aa77 runtime: NetBSD/ARM support
R=rsc, dave
CC=golang-dev
https://golang.org/cl/7289044
2013-02-13 01:00:04 +08:00
Marcel van Lohuizen
f38da96755 exp/locale/collate: moved low-level collation functionality
into separate package.  This allows this code to be shared
with the search package without the need for these two to use
the same tables.
Adjusted various files accordingly.

R=rsc
CC=golang-dev
https://golang.org/cl/7213044
2013-02-12 15:59:55 +01:00
Robert Griesemer
ae8da3a28c go/types: len(((*T)(nil)).X) is const if X is an array
Fixes #4744.

R=adonovan
CC=golang-dev
https://golang.org/cl/7305080
2013-02-11 22:39:55 -08:00
Alan Donovan
d8e3b16f8b exp/ssa: special-case 'range' loops based on type of range expression.
The lowering of ast.RangeStmt now has three distinct cases:

1) rangeIter for maps and strings; approximately:
    it = range x
    for {
      k, v, ok = next it
      if !ok { break }
      ...
    }
   The Range instruction and the interpreter's "iter"
   datatype are now restricted to these types.

2) rangeChan for channels; approximately:
    for {
      k, ok = <-x
      if !ok { break }
      ...
    }

3) rangeIndexed for slices, arrays, and *array; approximately:
    for k, l = 0, len(x); k < l; k++ {
      v = x[k]
      ...
    }

In all cases we now evaluate the side effects of the range expression
exactly once, per comments on http://code.google.com/p/go/issues/detail?id=4644.

However the exact spec wording is still being discussed in
https://golang.org/cl/7307083/.  Further (small)
changes may be required once the dust settles.

R=iant
CC=golang-dev
https://golang.org/cl/7303074
2013-02-11 22:12:56 -05:00
Alan Donovan
1c1096ea31 test: a number of fixes.
Details:
- reorder.go: delete p8.
  (Once expectation is changed per b/4627 it is identical to p1.)
- switch.go: added some more (degenerate) switches.
- range.go: improved error messages in a few cases.
- method.go: added tests of calls to promoted methods.

R=iant
CC=golang-dev
https://golang.org/cl/7306087
2013-02-11 18:20:52 -05:00
Rob Pike
d282532901 vet: improve flag handling
Simplify the internal logic for flags controlling what to vet,
by introducing a map of flags that gathers them all together.
This change should simplify the process of adding further flags.

Add a test for untagged struct literals.
Delete a redundant test that was also in the wrong file.
Clean up some ERROR patterns that weren't working.

"make test" passes again.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7305075
2013-02-11 13:33:11 -08:00
Robin Eklind
6c119a9e70 api: Update readme.
R=golang-dev, bradfitz, dave
CC=golang-dev
https://golang.org/cl/7303065
2013-02-11 09:10:35 -08:00
Russ Cox
02e05817ad sync: add caution about where to call (*WaitGroup).Add
Fixes #4762.

R=daniel.morsing, adg
CC=golang-dev
https://golang.org/cl/7308045
2013-02-11 08:05:46 -05:00
Russ Cox
71c941b6f6 spec: only require parens around ambiguous conversions
This is documenting the status quo. The previous cleanup
added this language as an implementation restriction, but
at least for now it is really part of the language proper.

Fixes #4605.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7305071
2013-02-11 07:48:14 -05:00
Russ Cox
7576179aa3 spec: document fp rounding during explicit constant conversion
The gc compilers already behave this way. It was an explicit
decision during the very long constant design discussions,
but it appears not to have made it into the spec.

Fixes #4398.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7313069
2013-02-11 07:47:41 -05:00
Russ Cox
0a22018d46 spec: reject top-level init names
Fixes #4586.

R=golang-dev, remyoudompheng, r
CC=golang-dev
https://golang.org/cl/7307082
2013-02-11 07:46:39 -05:00