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

7162 Commits

Author SHA1 Message Date
Ian Lance Taylor
514f10b9ab net: skip TestMulticastListener on Solaris
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7308060
2013-02-07 09:58:42 -08:00
Péter Surányi
fe7dbea00e os/exec: LookPath on Unix shouldn't look in cwd when PATH is empty
R=golang-dev, dave, bradfitz
CC=golang-dev
https://golang.org/cl/7305053
2013-02-07 06:41:35 -08:00
Shenghou Ma
80e1cf73eb crypto/rc4: naïve ARM assembly implementation
On 800MHz Cortex-A8:
benchmark           old ns/op    new ns/op    delta
BenchmarkRC4_128         9395         2838  -69.79%
BenchmarkRC4_1K         74497        22120  -70.31%
BenchmarkRC4_8K        587243       171435  -70.81%

benchmark            old MB/s     new MB/s  speedup
BenchmarkRC4_128        13.62        45.09    3.31x
BenchmarkRC4_1K         13.75        46.29    3.37x
BenchmarkRC4_8K         13.79        47.22    3.42x

Result for "OpenSSL 1.0.1c 10 May 2012" from Debian/armhf sid:
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes
rc4              39553.81k    46522.39k    49336.11k    50085.63k    50258.06k

R=golang-dev, agl, dave
CC=golang-dev
https://golang.org/cl/7310051
2013-02-07 18:54:21 +08:00
Ian Lance Taylor
0592c44956 net: permit pollster DelFD to return whether to call Wakeup
This is necessary for systems that use select as the pollster,
such as Solaris (supported by gccgo).  It corresponds to the
bool returned by AddFD.  In general it's not clearly defined
what happens when a descriptor used in a select is closed, and
different systems behave differently.  Waking up the select
will cause the right thing to happen: the closed descriptor
will be dropped from the next iteration.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7303056
2013-02-06 17:18:53 -08:00
Gaal Yahas
c2fb6e2c0b sync: improve WaitGroup example by putting the call to Done in a
deferred block. This makes hangs in the waiting code less likely
if a goroutine exits abnormally.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7306052
2013-02-07 00:39:52 +08:00
Albert Strasheim
309d88e28c syscall, net: Fix unix socket autobind on Linux.
R=rsc, iant, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/7300047
2013-02-06 06:45:57 -08:00
Volker Dobler
8c6489bc27 exp/cookiejar: infrastructure for upcoming implementation
This CL is the first of a handful of CLs which will provide
the implementation of cookiejar. It contains several helper
functions and the skeleton of Cookies and SetCookies.

Proper host name handling requires the ToASCII transformation
from package idna which currently lives in the go.net
subrepo. This CL thus contains just a TODO for this issue.

R=nigeltao, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/7287046
2013-02-06 22:37:34 +11:00
Dmitriy Vyukov
0a40cd2661 runtime/race: switch to explicit race context instead of goroutine id's
Removes limit on maximum number of goroutines ever existed.
code.google.com/p/goexecutor tests now pass successfully.
Also slightly improves performance.
Before: $ time ./flate.test -test.short
real	0m9.314s
After:  $ time ./flate.test -test.short
real	0m8.958s
Fixes #4286.
The runtime is built from llvm rev 174312.

R=rsc
CC=golang-dev
https://golang.org/cl/7218044
2013-02-06 11:40:54 +04:00
Jeff R. Allen
33995fe59e log/syslog: retry once if write fails
Implements deferred connections + single-attempt automatic
retry. Based on CL 5078042 from kuroneko.

Fixes #2264.

R=mikioh.mikioh, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/6782140
2013-02-05 09:54:01 -08:00
Shenghou Ma
7de3d71797 runtime: save LR to stack when panicking to handle leaf function traceback
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7289047
2013-02-06 01:18:37 +08:00
Ian Lance Taylor
da35d42521 exp/inotify: close event channel before file descriptor
Closing the inotify file descriptor can take over a second
when running on Ubuntu Precise in an NFS directory, leading to
the test error in issue 3132.  Closing the event channel first
lets a client that does not care about the error channel move
on.

Fixes #3132.

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/7300045
2013-02-05 06:11:10 -08:00
Caleb Spare
dff017ea99 container/heap: fix comment typo in example test
This updates a bad reference to a method name in the example priority queue test.

The error was introduced in the example refactoring in rev. 2ea8f07b2ffe.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7279045
2013-02-05 07:06:00 -05:00
Dmitriy Vyukov
6b1b613d6a runtime/race: do not include pthread.h
Fixes #4721.

