David Symonds [Thu, 14 Feb 2013 04:04:22 +0000 (15:04 +1100)]
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 2685076521351967 -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.
Dave Cheney [Wed, 13 Feb 2013 23:11:16 +0000 (10:11 +1100)]
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.
Robert Griesemer [Wed, 13 Feb 2013 18:21:24 +0000 (10:21 -0800)]
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.
Alan Donovan [Wed, 13 Feb 2013 05:15:07 +0000 (00:15 -0500)]
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.
Alan Donovan [Tue, 12 Feb 2013 18:17:49 +0000 (13:17 -0500)]
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.
Marcel van Lohuizen [Tue, 12 Feb 2013 14:59:55 +0000 (15:59 +0100)]
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.
Alan Donovan [Tue, 12 Feb 2013 03:12:56 +0000 (22:12 -0500)]
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.
Alan Donovan [Mon, 11 Feb 2013 23:20:52 +0000 (18:20 -0500)]
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.
Rob Pike [Mon, 11 Feb 2013 21:33:11 +0000 (13:33 -0800)]
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.
Russ Cox [Mon, 11 Feb 2013 12:48:14 +0000 (07:48 -0500)]
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
Russ Cox [Mon, 11 Feb 2013 12:47:41 +0000 (07:47 -0500)]
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
Volker Dobler [Mon, 11 Feb 2013 00:47:31 +0000 (11:47 +1100)]
exp/cookiejar: implementation of SetCookies
This CL provides the rest of the SetCookies code as well as
some test infrastructure which will be used to test also
the Cookies method. This test infrastructure is optimized
for readability and tries to make it easy to review table
driven test cases.
Tests for all the different corner cases of SetCookies
will be provided in a separate CL.
Dave Cheney [Mon, 11 Feb 2013 00:40:33 +0000 (19:40 -0500)]
doc: update contribute.html
Fixes #4582.
* mentioned hg upload.
* added section on hg file.
* added small mention about being inside $GOROOT.
* added hg revert @NNNN
* reorganise the hg submit section for the common case of a non committer.
* made the Copyright section h2
* added note about leaving copyright years unchanged.
Shane Hansen [Mon, 11 Feb 2013 00:36:29 +0000 (11:36 +1100)]
archive/tar: read/write extended pax/gnu tar archives
Support reading pax archives and applying extended attributes
like long names, subsecond mtime resolutions, etc. Default to
writing pax archives for long file and link names.
Support reading gnu archives using the ././@LongLink extended
header for file name and link target.
Dave Cheney [Sun, 10 Feb 2013 22:39:13 +0000 (17:39 -0500)]
doc: move os specific build instructions to wiki
Fixes #4010.
This proposal avoids cluttering the main install-source.html with OS specific instructions by linking to the wiki for details. See discussion in the comments.
Russ Cox [Sat, 9 Feb 2013 22:36:31 +0000 (17:36 -0500)]
spec: clarify that any unsafe.Pointer type is okay in conversion
The spec is not clear about whether this is allowed or not,
but both compilers allow it, because the reflect implementation
takes advantage of it. Document current behavior.
Fixes #4679.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7303064
Dave Cheney [Sat, 9 Feb 2013 21:18:09 +0000 (08:18 +1100)]
net/http: more request benchmarks
Add benchmarks for common http benchmarking tools. The intent is to catch optimisations which favor synthetic benchmarks that do not show improvements for real clients like Chrome.
Adam Langley [Sat, 9 Feb 2013 18:51:39 +0000 (13:51 -0500)]
crypto/x509: disable SCG test with system validation.
On Windows, CryptoAPI is finding an alternative validation path. Since
this is a little non-deterministic, this change disables that test
when using system validation.
Adam Langley [Sat, 9 Feb 2013 18:20:25 +0000 (13:20 -0500)]
crypto/x509: allow MS/NS SCG key usage as ServerAuth.
By default, crypto/x509 assumes that users wish to validate
certificates for ServerAuth. However, due to historical reasons,
COMODO's intermediates don't specify ServerAuth as an allowed key
usage.
Rather NSS and CryptoAPI both allow these SGC OIDs to be equivalent to
ServerAuth.
Dmitriy Vyukov [Fri, 8 Feb 2013 15:24:50 +0000 (19:24 +0400)]
runtime/race: deflake tests
With the new scheduler races in the tests are reported during execution of other tests.
The change joins goroutines started during the tests.
Russ Cox [Fri, 8 Feb 2013 03:45:12 +0000 (22:45 -0500)]
net: do not use RLock around Accept
It might be non-blocking, but it also might be blocking.
Cannot take the chance, as Accept might block indefinitely
and make it impossible to acquire ForkLock exclusively
(during fork+exec).
Ian Lance Taylor [Thu, 7 Feb 2013 01:18:53 +0000 (17:18 -0800)]
net: permit pollster DelFD to return whether to call Wakeup
This is necessary for systems that use select as the pollster,
such as Solaris (supported by gccgo). It corresponds to the
bool returned by AddFD. In general it's not clearly defined
what happens when a descriptor used in a select is closed, and
different systems behave differently. Waking up the select
will cause the right thing to happen: the closed descriptor
will be dropped from the next iteration.
Gaal Yahas [Wed, 6 Feb 2013 16:39:52 +0000 (00:39 +0800)]
sync: improve WaitGroup example by putting the call to Done in a
deferred block. This makes hangs in the waiting code less likely
if a goroutine exits abnormally.
Volker Dobler [Wed, 6 Feb 2013 11:37:34 +0000 (22:37 +1100)]
exp/cookiejar: infrastructure for upcoming implementation
This CL is the first of a handful of CLs which will provide
the implementation of cookiejar. It contains several helper
functions and the skeleton of Cookies and SetCookies.
Proper host name handling requires the ToASCII transformation
from package idna which currently lives in the go.net
subrepo. This CL thus contains just a TODO for this issue.
Dmitriy Vyukov [Wed, 6 Feb 2013 07:40:54 +0000 (11:40 +0400)]
runtime/race: switch to explicit race context instead of goroutine id's
Removes limit on maximum number of goroutines ever existed.
code.google.com/p/goexecutor tests now pass successfully.
Also slightly improves performance.
Before: $ time ./flate.test -test.short
real 0m9.314s
After: $ time ./flate.test -test.short
real 0m8.958s
Fixes #4286.
The runtime is built from llvm rev 174312.
Ian Lance Taylor [Tue, 5 Feb 2013 14:11:10 +0000 (06:11 -0800)]
exp/inotify: close event channel before file descriptor
Closing the inotify file descriptor can take over a second
when running on Ubuntu Precise in an NFS directory, leading to
the test error in issue 3132. Closing the event channel first
lets a client that does not care about the error channel move
on.
Shenghou Ma [Tue, 5 Feb 2013 13:43:04 +0000 (21:43 +0800)]
cmd/dist: add -Wstrict-prototypes to CFLAGS and fix all the compiler errors
Plan 9 compilers insist this but as we don't have Plan 9
builders, we'd better let gcc check the prototypes.
Russ Cox [Tue, 5 Feb 2013 12:00:38 +0000 (07:00 -0500)]
cmd/gc: add way to specify 'noescape' for extern funcs
A new comment directive //go:noescape instructs the compiler
that the following external (no body) func declaration should be
treated as if none of its arguments escape to the heap.
Dave Cheney [Tue, 5 Feb 2013 09:50:20 +0000 (20:50 +1100)]
misc/dashboard/app: trim old builds from the history
The dashboard is currently failing to store results of new builds for some keys, notable the go.codereview sub repository. This is causing the builders to mark the entire triggering commit as failed. With the help of David Symonds we think it is because the results value has breached the 1mb datastore limit on AppEngine.
Brad Fitzpatrick [Tue, 5 Feb 2013 04:26:25 +0000 (20:26 -0800)]
net/http: fix Server blocking after a Handler's Write fails
If a Handle's Write to a ResponseWriter fails (e.g. via a
net.Conn WriteDeadline via WriteTimeout on the Server), the
Server was blocking forever waiting for reads on that
net.Conn, even after a Write failed.
Instead, once we see a Write fail, close the connection,
since it's then dead to us anyway.