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

6979 Commits

Author SHA1 Message Date
Rob Pike
06d42690b6 time: delete erroneous word from documentation.
Fixes #4236.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6658051
2012-10-12 11:00:00 +11:00
Andrew Gerrand
bd6601f4a0 os/signal: add Notify example
R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/6615078
2012-10-12 10:22:13 +11:00
Robert Griesemer
4bee88d45f math/big: more conservative use of lock for divisor table
Minor performance impact running sequentially:

benchmark                      old ns/op    new ns/op    delta
BenchmarkString10Base2               389          391   +0.51%
BenchmarkString100Base2             1530         1534   +0.26%
BenchmarkString1000Base2           11789        11787   -0.02%
BenchmarkString10000Base2         111443       112030   +0.53%
BenchmarkString100000Base2       1017483      1015347   -0.21%
BenchmarkString10Base8               339          344   +1.47%
BenchmarkString100Base8              753          756   +0.40%
BenchmarkString1000Base8            4618         4641   +0.50%
BenchmarkString10000Base8          43217        43534   +0.73%
BenchmarkString100000Base8        397518       400602   +0.78%
BenchmarkString10Base10              630          630   +0.00%
BenchmarkString100Base10            1975         1960   -0.76%
BenchmarkString1000Base10          10179        10174   -0.05%
BenchmarkString10000Base10         44527        44416   -0.25%
BenchmarkString100000Base10     14404694     14425308   +0.14%
BenchmarkString10Base16              283          288   +1.77%
BenchmarkString100Base16             597          598   +0.17%
BenchmarkString1000Base16           3189         3186   -0.09%
BenchmarkString10000Base16         29403        29364   -0.13%
BenchmarkString100000Base16       265657       265587   -0.03%

Note that due to other improvements (faster assembly routines,
better code generation by compiler), these benchmarks now run
up to 37% faster than they used to at the last time measured (1/9/2012).

Minor performance impact for StringPiParallel running in parallel:

Current CL but with Lock/Unlock commented out (removed):

BenchmarkStringPiParallel	    5000	    343581 ns/op
BenchmarkStringPiParallel-2	   10000	    184511 ns/op
BenchmarkStringPiParallel-3	   10000	    129768 ns/op
BenchmarkStringPiParallel-4	   10000	    102326 ns/op

Current CL:

BenchmarkStringPiParallel	    5000	    345169 ns/op
BenchmarkStringPiParallel-2	   10000	    185827 ns/op
BenchmarkStringPiParallel-3	   10000	    131168 ns/op
BenchmarkStringPiParallel-4	   10000	    102353 ns/op

Fixes #4218.

R=dvyukov, michael.jones, dave
CC=golang-dev
https://golang.org/cl/6643053
2012-10-11 16:04:03 -07:00
Adam Langley
3acce59b93 crypto/rsa: fix decryption benchmark.
I was an idiot and was thinking that a small base didn't matter
because the exponentiation would quickly make the number the same size
as the modulus. But, of course, the small base continues to make
multiplications unrealistically cheap throughout the computation.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6649048
2012-10-11 18:25:23 -04:00
Dave Cheney
a14f87ca81 net/http: fix data race on countReader.n
Fixes #4220.

R=dvyukov, bradfitz
CC=golang-dev
https://golang.org/cl/6638053
2012-10-12 09:17:56 +11:00
Dave Cheney
f1b1753627 net/http: fix race on bodyEOFSignal.isClosed
Update #4191.

Fixes unreported race failure at
http://build.golang.org/log/61e43a328fb220801d3d5c88cd91916cfc5dc43c

R=dvyukov, bradfitz
CC=golang-dev
https://golang.org/cl/6640057
2012-10-12 08:32:56 +11:00
Adam Langley
6720997f9e crypto/hmac: add Equal function.
It was suggested that it's too easy to use crypto/hmac insecurely and
I think that has some merit. This change adds a Equal function to
make it obvious that MAC values should be compared in constant time.

R=rsc, max
CC=golang-dev
https://golang.org/cl/6632044
2012-10-11 15:28:02 -04:00
Taj Khattra
c12dab2aa6 container/heap: optimization in case heap has many duplicates
benchmark       old ns/op    new ns/op    delta
BenchmarkDup      3075682       609448  -80.18%

R=gri
CC=golang-dev
https://golang.org/cl/6613064
2012-10-10 11:35:57 -07:00
Dmitriy Vyukov
be2b95fe3a runtime/debug: fix the test
If source are not available, then the stack looks like:
stack_test.go:40: 	/tmp/gobuilder/linux-amd64-race-72b15c5d6f65/go/src/pkg/runtime/debug/bla-bla-bla/src/pkg/runtime/debug/stack_test.go:15 (0x43fb11)
stack_test.go:40: 	/tmp/gobuilder/linux-amd64-race-72b15c5d6f65/go/src/pkg/runtime/debug/bla-bla-bla/src/pkg/runtime/debug/stack_test.go:18 (0x43fb7a)
stack_test.go:40: 	/tmp/gobuilder/linux-amd64-race-72b15c5d6f65/go/src/pkg/runtime/debug/bla-bla-bla/src/pkg/runtime/debug/stack_test.go:37 (0x43fbf4)
stack_test.go:40: 	/tmp/gobuilder/linux-amd64-race-72b15c5d6f65/go/src/pkg/testing/bla-bla-bla/src/pkg/testing/testing.go:301 (0x43b5ba)
stack_test.go:40: 	/tmp/gobuilder/linux-amd64-race-72b15c5d6f65/go/src/pkg/runtime/bla-bla-bla/src/pkg/runtime/proc.c:276 (0x410670)
stack_test.go:40:
which is 6 lines.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/6637060
2012-10-10 20:49:18 +04:00
Dmitriy Vyukov
27e93fbd00 runtime: fix race detector handling of stackalloc()
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6632051
2012-10-10 18:06:29 +04:00
Andrew Gerrand
749a445ba0 bytes: fix tests and fix build
R=golang-dev, edsrzf
CC=golang-dev
https://golang.org/cl/6633051
2012-10-10 11:59:39 +11:00
Andrew Gerrand
e7c222cada bytes: make examples work in playground
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6633050
2012-10-10 11:15:41 +11:00
Robert Griesemer
241b23606c go/printer: idempotent comment formatting
Also:

- Refactored testing framework to permit easier
idempotency testing.

- Applied gofmt -w src misc

This CL depends on CL 6639044 being applied first.

Formatting is not idempotent for all files: In those
files the comment position has changed (due to missing
precise location information) and/or the comment formatting
cannot/is not aware of independent code re-formatting.
In general it is very hard to make format idempotent when
running it in one pass only. Leaving that aside for now.

Fixes #1835.

R=r, rsc
CC=golang-dev
https://golang.org/cl/6624051
2012-10-09 17:08:09 -07:00
Robert Griesemer
af79568fde gofmt: apply gofmt -w -s src misc
Preparation for forthcoming CL 6624051: Will make it
easier to see if/what changes are incurred by it.

The alignment changes in this CL are due to CL 6610051
(fix to alignment heuristic) where it appears that an
old version of gofmt was run (and thus the correct
alignment updates were not done).

R=r
CC=golang-dev
https://golang.org/cl/6639044
2012-10-09 17:01:28 -07:00
Brad Fitzpatrick
dfc7304d32 net/http: fix name of result parameter in a comment
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/6632053
2012-10-09 11:16:35 -07:00
Adam Langley
7e90f7b4ab crypto/tls: fix NPN extension parsing.
I typoed the code and tried to parse all the way to the end of the
message. Therefore it fails when NPN is not the last extension in the
ServerHello.

Fixes #4088.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6637052
2012-10-09 13:25:47 -04:00
Dmitriy Vyukov
49a5c28a18 io/ioutil: fix data race on rand
Fixes #4212.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6641050
2012-10-09 21:08:53 +04:00
Dmitriy Vyukov
cffbfaeb18 race: syscall changes
This is a part of a bigger change that adds data race detection feature:
https://golang.org/cl/6456044
The purpose of this patch is to provide coarse-grained synchronization
between all Read() and Write() calls.

R=rsc, bradfitz, alex.brainman
CC=golang-dev
https://golang.org/cl/6610064
2012-10-09 20:51:58 +04:00
Russ Cox
f76f120324 cmd/ld: use 64-bit alignment for large data and bss objects
Check for specific, important misalignment in garbage collector.
Not a complete fix for issue 599 but an important workaround.

Update #599.

R=golang-dev, iant, dvyukov
CC=golang-dev
https://golang.org/cl/6641049
2012-10-09 12:50:06 -04:00
Dmitriy Vyukov
aa97c88ecb encoding/gob: add test case for issue 4214.
See http://code.google.com/p/go/issues/detail?id=4214

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6619068
2012-10-09 09:55:57 +04:00
Rob Pike
e855fcc307 encoding/gob: fix data race in Register
Fixes #4214.

R=golang-dev, dsymonds, bradfitz
CC=golang-dev
https://golang.org/cl/6637047
2012-10-09 11:56:38 +11:00
Robin Eklind
e9f0fc8823 debug/pe: support PE files which contain no symbol table (if NumberOfSymbols is equal to 0 in the IMAGE_FILE_HEADER structure).
No longer assume that e_lfanew (in the IMAGE_DOS_HEADER strcuture) is always one byte. It is now regarded as a 4 byte uint32.

Fixes #4177.

R=golang-dev, alex.brainman, dave, minux.ma
CC=golang-dev
https://golang.org/cl/6587048
2012-10-09 11:15:53 +11:00
David Symonds
f8b5838123 testing: change -test.benchtime to a flag.Duration.
Fixes #3902.

R=golang-dev, minux.ma, rsc, r
CC=golang-dev
https://golang.org/cl/6611059
2012-10-09 08:57:29 +11:00
David Symonds
05e4e805e0 encoding/base{32,64}: add examples.
Fixes #4136.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6615061
2012-10-09 08:56:34 +11:00
David Symonds
c7cc894ef5 net/url: report first error from ParseQuery.
Fixes #4175.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6610068
2012-10-09 08:10:32 +11:00
Robert Griesemer
d5b570cdb1 fix build: use temporary variable to avoid compiler error
R=r
CC=golang-dev
https://golang.org/cl/6612066
2012-10-07 18:16:04 -07:00
Robert Griesemer
0d9474206f exp/types/staging: more flexible API, cleanups
- Changed Check signature to take function parameters for
  more flexibility: Now a client can interrupt type checking
  early (via panic in one the upcalls) once the desired
  type information or number of errors is reached. Default
  use is still simple.

- Cleaned up main typechecking loops. Now does not neglect
  _ declarations anymore.

- Various other cleanups.

R=golang-dev, r, rsc
CC=golang-dev
https://golang.org/cl/6612049
2012-10-07 18:02:19 -07:00
Robert Griesemer
5224875055 /exp/types/staging: expression and statement type checking
Still lots of pieces missing, but basic framework working.
Lots of tests.

R=rsc
CC=golang-dev
https://golang.org/cl/6594054
2012-10-07 18:01:43 -07:00
Robert Griesemer
328f0e7f2e exp/types/staging: test drivers
This code has been reviewed before. The most significant
change is to check_test which now can handle more than
one error at the same error position (due to spurious
errors - should not happen in praxis once error handling
has been fine-tuned). This change makes check_test easier
to use during development.

R=rsc
CC=golang-dev
https://golang.org/cl/6584057
2012-10-07 18:00:56 -07:00
Robert Griesemer
7f710c2de9 exp/locale/collate: use gofmt -w -s (rather than just gofmt -w)
Also: apply gofmt -w -s to existing tables.

R=mpvl, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6611051
2012-10-07 17:59:33 -07:00
Robert Griesemer
05fc42ab02 go/parser: fix object kind
Bug introduced with CL 6624047.