R=alex.brainman, minux.ma
CC=golang-dev
https://golang.org/cl/7275048
2013-02-05 13:08:07 +04:00
David Symonds
e7fe1944ac archive/tar: small simplification using FileMode.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7305043
2013-02-05 15:39:55 +11:00
Brad Fitzpatrick
d1e16d06b4 net/http: fix Server blocking after a Handler's Write fails
If a Handle's Write to a ResponseWriter fails (e.g. via a
net.Conn WriteDeadline via WriteTimeout on the Server), the
Server was blocking forever waiting for reads on that
net.Conn, even after a Write failed.

Instead, once we see a Write fail, close the connection,
since it's then dead to us anyway.

Fixes #4741

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7301043
2013-02-04 20:26:25 -08:00
Russ Cox
a60ffed9e7 path/filepath: document that Walk does not follow symlinks
Fixes #4759.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7304043
2013-02-04 22:59:30 -05:00
Anthony Martin
c56bb1d238 syscall: fix marshaling of stat messages on Plan 9
The order of the Qid fields was reversed. Mea culpa.

R=seed
CC=golang-dev
https://golang.org/cl/7231062
2013-02-04 19:47:23 -08:00
Brad Fitzpatrick
92e4645f31 net/http: add Next Protocol Negotation upgrade support to the Server
This provides the mechanism to connect SPDY support to the http
package, without pulling SPDY into the standard library.

R=rsc, agl, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/7287045
2013-02-04 13:55:38 -08:00
Mikio Hara
5ae6a23731 syscall: regenerate ztype files for linux
This CL adds TCPInfo struct to linux/386,arm.
It's already added to linux/amd64.

Note that not sure the reason but cgo godefs w/ latest gcc
translates a flexible array member in structures correctly,
handles it as a non-incomplete, non-opaque type, on Go 1.
This CL reverts such changes by hand for the Go 1 contract.

R=minux.ma, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/7197046
2013-02-05 06:53:58 +09:00
Brad Fitzpatrick
022504b3ab net/http: fix when server deadlines get extended
Deadlines should be extended at the beginning of
a request, not at the beginning of a connection.

Fixes #4676