R=r
CC=golang-dev
https://golang.org/cl/6620073
2012-10-07 17:58:13 -07:00
Dmitriy Vyukov
373dbcb37a io/ioutil: fix data race under the race detector
See issue 3970 (it's already marked as Fixed).

R=rsc, minux.ma
CC=golang-dev
https://golang.org/cl/6624059
2012-10-07 22:08:06 +04:00
Dmitriy Vyukov
59b8745328 race: sync/atomic changes
This is a part of a bigger change that adds data race detection feature:
https://golang.org/cl/6456044

R=rsc, remyoudompheng
CC=gobot, golang-dev
https://golang.org/cl/6536059
2012-10-07 22:07:32 +04:00
Dmitriy Vyukov
53390c8fc7 race: sync changes
This is a part of a bigger change that adds data race detection feature:
https://golang.org/cl/6456044

R=rsc, minux.ma
CC=gobot, golang-dev
https://golang.org/cl/6529053
2012-10-07 22:07:03 +04:00
Dmitriy Vyukov
2f6cbc74f1 race: runtime changes
This is a part of a bigger change that adds data race detection feature:
https://golang.org/cl/6456044

R=rsc
CC=gobot, golang-dev
https://golang.org/cl/6535050
2012-10-07 22:05:32 +04:00
Shenghou Ma
f82c59b6cf runtime: disable TestParForParallel for now on 32-bit hosts
Also add call to GC() to make it easier to re-enable the test.

Update #4155.
When we have precise GC merged, re-enable this test.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6622058
2012-10-08 01:56:27 +08:00
Brad Fitzpatrick
54c109b122 os: make TestMkdirAllWithSymlink more robust
Don't assume the test has a clean environment within /tmp.
Use an actual new tempdir for its tests.

Fixes FreeBSD build failure as seen at:
http://build.golang.org/log/396738676356d7fb6bab6eaf1b97cac820f8a90f

--- FAIL: TestMkdirAllWithSymlink (0.00 seconds)
path_test.go:178:                 Mkdir /tmp/dir: mkdir /tmp/dir: file exists
FAIL
FAIL    os      1.091s

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/6615057
2012-10-07 10:31:56 -07:00
Brad Fitzpatrick
13576e3b65 net/http/httptest: mimic the normal HTTP server's ResponseWriter more closely
Also adds tests, which didn't exist before.

Fixes #4188

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6613062
2012-10-07 09:48:14 -07:00
Shenghou Ma
51310d8320 testing: fix extra tabs when t.Log("string")
t.Log("line 1\nline 2\nline 3")

Old output:
=== RUN TestLine3
--- PASS: TestLine3 (0.00 seconds)
testing_test.go:25: 	line 1
		line 2
		line 3
		PASS

New output:
=== RUN TestLine3
--- PASS: TestLine3 (0.00 seconds)
testing_test.go:24: 	line 1
		line 2
		line 3
PASS

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6613069
2012-10-08 00:21:53 +08:00
Shenghou Ma
f8485954bf syscall: fix Statfs and Fstatfs on Linux/ARM
R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6615055
2012-10-08 00:13:28 +08:00
Nigel Tao
d7b7957db1 image/jpeg: move the huffman bit decoder state higher up in the
decoder struct, inside the unmappedzero limit, to eliminate some
TESTB instructions in the inner decoding loop.

benchmark          old ns/op    new ns/op    delta
BenchmarkDecode      2943204      2746360   -6.69%

R=r, dave
CC=golang-dev
https://golang.org/cl/6625058
2012-10-07 19:32:28 +11:00
Nigel Tao
0b9fe6d24e image/jpeg: move the level-shift and clip out of the idct function,
to be consistent with the fdct function, and to ease any future
idct rewrites in assembly.

The BenchmarkIDCT delta is obviously just an accounting change and not
a real saving, but it does give an indication of what proportion of
time was spent in the actual IDCT and what proportion was in shift and
clip. The idct time taken is now comparable to fdct.

The BenchmarkFDCT delta is an estimate of benchmark noise.

benchmark                   old ns/op    new ns/op    delta
BenchmarkFDCT                    3842         3837   -0.13%
BenchmarkIDCT                    5611         3478  -38.01%
BenchmarkDecodeRGBOpaque      2932785      2929751   -0.10%

R=r
CC=golang-dev
https://golang.org/cl/6625057
2012-10-07 11:32:02 +11:00
Nigel Tao
f2444f0bc1 image/jpeg: clean up BenchmarkDecode and BenchmarkEncode to not
refer to opacity. Those references were copy/pasted from the
image/png encoding benchmarks, which cares whether or not the
source image is opaque, but the JPEG encoder does not care.

R=r
CC=golang-dev
https://golang.org/cl/6623052
2012-10-07 11:30:47 +11:00
Nigel Tao
12e343f372 image/jpeg: add DCT tests, do a small optimization (common sub-expression
elimination) in idct.go.

benchmark                   old ns/op    new ns/op    delta
BenchmarkIDCT                    5649         5610   -0.69%
BenchmarkDecodeRGBOpaque      2948607      2941051   -0.26%

The "type block" declaration moved so that idct.go is compilable
as a stand-alone file: "go tool 6g -S idct.go" works.

R=r
CC=golang-dev
https://golang.org/cl/6619056
2012-10-07 10:21:17 +11:00
Rob Pike
bcccad4020 text/template: fix nil crash on Templates
Fixes #3872.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6612060
2012-10-07 09:26:59 +11:00
Rob Pike
421b75c0db text/template: add an unexported method to Node
Protects the package a little against undesirable clients.

R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/6624054
2012-10-07 07:15:11 +11:00
Rémy Oudompheng
782464aea5 runtime: fix a panic when growing zero-width-element slices.
Fixes #4197.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6611056
2012-10-06 12:05:52 +02:00
Dmitriy Vyukov
4cc7bf326a pprof: add goroutine blocking profiling
The profiler collects goroutine blocking information similar to Google Perf Tools.
You may see an example of the profile (converted to svg) attached to
http://code.google.com/p/go/issues/detail?id=3946
The public API changes are:
+pkg runtime, func BlockProfile([]BlockProfileRecord) (int, bool)
+pkg runtime, func SetBlockProfileRate(int)
+pkg runtime, method (*BlockProfileRecord) Stack() []uintptr
+pkg runtime, type BlockProfileRecord struct
+pkg runtime, type BlockProfileRecord struct, Count int64
+pkg runtime, type BlockProfileRecord struct, Cycles int64
+pkg runtime, type BlockProfileRecord struct, embedded StackRecord

R=rsc, dave, minux.ma, r
CC=gobot, golang-dev, r, remyoudompheng
https://golang.org/cl/6443115
2012-10-06 12:56:04 +04:00
Dmitry Chestnykh
b459afe843 crypto/sha256, crypto/sha512: 1.3x speedup
SHA-256:

benchmark          old ns/op    new ns/op    delta
BenchmarkHash1K        21686        16912  -22.01%
BenchmarkHash8K       173216       135020  -22.05%

benchmark           old MB/s     new MB/s  speedup
BenchmarkHash1K        47.22        60.55    1.28x
BenchmarkHash8K        47.29        60.67    1.28x

SHA-512:

benchmark          old ns/op    new ns/op    delta
BenchmarkHash1K        14323        11163  -22.06%
BenchmarkHash8K       114120        88693  -22.28%

benchmark           old MB/s     new MB/s  speedup
BenchmarkHash1K        71.49        91.73    1.28x
BenchmarkHash8K        71.78        92.36    1.29x

R=golang-dev, agl
CC=golang-dev
https://golang.org/cl/6584071
2012-10-05 17:04:48 -04:00
Akshat Kumar
23599ca2f6 runtime: mask SSE exceptions on plan9/amd64
The Go run-time assumes that all SSE floating-point exceptions
are masked so that Go programs are not broken by such invalid
operations. By default, the 64-bit version of the Plan 9 kernel
masks only some SSE floating-point exceptions. Here, we mask
them all on a per-thread basis.

R=rsc, rminnich, minux.ma
CC=golang-dev
https://golang.org/cl/6592056
2012-10-05 16:23:30 -04:00
Robert Griesemer
1f6fba2d56 go/printer: don't forget the .0 in 1.0
(use floating-point rather then integer constant division)

gofmt -w src misc

Fixes #3965.

R=r, bsiegert, 0xjnml
CC=bradfitz, golang-dev
https://golang.org/cl/6610051
2012-10-05 08:48:23 -07:00
Robert Griesemer
1065c6f65a go/printer: parenthesize literal function types in conversions
Also: gofmt -w src misc

R=r
CC=golang-dev, iant
https://golang.org/cl/6591071
2012-10-04 21:03:50 -07:00
Robert Griesemer
6c740e769f go/parser: unify parsing of const and var declarations
The AST representation is already identical. Making the
code (nearly) identical in the parser reduces code size
and ensures that the ast.ValueSpec nodes have the same
values (specifically, iota). This in turn permits the
sharing of much of the respective code in the typechecker.

While at it: type functions work now, so use them.

R=r
CC=golang-dev
https://golang.org/cl/6624047
2012-10-04 20:53:43 -07:00
Graham Miller
9f807fcc4a net/mail: make address parsing (more) public
Code for parsing email addresses was already partially part of the public API with "func (Header) AddressList".  This CL adds a trivial implementation for two public methods to parse address and lists from a string. With tests.

R=dsymonds
CC=golang-dev
https://golang.org/cl/5676067
2012-10-05 10:08:54 +10:00
Jeff Wendling
70ab57ea2d crypto/x509: add DecryptBlock function for loading password protected keys
Adds a DecryptBlock function which takes a password and a *pem.Block and
returns the decrypted DER bytes suitable for passing into other crypto/x509
functions.

R=golang-dev, agl, leterip
CC=golang-dev
https://golang.org/cl/6555052
2012-10-04 15:42:57 -04:00
Andrew Gerrand
ce6acefc5d go/doc: add nil to list of predeclared constants
R=gri
CC=gobot, golang-dev
https://golang.org/cl/6601054
2012-10-04 08:37:48 +10:00
Andrew Gerrand
81ae666f16 go/doc: rewrite whole file examples for playground
R=gri
CC=gobot, golang-dev
https://golang.org/cl/6592061
2012-10-04 07:55:24 +10:00
Shenghou Ma
727e5ce95f testing: update package docs to use ResetTimer() instead of StopTimer/StartTimer()
R=golang-dev, rsc, r
CC=golang-dev
https://golang.org/cl/6591051
2012-10-03 11:41:18 +08:00
Rob Pike
7f4b4c0c00 text/template: better error messages during execution,
They now show the correct name, the byte offset on the line, and context for the failed evaluation.
Before:
        template: three:7: error calling index: index out of range: 5
After:
        template: top:7:20: executing "three" at <index "hi" $>: error calling index: index out of range: 5
Here top is the template that was parsed to create the set, and the error appears with the action
starting at byte 20 of line 7 of "top", inside the template called "three", evaluating the expression
<index "hi" $>.

Also fix a bug in index: it didn't work on strings. Ouch.

Also fix bug in error for index: was showing type of index not slice.
The real previous error was:
        template: three:7: error calling index: can't index item of type int
The html/template package's errors can be improved by building on this;
I'll do that in a separate pass.

Extends the API for text/template/parse but only by addition of a field and method. The
old API still works.

Fixes #3188.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6576058
2012-10-03 12:02:13 +10:00
Robert Griesemer
1659aef399 go/ast: track position of <- for channel types
This is a backward-compatible API change.

Without the correct <- position information,
certain channel types have incorrect position
information.

R=iant, iant
CC=golang-dev
https://golang.org/cl/6585063
2012-10-02 17:50:36 -07:00
Shivakumar GN
5f7f9062db os/user : use username as fullname if all else fails (on windows)
Fixes #4113.

R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/6545054
2012-10-03 10:33:09 +10:00
Robert Griesemer
05dc3bf572 go/parser: correctly parse <-chan T(x) as <-(chan T)(x)
Fixes #4110.

R=iant
CC=golang-dev
https://golang.org/cl/6597069
2012-10-02 16:48:30 -07:00
Andrew Gerrand
cf513387c3 go/doc: strip example output comment from synthesized main function
R=gri
CC=gobot, golang-dev
https://golang.org/cl/6524047
2012-10-02 08:35:20 +10:00
Jeremy Jackins
b9e423eff3 archive/tar: fix inconsistent namespace usage in example
This fixes some example code in the tar package documentation, which
first refers to tar.NewWriter and then to Header, which is inconsistent
because NewWriter and Header are both in the tar namespace.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6595050
2012-10-02 08:10:42 +10:00
Adam Langley
9070d5759f math/big: avoid some allocation in Exp
benchmark                        old ns/op    new ns/op    delta
BenchmarkRSA1024Decrypt             745686       644964  -13.51%
BenchmarkRSA2048Decrypt            5517318      5049200   -8.48%
Benchmark3PrimeRSA2048Decrypt      3767386      3288048  -12.72%

R=gri
CC=gobot, golang-dev
https://golang.org/cl/6566043
2012-10-01 17:31:35 -04:00
Akshat Kumar
af582674b0 pkg/syscall: Plan 9, 64-bit: Update error checks from sys calls.
This change updates CL 6576057 for exceptional cases where
return values from Syscall/RawSyscall functions are used.

The system calls return 32-bit integers. With the recent change
in size of `int' in Go for amd64, the type conversion was not
catching `-1' return values. This change makes the conversion
explicitly `int32'.

R=rsc, r
CC=golang-dev
https://golang.org/cl/6590047
2012-10-01 10:09:08 +10:00
David Symonds
ff2f851af1 exp/types: permit importing packages without available source.
R=gri, iant
CC=golang-dev
https://golang.org/cl/6586051
2012-09-30 15:56:23 +10:00
David Symonds
0b448bdef7 exp/types: better diagnosis for compile failures.
R=gri, dave
CC=golang-dev
https://golang.org/cl/6587046
2012-09-30 15:46:37 +10:00
Mikio Hara
2fee6e3788 syscall: add ipv4 ancillary data for darwin
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/6586044
2012-09-29 12:43:05 +09:00
Robert Griesemer
de782dd146 container/list: slightly better code factoring
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6569077
2012-09-28 10:58:46 -07:00
Robert Griesemer
0e9daef2d1 container/list: Correctly maintain internal invariants
The previous implementation was a mess with invariants
maintained inconsistently. Essentially reimplemented
the package:

- used a circular list as internal representation for
  significantly simpler implementation with fewer
  special cases while maintaining the illusion of
  a nil-terminated doubly linked list externally

- more precise documentation

- cleaned up and simplified tests, added test case
  for issue 4103.

No changes to the API or documented semantics.

All this said, I would be in favor of removing
this package eventually. container/ring provides
a faster implementation and a simpler and more
powerful API.

Fixes #4103.

R=r
CC=golang-dev
https://golang.org/cl/6569072
2012-09-28 10:35:32 -07:00
Eric Roshan-Eisner
631a0e71c1 strings: implement a faster single-string Replacer
The string searching is implemented separately so other functions
may make use of it in the future.

benchmark                        old ns/op    new ns/op    delta
BenchmarkSingleMaxSkipping          125889         2474  -98.03%
BenchmarkSingleLongSuffixFail        16252         1996  -87.72%
BenchmarkSingleMatch                260793       136266  -47.75%

benchmark                         old MB/s     new MB/s  speedup
BenchmarkSingleMaxSkipping           79.43      4041.57   50.88x
BenchmarkSingleLongSuffixFail        61.65       501.81    8.14x
BenchmarkSingleMatch                 57.52       110.08    1.91x

R=nigeltao
CC=golang-dev
https://golang.org/cl/6545049
2012-09-28 12:34:18 +10:00
Eric Roshan-Eisner
4bf6249ba5 testing: remove redundant whitespace in output
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6565061
2012-09-28 10:01:09 +10:00
Akshat Kumar
8fdc90acf4 pkg/syscall: Plan 9, 64-bit: Update error checks from sys calls.
The system calls return 32-bit integers. With the recent change
in size of `int' in Go for amd64, the type conversion was not
catching `-1' return values. This change makes the conversion
explicitly `int32'.

R=rsc, rminnich, npe, r
CC=golang-dev
https://golang.org/cl/6576057
2012-09-28 09:56:44 +10:00
Michael Chaten
e289a2b913 bufio: Implement io.WriterTo for (*Reader)
This is part 1 of 2 for issue 4028

benchmark                       old ns/op    new ns/op    delta
BenchmarkReaderCopyOptimal          33495         9849  -70.60%
BenchmarkReaderCopyUnoptimal        70631        27041  -61.72%
BenchmarkReaderCopyOldImpl          51407        52970   +3.04%

Update #4028

R=dave, nigeltao, rsc, bradfitz, rogpeppe
CC=golang-dev
https://golang.org/cl/6548047
2012-09-27 16:31:03 +10:00
Josh Holland
348e31f8f7 text/template: fix typo of errorf as error in comment.
R=r, minux.ma
CC=gobot, golang-dev
https://golang.org/cl/6506120
2012-09-27 15:47:54 +10:00
Nigel Tao
791ac65b82 lzw: fix Write returning the wrong number of bytes written.
Fixes #4160.

R=rsc, r
CC=golang-dev
https://golang.org/cl/6564060
2012-09-27 13:29:39 +10:00
Rob Pike
ffea835b8f fmt: allow # and x together for strings
Silly and small but easy to be consistent.
To make it worthwhile, I eliminated an allocation when using
%x on a byte slice.

Fixes #4149.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6574046
2012-09-27 06:21:38 +10:00
Sébastien Paolacci
7014bc64b1 net: spread fd over several pollservers.
Lighten contention without preventing further improvements on pollservers.
Connections are spread over Min(GOMAXPROCS, NumCPU, 8) pollserver instances.

Median of 10 runs, 4 cores @ 3.4GHz, amd/linux-3.2:

BenchmarkTCPOneShot                171917 ns/op   175194 ns/op      1.91%
BenchmarkTCPOneShot-2              101413 ns/op   109462 ns/op      7.94%
BenchmarkTCPOneShot-4               91796 ns/op    35712 ns/op    -61.10%
BenchmarkTCPOneShot-6               90938 ns/op    30607 ns/op    -66.34%
BenchmarkTCPOneShot-8               90374 ns/op    29150 ns/op    -67.75%
BenchmarkTCPOneShot-16             101089 ns/op   111526 ns/op     10.32%

BenchmarkTCPOneShotTimeout         174986 ns/op   178606 ns/op      2.07%
BenchmarkTCPOneShotTimeout-2       101585 ns/op   110678 ns/op      8.95%
BenchmarkTCPOneShotTimeout-4        91547 ns/op    35931 ns/op    -60.75%
BenchmarkTCPOneShotTimeout-6        91496 ns/op    31019 ns/op    -66.10%
BenchmarkTCPOneShotTimeout-8        90670 ns/op    29531 ns/op    -67.43%
BenchmarkTCPOneShotTimeout-16      101013 ns/op   106026 ns/op      4.96%

BenchmarkTCPPersistent              51731 ns/op    53324 ns/op      3.08%
BenchmarkTCPPersistent-2            32888 ns/op    30678 ns/op     -6.72%
BenchmarkTCPPersistent-4            25751 ns/op    15595 ns/op    -39.44%
BenchmarkTCPPersistent-6            26737 ns/op     9805 ns/op    -63.33%
BenchmarkTCPPersistent-8            26850 ns/op     9730 ns/op    -63.76%
BenchmarkTCPPersistent-16          104449 ns/op   102838 ns/op     -1.54%

BenchmarkTCPPersistentTimeout       51806 ns/op    53281 ns/op      2.85%
BenchmarkTCPPersistentTimeout-2     32956 ns/op    30895 ns/op     -6.25%
BenchmarkTCPPersistentTimeout-4     25994 ns/op    18111 ns/op    -30.33%
BenchmarkTCPPersistentTimeout-6     26679 ns/op     9846 ns/op    -63.09%
BenchmarkTCPPersistentTimeout-8     26810 ns/op     9727 ns/op    -63.72%
BenchmarkTCPPersistentTimeout-16   101652 ns/op   104410 ns/op      2.71%

R=rsc, dvyukov, dave, mikioh.mikioh, bradfitz, remyoudompheng
CC=golang-dev
https://golang.org/cl/6496054
2012-09-26 15:32:59 -04:00
David du Colombier
cca48f1a57 crypto/x509: add Plan 9 root certificate location
R=golang-dev
CC=golang-dev, rsc
https://golang.org/cl/6571056
2012-09-26 14:47:47 -04:00
Shenghou Ma
948db4e091 crypto/aes: speed up using AES-NI on amd64
This CL requires CL 5970055.

benchmark           old ns/op    new ns/op    delta
BenchmarkEncrypt          161           23  -85.71%
BenchmarkDecrypt          158           24  -84.24%
BenchmarkExpand           526           62  -88.21%

benchmark            old MB/s     new MB/s  speedup
BenchmarkEncrypt        99.32       696.19    7.01x
BenchmarkDecrypt       100.93       641.56    6.36x

R=golang-dev, bradfitz, dave, rsc
CC=golang-dev
https://golang.org/cl/6549055
2012-09-27 01:54:10 +08:00
Rob Pike
ded94b7222 reflect.DeepEqual: rewrite clarification about nil and empty slice.
The previous version was created by an idiot. This time, Rog Peppe
wrote the text. Thanks, Rog.
(== doesn't work on slices in general, so it makes no sense to
talk about in the context of DeepEqual.)

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6566054
2012-09-26 20:46:49 +10:00
Mikio Hara
d6665bc338 net: fix plan 9 build
R=golang-dev, lucio.dere, fshahriar
CC=golang-dev
https://golang.org/cl/6562046
2012-09-26 16:11:49 +09:00
Rob Pike
74a7cc9bf2 reflect.DeepEqual: document that empty and nil are unequal for slices
Update #4133.
Added a sentence of documentation to call out the behavior.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6572051
2012-09-26 15:21:07 +10:00
Robert Griesemer
1785bfca6b exp/types/staging: updated gcimporter
Mostly minor changes to match the new
definitions in types.go and const.go.

R=rsc, r
CC=golang-dev
https://golang.org/cl/6506101
2012-09-25 17:39:02 -07:00
Robert Griesemer
ebf56e086d exp/types/staging: support for typechecking (most) builtins
This code relies on some functions that are not yet in staging,
but it get's harder to keep all this in sync in a piece-meal
fashion.

R=rsc
CC=golang-dev
https://golang.org/cl/6492124
2012-09-25 17:38:43 -07:00
Robert Griesemer
f5483fb801 exp/types/staging: operands, constants, and error handling
More pieces of the typechecker code:

- Operands are temporary objects representing an expressions's
type and value (for constants). An operand is the equivalent of
an "attribute" in attribute grammars except that it's not stored
but only passed around during type checking.

- Constant operations are implemented in const.go. Constants are
represented as bool (booleans), int64 and *big.Int (integers),
*big.Rat (floats), complex (complex numbers), and string (strings).

- Error reporting is consolidated in errors.go. Only the first
dozen of lines is new code, the rest of the file contains the
exprString and typeString functions formerly in two separate
files (which have been removed).

This is a replacement CL for 6492101 (which was created without
proper use of hg).

R=rsc, r
CC=golang-dev
https://golang.org/cl/6500114
2012-09-25 17:38:22 -07:00
Christian Himpel
1b6d4b5c0a net/http: use tls host instead of proxy, when checking against a certificate
Fixes #4152.

R=bradfitz
CC=golang-dev
https://golang.org/cl/6570045
2012-09-25 09:22:13 -07:00
Alex Brainman
0e6f927108 syscall: do not use int to test network syscall results (on windows)
Fixes #4147.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6569050
2012-09-25 17:06:39 +10:00
Russ Cox
10ea6519e4 build: make int 64 bits on amd64
The assembly offsets were converted mechanically using
code.google.com/p/rsc/cmd/asmlint. The instruction
changes were done by hand.

Fixes #2188.

R=iant, r, bradfitz, remyoudompheng
CC=golang-dev
https://golang.org/cl/6550058
2012-09-24 20:57:01 -04:00
Jan Ziak
f8c58373e5 runtime: add types to MSpan
R=rsc
CC=golang-dev
https://golang.org/cl/6554060
2012-09-24 20:08:05 -04:00
Russ Cox
ba4625c66f reflect: add MakeFunc (API CHANGE)
Fixes #1765.

R=iant, r, daniel.morsing, minux.ma, bradfitz, rogpeppe, remyoudompheng
CC=golang-dev
https://golang.org/cl/6554067
2012-09-24 20:06:32 -04:00
Mikio Hara
4b9e8415de net: add read, write message methods to IPConn, UDPConn
Both methods allow to access the IP ancillary data through
socket control messages.

This CL is required for CL 6482044; go.net/ipv4: new package.

R=rsc, r, dave
CC=golang-dev
https://golang.org/cl/6426047
2012-09-25 06:57:32 +09:00
Adam Langley
65c7dc4ace crypto/tls: support session ticket resumption.
Session resumption saves a round trip and removes the need to perform
the public-key operations of a TLS handshake when both the client and
server support it (which is true of Firefox and Chrome, at least).

R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/6555051
2012-09-24 16:52:43 -04:00
Francesc Campoy
b7cbfe6ace testing: document -test.bench flag
Fixes #4080.

R=rsc, adg
CC=golang-dev
https://golang.org/cl/6553068
2012-09-24 13:05:47 -07:00
Russ Cox
c7e0b8baa6 regexp/syntax: define accepted syntax
Update #3953.

R=bradfitz, campoy
CC=golang-dev
https://golang.org/cl/6543068
2012-09-24 15:33:53 -04:00
Eric Roshan-Eisner
74a1a8ae5f testing: add memory allocation stats to benchmark
R=rsc, nigeltao, dave, bradfitz, r, rogpeppe
CC=golang-dev
https://golang.org/cl/6497084
2012-09-24 15:03:16 -04:00
Russ Cox
0b08c9483f runtime: prepare for 64-bit ints
This CL makes the runtime understand that the type of
the len or cap of a map, slice, or string is 'int', not 'int32',
and it is also careful to distinguish between function arguments
and results of type 'int' vs type 'int32'.

In the runtime, the new typedefs 'intgo' and 'uintgo' refer
to Go int and uint. The C types int and uint continue to be
unavailable (cause intentional compile errors).

This CL does not change the meaning of int, but it should make
the eventual change of the meaning of int on amd64 a bit
smoother.

Update #2188.

R=iant, r, dave, remyoudompheng
CC=golang-dev
https://golang.org/cl/6551067
2012-09-24 14:58:34 -04:00
Akshat Kumar
e42788628a cmd/dist, pkg/runtime: Plan 9, 64-bit: Get PID from TLS; remove use of `_tos'.
Using offsets from Tos is cumbersome and we've had problems
in the past. Since it's only being used to grab the PID, we'll just
get that from the default TLS instead.

R=rsc, rminnich, npe
CC=golang-dev
https://golang.org/cl/6543049
2012-09-24 12:24:45 -04:00
Russ Cox
8696b08446 reflect: fix mistake in error message
Pointed out by James Chalfant after submit of CL 6500065.

TBR=golang-dev
CC=golang-dev
https://golang.org/cl/6543067
2012-09-24 11:47:27 -04:00
Russ Cox
2f06615588 encoding/asn1: prepare for 64-bit ints
The code was assuming that int = 32 bits. Don't.

Update #2188.

R=agl
CC=golang-dev
https://golang.org/cl/6543063
2012-09-24 10:30:37 -04:00
Nigel Tao
6efa648853 compress/flate: move the history buffer out of the decompressor struct.
I'm not exactly sure why there's a performance gain, but it seems like
an easy win. Maybe it's a cache line thing. Maybe it's that
unsafe.Sizeof(decompressor{}) drops to below unmappedzero, so that
checkref/checkoffset don't need to insert TESTB instructions. Maybe
it's less noise for the conservative garbage collector. Maybe it's
something else.

compress/flate benchmarks:
BenchmarkDecodeDigitsSpeed1e4          378628       349906   -7.59%
BenchmarkDecodeDigitsSpeed1e5         3481976      3204898   -7.96%
BenchmarkDecodeDigitsSpeed1e6        34419500     31750660   -7.75%
BenchmarkDecodeDigitsDefault1e4        362317       335562   -7.38%
BenchmarkDecodeDigitsDefault1e5       3290032      3107624   -5.54%
BenchmarkDecodeDigitsDefault1e6      30542540     28937480   -5.26%
BenchmarkDecodeDigitsCompress1e4       362803       335158   -7.62%
BenchmarkDecodeDigitsCompress1e5      3294512      3114526   -5.46%
BenchmarkDecodeDigitsCompress1e6     30514940     28927090   -5.20%
BenchmarkDecodeTwainSpeed1e4           412818       389521   -5.64%
BenchmarkDecodeTwainSpeed1e5          3475780      3288908   -5.38%
BenchmarkDecodeTwainSpeed1e6         33629640     31931420   -5.05%
BenchmarkDecodeTwainDefault1e4         369736       348850   -5.65%
BenchmarkDecodeTwainDefault1e5        2861050      2721383   -4.88%
BenchmarkDecodeTwainDefault1e6       27120120     25862050   -4.64%
BenchmarkDecodeTwainCompress1e4        372057       350822   -5.71%
BenchmarkDecodeTwainCompress1e5       2855109      2718664   -4.78%
BenchmarkDecodeTwainCompress1e6      26987010     26336030   -2.41%

image/png benchmarks:
BenchmarkDecodeGray               1841839      1802251   -2.15%
BenchmarkDecodeNRGBAGradient      7115318      6933280   -2.56%
BenchmarkDecodeNRGBAOpaque        6135892      6013284   -2.00%
BenchmarkDecodePaletted           1153313      1114302   -3.38%
BenchmarkDecodeRGB                5619404      5511190   -1.93%

R=rsc, r
CC=golang-dev
https://golang.org/cl/6533048
2012-09-24 17:58:08 +10:00
Marcel van Lohuizen
5e47b77990 exp/locale/collate/tools/colcmp: implementation of colcmp tool used for comparing
various implementation of collation.  The tool provides commands for soring,
regressing one implementation against another, and benchmarking.
Currently it includes collation implementations for the Go collator, ICU,
and one using Darwin's CoreFoundation framework.
To avoid building this tool in the default build, the colcmp tag has been
added to all files. This allows other tools/colcmp in this directory (e.g. it may make
sense to move maketables here) to be put in this directory as well.

R=r, rsc, mpvl
CC=golang-dev
https://golang.org/cl/6496118
2012-09-24 13:22:03 +09:00
Russ Cox
3d5ddffa30 syscall: prepare for 64-bit ints
This CL fixes code that incorrectly assumes that int is 32 bits wide.
Specifically, the socketpair system call expects a pointer to a pair
of int32s, not a pair of ints. Fix this inside the wrappers without
changing the APIs.

Update #2188.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6552063
2012-09-24 00:06:22 -04:00
Rob Pike
9050550c12 text/template: allow .Field access to parenthesized expressions
Change the grammar so that field access is a proper operator.
This introduces a new node, ChainNode, into the public (but
actually internal) API of text/template/parse. For
compatibility, we only use the new node type for the specific
construct, which was not parseable before. Therefore this
should be backward-compatible.

Before, .X.Y was a token in the lexer; this CL breaks it out
into .Y applied to .X. But for compatibility we mush them
back together before delivering. One day we might remove
that hack; it's the simple TODO in parse.go/operand.

This change also provides grammatical distinction between
        f
and
        (f)
which might permit function values later, but not now.

Fixes #3999.

R=golang-dev, dsymonds, gri, rsc, mikesamuel
CC=golang-dev
https://golang.org/cl/6494119
2012-09-24 13:23:15 +10:00
Russ Cox
edce634963 time: prepare for 64-bit ints
The code was trying to interpret a uint32 n as a signed quantity
and then store it in an int. For this, int(n) currently works, but when
int becomes 64 bits one must write int(int32(n)) instead, to get
the 32-bit sign extension.

Update #2188.

R=golang-dev, nigeltao
CC=golang-dev
https://golang.org/cl/6551068
2012-09-23 23:04:28 -04:00
Alex Brainman
5d50dbc55a net/http: use r.Body.Close to close connection during TestServeFileFromCWD
Fixes #3917.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6553061
2012-09-24 12:48:19 +10:00
Akshat Kumar
659d1df1bc pkg/go/ast: Avoid doing zero-length writes to the fd.
After each line, ast.Print would do a zero-length write,
which would hit the boundary condition on Plan 9 when
reading over pipes (since message boundaries are
preserved). This change makes sure we only do positive-
length writes.

R=rsc, rminnich, dave, r
CC=golang-dev
https://golang.org/cl/6558046
2012-09-24 08:30:28 +10:00
Russ Cox
46f379cc2c reflect: add Type.ConvertibleTo, Value.Convert (API CHANGE)
Fixes #4047.

R=iant, r
CC=golang-dev
https://golang.org/cl/6500065
2012-09-22 08:52:27 -04:00
Joel Sing
5373e8a8d7 debug/pe: add symbol support
Add support for processing the COFF symbol table.

R=alex.brainman
CC=golang-dev
https://golang.org/cl/6551045
2012-09-22 17:56:49 +10:00
Jan Ziak
b16c41bed7 runtime: fix typos in comments
R=rsc
CC=golang-dev
https://golang.org/cl/6554043
2012-09-21 12:25:55 -04:00
Shenghou Ma
b151af1f36 runtime: fix mmap comments
We only pass lower 32 bits of file offset to asm routine.

R=r, dave, rsc
CC=golang-dev
https://golang.org/cl/6499118
2012-09-21 13:50:02 +08:00
Russ Cox
8572950383 all: match asm variable names to Go func declarations
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6548046
2012-09-21 00:35:56 -04:00
Russ Cox
4591cd631d unicode: performance improvements (API change)
*** There is an API change here: the introduction of the
LatinOffset int in the RangeTable struct. ***

* Avoid checking Latin range multiple times for non-Latin runes.
* Use linear search when it is faster than binary search.

go test -calibrate runs the calibration for where the linear/binary
crossover should be.

benchmark                       old MB/s     new MB/s  speedup
BenchmarkFields            36.27        41.43    1.14x
BenchmarkFieldsFunc        36.23        41.38    1.14x

The speedup here is evenly split between the linear scans
and the LatinOffset change. Both are about 1.07x.

R=r
CC=bradfitz, gobot, golang-dev
https://golang.org/cl/6526048
2012-09-21 00:35:25 -04:00
Mikio Hara
9773ac1d08 net: fix comment
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6546044
2012-09-21 07:13:36 +09:00
Dmitriy Vyukov
801f6e6367 sync: add Once test with panic
Tests behavior of Once when initialization function panics.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6554047
2012-09-20 23:29:29 +04:00
Dmitriy Vyukov
d151fb9e20 runtime: reset parfor stats
Otherwise they sum up between GCs.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6535048
2012-09-20 22:46:24 +04:00
Andrew Harding
c993ac11bc crypto/x509: Use ExtKeyUsage and UnknownExtKeyUsage fields from template in CreateCertificate
R=golang-dev, agl
CC=golang-dev
https://golang.org/cl/6535057
2012-09-20 12:36:37 -04:00
Adam Langley
be11889ab1 crypto/x509: ignore non-critical email constraints
Previously we tried to parse email constraints as the maximum base
distance (which is unused and must be omitted according to RFC 5280)
because they share the same tag number. Rather than complicate the
code further, this CL just ignores the unused values.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6552044
2012-09-20 12:30:56 -04:00
Robert Griesemer
93195e1f31 encoding/gob: fix comment
Fixes #4100.

R=adg, r, dave
CC=golang-dev
https://golang.org/cl/6535055
2012-09-19 10:11:24 -07:00
Alex Brainman
28cb9fd509 os: use small writes during console io
Fixes #3767

R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/6523043
2012-09-19 16:55:21 +10:00
Andrew Gerrand
7e525928d3 go/doc: synthesize "package main" for examples
R=gri
CC=golang-dev
https://golang.org/cl/6525046
2012-09-18 14:13:34 -07:00
Dmitriy Vyukov
8ed026e783 race: build system changes
This is the first part of a bigger change that adds data race detection feature:
https://golang.org/cl/6456044
Adds -race flag to go command.
API change:
+pkg go/build, type Context struct, InstallTag string

R=rsc
CC=golang-dev
https://golang.org/cl/6488075
2012-09-18 23:47:15 +04:00
Russ Cox
0e60019a42 bytes, strings: add Fields benchmarks
The performance changes will be a few different CLs.
Start with benchmarks as a baseline.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6537043
2012-09-18 15:02:08 -04:00
Jan Ziak
35724c1aa5 runtime: hide the semaphore table from garbage collector
R=rsc, dvyukov, dave
CC=golang-dev
https://golang.org/cl/6528043
2012-09-18 14:30:01 -04:00
Jan Ziak
384af66984 reflect: use []unsafe.Pointer instead of []*int
R=rsc
CC=golang-dev
https://golang.org/cl/6527043
2012-09-18 14:23:11 -04:00
Russ Cox
ccf2b8843e encoding/json: do not read beyond array literal
Fixes #3942.

R=golang-dev, mike.rosset, r
CC=golang-dev
https://golang.org/cl/6524043
2012-09-18 14:22:55 -04:00
Russ Cox
370ae05545 reflect: add Select
R=r, iant, rogpeppe, bradfitz
CC=golang-dev
https://golang.org/cl/6498078
2012-09-18 14:22:41 -04:00
Anthony Eufemio
e8de8b58ca builtin: Changed documentation for rune type.
Fixes #4093.

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/6536047
2012-09-18 11:01:10 -07:00
Dmitriy Vyukov
f20fd87384 runtime: refactor goroutine blocking
The change is a preparation for the new scheduler.
It introduces runtime.park() function,
that will atomically unlock the mutex and park the goroutine.
It will allow to remove the racy readyonstop flag
that is difficult to implement w/o the global scheduler mutex.

R=rsc, remyoudompheng, dave
CC=golang-dev
https://golang.org/cl/6501077
2012-09-18 21:15:46 +04:00
Mikio Hara
e4389c008a undo CL 6395055 / 2518eee18c4f
Broke TCP selfConnect

««« original CL description
net: avoid nil pointer dereference when RemoteAddr.String method chain is called

Fixes #3721.

R=dave, rsc
CC=golang-dev
https://golang.org/cl/6395055
»»»

R=rsc
CC=golang-dev
https://golang.org/cl/6533043
2012-09-19 01:33:03 +09:00
Nigel Tao
648c9eb0b5 image/jpeg: ignore an incorrect but harmless trailing restart marker.
Fixes #4084.

R=r
CC=golang-dev
https://golang.org/cl/6526043
2012-09-18 21:57:33 +10:00
Alex Brainman
6e4d24999f syscall: attempt to find error message in "local" language before resorting to error number on windows
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6499121
2012-09-18 13:02:37 +10:00
Dave Cheney
55ca5ab0be runtime: arm: abort if VFPv3 support missing
Fixes #3456.

This proposal is a reformulation of CL 5987063. This CL resets
the default GOARM value to 6 and allows the use of the VFPv3
optimisation if GOARM=7. Binaries built with this CL in place
will abort if GOARM=7 was used and the target host does not
support VFPv3.

R=minux.ma, rsc, ajstarks
CC=golang-dev
https://golang.org/cl/6501099
2012-09-18 09:55:07 +10:00
Lucio De Re
b29ed23ab5 build: fix various 'set and not used' for Plan 9
R=dave, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6501134
2012-09-17 17:25:26 -04:00
Jan Ziak
54193689cc cmd/ld: fix compilation when GOARCH != GOHOSTARCH
R=rsc, dave, minux.ma
CC=golang-dev
https://golang.org/cl/6493123
2012-09-17 17:18:21 -04:00
Charles L. Dorian
0f8f5d2140 math: Faster Tanh
From 159 to 47.6 ns/op; slightly more accurate.

R=rsc, golang-dev, mtj, dave, remyoudompheng
CC=golang-dev
https://golang.org/cl/6500121
2012-09-17 17:18:16 -04:00
Sanjay Menakuru
da1ce83732 unicode/utf8: add Examples
R=golang-dev, r
CC=adg, golang-dev
https://golang.org/cl/6493124
2012-09-17 11:06:42 -07:00
Eric Eisner
0aad3cdc59 strings: implement a faster generic Replacer
This also fixes the semantics of some corner cases with the empty
match. TODOs for genericReplacer in the tests are fixed.

benchmark                  old ns/op    new ns/op    delta
BenchmarkGenericNoMatch        71395         3132  -95.61%
BenchmarkGenericMatch1         75610        20280  -73.18%
BenchmarkGenericMatch2        837995        86725  -89.65%

R=nigeltao, rsc
CC=golang-dev
https://golang.org/cl/6492076
2012-09-17 11:50:15 +10:00
Shenghou Ma
ecb2a0a9e5 runtime: fix SI_USER for FreeBSD
Ref: http://svnweb.freebsd.org/base/head/sys/sys/signal.h?revision=HEAD&view=markup

R=golang-dev, devon.odell, r
CC=golang-dev
https://golang.org/cl/6490118
2012-09-17 01:08:41 +08:00
Rob Pike
7b7a7a5737 text/template: towards better errors
Give the right name for errors, and add a test to check we're
getting the errors we expect.
Also fix an ordering bug (calling add after stopParse) that
caused a nil indirection rather than a helpful error.
Fixes #3280.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6520043
2012-09-14 15:25:37 -07:00
Brad Fitzpatrick
5c5c2c8112 os/exec: don't crash when out of fds
Command.Start could crash before if no fds were available
because a nil *os.File of /dev/null was added to the cleanup
list, which crashed before returning the proper error.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/6514043
2012-09-14 13:40:22 -07:00
Russ Cox
ab224094d0 go/build: use custom file readers to avoid I/O
When reading Go files, read through import block.
When reading non-Go files, read only leading comments.

R=nigeltao, adg, r
CC=golang-dev
https://golang.org/cl/6493068
2012-09-14 12:22:45 -04:00
Marcel van Lohuizen
a4d08ed5df exp/locale/collate: changed API to allow access to different locales through New(),
instead of variables. Several reasons:
- Encourage users of the API to minimize the number of creations and reuse Collate objects.
- Don't rule out the possibility of using initialization code for collators. For some locales
  it will be possible to have very compact representations that can be quickly expanded
  into a proper table on demand.
Other changes:
- Change name of root* vars to main*, as the tables are shared between locales.
- Added Locales() method to get a list of supported locales.

R=r
CC=golang-dev
https://golang.org/cl/6498107
2012-09-14 19:10:02 +09:00
Adam Langley
ecc04b8927 crypto/tls: allow certificates and key to be in either order.
X509KeyPair wasn't really supposed to allow the certificate and
key to be in the same file, but it did work if you put the key
first. Since some HTTPS servers support loading keys and certs
like this, this change makes it work in either order.

Fixes #3986.

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6499103
2012-09-13 11:00:16 -04:00
Russ Cox
37721cc1ce html/template: fix URL doc
This is the easy part of issue 3528.
(What to do about "noescape" is the hard part, left open.)

Update #3528.

R=mikesamuel, r, dsymonds
CC=golang-dev
https://golang.org/cl/6493113
2012-09-13 10:53:00 -04:00
Russ Cox
ef87c0edae crypto/rsa: reject PublicKey.E if it won't fit in a 32-bit int
Right now we only have 32-bit ints so that's a no-op.
Took the opportunity to check for some other invalid values too.
Suggestions for additions or modifications welcome.

R=agl
CC=golang-dev
https://golang.org/cl/6493112
2012-09-13 10:47:01 -04:00
Russ Cox
6ee91ced92 cmd/pack: rename __.SYMDEF to __.GOSYMDEF
This fixes a problem with ELF tools thinking they know the
format of the symbol table, as we do not use any of the
standard formats for that table.

This change will probably annoy the Plan 9 users, but I
believe there are other incompatibilities already that mean
they have to use a Go-specific nm.

Fixes #3473.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/6500117
2012-09-13 10:26:21 -04:00
Francisco Souza
ec9967ff11 go/build: reject empty strings in Import
Fixes #3889.

R=rsc, adg
CC=golang-dev
https://golang.org/cl/6499102
2012-09-13 10:25:35 -04:00
Nigel Tao
237ee39269 image/png: optimize encoding image.Gray and image.NRGBA images.
benchmark                    old ns/op    new ns/op    delta
BenchmarkEncodeGray           23616080      5624558  -76.18%
BenchmarkEncodeNRGBOpaque     34181260     17144380  -49.84%
BenchmarkEncodeNRGBA          41235820     20345990  -50.66%
BenchmarkEncodePaletted        5594652      5620362   +0.46%
BenchmarkEncodeRGBOpaque      17242210     17168820   -0.43%
BenchmarkEncodeRGBA           66515720     67243560   +1.09%

R=r
CC=golang-dev
https://golang.org/cl/6490099
2012-09-13 15:47:12 +10:00
Russ Cox
66331532cd net/rpc/jsonrpc: fix test error message
Fixes #4041.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6495121
2012-09-12 17:37:39 -04:00
Jan Ziak
d09afc2efb gc: generate garbage collection info for types
R=rsc, nigeltao, minux.ma
CC=golang-dev
https://golang.org/cl/6290043
2012-09-12 12:08:27 -04:00
Andreas Jellinghaus
452d6b46a3 syscall: add linux specific Getsockopt for Ucred struct
SO_PEERCRED on unix domain socket will fill a Ucred struct,
thus linux needs a custom Getsockopt variant.
Fixes #3836.

R=golang-dev, rsc, iant
CC=golang-dev
https://golang.org/cl/6445104
2012-09-12 06:38:21 -07:00
Alex Brainman
18601f88fd os: detect and handle console in File.Write on windows
Fixes #3376.

R=golang-dev, bsiegert, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6488044
2012-09-12 12:04:45 +10:00
Nigel Tao
6910356ea8 strings: fix NewReplacer(old0, new0, old1, new1, ...) to be consistent
when oldi == oldj.

Benchmark numbers show no substantial change.

R=eric.d.eisner, rogpeppe
CC=golang-dev
https://golang.org/cl/6496104
2012-09-12 10:40:39 +10:00
Nigel Tao
e39072d65f sync/atomic: add package doc for AddT, LoadT and StoreT.
Rename the first argument of CompareAndSwapT and AddT s/val/addr/
for consistency with LoadT and StoreT.

R=rsc, r, dvyukov
CC=golang-dev
https://golang.org/cl/6494112
2012-09-12 10:36:22 +10:00
Daniel Morsing
8fd65b0e1d cmd/gc: Inline pointer sized T2I interface conversions
This CL also adds support for marking the likelyness of IF nodes in the AST being true. This feature is being used here to mark the slow path as unlikely.

src/pkg/runtime:
benchmark                  old ns/op    new ns/op    delta
BenchmarkConvT2IUintptr           16            1  -91.63%

test/bench/go1:
benchmark                 old ns/op    new ns/op    delta
BenchmarkBinaryTree17    5416917000   5461355000   +0.82%
BenchmarkFannkuch11      3810355000   3842609000   +0.85%
BenchmarkGobDecode         19950950     19855420   -0.48%
BenchmarkGobEncode         11301220     11308530   +0.06%
BenchmarkGzip             548119600    546869200   -0.23%
BenchmarkGunzip           176145400    180208300   +2.31%
BenchmarkJSONEncode        93117400     70163100  -24.65%
BenchmarkJSONDecode       406626800    409999200   +0.83%
BenchmarkMandelbrot200      6300992      6317866   +0.27%
BenchmarkParse              7664396      7451625   -2.78%
BenchmarkRevcomp         1189424000   1412332000  +18.74%
BenchmarkTemplate         491308400    458654200   -6.65%

benchmark                  old MB/s     new MB/s  speedup
BenchmarkGobDecode            38.47        38.66    1.00x
BenchmarkGobEncode            67.92        67.87    1.00x
BenchmarkGzip                 35.40        35.48    1.00x
BenchmarkGunzip              110.16       107.68    0.98x
BenchmarkJSONEncode           20.84        27.66    1.33x
BenchmarkJSONDecode            4.77         4.73    0.99x
BenchmarkParse                 7.56         7.77    1.03x
BenchmarkRevcomp             213.69       179.96    0.84x
BenchmarkTemplate              3.95         4.23    1.07x

R=rsc, dave, nigeltao
CC=golang-dev
https://golang.org/cl/6351090
2012-09-11 21:42:30 +02:00
Nigel Tao
b19c32acce strings: more thorough Replacer tests.
This verifies existing behavior. Some replacements are arguably wrong
(these are marked with TODO) but changing behavior is left for a
follow-up CL.

Also fix that BenchmarkGenericMatch wasn't actually matching anything.

R=rsc, eric.d.eisner
CC=bradfitz, golang-dev
https://golang.org/cl/6488110
2012-09-11 14:40:08 +10:00
Russ Cox
f97bfb93f4 encoding/json: handle anonymous fields
Fixes #3069.

R=golang-dev, n13m3y3r
CC=golang-dev
https://golang.org/cl/6460044
2012-09-10 23:31:40 -04:00
Mikio Hara
d5a8c58170 net: delete unused IP-level socket option helpers
R=rsc, dave
CC=bradfitz, gobot, golang-dev
https://golang.org/cl/6497044
2012-09-11 08:56:28 +09:00
Mikio Hara
6c4645cffe net: rename files to clarify platform dependency
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6489056
2012-09-11 07:37:43 +09:00
Robert Griesemer
b29d641b3a exp/types/staging: typechecker API
First set of type checker files for review.
The primary concern here is the typechecker
API (types.go).

R=rsc, adonovan, r, rogpeppe
CC=golang-dev
https://golang.org/cl/6490089
2012-09-10 14:54:52 -07:00
Brad Fitzpatrick
a7743d7ad2 net/http: add If-None-Match and If-Range support to ServeContent
Also, clear Content-Type and Content-Length on Not Modified
responses before server.go strips them and spams the logs with
warnings.

R=rsc
CC=golang-dev
https://golang.org/cl/6503090
2012-09-10 10:16:09 -07:00
Adam Langley
122d2873a8 crypto/rand: typo fix from a69e30463bf4
R=golang-dev
CC=golang-dev
https://golang.org/cl/6497106
2012-09-09 20:11:58 -04:00
Adam Langley
b752ab2e90 crypto/rand: zero length reads shouldn't crash on Windows.
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/6496099
2012-09-09 20:07:09 -04:00
Mikio Hara
b737644266 net: change cname lookup test target to iana.org
It might be meaningful, and stable than others.

R=golang-dev, agl
CC=golang-dev
https://golang.org/cl/6499091
2012-09-09 23:53:48 +09:00
Marcel van Lohuizen
ef48dfa310 exp/locale/collate: added indices to builder for reusing blocks between locales.
Refactored build + buildTrie into build + buildOrdering.
Note that since the tailoring code is not checked in yet, all tailorings are identical
to root.  The table therefore should not and does not grow at this point.

R=r
CC=golang-dev
https://golang.org/cl/6500087
2012-09-08 10:46:55 +09:00
Marcel van Lohuizen
21d94a22fe exp/locale/collate: switch from DUCET to CLDR for the default root table.
R=r
CC=golang-dev
https://golang.org/cl/6499079
2012-09-08 10:38:11 +09:00
Robert Griesemer
d4cdfcf3d9 text/scanner: skip first character if it's a BOM
R=r
CC=golang-dev
https://golang.org/cl/6493097
2012-09-07 17:15:42 -07:00
Robert Griesemer
2a391f467d go/scanner: add missing BOM test
R=r
CC=golang-dev
https://golang.org/cl/6498106
2012-09-07 16:28:15 -07:00
Robert Griesemer
d5ab44e2fe go/scanner: skip first character if it's a BOM
R=r
CC=golang-dev
https://golang.org/cl/6490095
2012-09-07 13:56:31 -07:00
Albert Strasheim
412c60f1fa syscall: Test SCM credentials on Linux.
This test was previously removed in 087c6e15702e.

R=bradfitz, rsc, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/6506061
2012-09-07 10:31:17 -07:00
Lucio De Re
7e414a5b01 net,mime: Minor corrections to documentation comments.
R=r
CC=dsymonds, gobot, golang-dev
https://golang.org/cl/6495085
2012-09-07 10:24:55 -07:00
Dave Cheney
212ce41d00 runtime: arm: abort if hardware floating point missing
Fixes #3911.

Requires CL 6449127.

dfc@qnap:~$ ./runtime.test
runtime: this CPU has no floating point hardware, so it cannot run
this GOARM=7 binary. Recompile using GOARM=5.

R=rsc, minux.ma
CC=golang-dev
https://golang.org/cl/6442109
2012-09-07 14:26:42 +10:00
Joel Sing
256cd7e78e syscall: regenerate/update netbsd z-files
Regenerate/update netbsd z-files on NetBSD 6.0 RC1.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6506062
2012-09-07 02:13:14 +10:00
Dave Cheney
67ee9a7db1 crypto/tls: fix data race on conn.err
Fixes #3862.

There were many areas where conn.err was being accessed
outside the mutex. This proposal moves the err value to
an embedded struct to make it more obvious when the error
value is being accessed.

As there are no Benchmark tests in this package I cannot
feel confident of the impact of this additional locking,
although most will be uncontended.

R=dvyukov, agl
CC=golang-dev
https://golang.org/cl/6497070
2012-09-06 17:50:26 +10:00
Marcel van Lohuizen
f0a31b5fc2 exp/locale/collate/build: moved some of the code to the appropriate file, as
promised in CL 13985.

R=r
CC=golang-dev
https://golang.org/cl/6503071
2012-09-06 13:16:02 +09:00
Nigel Tao
4bd8a38641 image/jpeg: fix quantization tables to be in zig-zag order, not natural
order.

JPEG images generated prior to this CL are still valid JPEGs, as the
quantization tables used are encoded in the wire format. Such JPEGs just
don't use the recommended quantization tables.

R=r, dsymonds, raph, adg
CC=golang-dev, tuom.larsen
https://golang.org/cl/6497083
2012-09-06 11:10:47 +10:00
Russ Cox
5e3224ce79 reflect: faster FieldByName, FieldByNameFunc
The old code was a depth first graph traversal that could, under the
right conditions, end up re-exploring the same subgraphs multiple
times, once for each way to arrive at that subgraph at a given depth.

The new code uses a breadth first search to make sure that it only
visits each reachable embedded struct once.

Also add fast path for the trivial case.

benchmark                old ns/op    new ns/op    delta
BenchmarkFieldByName1         1321          187  -85.84%
BenchmarkFieldByName2         6118         5186  -15.23%
BenchmarkFieldByName3      8218553        42112  -99.49%

R=gri, r
CC=golang-dev
https://golang.org/cl/6458090
2012-09-05 09:35:53 -04:00
Alan Donovan
ee911c4265 runtime: fix typo in openbsd-only symbol name.
R=golang-dev, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6490076
2012-09-04 16:35:05 -04:00
Sébastien Paolacci
2836c63459 net: fix {FileConn, FileListener, FilePacketConn} fd leak to child process.
All of them call `newFileFD' which must properly restore close-on-exec on
duplicated fds.

R=golang-dev, bradfitz, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/6445081
2012-09-04 12:37:23 -07:00
Alan Donovan
532dee3842 runtime: discard SIGPROF delivered to non-Go threads.
Signal handlers are global resources but many language
environments (Go, C++ at Google, etc) assume they have sole
ownership of a particular handler.  Signal handlers in
mixed-language applications must therefore be robust against
unexpected delivery of certain signals, such as SIGPROF.

The default Go signal handler runtime·sigtramp assumes that it
will never be called on a non-Go thread, but this assumption
is violated by when linking in C++ code that spawns threads.
Specifically, the handler asserts the thread has an associated
"m" (Go scheduler).

This CL is a very simple workaround: discard SIGPROF delivered to non-Go threads.  runtime.badsignal(int32) now receives the signal number; if it returns without panicking (e.g. sig==SIGPROF) the signal is discarded.

I don't think there is any really satisfactory solution to the
problem of signal-based profiling in a mixed-language
application.  It's not only the issue of handler clobbering,
but also that a C++ SIGPROF handler called in a Go thread
can't unwind the Go stack (and vice versa).  The best we can
hope for is not crashing.

Note:
- I've ported this to all POSIX platforms, except ARM-linux which already ignores unexpected signals on m-less threads.
- I've avoided tail-calling runtime.badsignal because AFAICT the 6a/6l don't support it.
- I've avoided hoisting 'push sig' (common to both function calls) because it makes the code harder to read.
- Fixed an (apparently incorrect?) docstring.

R=iant, rsc, minux.ma
CC=golang-dev
https://golang.org/cl/6498057
2012-09-04 14:40:49 -04:00
Alan Donovan
b2458ff75c runtime/pprof: emit end-of-log marker at end of CPU profile.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6489065
2012-09-04 14:34:03 -04:00
Patrick Crosby
f4c22b29d4 net/http/pprof: updated documentation (run an http server)
Added instructions for starting an http server
to the godoc header for this package.  With the old
instructions, the example "go tool pprof..." commands
wouldn't work unless you happen to be running an http
server on port 6060 in your application.

R=golang-dev, minux.ma, adg, giacomo.tartari
CC=golang-dev
https://golang.org/cl/6483049
2012-09-04 11:27:20 +10:00
Alex Brainman
7f075ece42 runtime: increase stack frame during cgo call on windows/amd64
Fixes #3945.

R=golang-dev, minux.ma
CC=golang-dev, vcc.163
https://golang.org/cl/6490056
2012-09-03 12:12:51 +10:00
Russ Cox
a96c2b8c1a cmd/gc: fix PkgPath of byte, rune types
Fixes #3853.

R=ken2
CC=golang-dev
https://golang.org/cl/6492071
2012-09-01 19:55:55 -04:00
Rémy Oudompheng
c1c027964e strconv: faster FormatFloat for fixed number of digits.
The performance improvement applies to the case where
prec >= 0 and fmt is 'e' or 'g'.

Additional minor optimisations are included. A small
performance impact happens in some cases due to code
refactoring.

benchmark                              old ns/op    new ns/op    delta
BenchmarkAppendFloat64Fixed1                 623          235  -62.28%
BenchmarkAppendFloat64Fixed2                1050          272  -74.10%
BenchmarkAppendFloat64Fixed3                3723          243  -93.47%
BenchmarkAppendFloat64Fixed4               10285          274  -97.34%

BenchmarkAppendFloatDecimal                  190          206   +8.42%
BenchmarkAppendFloat                         387          377   -2.58%
BenchmarkAppendFloatExp                      397          339  -14.61%
BenchmarkAppendFloatNegExp                   377          336  -10.88%
BenchmarkAppendFloatBig                      546          482  -11.72%

BenchmarkAppendFloat32Integer                188          204   +8.51%
BenchmarkAppendFloat32ExactFraction          329          298   -9.42%
BenchmarkAppendFloat32Point                  400          372   -7.00%
BenchmarkAppendFloat32Exp                    369          306  -17.07%
BenchmarkAppendFloat32NegExp                 372          305  -18.01%

R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/6462049
2012-09-01 16:31:46 +02:00
Marcel van Lohuizen
5a78e5ea4c exp/locale/collate: Added functionality to parse and process LDML files
for both locale-specific exemplar characters and tailorings to
the collation table.
Some specifices:
- Moved stringSet to the beginning of the file and added some functionality
  to parse command line files.
- openReader now modifies the input URL for localFiles to guarantee that
  any http source listed in the generated file is indeed this source.
- Note that the implementation of the Tailoring API used by maketables.go
  is not yet checked in. So for now adding tailorings are simply no-ops.
- The generated file of exemplar characters will be used somewhere else.
  Here is a snippet of how the body of the generated file looks like:

type exemplarType int
const (
        exCharacters exemplarType = iota
        exContractions
        exPunctuation
        exAuxiliary
        exCurrency
        exIndex
        exN
)

var exemplarCharacters = map[string][exN]string{
        "af": [exN]string{
                0: "a á â b c d e é è ê ë f g h i î ï j k l m n o ô ö p q r s t u û v w x y z",
                3: "á à â ä ã æ ç é è ê ë í ì î ï ó ò ô ö ú ù û ü ý",
                4: "a b c d e f g h i j k l m n o p q r s t u v w x y z",
        },
        ...
}

R=r
CC=golang-dev
https://golang.org/cl/6501070
2012-09-01 14:15:00 +02:00
Marcel van Lohuizen
18aa55c169 exp/locale/collate: first changes that introduce implementation of tailorings:
- Elements in the array are now sorted as a linked list.  This makes it easier to
  apply tailorings.
- Added code to sort entries by collation elements.
- Added logical reset points.  This is used for tailoring relative to certain
  properties, rather than characters.

NOTE: all code for type entry should now be in order.go.  To keep the diffs for
this CL reasonable, though, the existing code is left in builder.go.  I'll move
this in a separate CL.

R=r
CC=golang-dev
https://golang.org/cl/6493063
2012-09-01 14:13:37 +02:00
Dave Cheney
dd79b330c9 syscall: add PtraceSyscall(pid int, signal int)
Fixes #3525.

PTRACE_SYSCALL behaves like PTRACE_CONT and can deliver
a signal to the process. Ideally PtraceSingleStep should
support the signal argument, but its interface is frozen
by Go1.

R=golang-dev, r, rsc
CC=golang-dev
https://golang.org/cl/6353051
2012-09-01 09:17:14 +10:00
Patrick Higgins
d168442708 net/http: added ParseTime function.
Parses a time header value into a time.Time according to rfc2616 sec 3.3.

R=golang-dev, dave, rsc, r
CC=bradfitz, golang-dev
https://golang.org/cl/6344046
2012-08-31 18:10:16 -04:00
Shawn Smith
a11b748fa2 encoding/xml: parse comments in DOCTYPE
R=rsc, n13m3y3r
CC=golang-dev
https://golang.org/cl/6330061
2012-08-31 18:09:31 -04:00
Ivan Krasin
5287175ad9 runtime: add vdso support for linux/amd64. Fixes issue 1933.
R=iant, imkrasin, krasin, iant, minux.ma, rsc, nigeltao, r, fullung
CC=golang-dev
https://golang.org/cl/6454046
2012-08-31 18:07:04 -04:00
Alexandru Moșoi
3efc482190 net/rpc/jsonrpc: handles missing "params" in jsonrpc.
A crash happens in the first request in a connection
if "params" field is missing because c.req.Params is Nil.

Fixes #3848.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6446051
2012-08-31 15:52:27 -04:00
Russ Cox
020c6558d9 runtime/pprof: restore articles in type doc comments
Reverts part of CL 6460082.

If a doc comment describes a type by explaining the
meaning of one instance of the type, a leading article
is fine and makes the text less awkward.

Compare:
// A dog is a kind of animal.
// Dog is a kind of animal.

R=golang-dev, dsymonds, dvyukov, r
CC=golang-dev
https://golang.org/cl/6494066
2012-08-31 13:49:57 -04:00
Akshat Kumar
a72bebf6e1 src: Add support for 64-bit version of Plan 9
This set of changes extends the Plan 9 support
to include the AMD64 architecture and should
work on all versions of Plan 9.

R=golang-dev, rminnich, noah.evans, rsc, minux.ma, npe
CC=akskuma, golang-dev, jfflore, noah.evans
https://golang.org/cl/6479052
2012-08-31 13:21:13 -04:00
Russ Cox
e29659b3c3 net/http: add (*ServeMux).Handler method
The Handler method makes the ServeMux dispatch logic
available to wrappers that enforce additional constraints
on requests.

R=golang-dev, bradfitz, dsymonds
CC=golang-dev
https://golang.org/cl/6450165
2012-08-31 12:16:31 -04:00
Christian Himpel
db7dbe32aa net/http: fix inserting of implicit redirects in serve mux
In serve mux, if pattern contains a host name, pass only the path to
the redirect handler.

Add tests for serve mux redirections.

R=rsc
CC=bradfitz, gobot, golang-dev
https://golang.org/cl/6329045
2012-08-31 12:00:01 -04:00
Nigel Tao
13cf2473b8 exp/html: change a node's children from a slice to a linked list.
Also rename Node.{Add,Remove} to Node.{AppendChild,RemoveChild} to
be consistent with the DOM.

benchmark                      old ns/op    new ns/op    delta
BenchmarkParser                  4042040      3749618   -7.23%

benchmark                       old MB/s     new MB/s  speedup
BenchmarkParser                    19.34        20.85    1.08x

BenchmarkParser mallocs per iteration is also:
10495 before / 7992 after

R=andybalholm, r, adg
CC=golang-dev
https://golang.org/cl/6495061
2012-08-31 10:00:12 +10:00
Robert Griesemer
d6c69dc602 go/scanner: don't print garbage if there's no error
R=r
CC=golang-dev
https://golang.org/cl/6489059
2012-08-30 16:10:33 -07:00
Rob Pike
363ec80dec cmd/gc: string conversion for surrogates
This is required by the spec to produce the replacement char.
The fix lies in lib9's rune code.

R=golang-dev, nigeltao, rsc
CC=golang-dev
https://golang.org/cl/6443109
2012-08-30 11:16:55 -07:00
Rob Pike
b7627d3d1f path: improve documentation for Dir
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6495059
2012-08-30 11:16:41 -07:00
Dmitriy Vyukov
e61c047c3e net/rpc: protect serviceMap with RWMutex
R=r, r
CC=golang-dev
https://golang.org/cl/6494044
2012-08-30 20:32:32 +04:00
Rob Pike
de13e8dccd text/template: make spaces significant
Other than catching an error case that was missed before, this
CL introduces no changes to the template language or API.

For simplicity, templates use spaces as argument separators.
This means that spaces are significant: .x .y is not the same as .x.y.
In the existing code, these cases are discriminated by the lexer,
but that means for instance that (a b).x cannot be distinguished
from (a b) .x, which is lousy. Although that syntax is not
supported yet, we want to support it and this CL is a necessary
step.

This CL emits a "space" token (actually a run of spaces) from
the lexer so the parser can discriminate these cases. It therefore
fixes a couple of undisclosed bugs ("hi".x is now an error) but
doesn't otherwise change the language. Later CLs will amend
the grammar to make .X a proper operator.

There is one unpleasantness: With space a token, three-token
lookahead is now required when parsing variable declarations
to discriminate them from plain variable references. Otherwise
the change isn't bad.

The CL also moves the debugging print code out of the lexer
into the test, which is the only place it's needed or useful.

Step towards resolving issue 3999.
It still remains to move field chaining out of the lexer
and into the parser and make field access an operator.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6492054
2012-08-29 21:42:53 -07:00
Shenghou Ma
f78ead3ca4 syscall: extract an ExampleLoadLibrary from comment
while we are at it, fix some out-of-date comments.

R=golang-dev, dave, r
CC=golang-dev
https://golang.org/cl/6498054
2012-08-29 21:44:46 +08:00
Dave Cheney
f8d4bb884f net/http/httputil: fix race in DumpRequestOut
Fixes #3892.

Swapping the order of the writers inside the MultiWriter ensures
the request will be written to buf before http.ReadRequest completes.

The fencedBuffer is not required to make the test pass on
any machine that I have access too, but as the buf is shared
across goroutines, I think it is necessary for correctness.

R=bradfitz, fullung, franciscossouza
CC=golang-dev
https://golang.org/cl/6483061
2012-08-29 09:05:30 +10:00
Mikio Hara
ddbc85ce48 net: delete unused socket-level option helpers
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6499043
2012-08-29 06:54:00 +09:00
Christopher Swenson
baf426f10f math/big: Replace RCLQ + ANDQ with SETCS in unrolled arithmetic assembly.
benchmark             old ns/op    new ns/op    delta
BenchmarkAddVW_1              8            8   +0.60%
BenchmarkAddVW_2             10            9   -8.64%
BenchmarkAddVW_3             10           10   -4.63%
BenchmarkAddVW_4             10           11   +3.67%
BenchmarkAddVW_5             11           12   +5.98%
BenchmarkAddVW_1e1           18           20   +6.38%
BenchmarkAddVW_1e2          129          115  -10.85%
BenchmarkAddVW_1e3         1270         1089  -14.25%
BenchmarkAddVW_1e4        13376        12145   -9.20%
BenchmarkAddVW_1e5       130392       125260   -3.94%

benchmark              old MB/s     new MB/s  speedup
BenchmarkAddVW_1        7709.10      7661.92    0.99x
BenchmarkAddVW_2       12451.10     13604.00    1.09x
BenchmarkAddVW_3       17727.81     18721.54    1.06x
BenchmarkAddVW_4       23552.64     22708.81    0.96x
BenchmarkAddVW_5       27411.40     25816.22    0.94x
BenchmarkAddVW_1e1     34063.19     32023.06    0.94x
BenchmarkAddVW_1e2     49529.97     55360.55    1.12x
BenchmarkAddVW_1e3     50380.44     58764.18    1.17x
BenchmarkAddVW_1e4     47843.59     52696.10    1.10x
BenchmarkAddVW_1e5     49082.60     51093.66    1.04x

R=gri, rsc, r
CC=golang-dev
https://golang.org/cl/6480063
2012-08-28 09:29:45 -07:00
Brad Fitzpatrick
49f29c9c22 net/http: send an explicit zero Content-Length when Handler never Writes
Fixes #4004

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6472055
2012-08-26 11:17:55 -07:00
Joel Sing
79473d6b1c runtime: use netbsd signal ABI v2
Use version 2 of the NetBSD signal ABI - both version 2 and version 3
are supported by the kernel, with near identical behaviour. However,
the netbsd32 compat code does not allow version 3 to be used, which
prevents Go netbsd/386 binaries from running in compat mode on a
NetBSD amd64 kernel. Switch to version 2 of the ABI, which is the
same version currently used by NetBSD's libc.

R=minux.ma
CC=golang-dev
https://golang.org/cl/6476068
2012-08-26 20:57:47 +10:00
Robert Griesemer
74c6325142 math/big: fix broken comment
R=iant, iant
CC=golang-dev
https://golang.org/cl/6485064
2012-08-24 13:50:09 -07:00
Rob Pike
8b23066239 text/template: catch (A).X as a parse error
This shouldn't be an error (see issue 3999), but until it's handled
correctly, treat it as one to avoid confusion. Without this CL,
(A).X parses as two arguments.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6473059
2012-08-24 13:00:24 -07:00
Rob Pike
cc842c738e text/template: allow grouping of pipelines using parentheses
Based on work by Russ Cox. From his CL:

        This is generally useful but especially helpful when trying
        to use the built-in boolean operators.  It lets you write:

        {{if not (f 1)}} foo {{end}}
        {{if and (f 1) (g 2)}} bar {{end}}
        {{if or (f 1) (g 2)}} quux {{end}}

        instead of

        {{if f 1 | not}} foo {{end}}
        {{if f 1}}{{if g 2}} bar {{end}}{{end}}
        {{$do := 0}}{{if f 1}}{{$do := 1}}{{else if g 2}}{{$do := 1}}{{end}}{{if $do}} quux {{end}}

The result can be a bit LISPy but the benefit in expressiveness and readability
for such a small change justifies it.

I believe no changes are required to html/template.

Fixes #3276.

R=golang-dev, adg, rogpeppe, minux.ma
CC=golang-dev
https://golang.org/cl/6482056
2012-08-24 12:37:23 -07:00
Robert Griesemer
3bd8684fac math/big: minor tweaks to assembly code (slightly better performance)
Benchmarks run on 2.8GHz Quad-Code Intel Xeon,
4GB 800MHz DDR2 FB-DIMM ("PowerMac").

benchmark             old ns/op    new ns/op    delta
BenchmarkAddVV_1              7            7   -0.82%
BenchmarkAddVV_2              8            8   -3.46%
BenchmarkAddVV_3             10            9   -4.81%
BenchmarkAddVV_4              9            9   -1.89%
BenchmarkAddVV_5             11           10   -5.22%
BenchmarkAddVV_1e1           17           18   +4.05%
BenchmarkAddVV_1e2          117          115   -1.71%
BenchmarkAddVV_1e3         1095         1090   -0.46%
BenchmarkAddVV_1e4        13149        12679   -3.57%
BenchmarkAddVV_1e5       135133       129482   -4.18%
BenchmarkAddVW_1              6            6   -1.14%
BenchmarkAddVW_2              7            7   +3.78%
BenchmarkAddVW_3              8            8   +0.12%
BenchmarkAddVW_4              8            8   -6.52%
BenchmarkAddVW_5              9            8   -3.70%
BenchmarkAddVW_1e1           14           13   -4.29%
BenchmarkAddVW_1e2           97           96   -1.33%
BenchmarkAddVW_1e3          953          940   -1.36%
BenchmarkAddVW_1e4         9776         9527   -2.55%
BenchmarkAddVW_1e5       102396        97738   -4.55%

benchmark              old MB/s     new MB/s  speedup
BenchmarkAddVV_1        8702.84      8774.56    1.01x
BenchmarkAddVV_2       14739.60     15277.82    1.04x
BenchmarkAddVV_3       18375.37     19398.16    1.06x
BenchmarkAddVV_4       26935.44     27464.68    1.02x
BenchmarkAddVV_5       27754.04     29423.30    1.06x
BenchmarkAddVV_1e1     37050.89     35629.72    0.96x
BenchmarkAddVV_1e2     54289.15     55533.24    1.02x
BenchmarkAddVV_1e3     58428.83     58682.53    1.00x
BenchmarkAddVV_1e4     48670.55     50475.99    1.04x
BenchmarkAddVV_1e5     47360.54     49427.66    1.04x
BenchmarkAddVW_1       10397.27     10502.23    1.01x
BenchmarkAddVW_2       17279.03     16654.13    0.96x
BenchmarkAddVW_3       23858.39     23825.89    1.00x
BenchmarkAddVW_4       29799.42     31895.06    1.07x
BenchmarkAddVW_5       34781.83     36105.11    1.04x
BenchmarkAddVW_1e1     45629.88     47597.42    1.04x
BenchmarkAddVW_1e2     65341.93     66240.04    1.01x
BenchmarkAddVW_1e3     67153.67     68069.83    1.01x
BenchmarkAddVW_1e4     65464.60     67173.83    1.03x
BenchmarkAddVW_1e5     62501.88     65480.66    1.05x

R=iant
CC=golang-dev
https://golang.org/cl/6484056
2012-08-24 10:51:39 -07:00
Robert Griesemer
35422bc11f math/big: faster (add|sub)V(V|W) routines
Benchmarks run on 3.06GHz Intel Core 2 Duo,
4GB 800MHz DDR2 SDRAM ("iMac").

benchmark             old ns/op    new ns/op    delta
BenchmarkAddVV_1              6            6   +2.75%
BenchmarkAddVV_2              9            7  -19.71%
BenchmarkAddVV_3              9            9   +2.25%
BenchmarkAddVV_4             10            8  -20.46%
BenchmarkAddVV_5             12           10  -19.53%
BenchmarkAddVV_1e1           23           15  -32.48%
BenchmarkAddVV_1e2          213          107  -49.77%
BenchmarkAddVV_1e3         2088          993  -52.44%
BenchmarkAddVV_1e4        20874        12027  -42.38%
BenchmarkAddVV_1e5       209858       121480  -42.11%
BenchmarkAddVW_1              5            5   +0.90%
BenchmarkAddVW_2             11           11   -3.51%
BenchmarkAddVW_3              7            7   -0.27%
BenchmarkAddVW_4              8            7   -6.32%
BenchmarkAddVW_5              9            8  -10.89%
BenchmarkAddVW_1e1           17           12  -26.01%
BenchmarkAddVW_1e2          155           89  -42.32%
BenchmarkAddVW_1e3         1479          873  -40.97%
BenchmarkAddVW_1e4        13838         8764  -36.67%
BenchmarkAddVW_1e5       147353        89560  -39.22%

benchmark              old MB/s     new MB/s  speedup
BenchmarkAddVV_1        9765.57      9508.55    0.97x
BenchmarkAddVV_2       13077.63     16284.97    1.25x
BenchmarkAddVV_3       20599.58     20156.67    0.98x
BenchmarkAddVV_4       23591.58     29516.02    1.25x
BenchmarkAddVV_5       24920.95     31194.10    1.25x
BenchmarkAddVV_1e1     27393.76     40621.71    1.48x
BenchmarkAddVV_1e2     29911.96     59592.99    1.99x
BenchmarkAddVV_1e3     30650.73     64429.84    2.10x
BenchmarkAddVV_1e4     30660.09     53213.08    1.74x
BenchmarkAddVV_1e5     30496.74     52683.46    1.73x
BenchmarkAddVW_1       11503.39     11405.98    0.99x
BenchmarkAddVW_2       11203.56     11586.92    1.03x
BenchmarkAddVW_3       26173.45     26224.75    1.00x
BenchmarkAddVW_4       30560.30     32621.94    1.07x
BenchmarkAddVW_5       33183.81     37269.94    1.12x
BenchmarkAddVW_1e1     36991.75     50098.53    1.35x
BenchmarkAddVW_1e2     41087.14     71549.93    1.74x
BenchmarkAddVW_1e3     43266.42     73279.83    1.69x
BenchmarkAddVW_1e4     46246.74     73021.97    1.58x
BenchmarkAddVW_1e5     43433.00     71459.96    1.65x

Benchmarks run on 2.8GHz Quad-Code Intel Xeon,
4GB 800MHz DDR2 FB-DIMM ("PowerMac").

benchmark             old ns/op    new ns/op    delta
BenchmarkAddVV_1              7            7   +2.51%
BenchmarkAddVV_2              8            8   +3.70%
BenchmarkAddVV_3             10           10   +4.00%
BenchmarkAddVV_4             11            9  -19.49%
BenchmarkAddVV_5             14           11  -18.44%
BenchmarkAddVV_1e1           23           17  -27.00%
BenchmarkAddVV_1e2          234          117  -50.00%
BenchmarkAddVV_1e3         2284         1095  -52.06%
BenchmarkAddVV_1e4        22906        13149  -42.60%
BenchmarkAddVV_1e5       229860       135133  -41.21%
BenchmarkAddVW_1              6            6   +1.15%
BenchmarkAddVW_2              7            7   +1.37%
BenchmarkAddVW_3              7            8   +1.00%
BenchmarkAddVW_4              9            8   -6.93%
BenchmarkAddVW_5             10            9  -13.21%
BenchmarkAddVW_1e1           18           14  -24.32%
BenchmarkAddVW_1e2          170           97  -42.41%
BenchmarkAddVW_1e3         1619          953  -41.14%
BenchmarkAddVW_1e4        15142         9776  -35.44%
BenchmarkAddVW_1e5       160835       102396  -36.33%

benchmark              old MB/s     new MB/s  speedup
BenchmarkAddVV_1        8928.95      8702.84    0.97x
BenchmarkAddVV_2       15298.84     14739.60    0.96x
BenchmarkAddVV_3       19116.52     18375.37    0.96x
BenchmarkAddVV_4       21644.30     26935.44    1.24x
BenchmarkAddVV_5       22771.64     27754.04    1.22x
BenchmarkAddVV_1e1     27017.62     37050.89    1.37x
BenchmarkAddVV_1e2     27326.09     54289.15    1.99x
BenchmarkAddVV_1e3     28016.84     58428.83    2.09x
BenchmarkAddVV_1e4     27939.38     48670.55    1.74x
BenchmarkAddVV_1e5     27843.00     47360.54    1.70x
BenchmarkAddVW_1       10510.97     10397.27    0.99x
BenchmarkAddVW_2       17499.71     17279.03    0.99x
BenchmarkAddVW_3       24093.93     23858.39    0.99x
BenchmarkAddVW_4       27733.08     29799.42    1.07x
BenchmarkAddVW_5       30267.17     34781.83    1.15x
BenchmarkAddVW_1e1     34566.78     45629.88    1.32x
BenchmarkAddVW_1e2     37521.89     65341.93    1.74x
BenchmarkAddVW_1e3     39513.18     67153.67    1.70x
BenchmarkAddVW_1e4     42263.80     65464.60    1.55x
BenchmarkAddVW_1e5     39792.21     62501.88    1.57x

R=iant, remyoudompheng, nightlyone, minux.ma
CC=golang-dev
https://golang.org/cl/6482062
2012-08-24 09:20:44 -07:00
Marcel van Lohuizen
c61a185f35 exp/locale/collate: add code to ignore tests with (unpaired) surrogates.
In the regtest data, surrogates are assigned primary weights based on
the surrogate code point value.  Go now converts surrogates to FFFD, however,
meaning that the primary weight is based on this code point instead.
This change drops tests with surrogates and lets the tests pass.

R=r
CC=golang-dev
https://golang.org/cl/6461100
2012-08-24 15:56:07 +02:00
Dmitriy Vyukov
75af013229 net/http: add parallel client/server benchmark
R=bradfitz@golang.org

R=bradfitz
CC=bradfitz, dave, dsymonds, gobot, golang-dev
https://golang.org/cl/6441134
2012-08-24 14:19:49 +04:00
Nigel Tao
8eb05b3843 exp/html: remove unused forTag function.
R=adg
CC=golang-dev
https://golang.org/cl/6480051
2012-08-24 14:15:55 +10:00
Julien Schmidt
37b40dab51 database/sql: stop reuse of bad connections
The second parameter for sql.putConn() (err) is always nil. As a result bad
connections are reused, even if the driver returns an driver.ErrBadConn.
Unsing a pointer to err instead achievs the desired behavior.
See http://code.google.com/p/go/issues/detail?id=3777 for more details.
Fixes #3777.

R=golang-dev, dave, bradfitz, jameshuachow, BlakeSGentry
CC=golang-dev
https://golang.org/cl/6348069
2012-08-23 19:29:47 -07:00
Robert Griesemer
77e98fb8f2 go/scanner: don't drop identifiers starting with non-ASCII letter...
Bug introduced with CL 6454150.

Fixes #4000.

R=r
CC=golang-dev
https://golang.org/cl/6474061
2012-08-23 17:03:33 -07:00
Robert Griesemer
053b448d61 math/big: added benchmarks to establish baseline for core functions
BenchmarkAddVV_1          500000000        7.24 ns/op     8844.11 MB/s
BenchmarkAddVV_2          100000000       10.4 ns/op     12290.41 MB/s
BenchmarkAddVV_3          100000000       10.7 ns/op     17966.58 MB/s
BenchmarkAddVV_4          100000000       12.3 ns/op     20848.67 MB/s
BenchmarkAddVV_5          100000000       14.5 ns/op     21993.82 MB/s
BenchmarkAddVV_1e1        100000000       24.0 ns/op     26720.65 MB/s
BenchmarkAddVV_1e2         10000000      246 ns/op       26014.58 MB/s
BenchmarkAddVV_1e3          1000000     2416 ns/op       26485.06 MB/s
BenchmarkAddVV_1e4           100000    23874 ns/op       26806.36 MB/s
BenchmarkAddVV_1e5            10000   241155 ns/op       26538.87 MB/s
BenchmarkAddVW_1          500000000        6.12 ns/op    10461.91 MB/s
BenchmarkAddVW_2          200000000       11.0 ns/op     11596.63 MB/s
BenchmarkAddVW_3          200000000        8.97 ns/op    21409.82 MB/s
BenchmarkAddVW_4          100000000       10.8 ns/op     23696.72 MB/s
BenchmarkAddVW_5          100000000       12.5 ns/op     25524.88 MB/s
BenchmarkAddVW_1e1        100000000       21.5 ns/op     29786.32 MB/s
BenchmarkAddVW_1e2         10000000      168 ns/op       37925.36 MB/s
BenchmarkAddVW_1e3          1000000     1658 ns/op       38579.15 MB/s
BenchmarkAddVW_1e4           100000    16492 ns/op       38805.85 MB/s
BenchmarkAddVW_1e5            10000   172155 ns/op       37175.69 MB/s
BenchmarkAddMulVVW_1      100000000       12.9 ns/op      4968.49 MB/s
BenchmarkAddMulVVW_2      100000000       15.5 ns/op      8279.42 MB/s
BenchmarkAddMulVVW_3      100000000       13.4 ns/op     14340.53 MB/s
BenchmarkAddMulVVW_4      100000000       15.8 ns/op     16194.94 MB/s
BenchmarkAddMulVVW_5      100000000       18.9 ns/op     16906.61 MB/s
BenchmarkAddMulVVW_1e1     50000000       32.3 ns/op     19838.35 MB/s
BenchmarkAddMulVVW_1e2     10000000      285 ns/op       22427.28 MB/s
BenchmarkAddMulVVW_1e3      1000000     2777 ns/op       23040.42 MB/s
BenchmarkAddMulVVW_1e4       100000    27901 ns/op       22938.01 MB/s
BenchmarkAddMulVVW_1e5        10000   281087 ns/op       22768.73 MB/s

R=r
CC=golang-dev
https://golang.org/cl/6478055
2012-08-23 15:56:14 -07:00
Adam Langley
0a115d72c1 crypto/tls: return better error message in the case of an SSLv2 handshake.
Update #3930
Return a better error message in this situation.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6474055
2012-08-23 16:44:44 -04:00
Mikio Hara
6cf77f2af4 net: avoid nil pointer dereference when RemoteAddr.String method chain is called
Fixes #3721.

R=dave, rsc
CC=golang-dev
https://golang.org/cl/6395055
2012-08-23 20:54:00 +09:00
Rob Pike
6fd2febaef time: fix spacing in comment.
No semantic change.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6475050
2012-08-22 21:30:18 -07:00
Carlos Castillo
7802080962 time: add YearDay method for time.Time structs
YearDay provides the day in the year represented by a given time.Time
object. This value is normally computed as part of other date calculations,
but not exported.

Fixes #3932.

R=golang-dev, r, remyoudompheng
CC=golang-dev, rsc
https://golang.org/cl/6460069
2012-08-22 20:49:16 -07:00
Rob Pike
84a5a9b558 time: avoid data race in abs
Fixes #3967.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6460115
2012-08-22 14:36:23 -07:00
Dave Borowitz
2eb6a16e16 net/http: Set TLSClientConfig.ServerName on every HTTP request.
This makes SNI "just work" for callers using the standard http.Client.

Since we now have a test that depends on the httptest.Server cert, change
the cert to be a CA (keeping all other fields the same).

R=bradfitz
CC=agl, dsymonds, gobot, golang-dev
https://golang.org/cl/6448154
2012-08-22 09:15:41 -07:00
Joakim Sernbrant
2e6d0968e3 archive/zip: zip64 support
R=golang-dev, r, adg
CC=golang-dev
https://golang.org/cl/6463050
2012-08-22 11:05:24 +10:00
Nigel Tao
fa0e9cd279 exp/html: refactor the parser.read method.
R=andybalholm
CC=golang-dev
https://golang.org/cl/6463070
2012-08-21 20:59:02 +10:00
Dave Cheney
46c9346d74 net/http: fix misplaced defer and example
Moves the defer (again).

Also, correct the example documentation to match.

R=r, robert.hencke, iant, dsymonds, bradfitz
CC=golang-dev
https://golang.org/cl/6458158
2012-08-21 11:46:07 +10:00
Dave Cheney
2bdc60f8e7 net/http: fix send on close channel error
Fixes #3793.

Tested using GOMAXPROCS=81 which was able to trigger a panic
in TestStressSurpriseServerCloses continually on a Core i5.

R=fullung, bradfitz
CC=golang-dev
https://golang.org/cl/6445069
2012-08-21 11:18:16 +10:00
Dave Cheney
122a558f47 os: fix data race on Process.done
Fixes #3969.

R=dvyukov, r, alex.brainman, minux.ma
CC=golang-dev
https://golang.org/cl/6462081
2012-08-21 10:41:31 +10:00
Dmitriy Vyukov
922056d410 net: add TCP benchmarks
Current results on linux_amd64, 8 HT cores @2.4GHz:
BenchmarkTCPOneShot	   10000	    194037 ns/op
BenchmarkTCPOneShot-2	   20000	     93641 ns/op
BenchmarkTCPOneShot-4	   20000	     94039 ns/op
BenchmarkTCPOneShot-8	   20000	     94667 ns/op
BenchmarkTCPOneShot-16	   10000	    301924 ns/op
BenchmarkTCPOneShotTimeout	   10000	    193264 ns/op
BenchmarkTCPOneShotTimeout-2	   20000	     98247 ns/op
BenchmarkTCPOneShotTimeout-4	   20000	     94442 ns/op
BenchmarkTCPOneShotTimeout-8	   20000	     95297 ns/op
BenchmarkTCPOneShotTimeout-16	   10000	    307970 ns/op
BenchmarkTCPPersistent	   50000	     52050 ns/op
BenchmarkTCPPersistent-2	  100000	     29452 ns/op
BenchmarkTCPPersistent-4	  100000	     28823 ns/op
BenchmarkTCPPersistent-8	   50000	     30473 ns/op
BenchmarkTCPPersistent-16	   10000	    311777 ns/op
BenchmarkTCPPersistentTimeout	   50000	     32574 ns/op
BenchmarkTCPPersistentTimeout-2	   50000	     29723 ns/op
BenchmarkTCPPersistentTimeout-4	  100000	     28592 ns/op
BenchmarkTCPPersistentTimeout-8	  100000	     28997 ns/op
BenchmarkTCPPersistentTimeout-16	   10000	    314354 ns/op

R=golang-dev, alex.brainman, dave, mikioh.mikioh, r, iant, bradfitz, iant
CC=golang-dev
https://golang.org/cl/6458128
2012-08-20 21:27:52 +04:00
Volker Dobler
db645a024d strconv: consistent parameter names for ParseUint
If ParseUint is like ParseInt it should have the same parameter
names, thus rename b to to base as in ParseInt's documentation.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6453152
2012-08-20 22:30:04 +10:00
Dmitriy Vyukov
20f6a8fdaf net/http: reduce mutex contention
benchmark                           old ns/op    new ns/op    delta
BenchmarkClientServerParallel          155909       154454   -0.93%
BenchmarkClientServerParallel-2         86012        82986   -3.52%
BenchmarkClientServerParallel-4         70211        55168  -21.43%
BenchmarkClientServerParallel-8         80755        47862  -40.73%
BenchmarkClientServerParallel-12        77753        51478  -33.79%
BenchmarkClientServerParallel-16        77920        50278  -35.47%
The benchmark is https://golang.org/cl/6441134
The machine is 2 x 4 HT cores (16 HW threads total).
Fixes #3946.
Now contention moves to net.pollServer.AddFD().

R=bradfitz
CC=bradfitz, dave, dsymonds, gobot, golang-dev, remyoudompheng
https://golang.org/cl/6454142
2012-08-20 13:28:27 +04:00
Marcel van Lohuizen
a8357f0160 exp/locale/collate/build: fixed bug that was exposed by experimenting
with table changes.
NOTE: there is no test for this, but 1) the code has now the same
control flow as scan in exp/locale/collate/contract.go, which is
tested and 2) Builder verifies the generated table so bugs in this
code are quickly and easily found (which is how this bug was discovered).

R=r
CC=golang-dev
https://golang.org/cl/6461082
2012-08-20 10:56:41 +02:00
Marcel van Lohuizen
98883c811a exp/locale/collate: let regtest generate its own collation table.
The main table will need to get a slightly different collation table as the one
used by regtest, as the regtest is based on the standard UCA DUCET, while
the locale-specific tables are all based on a CLDR root table.
This change allows changing the table without affecting the regression test.

R=r
CC=golang-dev
https://golang.org/cl/6453089
2012-08-20 10:56:19 +02:00
Marcel van Lohuizen
2845e5881f exp/locale/collate: changed default AlternateHandling to non-ignorable, the same
default as ICU.

R=r
CC=golang-dev
https://golang.org/cl/6445080
2012-08-20 10:56:06 +02:00
Marcel van Lohuizen
6918357031 exp/locale/collate: Added test flag to maketables tool for comparing newly
against previously generated tables.

R=r
CC=golang-dev
https://golang.org/cl/6441098
2012-08-20 10:55:40 +02:00
Nigel Tao
2b14a48d54 exp/html: make the parser manipulate the tokenizer via exported methods
instead of touching the tokenizer's internal state.

R=andybalholm
CC=golang-dev
https://golang.org/cl/6446153
2012-08-20 11:04:36 +10:00
Mikkel Krautz
67924c1b60 crypto/tls: explicitly require ExtKeyUsageClientAuth for client certs
If we aren't explicit about the KeyUsages, the verifier
will treat the certificate as a server certificate and require
it to have a ExtKeyUsageServerAuth key usage.