R=golang-dev, fullung, patrick.allen.higgins, adg
CC=golang-dev
https://golang.org/cl/7220076
2013-02-04 13:52:45 -08:00
Alan Donovan
c06a5335ba exp/ssa: (#4 of 5): the SSA builder.
R=iant, gri, iant, rogpeppe
CC=golang-dev
https://golang.org/cl/7196053
2013-02-04 12:22:35 -05:00
Alex Brainman
94064548c6 net: use windows sysSocket everywhere
R=golang-dev, bradfitz, dave
CC=golang-dev
https://golang.org/cl/7273046
2013-02-04 16:03:41 +11:00
Russ Cox
472354f81e runtime/debug: add controls for garbage collector
Fixes #4090.

R=golang-dev, iant, bradfitz, dsymonds
CC=golang-dev
https://golang.org/cl/7229070
2013-02-04 00:00:55 -05:00
Russ Cox
6b4cf2b367 time: fix error message from Parse
Was incorrectly discarding the offending text in some cases.

Fixes #4493.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7277050
2013-02-04 00:00:36 -05:00
Andrew Gerrand
5fad786452 regexp: update comment on (*Regexp).Longest
Missed this review comment.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7229084
2013-02-04 15:57:32 +11:00
Russ Cox
89a2a8c8df cmd/go, testing: revise docs for test flags
In cmd/go's 'go help testflag':
* Rewrite list of flags to drop test. prefix on every name.
* Sort list of flags.
* Add example of using -bench to match all benchmarks.

In testing:
* Remove mention of undefined 'CPU group' concept.

Fixes #4488.
Fixes #4508.

R=adg
CC=golang-dev
https://golang.org/cl/7288053
2013-02-03 23:47:03 -05:00
Nigel Tao
4e285bac6e container/heap: fix package doc comment about ordering.
R=gri, rsc
CC=golang-dev
https://golang.org/cl/7280044
2013-02-04 15:30:41 +11:00
Andrew Gerrand
f41ffc2bf4 regexp: add (*Regexp).Longest
Fixes #3696.

R=rsc
CC=golang-dev
https://golang.org/cl/7133051
2013-02-04 15:28:55 +11:00
Russ Cox
1d9f67daf0 time: deal a bit better with time zones in Parse
* Document Parse's zone interpretation.
* Add ParseInLocation (API change).
* Recognize "wrong" time zone names, like daylight savings time in winter.
* Disambiguate time zone names using offset (like winter EST vs summer EST in Sydney).

The final two are backwards-incompatible changes, but I believe
they are both buggy behavior in the Go 1.0 versions; the old results
were more wrong than the new ones.

Fixes #3604.
Fixes #3653.
Fixes #4001.

R=adg
CC=golang-dev
https://golang.org/cl/7288052
2013-02-03 23:02:12 -05:00
Russ Cox
6a003d7589 time: handle zone file with no transitions
Code fix by Alex Bramley.

Fixes #4064.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7289049
2013-02-03 22:41:00 -05:00
Andrew Gerrand
0df8c7517e archive/tar: add Copyright notice to example_test.go
R=golang-dev, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/7278050
2013-02-04 14:34:35 +11:00
Alex Brainman
bc9999337b net: prevent races during windows lookup calls
This only affects code (with exception of lookupProtocol)
that is only executed on older versions of Windows.

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/7293043
2013-02-04 13:05:20 +11:00
Robin Eklind
97916f1154 archive/tar: Add reader and writer code example.
Remove the previous comment examples.

R=golang-dev, minux.ma, adg
CC=golang-dev
https://golang.org/cl/7220048
2013-02-04 12:37:18 +11:00
Russ Cox
f02067a99a cmd/gc: implement latest rules for checking make sizes
Fixes #4085.

R=ken2
CC=golang-dev
https://golang.org/cl/7277047
2013-02-03 14:28:44 -05:00
Shivakumar GN
848d10f06c xml: omit newline at beginning of MarshalIndent output
(Still valid XML.)

Fixes #3354.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/7288047
2013-02-03 11:21:07 -05:00
Russ Cox
e87cc3dc5b exp/gotype: disable broken test
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7275045
2013-02-03 01:25:58 -05:00
Russ Cox
2eafbb8878 cmd/gc: elide self-assignment during return
More efficient, less racy code.

Fixes #4014.

R=ken2, ken
CC=golang-dev
https://golang.org/cl/7275047
2013-02-03 01:18:28 -05:00
Kyle Lemons
9bfd3c3937 testing: add AllocsPerRun
This CL also replaces similar loops in other stdlib
package tests with calls to AllocsPerRun.

Fixes #4461.

R=minux.ma, rsc
CC=golang-dev
https://golang.org/cl/7002055
2013-02-02 22:52:29 -05:00
Russ Cox
18178fd138 cmd/go: run examples in source order, not name order
Add Order field to doc.Example and write doc comments there.

Fixes #4662.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7229071
2013-02-02 16:26:12 -05:00
Ian Lance Taylor
e5ea2d5335 runtime: fix windows build
Fixes #4743.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7284044
2013-02-02 11:41:04 -08:00
Shenghou Ma
dcf16bd83d syscall: (*Proc).Call should return nil error when no error occurs
Fixes #4686.

R=alex.brainman, rsc
CC=golang-dev
https://golang.org/cl/7174047
2013-02-03 01:42:17 +08:00
Russ Cox
b396d1143b reflect: explain StructField.Anonymous field as 'embedded'
The spec mostly uses the term embedded.
It's too late to change the field name but at least fix the docs.

Fixes #4514.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/7235080
2013-02-01 21:01:46 -05:00
Russ Cox
2cb8dcea5c testing: SkipNow, FailNow must be called from test goroutine
Impossible for us to check (without sleazily reaching into the
runtime) but at least document it.

Fixes #3800.

R=golang-dev, bradfitz, dave
CC=golang-dev
https://golang.org/cl/7268043
2013-02-01 21:01:32 -05:00
Alex Brainman
6d175e243a net: use windows GetAddrInfoW in LookupPort when possible
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7252045
2013-01-18 17:05:04 +11:00
Elias Naur
44cf814d50 runtime, cmd/ld: make code more position-independent
Change the stack unwinding code to compensate for the dynamic
relocation of symbols.
Change the gc instruction GC_CALL to use a relative offset instead of
an absolute address.

R=golang-dev
CC=golang-dev
https://golang.org/cl/7248048
2013-02-01 11:24:49 -08:00
Robert Daniel Kortschak
11d16dc535 reflect: document that Value.Slice panics on an unaddressable array.
Fixes #4736.

R=rsc
CC=golang-dev
https://golang.org/cl/7239045
2013-02-01 10:02:23 -08:00
Brad Fitzpatrick
2ccd4e9f87 sort: delete now-duplicate example, fix build
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7220075
2013-02-01 09:08:25 -08:00
Miek Gieben
d4cfe28885 sort: add Reverse as a function
This updates: https://golang.org/cl/6909059/
Fixes #4511.

R=minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6932054
2013-02-01 08:44:45 -08:00
Brad Fitzpatrick
e515d80d5d bytes, strings: add TrimPrefix and TrimSuffix
Everybody either gets confused and thinks this is
TrimLeft/TrimRight or does this by hand which gets
repetitive looking.

R=rsc, kevlar
CC=golang-dev
https://golang.org/cl/7239044
2013-02-01 08:41:25 -08:00
Russ Cox
b0a29f393b runtime: cgo-related fixes
* Separate internal and external LockOSThread, for cgo safety.
* Show goroutine that made faulting cgo call.
* Never start a panic due to a signal caused by a cgo call.

Fixes #3774.
Fixes #3775.
Fixes #3797.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7228081
2013-02-01 08:34:41 -08:00
Volker Dobler
7d8cc587b2 exp/cookiejar: remove external storage
This CL removes the external storage of a cookie jar
and minimized the exported API as discussed in [1].

[1] https://groups.google.com/d/topic/golang-dev/ygDB3nbir00/discussion

Update #1960.

R=nigeltao
CC=golang-dev
https://golang.org/cl/7235065
2013-02-01 10:56:08 +11:00
Russ Cox
31fafa5081 encoding/base64: fix test for ReadFull change
R=golang-dev
CC=golang-dev
https://golang.org/cl/7249045
2013-01-31 14:42:56 -08:00
Russ Cox
662ff54212 io: guarantee err == nil for full reads in ReadFull and ReadAtLeast
This is a backwards compatible API change that fixes broken code.

In Go 1.0, ReadFull(r, buf) could return either len(buf), nil or len(buf), non-nil.
Most code expects only the former, so do that and document the guarantee.

Code that was correct before is still correct.
Code that was incorrect before, by assuming the guarantee, is now correct too.

The same applies to ReadAtLeast.

Fixes #4544.

R=golang-dev, bradfitz, minux.ma
CC=golang-dev
https://golang.org/cl/7235074
2013-01-31 13:46:12 -08:00
Russ Cox
4085426f7d net/url: normalize scheme to lower case (http not HTTP)
Also document %2f vs / ambiguity in URL.Path.

Fixes #3913.
Fixes #3659.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7225076
2013-01-31 13:45:43 -08:00
Adam Langley
5c659d7362 crypto/x509: test for negative RSA parameters.
Someone found software that generates negative numbers for the RSA
modulus in an X.509 certificate. Our error messages were very poor in
this case so this change improves that.

Update #4728
Return more helpful errors when RSA parameters are negative or zero.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7228072
2013-01-31 12:54:37 -05:00
Russ Cox
8b6534b78a cmd/go: many bug fixes
* Reject import paths of the form cmd/x/y.
* Reject 'go install' of command outside GOPATH
* Clearer error rejecting 'go install' of package outside GOPATH.
* Name temporary binary for first file in 'go run' list or for test.
* Provide a way to pass -ldflags arguments with spaces.
* Pass all Go files (even +build ignored ones) to go fix, go fmt, go vet.
* Reject 'go run foo_test.go'.
* Silence 'exit 1' prints from 'go tool' invocations.
* Make go test -xxxprofile leave binary behind for analysis.
* Reject ~ in GOPATH except on Windows.
* Get a little less confused by symlinks.
* Document that go test x y z runs three test binaries.
* Fix go test -timeout=0.
* Add -tags flag to 'go list'.
* Use pkg/gccgo_$GOOS_$GOARCH for gccgo output.

Fixes #3389.
Fixes #3500.
Fixes #3503.
Fixes #3760.
Fixes #3941.
Fixes #4007.
Fixes #4032.
Fixes #4074.
Fixes #4127.
Fixes #4140.
Fixes #4311.
Fixes #4568.
Fixes #4576.
Fixes #4702.

R=adg
CC=golang-dev
https://golang.org/cl/7225074
2013-01-31 08:06:38 -08:00
Russ Cox
30985c1203 os: use signal strings where possible in ProcessState.String
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7228067
2013-01-31 07:53:18 -08:00
Russ Cox
956cd0059c encoding/json: document case-insensitive Unmarshal key matching
Fixes #4664.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7237060
2013-01-31 07:49:23 -08:00
Caleb Spare
0e74f04acc container/heap: split example into two
This adds a simple IntHeap example, and modifies the more complex
PriorityQueue example to make use of the index field it maintains.

Fixes #4331.

R=rsc, adg
CC=golang-dev
https://golang.org/cl/7068048
2013-01-30 23:14:29 -08:00
Alex Brainman
bd75468a08 os: provide access to file LastAccessTime and CreationTime on windows
Fixes #4569.

R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/6972047
2013-01-31 17:17:37 +11:00
Nigel Tao
6799b773eb exp/cookiejar: update PublicSuffixList doc comment to match the
examples at http://publicsuffix.org/.

That website previously listed pvt.k12.wy.us, but that was an error,
as confirmed by correspondance with submissions@publicsuffix.org, and
the website was fixed on 2013-01-23.

R=adg
CC=dr.volker.dobler, golang-dev
https://golang.org/cl/7241053
2013-01-31 14:12:43 +11:00
Robert Daniel Kortschak
92bc896909 fmt: improve go syntax handling of byte-derived arrays and slices
Fixes #4685.

R=golang-dev, adg, remyoudompheng, rsc
CC=golang-dev
https://golang.org/cl/7205047
2013-01-30 17:53:53 -08:00
Rick Arnold
eea0f19990 encoding/json: improve performance of Unmarshal on primitive types
Attempt 2. The first fix was much faster but ignored syntax errors.

benchmark                      old ns/op    new ns/op    delta
BenchmarkCodeEncoder            74993543     72982390   -2.68%
BenchmarkCodeMarshal            77811181     75610637   -2.83%
BenchmarkCodeDecoder           213337123    190144982  -10.87%
BenchmarkCodeUnmarshal         212180972    190394852  -10.27%
BenchmarkCodeUnmarshalReuse    202113428    182106660   -9.90%
BenchmarkUnmarshalString            1343          919  -31.57%
BenchmarkUnmarshalFloat64           1149          908  -20.97%
BenchmarkUnmarshalInt64              967          778  -19.54%
BenchmarkSkipValue              28851581     28414125   -1.52%

benchmark                       old MB/s     new MB/s  speedup
BenchmarkCodeEncoder               25.88        26.59    1.03x
BenchmarkCodeMarshal               24.94        25.66    1.03x
BenchmarkCodeDecoder                9.10        10.21    1.12x
BenchmarkCodeUnmarshal              9.15        10.19    1.11x
BenchmarkSkipValue                 69.05        70.11    1.02x

Fixes #3949.

R=rsc
CC=golang-dev
https://golang.org/cl/7231058
2013-01-30 17:53:48 -08:00
Alan Donovan
19bb42d637 math/big: make tests faster by reducing coverage in --test.short mode.
The time to test all of math/big is now:
 default      => ~3min
 --test.short => 150ms

R=rsc
CC=golang-dev
https://golang.org/cl/7223054
2013-01-30 18:19:58 -05:00
Brad Fitzpatrick
1aa56a2396 net/http: fix race
Fixes #4724

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7225071
2013-01-30 15:10:07 -08:00
Russ Cox
fa2acad603 crypto/cipher: avoid out of bounds error in CryptBlocks
Fixes #4699.

R=golang-dev, agl
CC=golang-dev
https://golang.org/cl/7231065
2013-01-30 12:45:13 -08:00
Marcel van Lohuizen
f5154edc53 exp/locale/collate/tools/colcmp: fixes some discrepancies between
ICU and collate package: ICU requires strings to be in FCD form.
Not all NFC strings are in this form, leading to incorrect results.
Change to NFD instead.

R=rsc
CC=golang-dev
https://golang.org/cl/7201043
2013-01-30 21:19:03 +01:00
Jeff R. Allen
6563d8623d syscall: handle empty address in ReadFrom better
Handle return values from recvfrom correctly when the
kernel decides to not return an address.

Fixes #4636.
Fixes #4352.

R=rsc, mikioh.mikioh, dave
CC=golang-dev
https://golang.org/cl/7058062
2013-01-30 10:02:01 -08:00
Akshat Kumar
fb451490ec os: don't hold ForkLock across opens on Plan 9
If os.OpenFile holds ForkLock on files that block opens,
then threads that simultaneously try to do fork-exec will
get hung up (until the open succeeds). Blocked opens are
common enough on Plan 9 that protecting against fd leaks
into fork-execs means not being able to do fork-execs
properly in the general case. Thus, we forgo taking the
lock.

R=rsc, ality
CC=golang-dev
https://golang.org/cl/7235066
2013-01-30 09:41:16 -08:00
Michael Teichgräber
ad341843a7 net: SplitHostPort: adjust error message for missing port in IPv6 addresses
An hostport of "[::1]" now results in the same error message
"missing port in address" as the hostport value "127.0.0.1",
so SplitHostPort won't complain about "too many colons
in address" anymore for an IPv6 address missing a port.

Added tests checking the error values.

Fixes #4526.

R=dave, rsc, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/7038045
2013-01-30 09:25:16 -08:00
Andrey Mirtchovski
e579395905 encoding/json: properly unmarshal empty arrays.
The JSON unmarshaller failed to allocate an array when there
are no values for the input causing the `[]` unmarshalled
to []interface{} to generate []interface{}(nil) rather than
[]interface{}{}. This wasn't caught in the tests because Decode()
works correctly and because jsonBig never generated zero-sized
arrays. The modification to scanner_test.go quickly triggers
the error:

without the change to decoder.go, but with the change to scanner_test.go:

$ go test
--- FAIL: TestUnmarshalMarshal (0.10 seconds)
decode_test.go:446:		Marshal jsonBig
scanner_test.go:206:	diverge at 70: «03c1OL6$":null},{"[=» vs «03c1OL6$":[]},{"[=^\»
FAIL
exit status 1
FAIL	encoding/json	0.266s

Also added a simple regression to decode_test.go.

R=adg, dave, rsc
CC=golang-dev
https://golang.org/cl/7196050
2013-01-30 09:10:32 -08:00
Jan Ziak
4da6b36fbf runtime: local allocation in mprof.goc
Binary data in mprof.goc may prevent the garbage collector from freeing
memory blocks. This patch replaces all calls to runtime·mallocgc() with
calls to an allocator private to mprof.goc, thus making the private
memory invisible to the garbage collector. The addrhash variable is
moved outside of the .bss section.

R=golang-dev, dvyukov, rsc, minux.ma
CC=dave, golang-dev, remyoudompheng
https://golang.org/cl/7135063
2013-01-30 09:01:31 -08:00
Adam Langley
475d86b6d9 crypto/rc4: add simple amd64 asm implementation.
(Although it's still half the speed of OpenSSL.)

benchmark           old ns/op    new ns/op    delta
BenchmarkRC4_128         1409          398  -71.75%
BenchmarkRC4_1K         10920         2898  -73.46%
BenchmarkRC4_8K        131323        23083  -82.42%

benchmark            old MB/s     new MB/s  speedup
BenchmarkRC4_128        90.83       321.43    3.54x
BenchmarkRC4_1K         93.77       353.28    3.77x
BenchmarkRC4_8K         61.65       350.73    5.69x

R=rsc, remyoudompheng
CC=golang-dev, jgrahamc
https://golang.org/cl/7234055
2013-01-30 11:01:19 -05:00
Russ Cox
ee90874826 encoding/xml: add (*Encoder).Indent
Exposing this on the Encoder allows streaming generation of indented XML.

R=golang-dev, rogpeppe
CC=golang-dev
https://golang.org/cl/7221075
2013-01-30 07:57:20 -08:00
Akshat Kumar
c74f3c4576 runtime: add support for panic/recover in Plan 9 note handler
This change also resolves some issues with note handling: we now make
sure that there is enough room at the bottom of every goroutine to
execute the note handler, and the `exitstatus' is no longer a global
entity, which resolves some race conditions.

R=rminnich, npe, rsc, ality
CC=golang-dev
https://golang.org/cl/6569068
2013-01-30 02:53:56 -08:00
Rémy Oudompheng
ccc61eadd5 runtime: implement range access functions in race detector.
Range access functions are already available in TSan library
but were not yet used.

Time for go test -race -short:

Before:
compress/flate 24.244s
exp/norm       >200s
go/printer     78.268s

After:
compress/flate 17.760s
exp/norm        5.537s
go/printer      5.738s

Fixes #4250.

R=dvyukov, golang-dev, fullung
CC=golang-dev
https://golang.org/cl/7229044
2013-01-30 01:55:02 +01:00
Andrew Gerrand
3bf3ba2d81 go/build: clean up after rollback
R=rsc
CC=golang-dev
https://golang.org/cl/7237049
2013-01-30 09:10:58 +11:00
Russ Cox
ad37081b67 encoding/json: add test for Unmarshal of malformed data
Roll back CL making primitive type unmarshal faster,
because it broke the Unmarshal of malformed data.

Add benchmarks for unmarshal of primitive types.

Update #3949.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7228061
2013-01-29 13:34:18 -08:00
Russ Cox
ec1948a44d runtime: clear up lr comments
R=cshapiro
CC=golang-dev
https://golang.org/cl/7230052
2013-01-29 13:12:50 -08:00
Alan Donovan
aa0b573ad6 exp/ssa: make Parameters values, not addresses.
We explicitly spill all parameters to the frame during initial
SSA construction.  (Later passes will remove spills.)
We now properly handle local Allocs escaping via Captures.

Also: allocate BasicBlock.Succs inline.

R=iant, iant
CC=golang-dev
https://golang.org/cl/7231050
2013-01-29 10:49:16 -05:00
Dmitriy Vyukov
81221f512d runtime: dump the full stack of a throwing goroutine
Useful for debugging of runtime bugs.
+ Do not print "stack segment boundary" unless GOTRACEBACK>1.
+ Do not traceback system goroutines unless GOTRACEBACK>1.

R=rsc, minux.ma
CC=golang-dev
https://golang.org/cl/7098050
2013-01-29 14:57:11 +04:00
Brad Fitzpatrick
91e99c1345 encoding/json: add Decoder.Buffered accessor to get overread data
Otherwise it's impossible to know how much data from the
json.Decoder's underlying Reader was actually consumed.

The old fix from golang.org/issue/1955 just added docs. This
provides an actual mechanism.

Update #1955

R=golang-dev, adg, rsc
CC=golang-dev
https://golang.org/cl/7181053
2013-01-28 16:31:46 -08:00
Alan Donovan
55cac53952 exp/ssa: fix breakage due to https://code.google.com/p/go/source/detail?r=ca5e5de48173
I don't understand why this didn't show up during my testing.

R=bradfitz
TBR=bradfitz
CC=golang-dev
https://golang.org/cl/7237047
2013-01-28 19:21:25 -05:00
Alan Donovan
3c51a69937 exp/gotype: fix build breakage due to https://code.google.com/p/go/source/detail?r=ca5e5de48173
Add 'math/big' to blacklist of packages that use shift
operations as yet unsupported by go/types.

(The failure was masked due to local bugfixes in my client.)

R=rsc, bradfitz, bradfitz
CC=golang-dev
https://golang.org/cl/7220057
2013-01-28 18:26:26 -05:00
Alan Donovan
8f90915692 exp/ssa: (#3 of 5): Function, BasicBlock and optimisations
R=gri, iant, iant
CC=golang-dev
https://golang.org/cl/7202051
2013-01-28 18:14:09 -05:00
Alan Donovan
66bf59712e exp/ssa: (#2 of 5): core utilities
This CL includes the implementation of Literal, all the
Value.String and Instruction.String methods, the sanity
checker, and other misc utilities.

R=gri, iant, iant
CC=golang-dev
https://golang.org/cl/7199052
2013-01-28 18:06:14 -05:00
Alan Donovan
961195ae69 math/big: add Rat.{,Set}Float64 methods for IEEE 754 conversions.
Added tests, using input data from strconv.ParseFloat.
Thanks to rsc for most of the test code.

math/big could use some good package-level documentation.

R=remyoudompheng, rsc
CC=golang-dev
https://golang.org/cl/6930059
2013-01-28 18:00:15 -05:00
Vega Garcia Luis Alfonso
cf1f542420 xml: differentiate between float32 and float64 for marshalSimple
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7235045
2013-01-28 12:54:27 -05:00
Sébastien Paolacci
09ea3b518e runtime: earlier detection of unused spans.
Mark candidate spans one GC pass earlier.

Move scavenger's code out from mgc0 and constrain it into mheap (where it belongs).

R=rsc, dvyukov, minux.ma
CC=golang-dev
https://golang.org/cl/7002049
2013-01-28 12:53:35 -05:00
Russ Cox
a8e0a75726 go/build: undo CL 7129048
This broke 'godoc net/http'.

TBR=adg
CC=golang-dev
https://golang.org/cl/7235052
2013-01-28 12:49:26 -05:00
Ian Lance Taylor
2cd5b01454 net: fix windows build
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7229050
2013-01-28 09:37:10 -08:00
Ian Lance Taylor
31f58dce67 net, syscall: use accept4 and SOCK_CLOEXEC on Linux
R=golang-dev, bradfitz, mikioh.mikioh, dave, minux.ma
CC=golang-dev
https://golang.org/cl/7227043
2013-01-28 08:54:15 -08:00
Vega Garcia Luis Alfonso
1da07a783e go/ast: Fix typo for the godoc of ObjKind
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7232045
2013-01-27 21:36:47 -08:00
Ian Lance Taylor
e65c0a82ce runtime: use new CNT_MASK in lfstack
This is for SPARC64, a 64-bit processor that uses all 64-bits
of virtual addresses.  The idea is to use the low order 3 bits
to at least get a small ABA counter.  That should work since
pointers are aligned.  The idea is for SPARC64 to set CNT_MASK
== 7, PTR_BITS == 0, PTR_MASK == 0xffffffffffffff8.

Also add uintptr casts to avoid GCC warnings.  The gccgo
runtime code is compiled with GCC, and GCC warns when casting
between a pointer and a type of a different size.

R=dvyukov
CC=golang-dev
https://golang.org/cl/7225043
2013-01-26 18:16:43 -08:00
Rémy Oudompheng
75104237c8 all: make tests able to run multiple times.
It is now possible to run "go test -cpu=1,2,4 std"
successfully.

Fixes #3185.

R=golang-dev, dave, minux.ma, bradfitz
CC=golang-dev
https://golang.org/cl/7196052
2013-01-27 00:24:09 +01:00
Shenghou Ma
4019d0e424 runtime: avoid defining the same variable in more than one translation unit
For gccgo runtime and Darwin where -fno-common is the default.

R=iant, dave
CC=golang-dev
https://golang.org/cl/7094061
2013-01-26 09:57:06 +08:00
John Graham-Cumming
3c77b8961c net/http: fix Content-Length/Transfer-Encoding on HEAD requests
net/http currently assumes that the response to a HEAD request
    will always have a Content-Length header. This is incorrect.

RFC2616 says: "The HEAD method is identical to GET except that
the server MUST NOT return a message-body in the response. The
metainformation contained in the HTTP headers in response to a
HEAD request SHOULD be identical to the information sent in
response to a GET request. This method can be used for
obtaining metainformation about the entity implied by the
request without transferring the entity-body itself. This
method is often used for testing hypertext links for validity,
accessibility, and recent modification."

This means that three cases are possible: a Content-Length
header, a Transfer-Encoding header or neither. In the wild the
following sites exhibit these behaviours (curl -I):

HEAD on http://www.google.co.uk/ has Transfer-Encoding: chunked
HEAD on http://www.bbc.co.uk/    has Content-Length: 45247
HEAD on http://edition.cnn.com/  has neither header

This patch does not remove the ErrMissingContentLength error
for compatibility reasons, but it is no longer used.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7182045
2013-01-25 10:20:19 -08:00
Alan Donovan
09899d3b35 exp/ssa: API and documentation.
R=gri, iant, crawshaw, bradfitz, gri, iant
CC=golang-dev
https://golang.org/cl/7071058
2013-01-24 17:21:48 -05:00
Alan Donovan
0cbf289b36 go/types: expose types.IsIdentical, the Type equivalence relation.
This function is absolutely critical for clients such as
exp/ssa, and too complex for clients to duplicate.

As with CL 7200046, gri expressed in the doc below [gophers
only] before going on leave that he intended to expose such a
predicate, though his wording suggests as an interface method
of Type rather than a standalone function.  (My preference is
for binary methods to be standalone; see "On Binary Methods",
Kim Bruce, 1995).  In any case if he wishes to move it that's
easily accommodated by clients.

https://docs.google.com/a/google.com/document/d/1-DQ4fxlMDs9cYtnkKhAAehX6MArjOQyJsRXp-6kiJLA/edit#heading=h.k3bwja7xony9

R=iant, gri, iant
CC=golang-dev
https://golang.org/cl/7203051
2013-01-24 14:22:17 -05:00
Alan Donovan
f8fb95f288 go/types: add String() method to Type interface.
All implementations delegate to typeString.

Though I don't wish to exploit gri's absence to change
his code, this change is pretty low-risk and he assented to it
in the blue ink in the doc below [gophers only].
https://docs.google.com/a/google.com/document/d/1-DQ4fxlMDs9cYtnkKhAAehX6MArjOQyJsRXp-6kiJLA/edit#

R=iant, gri, gri
CC=golang-dev
https://golang.org/cl/7200046
2013-01-24 14:21:51 -05:00