R=golang-dev
CC=golang-dev
https://golang.org/cl/6453148
2012-08-18 15:50:33 -07:00
Rob Pike
3ba0f6daf5 fmt: honor integer radix formats (%d etc.) for pointers
Before, pointers always appeared as 0x1234ABCD. This CL
keeps that as the default for %p and %v, but lets explicit
numeric verbs override the default.
Fixes #3936.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/6441152
2012-08-17 16:12:25 -07:00
Rob Pike
deb53889c2 all: move defers to after error check to avoid nil indirection
Only affects some tests and none seem likely to be problematic, but let's fix them.
Fixes #3971.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/6463060
2012-08-17 11:55:11 -07:00
Joel Sing
1b6557a0cf runtime: fix netbsd/386 stack pointer handling
When manipulating the stack pointer use the UESP register instead
of the ESP register, since the UESP register is the one that gets
restored from the machine context. Fixes broken tests on netbsd/386.

R=golang-dev, minux.ma, r, bsiegert
CC=golang-dev
https://golang.org/cl/6465054
2012-08-17 21:53:02 +10:00
Andrew Balholm
d624f0c922 exp/html: simplify testing code
Now that the parser passes all tests in the test suite,
it is no longer necessary to keep track of which tests
pass and which don't. So remove the testlogs directory
and the code that uses it.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6453124
2012-08-16 09:31:22 +10:00
Robert Griesemer
ace14d01bd text/scanner: report illegal hexadecimal numbers (bug fix)
R=r
CC=golang-dev
https://golang.org/cl/6450136
2012-08-15 11:09:34 -07:00
Joel Sing
2ab18f69a6 os/exec: disable additional file descriptor test on netbsd
This currently fails on NetBSD due to the cloned file descriptors
that result from opening /dev/urandom. Disable the additional checking
until this is investigated and properly fixed.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/6443129
2012-08-16 02:06:21 +10:00
Joel Sing
b60d45f5b8 runtime: disable crash handler test on netbsd
Disable the crash handler test on NetBSD until I can figure out why
it triggers failures in later tests.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/6460090
2012-08-16 02:02:00 +10:00
Joel Sing
858bd05e2d net: implement netbsd sockoptip
Provide sockoptip for NetBSD, based on sockoptip for OpenBSD.

R=golang-dev, rsc, mikioh.mikioh, minux.ma
CC=golang-dev
https://golang.org/cl/6308053
2012-08-16 00:44:20 +10:00
Andrew Balholm
27cb1cbb2e exp/html: skip render and reparse on more tests that build badly-formed parse trees
All of the remaining tests that had as status of PARSE rather than PASS had
good reasons for not passing the render-and-reparse step: the correct parse tree is
badly formed, so when it is rendered out as HTML, the result doesn't parse into the
same tree. So add them to the list of tests where that step is skipped.

Also, I discovered that it is possible to end up with HTML elements (not just text)
inside a raw text element through reparenting. So change the rendering routines to
handle that situation as sensibly as possible (which still isn't very sensible, but
this is HTML5).

R=nigeltao
CC=golang-dev
https://golang.org/cl/6446137
2012-08-15 11:44:25 +10:00
Robert Griesemer
3df0545a8b go/scanner: faster scanning
Optimize some common cases.

benchmark            old ns/op    new ns/op    delta
BenchmarkScanFile       718907       667960   -7.09%

benchmark             old MB/s     new MB/s  speedup
BenchmarkScanFile        23.03        25.51    1.11x

R=r
CC=golang-dev
https://golang.org/cl/6454150
2012-08-14 11:26:30 -07:00
Adam Langley
7fa3b9f7ea exp/proxy: remove package.
This package has moved to go.net.

R=golang-dev, minux.ma, r, dave
CC=golang-dev
https://golang.org/cl/6461056
2012-08-14 13:04:14 -04:00
Andrew Balholm
3ba25e76a7 exp/html: generate replacement for <isindex> correctly
When generating replacement elements for an <isindex> tag, the old
addSyntheticElement method was producing the wrong nesting. Replace
it with parseImpliedToken.

Pass the one remaining test in the test suite.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6453114
2012-08-14 09:53:10 +10:00
Dmitriy Vyukov
6d5eb61ae7 net: remove unused fields
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/6454145
2012-08-14 01:57:24 +04:00
Dmitriy Vyukov
058149f153 runtime/pprof: fix comments
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/6460082
2012-08-14 01:51:42 +04:00
Andrew Balholm
aa9a81b1b0 exp/html: discard tags that are terminated by EOF instead of by '>'
If a tag doesn't have a closing '>', it isn't considered a tag;
it is just ignored and EOF is returned instead.

Pass one additional test in the test suite.

Change tokenizer tests to match correct behavior.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6454131
2012-08-13 12:07:44 +10:00
Robert Griesemer
a9d0ff6ead go/parser: exit early if source file does not contain text
Partial fix for issue 3943.

R=r
CC=golang-dev
https://golang.org/cl/6458115
2012-08-11 21:06:40 -07:00
Rob Pike
2253f67157 text/template/parse: fix bug handling /*/
Incorrect syntax for comment was erroneously accepted.
Fixes #3919.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6453105
2012-08-09 19:24:46 -07:00
Shenghou Ma
4f308edc86 runtime: use sched_getaffinity for runtime.NumCPU() on Linux
Fixes #3921.

R=iant
CC=golang-dev
https://golang.org/cl/6448132
2012-08-10 10:05:26 +08:00
Andrew Balholm
c5038c8593 exp/html: ignore self-closing flag except in SVG and MathML
In HTML content, having a self-closing tag is a parse error unless
the tag would be self-closing anyway (like <img>). The only place a
self-closing tag actually makes a difference is in XML-based foreign
content.

Pass 1 additional test.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6450109
2012-08-10 09:34:10 +10:00
Rémy Oudompheng
f087764abc go/build: correct shouldBuild bug reading whole contents of file.
It was caused by bytes.TrimSpace being able to return a nil
slice.

Fixes #3914.

R=golang-dev, r
CC=golang-dev, remy
https://golang.org/cl/6458091
2012-08-09 23:22:51 +02:00
Robert Griesemer
0f2529317f exp/types: add more import tests
Also simplified parsing of interface
types since they can only contain
methods (and no embedded interfaces)
in the export data.

R=rsc
CC=golang-dev
https://golang.org/cl/6446084
2012-08-09 11:55:00 -07:00
Shenghou Ma
20bf1a94e1 testing: add Verbose() to expose whether -test.v is set
Fixes #3350.

R=golang-dev, adg, r, fullung
CC=golang-dev
https://golang.org/cl/6445092
2012-08-09 23:41:09 +08:00
Rob Pike
18c378c259 text/template: add 'nil' as a keyword in the language
The keyword reprents an untyped nil and is useful for
passing nil values to methods and functions. The
nil will be promoted to the appropriate type when
used; if a type cannot be assigned, an error results.

R=rsc, dsymonds
CC=golang-dev
https://golang.org/cl/6459056
2012-08-08 20:02:19 -07:00
Andrew Balholm
22e918f5d6 exp/html: ignore </html> in afterBodyIM when parsing a fragment
Pass 1 additional test.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6454124
2012-08-09 10:19:25 +10:00
Andrew Balholm
e4a50195c3 exp/html: when ignoring <textarea> tag, switch tokenizer out of raw text mode
Pass 1 additional test.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6459060
2012-08-09 09:43:10 +10:00
Charles L. Dorian
a5c4e0fa2a math: update definition of NaN in assembly language files
R=rsc, minux.ma, golang-dev, nigeltao
CC=golang-dev
https://golang.org/cl/6461047
2012-08-09 09:40:05 +10:00
Rob Pike
c48b77b1b5 all: make Unicode surrogate halves illegal as UTF-8
Surrogate halves are part of UTF-16 and should never appear in UTF-8.
(The rune that two combined halves represent in UTF-16 should
be encoded directly.)

Encoding: encode as RuneError.
Decoding: convert to RuneError, consume one byte.

This requires changing:
        package unicode/utf8
        runtime for range over string
Also added utf8.ValidRune and fixed bug in utf.RuneLen.

Fixes #3927.

R=golang-dev, rsc, bsiegert
CC=golang-dev
https://golang.org/cl/6458099
2012-08-08 14:01:23 -07:00
Andrew Gerrand
4939b7b065 io: amend ReaderFrom doc as per r's comment
R=r
CC=golang-dev
https://golang.org/cl/6458097
2012-08-08 15:41:47 +10:00
Yves Junqueira
4230dd4c6c crypto/rand: Example for Read.
R=adg, remyoudompheng, rsc, r
CC=golang-dev
https://golang.org/cl/6457085
2012-08-08 12:04:54 +10:00
Andrew Balholm
fca45719a4 exp/html: foster-parent text correctly
If a table contained whitespace, text nodes would not get foster parented
correctly.

Pass 1 additional test.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6459054
2012-08-08 10:00:57 +10:00
Nigel Tao
5f7bec693d image/jpeg: send a correct Start Of Scan (SOS) header.
Section B.2.3 of http://www.w3.org/Graphics/JPEG/itu-t81.pdf discusses
the End of spectral selection (Se) byte.

Apparently many JPEG decoders ignore the Se byte (or let it through
with a warning), but some configurations reject them. For example,
http://download.blender.org/source/chest/blender_2.03_tree/jpeg/jcmaster.c
has these lines:

if (Ss != 0 || Se != DCTSIZE2-1 || Ah != 0 || Al != 0)
  ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);

Fixes #3916.

R=r
CC=golang-dev
https://golang.org/cl/6459052
2012-08-08 09:57:09 +10:00
Shenghou Ma
0157c72d13 runtime: inline several float64 routines to speed up complex128 division
Depends on CL 6197045.

Result obtained on Core i7 620M, Darwin/amd64:
benchmark                       old ns/op    new ns/op    delta
BenchmarkComplex128DivNormal           57           28  -50.78%
BenchmarkComplex128DivNisNaN           49           15  -68.90%
BenchmarkComplex128DivDisNaN           49           15  -67.88%
BenchmarkComplex128DivNisInf           40           12  -68.50%
BenchmarkComplex128DivDisInf           33           13  -61.06%

Result obtained on Core i7 620M, Darwin/386:
benchmark                       old ns/op    new ns/op    delta
BenchmarkComplex128DivNormal           89           50  -44.05%
BenchmarkComplex128DivNisNaN          307          802  +161.24%
BenchmarkComplex128DivDisNaN          309          788  +155.02%
BenchmarkComplex128DivNisInf          278          237  -14.75%
BenchmarkComplex128DivDisInf           46           22  -52.46%

Result obtained on 700MHz OMAP4460, Linux/ARM:
benchmark                       old ns/op    new ns/op    delta
BenchmarkComplex128DivNormal         1557          465  -70.13%
BenchmarkComplex128DivNisNaN         1443          220  -84.75%
BenchmarkComplex128DivDisNaN         1481          218  -85.28%
BenchmarkComplex128DivNisInf          952          216  -77.31%
BenchmarkComplex128DivDisInf          861          231  -73.17%

The 386 version has a performance regression, but as we have
decided to use SSE2 instead of x87 FPU for 386 too (issue 3912),
I won't address this issue.

R=dsymonds, mchaten, iant, dave, mtj, rsc, r
CC=golang-dev
https://golang.org/cl/6024045
2012-08-07 23:45:50 +08:00
Brad Fitzpatrick
c8423f9002 io: document ReaderFrom and WriterTo
Fixes #3711

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6445083
2012-08-07 16:10:10 +10:00
Yves Junqueira
b3caa2ba3c text/template: fix range example.
R=r
CC=adg, gobot, golang-dev
https://golang.org/cl/6449096
2012-08-06 20:40:43 -07:00
Andrew Balholm
5530a426ef exp/html: correctly handle <title> after </head>
The <title> element was getting removed from the stack of open elements,
when its parent, the <head> element should have been removed instead.

Pass 2 additional tests.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6449101
2012-08-07 13:36:08 +10:00
Alex Brainman
0bfa31e961 net/http: disable TestServeFileFromCWD test on windows
This is an attempt to fix windows build. Will restore
once we know what the problem is.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6461046
2012-08-07 13:19:49 +10:00
Shenghou Ma
6e9506a7b4 math, runtime: use a NaN that matches gcc's
our old choice is not working properly at least on VFPv2 in
ARM1136JF-S (it's not preserved across float64->float32 conversions).

        Fixes #3745.

R=dave, rsc
CC=golang-dev
https://golang.org/cl/6344078
2012-08-07 09:57:14 +08:00
Shenghou Ma
41645847b4 runtime: remove unnecessary ROUND in alg.c
Introduced in CL 6452046.

R=golang-dev, nigeltao, dave
CC=golang-dev
https://golang.org/cl/6459051
2012-08-07 09:49:56 +08:00
Andrew Balholm
2276ab92c1 exp/html: fix foster-parenting when elements are implicitly closed
When an element (like <nobr> or <p>) was implicitly closed by another
start tag, it would keep foster parenting from working because
the check for what was on top of the stack of open elements was
in the wrong place.

Move the check to addChild.

Pass 2 additional tests.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6460045
2012-08-07 09:35:09 +10:00
Russ Cox
e1cf7d6fb6 net: fix spurious EADDRNOTAVAIL errors
R=golang-dev, fullung
CC=golang-dev
https://golang.org/cl/6443085
2012-08-06 16:32:00 -04:00
Alexey Borzenkov
8b5d4c3c03 syscall: fix plan9 build broken by CL 6458050
R=golang-dev, rsc
CC=golang-dev, r, yarikos
https://golang.org/cl/6454104
2012-08-06 16:24:08 -04:00
Brad Fitzpatrick
2d2866ee84 net: fix TCPListener file leak to child processes
Hold ForkLock during dup of fd + cloexec in the net pkg,
per the locking policy documented in syscall/exec_unix.go.

R=golang-dev, dsymonds, adg
CC=golang-dev
https://golang.org/cl/6457080
2012-08-06 14:12:23 +10:00
Alexey Borzenkov
a108369c83 syscall: return EINVAL when string arguments have NUL characters
Since NUL usually terminates strings in underlying syscalls, allowing
it when converting string arguments is a security risk, especially
when dealing with filenames. For example, a program might reason that
filename like "/root/..\x00/" is a subdirectory or "/root/" and allow
access to it, while underlying syscall will treat "\x00" as an end of
that string and the actual filename will be "/root/..", which might
be unexpected. Returning EINVAL when string arguments have NUL in
them makes sure this attack vector is unusable.

R=golang-dev, r, bradfitz, fullung, rsc, minux.ma
CC=golang-dev
https://golang.org/cl/6458050
2012-08-05 17:24:32 -04:00
Benny Siegert
8efb70f92e syscall: add some new syscall numbers from NetBSD-current
R=golang-dev
CC=golang-dev
https://golang.org/cl/6454100
2012-08-05 17:02:41 -04:00
Rémy Oudompheng
77f3e189d2 runtime: faster string equality.
benchmark                                old ns/op    new ns/op    delta
BenchmarkCompareStringEqual                     51           35  -30.20%
BenchmarkCompareStringIdentical                 51            7  -85.71%
BenchmarkCompareStringSameLength                25           18  -28.29%
BenchmarkCompareStringDifferentLength            2            2   +1.46%

R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/6450092
2012-08-05 21:35:41 +02:00
Russ Cox
ea392b8849 bufio: discourage use of ReadLine
Too many people use it without reading what it does.
Those people want ReadBytes or ReadString.

Fixes #3906.

R=golang-dev, iant, r
CC=golang-dev
https://golang.org/cl/6442087
2012-08-05 14:32:09 -04:00
Rémy Oudompheng
ff03482fd6 strconv: speedup AppendFloat/FormatFloat.
The improvement is obtained by eliminating the zero
initialization of a large structure that is only
needed when the fast path fails.

Also add a missing roundtrip test for float32s.

benchmark                              old ns/op    new ns/op    delta
BenchmarkAppendFloatDecimal                  301          180  -40.20%
BenchmarkAppendFloat                         486          388  -20.16%
BenchmarkAppendFloatExp                      492          383  -22.15%
BenchmarkAppendFloatNegExp                   478          370  -22.59%
BenchmarkAppendFloatBig                      650          541  -16.77%
BenchmarkAppendFloat32Integer                308          180  -41.56%
BenchmarkAppendFloat32ExactFraction          449          333  -25.84%
BenchmarkAppendFloat32Point                  494          390  -21.05%
BenchmarkAppendFloat32Exp                    488          387  -20.70%
BenchmarkAppendFloat32NegExp                 488          378  -22.54%

R=r, rsc
CC=golang-dev, remy
https://golang.org/cl/6346081
2012-08-05 20:30:13 +02:00
Andrew Balholm
74db9d298b exp/html: don't treat SVG <title> like HTML <title>
The content of an HTML <title> element is RCDATA, but the content of an SVG
<title> element is parsed as tags. Now the parser doesn't go into RCDATA
mode in foreign content.

Pass 4 additional tests.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6448111
2012-08-05 22:32:35 +10:00
Ian Lance Taylor
6fa38e5e0a cmd/go, go/build, misc/swig: add SWIG support to Go tool
R=adg, rsc, franciscossouza, seb.binet, gen.battle
CC=golang-dev
https://golang.org/cl/5845071
2012-08-03 18:08:43 -07:00
Michał Derkacz
dee5adcf74 5a, 5l, math: Add support for ABSD, ABSF floating point instructions.
R=golang-dev, dave, rsc, minux.ma
CC=golang-dev
https://golang.org/cl/6225051
2012-08-03 16:15:11 -04:00
Adam Langley
728f191319 crypto/elliptic: explicitly handle P+P, ∞+P and P+∞
These aren't needed for scalar multiplication, but since we export a
generic Add function we should handle it.

This change also corrects two bugs in p224Contract that it turned up.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6458076
2012-08-03 15:42:14 -04:00
Mike Rosset
cf06750372 debug/elf: Add support for getting DynTag string table values.
R=rsc
CC=golang-dev
https://golang.org/cl/6430064
2012-08-03 14:46:20 -04:00
Robert Griesemer
f3a45d4695 go/build: tiny cleanup
R=rsc
CC=golang-dev
https://golang.org/cl/6453083
2012-08-03 10:45:02 -07:00
Adam Langley
e107742080 crypto/tls: remove flakey tests
This removes some (non-short only) tests that involved connections to
the outside world and thus were flakey. This does remove some test
coverage of the root fetchers on non-Windows platforms, but the right
place for that is crypto/x509.

R=golang-dev, krautz, rsc
CC=golang-dev
https://golang.org/cl/6455085
2012-08-03 13:28:05 -04:00
Adam Langley
bbb5f1bffb crypto/x509: support ECDSA keys when generating certificates.
We already support reading ECDSA certificates and this change adds
write support.

R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/6422046
2012-08-03 10:37:30 -04:00
Marcel van Lohuizen
89d40b911c exp/locale/collate: changed API of Builder to be more convenient
for dealing with CLDR files:
- Add now taxes a list of indexes of colelems that are variables. Checking and
  handling is now done by the Builder.  VariableTop is now also properly generated
  using the Build method.
- Introduced separate Builder, called Tailoring, for creating tailorings of root
  table.  This clearly separates the functionality for building a table based on
  weights (the allkeys* files) versus tables based on LDML XML files.
- Tailorings are now added by two calls instead of one: SetAnchor and Insert.
  This more closely reflects the structure of LDML side and simplifies the
  implementation of both the client and library side.  It also preserves
  some information that is otherwise hard to recover for the Builder.
- Allow the LDML XML element extend to be passed to Insert.  This simplifies
  both client and library implementation.

R=r
CC=golang-dev
https://golang.org/cl/6454061
2012-08-03 09:01:21 +02:00
Alex Brainman
b9b29ce2ba os: test that IsExist and IsNotExist handle PathError and LinkError
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6442080
2012-08-03 14:25:35 +10:00
Robert Griesemer
c12a63f7d3 go/scanner: fix minor typo
R=r
CC=golang-dev
https://golang.org/cl/6442076
2012-08-02 17:10:41 -07:00
Robert Griesemer
593c51cff1 go/ast: ast.Print must not crash with unexported fields
Don't print unexported struct fields; their values are
not accessible via reflection.

Fixes #3898.

Also:
- added support for arrays
- print empty maps, arrays, slices, structs on one line
  for a denser output
- added respective test cases

R=r
CC=golang-dev
https://golang.org/cl/6454089
2012-08-02 17:05:51 -07:00
Andrew Balholm
2f39a33b6a exp/html: in parse tests, discard only one trailing newline
Pass 2 additional tests.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6454090
2012-08-03 09:31:45 +10:00
Nigel Tao
1916db786f html: make the low-level tokenizer also skip end-tag attributes.
R=andybalholm
CC=golang-dev
https://golang.org/cl/6453071
2012-08-03 09:29:16 +10:00
Rémy Oudompheng
37d7500f8d exp/types: set non-embedded method type during GcImport.
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/6445068
2012-08-02 16:24:09 -07:00
Robert Griesemer
a4ac339f43 exp/types: enable cycle checks again
Process a package's object in a reproducible
order (rather then in map order) so that we
get error messages in reproducible order.

R=r
CC=golang-dev
https://golang.org/cl/6449076
2012-08-01 16:37:06 -07:00
Andrew Balholm
dbbfbcc4a1 exp/html: implement escaping and double-escaping in scripts
The text inside <script> tags is not ordinary raw text; there are all sorts
of other complications. This CL implements those complications.

Pass 76 additional tests.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6443070
2012-08-01 14:45:35 +10:00
Shenghou Ma
e07958f7df runtime: round return value address in runtime.equal
Fixes #3866.

R=rsc, r, nigeltao
CC=golang-dev
https://golang.org/cl/6452046
2012-07-31 23:02:46 -04:00
Alex Brainman
f2b8f6b451 os: Rename error to fit IsExist
Fixes #3828.

R=golang-dev, iant, rsc
CC=golang-dev
https://golang.org/cl/6420056
2012-08-01 12:55:04 +10:00
Robert Griesemer
152279f203 exp/types: Replace String method with TypeString function
This is more in sync with the rest of the package;
for instance, we have functions (not methods) to
deref or find the underlying type of a Type.

In the process use a single bytes.Buffer to create
the string representation for a type rather than
the (occasional) string concatenation.

R=r
CC=golang-dev
https://golang.org/cl/6458057
2012-07-31 19:30:18 -07:00
Robert Griesemer
dcb6f59811 exp/types: implement Type.String methods for testing/debugging
Also:
- replaced existing test with a more comprehensive test
- fixed bug in map type creation

R=r
CC=golang-dev
https://golang.org/cl/6450072
2012-07-31 17:09:12 -07:00
Andrew Balholm
9f3b00579e exp/html: tokenize attributes of end tags
If an end tag has an attribute that is a quoted string containing '>',
the tokenizer would end the tag prematurely. Now it reads the attributes
on end tags just as it does on start tags, but the high-level interface
still doesn't return them, because their presence is a parse error.

Pass 1 additional test.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6457060
2012-08-01 09:35:02 +10:00
Nigel Tao
695024b8fa image/png: tRNS chunk is *non*-alpha-premultiplied.
R=r
CC=golang-dev
https://golang.org/cl/6446062
2012-08-01 09:20:44 +10:00
Mikio Hara
4e7f765b12 net: disable IPv6 multicast tests unless external IPv6 connection is present
R=rsc
CC=golang-dev
https://golang.org/cl/6398052
2012-07-31 20:58:35 +09:00
Bobby Powers
7520f0b4aa httputil: accumulate X-Forwarded-For header info
If the X-Forwarded-For header already exists on a request, we
should append our client's IP to it after a comma+space instead
of overwriting it.

Fixes #3846.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6448053
2012-07-31 08:38:49 +10:00
Rob Pike
ad058cacfb text/template/parse/lex.go: fix typo
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6448081
2012-07-30 15:23:36 -07:00
Han-Wen Nienhuys
36fe436cba pkg/syscall: unexport Prlimit.
This syscall was inadvertently exported when fixing
Getrlimit/Setrlimit on 32-bit platforms.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/6458051
2012-07-31 08:21:24 +10:00
Rob Pike
20d9fd3ae1 text/template/parse: fix data race
The situation only affects diagnostics but is easy to fix.
When computing lineNumber, use the position of the last item
returned by nextItem rather than the current state of the lexer.
This is internal only and does not affect the API.

Fixes #3886.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/6445061
2012-07-30 15:11:20 -07:00
Rob Pike
4783ad82da regexp: fix glitch in doc for FindReaderIndex
Fixes #3878.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6457054
2012-07-30 12:46:50 -07:00
Brad Fitzpatrick
538b2122f1 net/http: don't allow zero byte in FileServer paths
Should probably be fixed in the syscall package, either
additional or instead of this CL.

Fixes #3842

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6442061
2012-07-30 13:57:30 +10:00
Brad Fitzpatrick
f8c6514a1c net/http: don't modify Request Method's case
This fixes a data race (usually just harmlessly updating
"GET" to "GET"), but also follows RFC 2616 Sec 5.1.1 which
says that the request method is case-sensitive.

Fixes #3881

R=golang-dev, rsc, dsymonds
CC=golang-dev
https://golang.org/cl/6446063
2012-07-30 10:05:24 +10:00
Russ Cox
7aa60d998a syscall: apply comment from Mikioh
This comment was suggested in CL 6456045
but never got applied.

R=mikioh, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/6447056
2012-07-29 19:50:23 -04:00
Alexey Borzenkov
5197fa8040 syscall: workaround accept() bug on Darwin
Darwin kernels have a bug in accept() where error result from
an internal call is not checked and socket is accepted instead
of ECONNABORTED error. However, such sockets have no sockaddr,
which results in EAFNOSUPPORT error from anyToSockaddr, making
Go http servers running on Mac OS X easily susceptible to
denial of service from simple port scans with nmap.
Fixes #3849.

R=golang-dev, adg, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/6456045
2012-07-30 09:02:24 +10:00
Benny Siegert
b4402a49b6 runtime/cgo: fix netbsd build
Copy over freebsd.c to netbsd.c.

Fixes #3823.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6398045
2012-07-29 18:51:06 -04:00
Han-Wen Nienhuys
4dc85d67cd syscall: don't clobber source files if mksyscall.pl fails.
R=golang-dev, minux.ma, r, rsc
CC=golang-dev
https://golang.org/cl/6353069
2012-07-29 17:59:14 -04:00
Andrew Balholm
eff32f573b exp/html: replace NUL with U+FFFD in text in foreign content
Pass 5 additional tests.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6452055
2012-07-29 16:29:49 +10:00
Marcel van Lohuizen
601045e87a exp/locale/collate: changed trie in first step towards support for multiple locales.
- Allow handles into the trie for different locales.  Multiple tables share the same
  try to allow for reuse of blocks.
- Significantly improved memory footprint and reduced allocations of trieNodes.
  This speeds up generation by about 30% and allows keeping trieNodes around
  for multiple locales during generation.
- Renamed print method to fprint.

R=r
CC=golang-dev
https://golang.org/cl/6408052
2012-07-28 18:44:14 +02:00
Rob Pike
48ca3f288c flag: fix bug in handling of booleans on error
Fixes #3869.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6448072
2012-07-27 16:13:29 -07:00
Shenghou Ma
88e858ac80 log/syslog: don't append \n if there is one
pkg log already appends a linefeed to the log message,
so log/syslog doesn't need to append another.

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/6441048
2012-07-27 14:22:27 -04:00
Alex Brainman
9c8ae6ca34 os: move epipecheck from file_posix.go and into file_unix.go to fix windows build
R=golang-dev
CC=golang-dev
https://golang.org/cl/6450058
2012-07-27 22:21:33 +10:00
Dmitriy Vyukov
ab9ccedefe os: fix data race in epipecheck()
Fixes #3860.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6443051
2012-07-27 15:05:13 +04:00
Andrew Balholm
a1f340fa1a exp/html: parse CDATA sections in foreign content
Also convert NUL to U+FFFD in comments.

Pass 23 additional tests.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6446055
2012-07-27 16:05:25 +10:00
Ian Lance Taylor
b9e051e82d runtime: ignore signal 33 == SIGSETXID on GNU/Linux
When a cgo program calls setuid, setgid, etc., the GNU/Linux
pthread library sends signal SIGSETXID to each thread to tell
it to update its UID info.  If Go is permitted to intercept
the default SIGSETXID signal handler, the program will hang.

This patch tells the runtime package to not try to intercept
SIGSETXID on GNU/Linux.  This will be odd if a Go program
wants to try to use that signal, but it means that cgo
programs that call setuid, etc., won't hang.

Fixes #3871.

R=rsc, r, minux.ma, bradfitz
CC=golang-dev
https://golang.org/cl/6455050
2012-07-26 22:46:20 -07:00
Robert Griesemer
a7c74d52dc go/printer: don't crash if ast.FuncType.Params is nil
The go/ast comment for FuncType.Params says that the field may be nil.
Make sure the printer accepts such a value. The go/parser always sets
the field (to provide parenthesis position information), but a program
creating a Go AST from scatch may not.

Added corresponding test case.

Fixes #3870.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6448060
2012-07-26 17:09:11 -07:00
Andrew Balholm
55f0c8b2cd exp/html: replace NUL bytes in plaintext, raw text, and RCDATA
If NUL bytes occur inside certain elements, convert them to U+FFFD
replacement character.

Pass 1 additional test.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6452047
2012-07-27 09:27:10 +10:00
Andrew Wilkins
d399b681a4 exp/types: process ast.Fun in checkObj; fix variadic function building
Fixed creation of Func's, taking IsVariadic from parameter list rather
than results.

Updated checkObj to process ast.Fun objects.

R=gri
CC=golang-dev
https://golang.org/cl/6402046
2012-07-26 11:47:46 -07:00
Andrew Balholm
899be50991 exp/html: don't insert empty text nodes
Pass 1 additional test.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6443048
2012-07-26 10:32:24 +10:00
Brad Fitzpatrick
9b1412701f testing: allow concurrent use of T and B
Notably, allow concurrent logging and failing.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6453045
2012-07-25 10:17:27 -07:00
Andrew Balholm
4d22519678 exp/html: allow frameset if body contains whitespace
If the body of an HTML document contains text, the <frameset> tag is
ignored. But not if the text is only whitespace.

Pass 4 additional tests.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6442043
2012-07-25 12:09:58 +10:00
David Symonds
3e980e24c1 encoding/gob: test for type registration name.
R=r
CC=golang-dev
https://golang.org/cl/6435044
2012-07-25 09:31:27 +10:00
Mikio Hara
c1f2ec384f net: fix comment
RemoteAddr returns not only UDPAddr but IPAddr.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/6401054
2012-07-24 21:57:18 +09:00
Rob Pike
ce274339a1 text/template: fix bug in map indexing
If the key is not present, return value of the type of the element
not the type of the key. Also fix a test that should have caught this case.

Fixes #3850.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6405078
2012-07-23 16:19:12 -07:00
Rob Pike
7b73251d3d encoding/gob: revert 6348067, which broke compatibility
Add commentary to explain better what's going on, but the
code change is a simple one-line reversal to the previous
form.

R=rsc
CC=golang-dev
https://golang.org/cl/6428072
2012-07-23 13:34:46 -07:00
Andrew Balholm
f979528ce6 exp/html: special handling for entities in attributes
Don't unescape entities in attributes when they don't end with
a semicolon and they are followed by '=', a letter, or a digit.

Pass 6 more tests from the WebKit test suite, plus one that was
commented out in token_test.go.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6405073
2012-07-23 12:39:58 +10:00
Patrick Mylund Nielsen
614cb3b8dd encoding/binary: fix typo: ReadVarint returns an int64, not a uint64.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6432062
2012-07-22 10:26:32 +10:00
Mikio Hara
3a112a8112 net: remove unnecessary newline in testing.Logf from tests
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6434043
2012-07-22 01:49:58 +09:00
Mikio Hara
d380a97750 net: fix file descriptor leak on FileListener, FileConn and FilePacketConn
R=golang-dev, dave, r
CC=golang-dev
https://golang.org/cl/6430062
2012-07-22 01:48:15 +09:00
Gustavo Niemeyer
c0efcac6a9 bytes: make Join return a new buffer on len(a) == 1
Fixes #3844.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6432054
2012-07-20 16:04:22 -03:00
Mikio Hara
7bf8355dc7 net: fix typo
R=golang-dev, bsiegert, r
CC=golang-dev
https://golang.org/cl/6428050
2012-07-20 08:32:25 +09:00
Rob Pike
fc360f2381 unicode/utf8: reject out-of-range runes.
Surrogates are still admitted, but I have sent mail to golang-dev on that topic.

Fixes #3785.

R=golang-dev, rogpeppe, iant
CC=golang-dev
https://golang.org/cl/6398049
2012-07-19 11:58:14 -07:00
Rob Pike
55ff3f7076 sync: mention that WaitGroup.Add panics
Fixes #3839.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6428053
2012-07-19 11:55:03 -07:00
Brad Fitzpatrick
dfd7f18130 net/http: revert back to (and test) Go 1 CheckRedirect behavior
If a Client's CheckRedirect function returns an error, we
again return both a non-nil *Response and a non-nil error.

Fixes #3795

R=golang-dev, n13m3y3r
CC=golang-dev
https://golang.org/cl/6429044
2012-07-18 13:48:39 -07:00
Rémy Oudompheng
dd78f745c4 testing: fix memory blowup when formatting many lines.
Fixes #3830.

R=golang-dev, r
CC=golang-dev, remy
https://golang.org/cl/6373047
2012-07-17 07:56:25 +02:00
Nigel Tao
da4eef402d compress/flate: fix panic when nlit is out of bounds.
Fixes #3815.

R=r
CC=golang-dev
https://golang.org/cl/6352109
2012-07-16 12:01:18 +10:00
Benny Siegert
e726197858 os: add missing full stop in comment
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6399047
2012-07-15 09:48:31 -07:00
Rob Pike
bbe601789c encoding/gob: disable fuzz tests unless command-line flag is set
They can generate huge amounts of memory, causing failure on
small machines. Also they can be very slow. So slow that one test
was commented out! We uncomment it and use a flag.

Fixes #3742.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6373044
2012-07-13 14:23:51 -07:00
Marcel van Lohuizen
882b6ef454 exp/locale/collate: This CL includes the following changes:
- Changed the representation of colElem to support a few cases
  for some languages not supported by the current format.
- Changed offsets for implicit primary values. This makes the
  values both easier to read and debug (last 4 nibbles are identical to
  implicit primary value) and also results in better packing.
- Fixed bug in weight conversion code that did not pop up yet by
  sheer luck.
Note that tables.go also includes changes to the contraction trie
from CL 6346092.

R=r, mpvl
CC=golang-dev
https://golang.org/cl/6392060
2012-07-13 11:38:22 +02:00
Marcel van Lohuizen
adc19ac5e3 exp/locale/collate: adjusted contraction trie to support Myanmar (Burmese),
which has a rather large contraction table. The value of the next state
offset now starts after the current block, instead of before.  This is
slightly less efficient (on extra addition per state change), but gives
some extra range for the offsets.
Also introduced constants for final (0) and noIndex (0xFF).
tables.go is updated in a separate CL.

R=r
CC=golang-dev
https://golang.org/cl/6346092
2012-07-13 11:38:00 +02:00
Rob Pike
37519d950d encoding/gob: reduce decoder memory
Gob decoding reads a whole message into memory and then
copies it into a bytes.Buffer. For large messages this wastes
an entire copy of the message. In this CL, we use a staging
buffer to avoid the large temporary.

Update #2539
RSS drops to 775MB from 1GB.
Active memory drops to 858317048 from 1027878136,
essentially the size of one copy of the input file.

R=dsymonds, nigeltao
CC=golang-dev
https://golang.org/cl/6392057
2012-07-12 20:53:17 -07:00
Rob Pike
1255a6302d bytes.Buffer: export the Grow method
Allows a client to pre-allocate buffer space that is known to be necessary,
avoiding expensive reallocations.

R=gri, gri, adg
CC=golang-dev
https://golang.org/cl/6392061
2012-07-12 20:52:19 -07:00
Robert Griesemer
6a135a0894 mat/big: more optimal Karatsuba threshold
benchmark           old ns/op    new ns/op    delta
BenchmarkHilbert      6253043      6267289   +0.23%
BenchmarkMul         45355940     39490633  -12.93%

R=r
CC=golang-dev
https://golang.org/cl/6355104
2012-07-12 14:19:09 -07:00
Robert Griesemer
98ca655919 math/big: minor performance tuning
Reuse temporary slice to avoid extra allocations
(originally done correctly by remyoudompheng@gmail.com
in https://golang.org/cl/6345075/).

benchmark           old ns/op    new ns/op    delta
BenchmarkHilbert      6252790      6262304   +0.15%
BenchmarkMul         45827438     45301002   -1.15%

R=r
CC=golang-dev
https://golang.org/cl/6346097
2012-07-12 14:12:50 -07:00
Rob Pike
1fa32d21a9 encoding/gob: fix check for short input in slice decode
R=golang-dev, dsymonds, r, nigeltao
CC=golang-dev
https://golang.org/cl/6374059
2012-07-12 10:23:54 -07:00
Rémy Oudompheng
ac12131649 math/big: correct quadratic space complexity in Mul.
The previous implementation used to have a O(n) recursion
depth for unbalanced inputs. A test is added to check that a
reasonable amount of bytes is allocated in this case.

Fixes #3807.

R=golang-dev, dsymonds, gri
CC=golang-dev, remy
https://golang.org/cl/6345075
2012-07-12 10:18:24 -07:00
Brad Fitzpatrick
8a2a5013c9 net/http: fix Transport race(s) with high GOMAXPROCS
Also adds a new test for GOMAXPROCS=16 explicitly, which now passes
reliably in a stress loop like:

$ go test -c
$ (while ./http.test -test.v -test.run=Concurrency; do echo pass; done ) 2>&1 | tee foo; less foo

(It used to fail very quickly and reliably on at least Linux/amd64)

Fixes #3793

R=golang-dev, adg, r
CC=golang-dev
https://golang.org/cl/6347061
2012-07-11 16:40:44 -07:00
Adam Langley
93ea79ee7e crypto/rsa: left-pad PKCS#1 v1.5 outputs.
OpenSSL requires that RSA signatures be exactly the same byte-length
as the modulus. Currently it'll reject ~1/256 of our signatures: those
that end up a byte shorter.

Fixes #3796.

R=golang-dev, edsrzf, r
CC=golang-dev
https://golang.org/cl/6352093
2012-07-11 12:47:12 -04:00
Adam Langley
eeffa738a9 encoding/asn1: promote untyped strings to UTF8 as needed.
Previously, strings that didn't have an explicit ASN.1 string type
were taken to be ASN.1 PrintableStrings. This resulted in an error if
a unrepresentable charactor was included.

For compatibility reasons, I'm too afraid to switch the default string
type to UTF8String, but this patch causes untyped strings to become
UTF8Strings if they contain a charactor that's not valid in a
PrintableString.

Fixes #3791.

R=golang-dev, bradfitz, r, r
CC=golang-dev
https://golang.org/cl/6348074
2012-07-10 18:23:30 -04:00
Adam Langley
685a61df7e crypto/x509: exempt broken Entrust certificate from checks.
Entrust have issued a root certificate that's not marked as valid for
signing certificates.

This results in Go programs failing to validate certificates that
chain up to this root (i.e. gateway.push.apple.com:2195).

Although this is clearly a mistake on Entrust's part, it seems that we
will have to bodge around it.

R=golang-dev, dave, r
CC=golang-dev
https://golang.org/cl/6346064
2012-07-10 15:57:51 -04:00
Rémy Oudompheng
d6147d8102 strconv: extend Grisu3 algorithm to float32.
Also improve extfloat.Normalize to obtain a modest performance
gain in parsing, and add a shortcut path for exact integers.

benchmark                              old ns/op    new ns/op    delta
BenchmarkAtof64Decimal                        73           73   -0.54%
BenchmarkAtof64Float                          91           91   -0.54%
BenchmarkAtof64FloatExp                      198          180   -9.09%
BenchmarkAtof64Big                           307          308   +0.33%

BenchmarkAtof32Decimal                        72           72   +0.42%
BenchmarkAtof32Float                          83           83   -0.72%
BenchmarkAtof32FloatExp                      212          186  -12.26%
BenchmarkAtof32Random                        262          250   -4.58%

BenchmarkAppendFloatDecimal                  474          305  -35.65%
BenchmarkAppendFloat                         497          489   -1.61%
BenchmarkAppendFloatExp                      493          483   -2.03%
BenchmarkAppendFloatNegExp                   481          481   +0.00%
BenchmarkAppendFloatBig                      667          652   -2.25%

BenchmarkAppendFloat32Integer                338          307   -9.17%
BenchmarkAppendFloat32ExactFraction          364          439  +20.60%
BenchmarkAppendFloat32Point                 1299          490  -62.28%
BenchmarkAppendFloat32Exp                   2593          489  -81.14%
BenchmarkAppendFloat32NegExp                5116          481  -90.60%

R=rsc, r
CC=golang-dev, remy
https://golang.org/cl/6303087
2012-07-10 07:44:23 +02:00
David G. Andersen
106dd3c93f syscall/freebsd: remove Sendfile from unimplemented list
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/6343084
2012-07-09 09:37:56 -07:00
David G. Andersen
e66d29cdcf pkg: Removing duplicated words ("of of", etc.), mostly from comments.
Ran 'double.pl' on the pkg tree to identify doubled words.
One change to an error string return in x509;  the rest are in comments.
Thanks to Matt Jibson for the idea.

R=golang-dev, bsiegert
CC=golang-dev
https://golang.org/cl/6344089
2012-07-09 09:16:10 +10:00
Matthew William Jibson
f83a47cbb9 doc: various "the the" and other typos
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6355076
2012-07-08 11:57:04 +10:00
Dmitriy Vyukov
a54f920bfe runtime: move panic/defer/recover-related stuff to a separate file
Move panic/defer/recover-related stuff from proc.c/runtime.c to a new file panic.c.
No semantic changes.
proc.c is 1800+ LOC and is a bit difficult to work with.

R=golang-dev, dave, r
CC=golang-dev
https://golang.org/cl/6343071
2012-07-04 14:52:51 +04:00
Robert Griesemer
6044dbdf1b reflect: reflect.Zero results are neither addressable nor settable
This could be deduced from "The Laws of Reflection" but it seems
worthwhile highlighting it.

R=r
CC=golang-dev
https://golang.org/cl/6350073
2012-07-03 16:06:24 -07:00
Rémy Oudompheng
1a0a09dafe math/rand: avoid use of math.Pow in tests.
The use of math.Pow for mere squaring can be extremely
slow on soft-float ARM. Even on systems with hardware
floating-point, a speedup in test duration is observed.

On amd64
Before: ok      math/rand       2.009s
After:  ok      math/rand       0.340s

Fixes #3740.

R=dave, golang-dev, r, r
CC=golang-dev
https://golang.org/cl/6348061
2012-07-04 00:38:01 +02:00
Brad Fitzpatrick
55cc1ff721 net/http: clean up fs tests a bit
And fix some govet-caught format arg issues.

R=r
CC=golang-dev
https://golang.org/cl/6354068
2012-07-03 10:17:55 -07:00
Rob Pike
b04bf3882b encoding/gob: fix bug in Register
The old code added a star but did not indirect the reflect.Type.

R=bradfitz
CC=golang-dev
https://golang.org/cl/6348067
2012-07-03 10:05:27 -07:00
David G. Andersen
7b6541a593 syscall: fix FreeBSD 386 sendfile
The previous version was not handling an off_t (64 bit)
parameter on 32 bit i386 systems.  This patch splits sendfile
into two implementations in their respective arch-specific files.
Tested on FreeBSD amd64 and i386.

R=bradfitz
CC=golang-dev
https://golang.org/cl/6356048
2012-07-03 08:16:43 -07:00
Dmitriy Vyukov
a0c688331f runtime: refactor proc.c
1. Rename 'g' and 'm' local vars to 'gp' and 'mp' (convention already used in some functions)
'g' and 'm' are global vars that mean current goroutine and current machine,
when they are shadowed by local vars, it's confusing, no ability to debug log both, etc.
2. White-space shuffling.
No semantic changes.
In preparation to bigger changes.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/6355061
2012-07-03 12:54:13 +04:00
Han-Wen Nienhuys
8b7d39e7b6 syscall: use 32 bits structure for Getrlimit/Setrlimit on 386/ARM.
Fixes #2492

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/6295073
2012-07-02 22:57:32 -07:00
Nigel Tao
18e86644a3 cmd/gc: cache itab lookup in convT2I.
There may be further savings if convT2I can avoid the function call
if the cache is good and T is uintptr-shaped, a la convT2E, but that
will be a follow-up CL.

src/pkg/runtime:
benchmark                  old ns/op    new ns/op    delta
BenchmarkConvT2ISmall             43           15  -64.01%
BenchmarkConvT2IUintptr           45           14  -67.48%
BenchmarkConvT2ILarge            130          101  -22.31%

test/bench/go1:
benchmark                 old ns/op    new ns/op    delta
BenchmarkBinaryTree17    8588997000   8499058000   -1.05%
BenchmarkFannkuch11      5300392000   5358093000   +1.09%
BenchmarkGobDecode         30295580     31040190   +2.46%
BenchmarkGobEncode         18102070     17675650   -2.36%
BenchmarkGzip             774191400    771591400   -0.34%
BenchmarkGunzip           245915100    247464100   +0.63%
BenchmarkJSONEncode       123577000    121423050   -1.74%
BenchmarkJSONDecode       451969800    596256200  +31.92%
BenchmarkMandelbrot200     10060050     10072880   +0.13%
BenchmarkParse             10989840     11037710   +0.44%
BenchmarkRevcomp         1782666000   1716864000   -3.69%
BenchmarkTemplate         798286600    723234400   -9.40%

R=rsc, bradfitz, go.peter.90, daniel.morsing, dave, uriel
CC=golang-dev
https://golang.org/cl/6337058
2012-07-03 09:09:05 +10:00
David G. Andersen
917f764382 math/big: Remove unnecessary test from nat.go multiplication
The switch at the beginning of the function already ensures n > 1,
so testing for n < 2 is redundant.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/6350051
2012-07-02 15:30:00 -07:00
Dmitriy Vyukov
21de1ab359 reflect: set GOMAXPROCS=1 in the malloc test
Occasionally I see:
--- FAIL: TestAllocations-15 (0.00 seconds)
        all_test.go:1575: 6 mallocs after 100 iterations
Tested:
$ go test -cpu=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 reflect

R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/6354063
2012-07-02 20:55:08 +04:00
Dmitriy Vyukov
804e562a62 net/http: fix comment
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6348062
2012-07-02 20:10:31 +04:00
Shenghou Ma
435a001d68 image: fix doc typo
Fixes #3789.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6357058
2012-07-01 23:12:42 -04:00
Dmitriy Vyukov
ed516df4e4 runtime: add freemcache() function
It will be required for scheduler that maintains
GOMAXPROCS MCache's.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6350062
2012-07-01 13:10:01 +04:00
Brad Fitzpatrick
f06b12f0c7 net/http: ignore malicious or dumb Range requests
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6356050
2012-06-30 12:26:06 -07:00
Alex Brainman
c644a4ddfe path/filepath: avoid allocation in Clean of cleaned path even on windows (fix build)
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6344049
2012-06-30 22:08:53 +10:00
Brad Fitzpatrick
fa6f9b4a3e net/http: support multiple byte ranges in ServeContent
Fixes #3784

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6351052
2012-06-29 07:44:04 -07:00
Andrey Mirtchovski
4c3dc1ba74 net/http: Fix a verb-tense mismatch and a typo in documentation.
R=bradfitz
CC=golang-dev
https://golang.org/cl/6357049
2012-06-28 15:18:35 -07:00
Robert Griesemer
72a2abf8ad go/parser: minor internal cleanups
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6356046
2012-06-28 12:22:47 -07:00
Han-Wen Nienhuys
8907f94a51 path/filepath: add test case for rooted ".."
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6350047
2012-06-28 09:46:44 -07:00
Joe Poirier
8357dc9015 syscall: add missing argument type
And update implementation location comment.

R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/6352046
2012-06-27 18:21:48 -05:00
Mathieu Lonjaret
b6cc39d0dd image/jpeg: support for reading 4:4:0 subsampling.
Updates #2362.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6326057
2012-06-27 14:37:17 -07:00
Russ Cox
71643b2fdb runtime: fix string optimization
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6354048
2012-06-27 17:32:41 -04:00
Russ Cox
8744d35dd3 runtime: avoid allocation for "" + x + ""
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6359043
2012-06-27 17:06:49 -04:00
Russ Cox
f009fefd79 net: fix build (FreeBSD sendfile)
TBR=bradfitz
CC=golang-dev
https://golang.org/cl/6358043
2012-06-27 17:02:39 -04:00
Russ Cox
9525372e31 path/filepath: avoid allocation in Clean of cleaned path
Alternative to https://golang.org/cl/6330044.

Fixes #3681.

R=golang-dev, r, hanwen, iant
CC=golang-dev
https://golang.org/cl/6335056
2012-06-27 16:52:36 -04:00
Dmitriy Vyukov
5a5e698c8f runtime: add goroutine creation benchmark
Current results on 2 core darwin/amd64:
BenchmarkGoroutineChain		351 ns/op
BenchmarkGoroutineChain-2	3840 ns/op
BenchmarkGoroutineChain-4	4040 ns/op
BenchmarkConcGoroutineChain	350 ns/op
BenchmarkConcGoroutineChain-2	875 ns/op
BenchmarkConcGoroutineChain-4	2027 ns/op

R=r, rsc
CC=golang-dev
https://golang.org/cl/6332054
2012-06-27 21:57:49 +04:00
Russ Cox
596762e9a1 syscall: fix build
I missed the API change in the last FreeBSD CL, but the tool caught it.

TBR=bradfitz
CC=golang-dev
https://golang.org/cl/6331063
2012-06-25 20:45:18 -04:00
Patrick Mylund Nielsen
abb3c0618b net/http: provide access to POST-only form values
Fixes #3630.

R=rsc
CC=bradfitz, dsymonds, golang-dev, rodrigo.moraes
https://golang.org/cl/6210067
2012-06-25 20:41:46 -04:00
L Campbell
a9a8d7b544 syscall, net: sendfile for FreeBSD
R=golang-dev, rsc, bradfitz, devon.odell
CC=golang-dev
https://golang.org/cl/6221054
2012-06-25 20:26:19 -04:00
Rob Pike
a308be5fa8 fmt: set p.field before nil check
Fixes #3752.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6331062
2012-06-25 16:48:20 -07:00
Dave Cheney
d1537809ba runtime: add arm soft division and modulo benchmarks
arm soft div and mod performance plays an important part
in runtime performance.

The currently implementation is very stable, but we believe
we can best it. This benchmark provides a reference point.

linux/arm omap4 pandaboard

BenchmarkUint32Div7     10000000               298 ns/op
BenchmarkUint32Div37    10000000               298 ns/op
BenchmarkUint32Div123   10000000               298 ns/op
BenchmarkUint32Div763   10000000               298 ns/op
BenchmarkUint32Div1247  10000000               299 ns/op
BenchmarkUint32Div9305  10000000               298 ns/op
BenchmarkUint32Div13307 10000000               298 ns/op
BenchmarkUint32Div52513 10000000               298 ns/op
BenchmarkUint32Div60978747      10000000               298 ns/op
BenchmarkUint32Div106956295     10000000               297 ns/op
BenchmarkUint32Mod7     10000000               280 ns/op
BenchmarkUint32Mod37    10000000               280 ns/op
BenchmarkUint32Mod123   10000000               280 ns/op
BenchmarkUint32Mod763   10000000               280 ns/op
BenchmarkUint32Mod1247  10000000               280 ns/op
BenchmarkUint32Mod9305  10000000               280 ns/op
BenchmarkUint32Mod13307 10000000               280 ns/op
BenchmarkUint32Mod52513 10000000               280 ns/op
BenchmarkUint32Mod60978747      10000000               280 ns/op
BenchmarkUint32Mod106956295     10000000               280 ns/op

R=minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6258067
2012-06-26 08:58:00 +10:00
Jonathan Gold
b7bb1e32d8 encoding/json: add Number type
Number represents the actual JSON text,
preserving the precision and
formatting of the original input.

R=rsc, iant
CC=golang-dev
https://golang.org/cl/6202068
2012-06-25 17:36:09 -04:00
Michael Stapelberg
dfbd42e4f8 net: fix lookup of AAAA-only hosts without cgo
Fixes #3762.

R=rsc
CC=golang-dev
https://golang.org/cl/6303106
2012-06-25 17:32:39 -04:00
Pieter Droogendijk
baaa08eab0 go/build: fix doc typo
go/build section "Build Constraints", first paragraph said:
  "... they must be appear near the top of the file ..."
fixed to:
  "... they must appear near the top of the file ..."

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6329060
2012-06-25 17:20:48 -04:00
Thomas Alan Copeland
c08ff027c4 encoding/base32, encoding/base64: removed unneeded break label
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6305086
2012-06-25 17:18:50 -04:00
Micah Stetson
51ff2ef409 encoding/json: simplify (*decodeState).indirect
Removes an incorrect code comment and some superfluous variables.

The comment I removed says that struct fields which implement
Unmarshaler must be pointers, even if they're in an addressable
struct. That's not the case, and there's already a test in decode_test.go
that demonstrates as much.

Encoding/json has quite a few assignments of reflect.Values to extra
variables – things like "iv := v" when there's no need to make a copy. I
think these are left over from a previous version of the reflect API. If they
aren't wanted, I wouldn't mind going through the package and getting
rid of the rest of them.

R=rsc
CC=golang-dev
https://golang.org/cl/6318047
2012-06-25 16:03:18 -04:00
Jan Ziak
32a0cbb881 encoding/csv, encoding/xml: report write errors
Fixes #3773.

R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/6327053
2012-06-25 16:00:35 -04:00
Robert Griesemer
277e7e57ca go/ast: minor comment maps API change
This is a new, not yet committed API.

- Changed NewCommentMap to be independent of
  *File nodes and more symmetric with the
  Filter and Comments methods.

- Implemented Update method for use in
  AST modifications.

- Implemented String method for debugging

R=rsc
CC=golang-dev
https://golang.org/cl/6303086
2012-06-25 11:27:54 -07:00
Jan Ziak
b3382ec9e9 exp/inotify: prevent data race
Fixes #3713.

R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/6331055
2012-06-25 14:08:09 -04:00
Brad Fitzpatrick
5e75337c4e net/http: speed up Header.WriteSubset
A few performance improvements, but without the stack sorting
change to avoid allocating, which is instead waiting on better
escape analysis.

R=rsc
CC=golang-dev
https://golang.org/cl/6265047
2012-06-25 08:54:36 -07:00
Dave Cheney
3a50bc1a24 runtime: remove memset/memclr shim
This CL resolves https://golang.org/cl/6300043/#msg3
by renaming memset_arm.s to memclr_arm.s and merging the function
of the same name from asm_arm.s.

R=minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6336054
2012-06-25 23:01:34 +10:00
Dmitriy Vyukov
902911bcff runtime: fix potential GC deadlock
The issue seems to not be triggered right now,
but I've seen the deadlock after some other legal
modifications to runtime.
So I think we are safer this way.

R=rsc, r
CC=golang-dev
https://golang.org/cl/6339051
2012-06-25 11:08:09 +04:00
Russ Cox
bca01cd0bf runtime: detect hash map collision problems
This can only happen if the hash function we're using is getting
far more than it's fair share of collisions, but that has happened
to us repeatedly as we've expanded the allowed use cases for
hash tables (issue 1544, issue 2609, issue 2630, issue 2883, issue 3695).
Maybe this will help the next time we try something new.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6306083
2012-06-24 19:47:50 -04:00
Charles L. Dorian
35c3afdb62 math: improve Atan, Asin and Acos accuracy
pkg/math/all_test.go tests Atan (and therefore Asin and Acos) to a
relative accuracy of 4e-16, but the test vector misses values where
the old algorithm was in error by more than that. For example:

x            newError   oldError
0.414215746  1.41e-16  -4.24e-16
0.414216076  1.41e-16  -4.24e-16
0.414217632  1.41e-16  -4.24e-16
0.414218770  1.41e-16  -4.24e-16
0.414225466  0         -5.65e-16
0.414226244  1.41e-16  -4.24e-16
0.414228756  0         -5.65e-16
0.414235089  0         -5.65e-16
0.414237070  0         -5.65e-16

R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/6302093
2012-06-24 19:39:07 -04:00
Han-Wen Nienhuys
d36c095da9 os: make POSIX StartProcess work with chroot again.
Skip directory check in startProcess in the presence of
SysProcAttr.

Fixes #3649.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6297083
2012-06-24 19:34:06 -04:00
Jan Ziak
f5f3c3fe09 exp/inotify: prevent data race during testing
Fixes #3714.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6341047
2012-06-24 19:22:48 -04:00
Dave Cheney
e34079bb59 runtime: avoid r9/r10 during memmove
Fixes #3718.

Requires CL 6300043.

R=rsc, minux.ma, extraterrestrial.neighbour
CC=golang-dev
https://golang.org/cl/6305100
2012-06-25 08:28:30 +10:00
Dave Cheney
07826038c3 runtime: avoid r9/r10 during memset
Partially fixes issue 3718.

R=golang-dev, rsc, minux.ma
CC=golang-dev
https://golang.org/cl/6300043
2012-06-25 07:59:50 +10:00
David Symonds
c123c6c3f6 flag: fix indexing doc.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6341046
2012-06-24 12:23:51 -07:00
Brad Fitzpatrick
93b7d1bf1e net/http: fix doc inaccuracy and typo; tighten test
Note url.Error wrapping, and s/issue/issuing/.

Fixes #3724

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6294093
2012-06-24 10:41:12 -07:00
Shenghou Ma
a033e36766 runtime: fix struct Sigaction for Linux/386
We need to use kernel headers to generate defs_linux_$GOARCH.h

R=golang-dev, dave, alex.brainman, iant
CC=golang-dev
https://golang.org/cl/6296091
2012-06-24 01:41:17 +08:00
David G. Andersen
e2f2929d85 net/rpc: fix typo in documentation, clarify semantics of error return
Several of my students were confused by trying to use both the error
return and a reply return, so I figured it was worth explicitly clarifying
that returning an error overrides the reply.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6327051
2012-06-22 15:07:22 -07:00
David G. Andersen
75344d3d5b encoding/json: fix minor typo in documentation for Marshal
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6325053
2012-06-22 14:43:41 -07:00
Adam Langley
7f689864d8 crypto/x509: add extended key usage support.
Flame motivated me to get around to adding extended key usage support
so that code signing certificates can't be used for TLS server
authentication and vice versa.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6304065
2012-06-20 16:18:56 -04:00
Marcel van Lohuizen
77b1378c3e exp/locale/collate: added regression test for collate package
based on UCA test files.

R=r
CC=golang-dev
https://golang.org/cl/6216056
2012-06-19 11:34:56 -07:00
Shenghou Ma
d4c4f4d2c4 runtime: fix struct Sigaction for Linux/ARM
if we were to use sizeof(sa.sa_mask) instead of 8 as the last argument
        to rt_sigaction, we would have already fixed this bug, so also updated
        Linux/386 and Linux/amd64 files to use that; also test the return value
        of rt_sigaction.

R=dave, rsc
CC=golang-dev
https://golang.org/cl/6297087
2012-06-20 01:17:03 +08:00
Brad Fitzpatrick
a5aa91b9a2 net/http: make client await response concurrently with writing request
If the server replies with an HTTP response before we're done
writing our body (for instance "401 Unauthorized" response), we
were previously ignoring that, since we returned our write
error ("broken pipe", etc) before ever reading the response.
Now we read and write at the same time.

Fixes #3595

R=rsc, adg
CC=golang-dev
https://golang.org/cl/6238043
2012-06-19 09:20:41 -07:00
Brad Fitzpatrick
e1d9fcd267 net/http: clarify client return values in docs
Also, fixes one violation found during testing where both
response and error could be non-nil when a CheckRedirect test
failed.  This is arguably a minor API (behavior, not
signature) change, but it wasn't documented either way and was
inconsistent & non-Go like.  Any code depending on the old
behavior was wrong anyway.

R=adg, rsc
CC=golang-dev
https://golang.org/cl/6307088
2012-06-19 09:10:14 -07:00
Robert Griesemer
ca2ae27dd0 go/ast: multiple "blank" imports are permitted
R=rsc, dsymonds
CC=golang-dev
https://golang.org/cl/6303099
2012-06-18 21:56:41 -07:00
Marcel van Lohuizen
9c9754409d bytes: fixed typo.
R=r
CC=golang-dev
https://golang.org/cl/6301096
2012-06-18 17:43:05 -07:00
Brad Fitzpatrick
61809cd182 net/url: sort keys in Encode; don't enumerate map randomly
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6303098
2012-06-18 12:54:36 -07:00
Robert Griesemer
417a7f80d2 go/ast: Walk: do not walk comment list
A comment to that effect was introduced
with rev d332f4b9cef5 but the respective
code wasn't deleted.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6304086
2012-06-15 16:55:15 -07:00
Nigel Tao
834edc4257 exp/html/atom: add some more atoms.
R=r, dsymonds
CC=golang-dev
https://golang.org/cl/6298085
2012-06-15 15:39:25 +10:00
Shenghou Ma
9852614291 exp/types: clean up objects after test
Fixes #3739.

R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/6295083
2012-06-15 02:52:18 +08:00
Shenghou Ma
a11e74daf7 crypto/elliptic: fix doc typo
Fixes #3735.

R=golang-dev, agl
CC=golang-dev
https://golang.org/cl/6301083
2012-06-14 22:43:15 +08:00
Nigel Tao
8f84328fdc cmd/gc: inline convT2E when T is uintptr-shaped.
GOARCH=amd64 benchmarks

src/pkg/runtime
benchmark                  old ns/op    new ns/op    delta
BenchmarkConvT2ESmall             10           10   +1.00%
BenchmarkConvT2EUintptr            9            0  -92.07%
BenchmarkConvT2EBig               74           74   -0.27%
BenchmarkConvT2I                  27           26   -3.62%
BenchmarkConvI2E                   4            4   -7.05%
BenchmarkConvI2I                  20           19   -2.99%

test/bench/go1
benchmark                 old ns/op    new ns/op    delta
BenchmarkBinaryTree17    5930908000   5937260000   +0.11%
BenchmarkFannkuch11      3927057000   3933556000   +0.17%
BenchmarkGobDecode         21998090     21870620   -0.58%
BenchmarkGobEncode         12725310     12734480   +0.07%
BenchmarkGzip             567617600    567892800   +0.05%
BenchmarkGunzip           178284100    178706900   +0.24%
BenchmarkJSONEncode        87693550     86794300   -1.03%
BenchmarkJSONDecode       314212600    324115000   +3.15%
BenchmarkMandelbrot200      7016640      7073766   +0.81%
BenchmarkParse              7852100      7892085   +0.51%
BenchmarkRevcomp         1285663000   1286147000   +0.04%
BenchmarkTemplate         566823800    567606200   +0.14%

I'm not entirely sure why the JSON* numbers have changed, but
eyeballing the profile suggests that it could be spending less
and more time in runtime.{new,old}stack, so it could simply be
stack-split boundary noise.

R=rsc, dave, bsiegert, dsymonds
CC=golang-dev
https://golang.org/cl/6280049
2012-06-14 10:43:20 +10:00
Rob Pike
733ee91786 encoding/gob: don't cache broken encoding engines.
Fixes a situation where a nested bad type would still
permit the outer type to install a working engine, leading
to inconsistent behavior.

Fixes #3273.

R=bsiegert, rsc
CC=golang-dev
https://golang.org/cl/6294067
2012-06-13 15:55:43 -07:00
Brad Fitzpatrick
45969825b5 net/http: use index.html modtime (not directory) for If-Modified-Since
Thanks to Håvid Falch for finding the problem.

Fixes #3414

R=r, rsc
CC=golang-dev
https://golang.org/cl/6300081
2012-06-13 14:53:05 -07:00
Rémy Oudompheng
5468d16467 strconv: extend fast parsing algorithm to ParseFloat(s, 32)
benchmark                  old ns/op    new ns/op    delta
BenchmarkAtof32Decimal           215           73  -65.72%
BenchmarkAtof32Float             233           83  -64.21%
BenchmarkAtof32FloatExp         3351          209  -93.76%
BenchmarkAtof32Random           1939          260  -86.59%

R=rsc
CC=golang-dev, remy
https://golang.org/cl/6294071
2012-06-13 23:52:00 +02:00
Robert Griesemer
10b88888f6 math/big: correctly test for positive inputs in Int.GCD
Also: better GCD tests.

R=rsc
CC=golang-dev
https://golang.org/cl/6295076
2012-06-13 13:54:36 -07:00
Russ Cox
1c4e20744a syscall: fix windows copyFindData
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6301076
2012-06-13 16:44:19 -04:00
Robert Griesemer
f5f23e075e go/ast: comment map implementation
A comment map associates comments with AST nodes
and permits correct updating of the AST's comment
list when the AST is manipulated.

R=rsc
CC=golang-dev
https://golang.org/cl/6281044
2012-06-13 13:32:29 -07:00
Russ Cox
503aa6505e go/build: fix boolean negation
!(linux&cgo | darwin&cgo)
= (!linux|!cgo) & (!darwin|!cgo)
= (!linux&!darwin) | !cgo  // new comment
≠ !linux | !darwin | !cgo  // old comment

Fixes #3726.

R=golang-dev, bsiegert
CC=golang-dev
https://golang.org/cl/6306076
2012-06-13 16:24:56 -04:00
Jan Ziak
51fe5444fa runtime: improved continuity in hash computation
Fixes #3695.

R=r, dave, rsc
CC=golang-dev
https://golang.org/cl/6304062
2012-06-13 15:52:32 -04:00
Robert Griesemer
f4240666be math/big: fix binaryGCD
R=rsc
CC=golang-dev
https://golang.org/cl/6297085
2012-06-13 10:29:06 -07:00
Robert Griesemer
b7c5e23df0 math/big: various cleanups
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/6295072
2012-06-13 09:37:47 -07:00
Christopher Swenson
38735b957c math/big: Implemented binary GCD algorithm
benchmark                    old ns/op    new ns/op    delta
BenchmarkGCD10x10                 4383         2126  -51.49%
BenchmarkGCD10x100                5612         2124  -62.15%
BenchmarkGCD10x1000               8843         2622  -70.35%
BenchmarkGCD10x10000             17025         6576  -61.37%
BenchmarkGCD10x100000           118985        48130  -59.55%
BenchmarkGCD100x100              45328        11683  -74.23%
BenchmarkGCD100x1000             50141        12678  -74.72%
BenchmarkGCD100x10000           110314        26719  -75.78%
BenchmarkGCD100x100000          630000       156041  -75.23%
BenchmarkGCD1000x1000           654809       137973  -78.93%
BenchmarkGCD1000x10000          985683       159951  -83.77%
BenchmarkGCD1000x100000        4920792       366399  -92.55%
BenchmarkGCD10000x10000       16848950      3732062  -77.85%
BenchmarkGCD10000x100000      55401500      4675876  -91.56%
BenchmarkGCD100000x100000   1126775000    258951800  -77.02%

R=gri, rsc, bradfitz, remyoudompheng, mtj
CC=golang-dev
https://golang.org/cl/6305065
2012-06-13 09:31:20 -07:00
Nigel Tao
66429dcf75 exp/html: simplify some of the parser's internal methods.
benchmark          old ns/op    new ns/op    delta
BenchmarkParser      4006888      3950604   -1.40%

R=r, andybalholm
CC=golang-dev
https://golang.org/cl/6301070
2012-06-13 10:13:05 +10:00
Robert Griesemer
008c62b2cd math/big: optimize common case of Int.Bit(0)
R=golang-dev, dsymonds, rsc
CC=golang-dev
https://golang.org/cl/6306069
2012-06-12 09:36:35 -07:00
Rob Pike
ea3c3bb3a8 encoding/gob: better handling of nil pointers
- better message for top-level nil
- nil inside interface yields error, not panic

Fixes #3704.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6304064
2012-06-12 00:36:39 -04:00
Rob Pike
2a0fdf6ea0 fmt.Fscanf: don't read past newline
Makes interactive uses work line-by-line.
Fixes #3481.

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/6297075
2012-06-11 17:52:09 -04:00
Robert Griesemer
49d6e49087 exp/types: testing resolution of qualified identifiers
Also: fix a bug with exp/types/GcImport.

R=rsc, r
CC=golang-dev
https://golang.org/cl/6302060
2012-06-11 11:06:27 -07:00
Brad Fitzpatrick
1d609f9b9f encoding/gob: fix doc typo
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6300078
2012-06-09 18:30:44 -07:00
Dave Cheney
0b09425b5c runtime: use uintptr where possible in malloc stats
linux/arm OMAP4 pandaboard

benchmark                 old ns/op    new ns/op    delta
BenchmarkBinaryTree17   68723297000  37026214000  -46.12%
BenchmarkFannkuch11     34962402000  35958435000   +2.85%
BenchmarkGobDecode        137298600    124182150   -9.55%
BenchmarkGobEncode         60717160     60006700   -1.17%
BenchmarkGzip            5647156000   5550873000   -1.70%
BenchmarkGunzip          1196350000   1198670000   +0.19%
BenchmarkJSONEncode       863012800    782898000   -9.28%
BenchmarkJSONDecode      3312989000   2781800000  -16.03%
BenchmarkMandelbrot200     45727540     45703120   -0.05%
BenchmarkParse             74781800     59990840  -19.78%
BenchmarkRevcomp          140043650    139462300   -0.42%
BenchmarkTemplate        6467682000   5832153000   -9.83%

benchmark                  old MB/s     new MB/s  speedup
BenchmarkGobDecode             5.59         6.18    1.11x
BenchmarkGobEncode            12.64        12.79    1.01x
BenchmarkGzip                  3.44         3.50    1.02x
BenchmarkGunzip               16.22        16.19    1.00x
BenchmarkJSONEncode            2.25         2.48    1.10x
BenchmarkJSONDecode            0.59         0.70    1.19x
BenchmarkParse                 0.77         0.97    1.26x
BenchmarkRevcomp              18.15        18.23    1.00x
BenchmarkTemplate              0.30         0.33    1.10x

darwin/386 core duo

benchmark                 old ns/op    new ns/op    delta
BenchmarkBinaryTree17   10591616577   9678245733   -8.62%
BenchmarkFannkuch11     10758473315  10749303846   -0.09%
BenchmarkGobDecode         34379785     34121250   -0.75%
BenchmarkGobEncode         23523721     23475750   -0.20%
BenchmarkGzip            2486191492   2446539568   -1.59%
BenchmarkGunzip           444179328    444250293   +0.02%
BenchmarkJSONEncode       221138507    219757826   -0.62%
BenchmarkJSONDecode      1056034428   1048975133   -0.67%
BenchmarkMandelbrot200     19862516     19868346   +0.03%
BenchmarkRevcomp         3742610872   3724821662   -0.48%
BenchmarkTemplate         960283112    944791517   -1.61%

benchmark                  old MB/s     new MB/s  speedup
BenchmarkGobDecode            22.33        22.49    1.01x
BenchmarkGobEncode            32.63        32.69    1.00x
BenchmarkGzip                  7.80         7.93    1.02x
BenchmarkGunzip               43.69        43.68    1.00x
BenchmarkJSONEncode            8.77         8.83    1.01x
BenchmarkJSONDecode            1.84         1.85    1.01x
BenchmarkRevcomp              67.91        68.24    1.00x
BenchmarkTemplate              2.02         2.05    1.01x

R=rsc, 0xe2.0x9a.0x9b, mirtchovski
CC=golang-dev, minux.ma
https://golang.org/cl/6297047
2012-06-08 17:35:14 -04:00
Robert Griesemer
014d036d84 math/big: added nat.trailingZeroBits, simplified some code
Will simplify implementation of binaryGCD.

R=rsc, cswenson
CC=golang-dev
https://golang.org/cl/6299064
2012-06-08 13:00:49 -07:00
Russ Cox
7762a9dc1f syscall: unexport GetCurrentProcessId on Windows
This slipped in with the implementation of Getpid in CL 5909043.
I'd exclude that CL entirely but it is tangled up in the Win32finddata changes.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/6297065
2012-06-08 14:28:29 -04:00
Russ Cox
56f5e6d845 syscall: fix windows build
TBR=bradfitz
CC=golang-dev
https://golang.org/cl/6303061
2012-06-08 14:04:44 -04:00
Russ Cox
7ad37673e1 syscall: revert API changes in Windows Win32finddata fix.
Preserve old API by using correct struct in system call
and then copying the results, as we did for SetsockoptLinger.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6307065
2012-06-08 13:54:48 -04:00
Russ Cox
50452720ba regexp/syntax: unexport ErrUnexpectedParen
This new error is the only API change in the current draft of
Go 1.0.2 CLs. I'd like to include the CL that introduced it,
because it replaces a mysterious 'internal error' with a
useful error message, but I don't want any API changes,
so unexport the error constant for now. It can be
re-exported for Go 1.1.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6294055
2012-06-08 13:05:01 -04:00
Nigel Tao
6c204982e0 exp/html: check the context node for consistency when parsing fragments.
R=rsc
CC=golang-dev
https://golang.org/cl/6303053
2012-06-08 13:55:15 +10:00
Russ Cox
09b736a2ab encoding/json: fix panic unmarshaling into non-nil interface value
Fixes #3614.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6306051
2012-06-07 01:48:55 -04:00
Nigel Tao
c8fac7b967 exp/html: when parsing, compare atoms (ints) instead of strings.
This is the mechanical part of the 2-part change that started with
https://golang.org/cl/6305053/

R=rsc
CC=andybalholm, golang-dev, r
https://golang.org/cl/6295055
2012-06-07 13:46:57 +10:00
Nigel Tao
cd21eff705 exp/html: make the tokenizer return atoms for tag tokens.
This is part 1 of a 2 part changelist. Part 2 contains the mechanical
change to parse.go to compare atoms (ints) instead of strings.

The overall effect of the two changes are:
benchmark                      old ns/op    new ns/op    delta
BenchmarkParser                  4462274      4058254   -9.05%
BenchmarkRawLevelTokenizer        913202       912917   -0.03%
BenchmarkLowLevelTokenizer       1268626      1267836   -0.06%
BenchmarkHighLevelTokenizer      1947305      1968944   +1.11%

R=rsc
CC=andybalholm, golang-dev, r
https://golang.org/cl/6305053
2012-06-07 13:05:35 +10:00
Alex Brainman
f54d61061c runtime: include "typekind.h" to fix windows build
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6305059
2012-06-07 09:37:05 +10:00
Nigel Tao
90fa13d2b7 exp/html/atom: add more atoms.
This completely covers the tags used by exp/html's parser.

Before:
295 atoms; 1406 string bytes + 2048 tables = 3454 total data
BenchmarkLookup    50000         59841 ns/op

After:
322 atoms; 1508 string bytes + 2048 tables = 3556 total data
BenchmarkLookup    50000         60159 ns/op

R=r
CC=golang-dev
https://golang.org/cl/6296045
2012-06-07 09:35:35 +10:00
Fazlul Shahriar
42a76efc92 net: pass tests on Plan 9 again
R=golang-dev
CC=golang-dev
https://golang.org/cl/6280045
2012-06-06 18:38:56 -04:00
Jan Ziak
ede6718cd7 runtime: move type kinds into a separate file
R=rsc
CC=golang-dev
https://golang.org/cl/6285047
2012-06-06 17:20:02 -04:00
Daniel Morsing
c8cbbd31f0 fmt: fix doc typo
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6308046
2012-06-06 16:54:02 -04:00
Markus Sonderegger
3476c23124 crypto/rand: enable rand.Reader on plan9
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6297044
2012-06-06 16:05:47 -04:00
Russ Cox
ee3c272611 fmt: fix inadvertent change to %#v
The reordering speedup in CL 6245068 changed the semantics
of %#v by delaying the clearing of some flags.  Restore the old
semantics and add a test.

Fixes #3706.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6302048
2012-06-06 15:08:00 -04:00
Shenghou Ma
58993e514e net: fix cgoAddrInfoFlags() on FreeBSD
CL 6250075 removed AI_MASK mask on all BSD variants,
        however FreeBSD's AI_MASK does not include AI_V4MAPPED
        and AI_ALL, and its libc is strict about the ai_flags.

        This will fix the FreeBSD builder.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6305054
2012-06-06 22:03:31 +08:00
Joel Sing
2cb7498455 runtime: fix tv_sec handling for netbsd/386
On netbsd/386, tv_sec is a 64-bit integer for both timeval and timespec.
Fix the time handling code so that it works correctly.

R=golang-dev, rsc, m4dh4tt3r
CC=golang-dev
https://golang.org/cl/6256056
2012-06-06 20:39:27 +10:00
Russ Cox
3a66bc415e runtime: use OS X vsyscall for gettimeofday (amd64)
Thanks to Dave Cheney for the magic words "comm page".

benchmark       old ns/op    new ns/op    delta
BenchmarkNow          197           33  -83.05%

This should make profiling a little better on OS X.
The raw time saved is unlikely to matter: what likely matters
more is that it seems like OS X sends profiling signals on the
way out of system calls more often than it should; avoiding
the system call should increase the accuracy of cpu profiles.

The 386 version would be similar but needs to do different
math for CPU speeds less than 1 GHz. (Apparently Apple has
never shipped a 64-bit CPU with such a slow clock.)

R=golang-dev, bradfitz, dave, minux.ma, r
CC=golang-dev
https://golang.org/cl/6275056
2012-06-05 16:24:37 -04:00
Russ Cox
c7be4defe3 runtime: use OS X vsyscall for gettimeofday (386)
amd64 was done in CL 6275056.

We don't attempt to handle machines with clock speeds
less than 1 GHz. Those will fall back to the system call.

benchmark       old ns/op    new ns/op    delta
BenchmarkNow          364           38  -89.53%

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6307045
2012-06-05 16:23:30 -04:00
Dave Cheney
09f48db3e1 runtime: use uintptr for block length in scanblock
Using an int64 for a block size doesn't make
sense on 32bit platforms but extracts a performance
penalty dealing with double word quantities on Arm.

linux/arm

benchmark                 old ns/op    new ns/op    delta
BenchmarkGobDecode        155401600    144589300   -6.96%
BenchmarkGobEncode         72772220     62460940  -14.17%
BenchmarkGzip               5822632      2604797  -55.26%
BenchmarkGunzip              326321       151721  -53.51%

benchmark                  old MB/s     new MB/s  speedup
BenchmarkGobDecode             4.94         5.31    1.07x
BenchmarkGobEncode            10.55        12.29    1.16x

R=golang-dev, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/6272047
2012-06-05 18:55:14 +10:00
Rob Pike
2176869e4e net/http/httputil: fix typo in comment.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6272050
2012-06-04 18:37:31 -07:00
Russ Cox
dcc46388df time: accept .999 in Parse
The recent shuffle in parsing formats exposed probably unintentional
behavior in time.Parse, namely that it was mostly ignoring ".99999"
in the format, producing the following behavior:

fmt.Println(time.Parse("03:04:05.999 MST", "12:00:00.888 PDT")) // error (.888 unexpected)
fmt.Println(time.Parse("03:04:05.999", "12:00:00")) // error (input too short)
fmt.Println(time.Parse("03:04:05.999 MST", "12:00:00 PDT"))  // ok (extra bytes on input make it ok)

http://play.golang.org/p/ESJ1UYXzq2

API CHANGE:

This CL makes all three examples valid: ".999" can match an
empty string or else a fractional second with at most nine digits.

Fixes #3701.

R=r, r
CC=golang-dev
https://golang.org/cl/6267045
2012-06-04 13:09:19 -04:00
Robert Griesemer
cc1890cbe3 math/big: improved karatsuba calibration code, better mul benchmark
An attempt to profit from CL 6176043 (fix to superpolinomial
runtime of karatsuba multiplication) and determine a better
karatsuba threshold. The result indicates that 32 is still
a reasonable value. Left the threshold as is (== 32), but
made some minor changes to the calibrate code which are
worthwhile saving (use of existing benchmarking code for
better results, better use of package time).

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6260062
2012-06-04 09:48:27 -07:00
Marcel van Lohuizen
de0c1c9cf5 exp/locale/collate: somehow an incorrect version of tables was checked in earlier.
Regenerated tables using maketables.

R=r, rsc
CC=golang-dev
https://golang.org/cl/6248067
2012-06-04 18:35:26 +02:00
Joel Sing
622ace8ffe net: fix botched cgo netbsd merge
Fix botched cgo_netbsd.go merge and remove redundant +build directive.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6282048
2012-06-05 02:12:23 +10:00
Joel Sing
5131deeeb2 cgo: enable cgo on netbsd/386 and netbsd/amd64
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6261056
2012-06-05 01:43:04 +10:00
Benny Siegert
677cdb800d syscall: use pipe instead of pipe2 on NetBSD
pipe2 is equivalent to pipe with flags set to 0.
However, pipe2 was only added recently. Using pipe
instead improves compatibility with NetBSD 5.

R=jsing
CC=golang-dev
https://golang.org/cl/6268045
2012-06-05 01:29:34 +10:00
Brad Fitzpatrick
afeaf554aa net/http: add new Server benchmark
The new BenchmarkServer avoids profiling the client code
by running it in a child process.

R=rsc
CC=golang-dev
https://golang.org/cl/6260053
2012-06-04 08:04:40 -07:00
Brad Fitzpatrick
6e3d87f315 net/textproto: add benchmark, cleanup, update comment
The cleanup also makes it ~5% faster, but that's
not the point of this CL.

Optimizations can come in future CLs.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6286043
2012-06-04 07:18:06 -07:00
Brad Fitzpatrick
6b31508e3d net/http: simplify ParseHTTPVersion
Removes code. No need for atoi helper.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6285045
2012-06-04 07:06:05 -07:00
Brad Fitzpatrick
290115fdf4 net/http: change a Del to delete
No need to fix case of "Host" string literal.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6278049
2012-06-03 22:40:16 -07:00
Mikio Hara
24075d33a5 path/filepath: fix test
Make it possible to run test over symlinked GOROOT.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6268046
2012-06-04 09:57:03 +09:00
Russ Cox
a76c8b2430 time: make Format 2.7x faster
benchmark             old ns/op    new ns/op    delta
BenchmarkFormat            2495          937  -62.44%
BenchmarkFormatNow         2308          889  -61.48%

Update #3679.

R=r
CC=golang-dev
https://golang.org/cl/6278047
2012-06-03 11:08:17 -04:00
Joel Sing
eb4138f481 net: move cgo address info flags to per-platform files
Move address info flags to per-platform files. This is needed to
enable cgo on NetBSD (and later OpenBSD), as some of the currently
used AI_* defines do not exist on these platforms.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6250075
2012-06-03 23:54:14 +10:00
Alex Brainman
8801402940 syscall: correct Win32finddata definition
Fixes #3685.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6261053
2012-06-03 19:27:17 +10:00
Luuk van Dijk
40af78c19e cmd/gc: inline slice[arr,str] in the frontend (mostly).
R=rsc, ality, rogpeppe, minux.ma, dave
CC=golang-dev
https://golang.org/cl/5966075
2012-06-02 22:50:57 -04:00
Russ Cox
192550592a exp/html/atom: faster Lookup with smaller tables
Use perfect cuckoo hash, to avoid binary search.
Define Atom bits as offset+len in long string instead
of enumeration, to avoid string headers.

Before: 1909 string bytes + 6060 tables = 7969 total data
After: 1406 string bytes + 2048 tables = 3454 total data

benchmark          old ns/op    new ns/op    delta
BenchmarkLookup        83878        64681  -22.89%

R=nigeltao, r
CC=golang-dev
https://golang.org/cl/6262051
2012-06-02 22:43:11 -04:00
Shenghou Ma
911f802b37 syscall: fix 32-bit uid calls
16-bit uid calls are not always supported in newer kernels.

R=dave, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/6279047
2012-06-03 06:49:57 +08:00
Shenghou Ma
e8265f18e6 runtime: remove unnecessary macros in vlop_arm.s
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6270045
2012-06-03 04:03:09 +08:00
Shenghou Ma
d186d07eda cmd/5a, cmd/5l, math: add CLZ instruction for ARM
Supported in ARMv5 and above.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6284043
2012-06-03 03:08:49 +08:00
Jan Ziak
65e61d5770 runtime: add (unused for now) gc field to type information
R=rsc
CC=golang-dev
https://golang.org/cl/6255074
2012-06-02 14:02:44 -04:00
Charles L. Dorian
322057cbfc math: amd64 versions of Ceil, Floor and Trunc
Ceil  to 4.81 from 20.6 ns/op
Floor to 4.37 from 13.5 ns/op
Trunc to 3.97 from 14.3 ns/op
Also changed three MOVSDs to MOVAPDs in log_amd64.s

R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/6262048
2012-06-02 13:06:12 -04:00
Jan Mercl
2b57a87678 path/filepath: implement documented SkipDir behavior
Currently walk() doesn't check for err == SkipDir when iterating
a directory list, but such promise is made in the docs for WalkFunc.

Fixes #3486.

R=rsc, r
CC=golang-dev
https://golang.org/cl/6257059
2012-06-02 13:00:09 -04:00
Rob Pike
0e45890c8b text/template/parse: restore the goroutine
To avoid goroutines during init, the nextItem function was a
clever workaround. Now that init goroutines are permitted,
restore the original, simpler design.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6282043
2012-06-01 18:34:14 -07:00