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

7439 Commits

Author SHA1 Message Date
Robert Griesemer
83c8cc5436 go/types: fixed a few failure checks
More robustness in case of incorrect programs.

Fixes #4962.

R=dsymonds
CC=golang-dev
https://golang.org/cl/7429047
2013-03-01 17:39:22 -08:00
Rob Pike
f235d5d8d7 runtime: special-case append([]byte, string) for small strings
Also make the crossover point an architecture-dependent constant,
although it's the same everywhere for now.

BenchmarkAppendStr1Byte            416          145  -65.14%
BenchmarkAppendStr4Bytes           743          217  -70.79%
BenchmarkAppendStr8Bytes           421          270  -35.87%
BenchmarkAppendStr16Bytes          415          403   -2.89%
BenchmarkAppendStr32Bytes          415          391   -5.78%

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7459044
2013-03-01 16:41:39 -08:00
Rob Pike
8cfed59941 runtime: special-case small byte appends.
Update #3679.

BenchmarkAppend1Byte            484          199  -58.88%
BenchmarkAppend4Bytes           829          286  -65.50%
BenchmarkAppend8Bytes           484          365  -24.59%
BenchmarkAppend16Bytes          484          498   +2.89%
BenchmarkAppend32Bytes          486          484   -0.41%

R=iant, dave, rsc
CC=golang-dev
https://golang.org/cl/7443047
2013-03-01 14:31:26 -08:00
Russ Cox
0598114a90 runtime/cgo: fix arm build, re-enable test
Fixes #4961.

R=golang-dev, r, minux.ma
CC=golang-dev
https://golang.org/cl/7443048
2013-03-01 16:24:23 -05:00
Russ Cox
3611553c3b runtime: add atomics to fix arm
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7429046
2013-03-01 14:57:05 -05:00
John Graham-Cumming
f42a11ec8e net: eliminate odd if statement with identical branches
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7447044
2013-03-01 11:56:33 -08:00
Alan Donovan
be6e82e30b exp/ssa/interp: disable interp_test on non-POSIX.
R=gri, rsc
CC=golang-dev
https://golang.org/cl/7422051
2013-03-01 13:17:13 -05:00
Alan Donovan
ba1d5571db exp/ssa/interp: uncomment tests now passing thanks to recent typechecker fixes.
Also: add support for pointer conversions, covered by one new test.

R=gri, bradfitz, dave
CC=golang-dev
https://golang.org/cl/7435047
2013-03-01 12:51:34 -05:00
Alan Donovan
139160eb30 exp/ssa: fix bug in bridge method
Bridge methods for embedded interfaces were
passing the interface twice: once as receiver,
once as first param.
Covered by $GOROOT/test/ddd.go.

Also:
- invent names ("arg%d") for parameters if missing.
- refactoring: move common code for bridge methods into
  createParams and emitTailCall.

R=gri
CC=golang-dev
https://golang.org/cl/7437047
2013-03-01 12:51:19 -05:00
Russ Cox
83f59d0a4f net/http/cgi: disable TestCopyError to try to fix darwin/386 on builder
Update #4958.

R=golang-dev
CC=golang-dev
https://golang.org/cl/7434047
2013-03-01 12:00:24 -05:00
Russ Cox
08a1631cda runtime: fix build on openbsd, plan9
R=golang-dev
CC=golang-dev
https://golang.org/cl/7438052
2013-03-01 11:57:50 -05:00
Russ Cox
418dd410db syscall: disable TestPassFD on openbsd
Update #4956.

R=golang-dev
CC=golang-dev
https://golang.org/cl/7417048
2013-03-01 11:51:32 -05:00
Russ Cox
e6a3e22c75 runtime: start all threads with runtime.mstart
Putting the M initialization in multiple places will not scale.
Various code assumes mstart is the start already. Make it so.

R=golang-dev, devon.odell
CC=golang-dev
https://golang.org/cl/7420048
2013-03-01 11:44:43 -05:00
Russ Cox
d0d7416d3f runtime: more build fixing
Move the mstartfn into its own field.
Simpler, more likely to be correct.

R=golang-dev, devon.odell
CC=golang-dev
https://golang.org/cl/7414046
2013-03-01 09:24:17 -05:00
Russ Cox
c5f694a5c9 runtime: fix new scheduler on freebsd, windows
R=devon.odell
CC=golang-dev
https://golang.org/cl/7443046
2013-03-01 08:30:11 -05:00
Russ Cox
776b51850b runtime/cgo: fix crosscall2 on arm
This time for sure.

R=golang-dev
CC=golang-dev
https://golang.org/cl/7449045
2013-03-01 05:02:41 -08:00
Dmitriy Vyukov
779c45a507 runtime: improved scheduler
Distribute runnable queues, memory cache
and cache of dead G's per processor.
Faster non-blocking syscall enter/exit.
More conservative worker thread blocking/unblocking.

R=dave, bradfitz, remyoudompheng, rsc
CC=golang-dev
https://golang.org/cl/7314062
2013-03-01 13:49:16 +02:00
Russ Cox
d17506e52d runtime/cgo: make crosscall2 5a/6a/8a-assembled
There is a #pragma dynexport crosscall2, to help SWIG,
and 6l cannot export the symbol if it doesn't get to see it.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7448044
2013-02-28 22:14:55 -08:00
Russ Cox
83c5d07c0e runtime/cgo: fix arm build
During my global search and replace I forgot to open *.S (capital).

R=golang-dev
TBR=golang-dev
CC=golang-dev
https://golang.org/cl/7415047
2013-03-01 00:30:19 -05:00
Jan Ziak
94955f9b40 runtime: check the value returned by runtime·SysAlloc
R=golang-dev, rsc
CC=golang-dev, minux.ma
https://golang.org/cl/7424047
2013-03-01 00:21:08 -05:00
Andrew Gerrand
df60c0a3b8 html/template: fix doc typo
Fixes #4950.

R=golang-dev, peter
CC=golang-dev
https://golang.org/cl/7415046
2013-03-01 14:57:59 +11:00
Alex Brainman
3889d8afe5 path/filepath: better error reporting during TestWinSplitListTestsAreValid
Fixes #4930.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7424043
2013-03-01 14:49:55 +11:00
Alan Donovan
abbbb4283a go/types: fix regression in type checking of RangeStmt.
Now that untyped expressions are done in two phases, the
identity of operand.expr is used as a map key; when reusing
operand values we now must be careful to update the
expr field.

R=gri
CC=golang-dev
https://golang.org/cl/7444049
2013-02-28 20:37:25 -05:00
Brad Fitzpatrick
0bc38b7fe4 net/http: don't special-case multipart/byteranges responses
Fixes #4767

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7435046
2013-02-28 16:58:26 -08:00
Brad Fitzpatrick
523cb45c9d net/http: document net/http/cookiejar on CookieJar
R=golang-dev, nigeltao, adg
CC=golang-dev
https://golang.org/cl/7444048
2013-02-28 16:58:14 -08:00
Nigel Tao
f29b0cf955 net/http/cookiejar: move cookiejar from exp/cookiejar to
net/http/cookiejar.

This is a straight rename. There are no code changes.

Fixes #1960.

R=rsc, adg
CC=dr.volker.dobler, golang-dev
https://golang.org/cl/7436043
2013-03-01 11:15:00 +11:00
Robert Griesemer
3a9fcc45f6 go/types: fix type-checking of shift expressions
Completely rethought shift expression type checking.
Instead of attempting to type-check them eagerly, now
delay the checking of untyped constant lhs in non-
constant shifts until the final expression type
becomes clear. Once it is clear, update the respective
expression tree with the final (not untyped) type and
check respective shift lhs' where necessary.

This also cleans up another conundrum: How to report
the type of untyped constants as it changes from
untyped to typed. Now, Context.Expr is only called
for an expresion x once x has received its final
(not untyped) type (for constant initializers, the
final type may still be untyped).

With this CL all remaining std lib packages that
did not typecheck due to shift errors pass now.

TODO: There's a lot of residual stuff that needs
to be cleaned up but with this CL all tests pass
now.

R=adonovan, axwalk
CC=golang-dev
https://golang.org/cl/7381052
2013-02-28 15:27:52 -08:00
Dmitriy Vyukov
38d4d3c66a runtime: refactor Syscall benchmark
And add a benchmark where #goroutines>GOMAXPROCS,
because it's the most interesting case.
Current results on darwin/amd64, Intel Core 2 Duo 2.13 GHz, 2 cores:
BenchmarkSyscall	100000000	        56.0 ns/op
BenchmarkSyscall-2	50000000	        57.2 ns/op
BenchmarkSyscallWork	10000000	       635 ns/op
BenchmarkSyscallWork-2	10000000	       315 ns/op
BenchmarkSyscallExcess	 1000000	      2698 ns/op
BenchmarkSyscallExcess-2	 5000000	      1192 ns/op
BenchmarkSyscallExcessWork	 1000000	      2832 ns/op
BenchmarkSyscallExcessWork-2	 2000000	      1966 ns/op

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7415044
2013-03-01 01:10:34 +02:00
Dmitriy Vyukov
72b09bd7ae runtime: add matrix multiplication benchmark
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7431047
2013-03-01 00:41:45 +02:00
Akshat Kumar
bd88990722 os: Plan 9: allocate space for a string in Rename
The Name field of the stat structure is variable length
and the marshalling code in package syscall requires
a buf long enough to contain the Name as well as the
static data. This change makes sure that the buffer in
os.Rename is allocated with the appropriate length.

R=rsc, rminnich, ality, r
CC=golang-dev
https://golang.org/cl/7453044
2013-02-28 14:20:42 -08:00
Russ Cox
5bffa3b88e runtime/cgo: move common symbol overrides into 6c-compiled code
There are some function pointers declared by 6c in
package runtime without initialization and then also
declared in package runtime/cgo with initialization,
so that if runtime/cgo is linked in, the function pointers
are non-nil, and otherwise they are nil. We depend on
this property for implementing non-essential cgo hooks
in package runtime.

The declarations in package runtime are 6c-compiled
and end up in .6 files. The declarations in package runtime/cgo
are gcc-compiled and end up in .o files. Since 6l links the .6
and .o files together, this all works.

However, when we switch to "external linking" mode,
6l will not see the .o files, and it would be up to the host linker
to resolve the two into a single initialized symbol.
Not all host linkers will do this (in particular OS X gcc will not).

To fix this, move the cgo declarations into 6c-compiled code,
so that they end up in .6 files, so that 6l gets them no matter what.

R=golang-dev
CC=golang-dev
https://golang.org/cl/7440045
2013-02-28 13:54:23 -08:00
Russ Cox
349cc74867 encoding/gob: fix copyright
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7423046
2013-02-28 13:30:59 -08:00
Russ Cox
f8d49b509b runtime/cgo: make symbol naming consistent
The naming in this package is a disaster.
Make it all consistent.

Remove some 'static' from functions that will
be referred to from other files soon.

This CL is purely renames using global search and replace.

Submitting separately so that real changes will not
be drowned out by these renames in future CLs.

TBR=iant
CC=golang-dev
https://golang.org/cl/7416046
2013-02-28 16:24:38 -05:00
Russ Cox
40ed753ebd cmd/ld: fix symbol table sorting
runtime: double-check that symbol table is sorted

If the symbol table is unsorted, the binary search in findfunc
will not find its func, which will make stack traces stop early.
When the garbage collector starts using the stack tracer,
that would be a serious problem.

The unsorted symbol addresses came from from two things:

1. The symbols in an ELF object are not necessarily sorted,
   so sort them before adding them to the symbol list.

2. The __i686.get_pc_thunk.bx symbol is present in multiple
   object files and was having its address adjusted multiple
   times, producing an incorrect address in the symbol table.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7440044
2013-02-28 16:21:58 -05:00
Rob Pike
1bf66f081f all: fix a few more printf arg bugs found by go vet
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7413045
2013-02-28 11:33:08 -08:00
Matt Brown
1300fb5449 strconv: use Quote to escape the input string for failed conversion errors
This reveals the presence of control and non-printable characters in the
errors returned by the Parse functions.  Also add unit tests for NumError.

R=golang-dev, r, rsc
CC=golang-dev
https://golang.org/cl/7393075
2013-02-28 10:08:05 -08:00
John Graham-Cumming
087b708fd3 net/http: fix handling of HEAD in ReadResponse and (*http.Response).Write
The test suite for ReadResponse was not checking the error return on the io.Copy
on the body. This was masking two errors: the handling of chunked responses to
HEAD requests and the handling of Content-Length > 0 to HEAD.

The former manifested itself as an 'unexpected EOF' when doing the io.Copy
because a chunked reader was assigned but there were no chunks to read. The
latter cause (*http.Response).Write to report an error on HEAD requests
because it saw a Content-Length > 0 and expected a body.

There was also a missing \r\n in one chunked test that meant that the chunked
encoding was malformed. This does not appear to have been intentional.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7407046
2013-02-28 09:29:50 -08:00
Shenghou Ma
6ecb39fce6 cmd/go: fix "go run" cgo source when cgo is disabled
also move a cgo-depend test to appropriate source file in runtime.

R=golang-dev, dave, adg, rsc
CC=golang-dev
https://golang.org/cl/7393063
2013-02-28 16:07:26 +08:00
Rémy Oudompheng
67d0445c87 log/syslog: fix race in test between channel close and accept.
Fixes #4769.

R=golang-dev, dave, adg, bradfitz
CC=fullung, golang-dev
https://golang.org/cl/7322089
2013-02-28 07:48:16 +01:00
Rémy Oudompheng
e2f9e816b7 runtime: fix racefuncenter argument corruption.
Revision 6a88e1893941 corrupts the argument to
racefuncenter by pushing the data block pointer
to the stack.

Fixes #4885.

R=dvyukov, rsc
CC=golang-dev
https://golang.org/cl/7381053
2013-02-28 07:32:29 +01:00
Akshat Kumar
b2249f2018 net: pass tests on Plan 9
Ignore problematic tests and un-ignore one
we can now pass.

R=rsc, rminnich, ality, dave, bradfitz
CC=golang-dev
https://golang.org/cl/7396060
2013-02-28 07:18:02 +01:00
Mikio Hara
322214cf54 net: fix slow network interface manipulations
This CL reduces unnecessary network facility lookups introduced
by recent changes below.

changeset: 15798:53a4da6a4f4a
net: return correct point-to-point interface address on linux

changeset: 15799:a81ef8e0cc05
net: set up IPv6 scoped addressing zone for network facilities

Also adds a test case for issue	4839.

Benchmark results on linux/amd64, virtual machine:
benchmark                                 old ns/op    new ns/op    delta
BenchmarkInterfaces-2                         80487        80382   -0.13%
BenchmarkInterfaceByIndex-2                   72013        71391   -0.86%
BenchmarkInterfaceByName-2                    79865        80101   +0.30%
BenchmarkInterfaceAddrs-2                     42071       829677  +1872.09%
BenchmarkInterfacesAndAddrs-2                 35016       607622  +1635.27%
BenchmarkInterfacesAndMulticastAddrs-2       169849       169082   -0.45%
old: 15797:9c3930413c1b, new: tip

Benchmark results on linux/amd64, virtual machine:
benchmark                                 old ns/op    new ns/op    delta
BenchmarkInterfaces-2                         80487        81459   +1.21%
BenchmarkInterfaceByIndex-2                   72013        71512   -0.70%
BenchmarkInterfaceByName-2                    79865        80567   +0.88%
BenchmarkInterfaceAddrs-2                     42071       120108  +185.49%
BenchmarkInterfacesAndAddrs-2                 35016        33259   -5.02%
BenchmarkInterfacesAndMulticastAddrs-2       169849        82391  -51.49%
old: 15797:9c3930413c1b, new: tip+CL7400055

Benchmark results on darwin/amd64:
benchmark                                 old ns/op    new ns/op    delta
BenchmarkInterfaces-2                         34402        34231   -0.50%
BenchmarkInterfaceByIndex-2                   13192        12956   -1.79%
BenchmarkInterfaceByName-2                    34791        34388   -1.16%
BenchmarkInterfaceAddrs-2                     36565        63906  +74.77%
BenchmarkInterfacesAndAddrs-2                 17497        31068  +77.56%
BenchmarkInterfacesAndMulticastAddrs-2        25276        66711  +163.93%
old: 15797:9c3930413c1b, new: tip

Benchmark results on darwin/amd64:
benchmark                                 old ns/op    new ns/op    delta
BenchmarkInterfaces-2                         34402        31854   -7.41%
BenchmarkInterfaceByIndex-2                   13192        12950   -1.83%
BenchmarkInterfaceByName-2                    34791        31926   -8.23%
BenchmarkInterfaceAddrs-2                     36565        42144  +15.26%
BenchmarkInterfacesAndAddrs-2                 17497        17329   -0.96%
BenchmarkInterfacesAndMulticastAddrs-2        25276        24870   -1.61%
old: 15797:9c3930413c1b, new: tip+CL7400055

Update #4234.
Fixes #4839 (again).
Fixes #4866.

R=golang-dev, fullung
CC=golang-dev
https://golang.org/cl/7400055
2013-02-28 14:58:41 +09:00
Akshat Kumar
f0a8b610e7 net, os, syscall: Plan 9: adjust error handling
syscall: Use NewError for all system errors and introduce
        some new errors for compatibility with other packages
        and proper error handling in net. Also introduce
        Temporary and Timeout methods on ErrorString.

net: Make errors from dial, accept, listen functions follow the
        OpError standard and discern whether the underlying
        error came from syscall. Since Plan 9 uses a correspondence
        between file and network operations, all system error
        reporting happens through the underlying file operation.
        In Go code, we go through package os for file operations,
        so there is another level of indirection in error types.
        This change allows us to compare the errors with those in
        package syscall, when appropriate.

os: Just use the error string already present in package os,
        instead of calling out to package syscall.

R=rsc, ality, rminnich, bradfitz
CC=golang-dev
https://golang.org/cl/7398054
2013-02-28 06:43:21 +01:00
Akshat Kumar
1f62a784f4 syscall: Plan 9: keep a consistent environment array
Map order is non-deterministic. Introduce a new
environment string array that tracks the env map.
This allows us to produce identical results for
Environ() upon successive calls, as expected by the
TestConsistentEnviron test in package os.

R=rsc, ality, rminnich, bradfitz, r
CC=golang-dev
https://golang.org/cl/7411047
2013-02-28 06:39:02 +01:00
Nigel Tao
3b69efb010 exp/cookiejar: eliminate some "."+str garbage.
It's not a big deal, but it's easy to fix.

R=dsymonds
CC=dr.volker.dobler, golang-dev
https://golang.org/cl/7425043
2013-02-28 13:46:26 +11:00
Volker Dobler
1069d25e37 exp/cookiejar: add some more tests
New tests added for port handling and IDNA domains.
A new test case contains several redundant
tests but provides a nice documentation of the
implemented rules for domain handling.

R=nigeltao
CC=golang-dev
https://golang.org/cl/7393070
2013-02-28 11:18:39 +11:00
Gustavo Niemeyer
64648986e3 net/http: don't drop error on request write
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7230059
2013-02-27 21:15:36 -03:00
Rob Pike
f12796e9f7 builtin: document appending a string to a byte slice
Fixes #4873.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7421043
2013-02-27 16:11:17 -08:00
Brad Fitzpatrick
abf5700a15 syscall: add MSG_FASTOPEN to Linux
Update #4842

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7369060
2013-02-27 15:51:51 -08:00
Robert Griesemer
25c99300b9 go/types: don't crash if there are no hints
R=r
CC=golang-dev
https://golang.org/cl/7375060
2013-02-27 15:22:14 -08:00
Brad Fitzpatrick
11776a39a1 net/http: add Transport.CancelRequest
Permits all sorts of custom HTTP timeout policies without
adding a new Transport timeout Duration for each combination
of HTTP phases.

This keeps track internally of which TCP connection a given
Request is on, and lets callers forcefully close the TCP
connection for a given request, without actually getting
the net.Conn directly.

Additionally, a future CL will implement res.Body.Close (Issue
3672) in terms of this.

Update #3362
Update #3672

R=golang-dev, rsc, adg
CC=golang-dev
https://golang.org/cl/7372054
2013-02-27 15:20:13 -08:00
Robert Griesemer
029457aab5 go/types: don't crash when assigning to undefined variables
R=adonovan
CC=golang-dev
https://golang.org/cl/7369059
2013-02-27 14:24:41 -08:00
Alan Donovan
877153f04a exp/ssa: fix *bsd breakage.
Use portable ReadDirent, not linux Getdents.

R=gri
TBR=gri
CC=golang-dev
https://golang.org/cl/7405051
2013-02-27 17:00:02 -05:00
Alan Donovan
1c5e079600 exp/ssa: a number of bug fixes.
ssadump:
- permit naming a package (not just *.go files) on command line.
- set BuildSerially flag when setting Log* flags
  (Q. should instead the logging functions take a lock?)

Builder:
- fixed bug when calling variadic function with zero '...'-params.
  Added regression test.

interp:
- more external functions:
   the 'error' interface
   bytes.{Equal,IndexByte}
   reflect.(Value).{Bool,NumOut,Out}
   syscall.{Close,Fstat,Read,Open,Stat,Lstat,Fstat,
     Getdents,ParseDirents,Getwd}
- permit comparisons between *Function and *closure.

With this CL, ssadump can now interpret ssadump itself (!),
loading, parsing, typing, SSA-building, and running
println("Hello, World!").  While a fmt-based equivalent still
lacks some external routines, e.g. math/big, I think there are
diminishing returns in expanding the interpreter (and
debugging it is starting to feel like "Inception").

I'm pretty confident this package is now good enough for wider use.

R=gri
CC=golang-dev
https://golang.org/cl/7392053
2013-02-27 16:43:16 -05:00
Brad Fitzpatrick
d1d38c535d net: fix windows build
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7392054
2013-02-27 12:42:26 -08:00
Brad Fitzpatrick
752fec22bb net: add DialOpt, the extensible Dial w/ options dialer
Add DialOpt. So we have:

func Dial(net, addr string) (Conn, error)
func DialTimeout(net, addr string, timeout time.Duration) (Conn, error)
func DialOpt(addr string, opts ...DialOption) (Conn, error)

DialTimeout (and Dial) are regrettable in retrospect. Maybe
in a future Go we'll be back down to one Dial, with DialOpt
becoming Dial.

DialOpt looks like:

c, err := net.DialOpt("google.com:80")  // tcp is default
c, err := net.DialOpt("google.com:80", net.Timeout(30 * time.Second))
c, err := net.DialOpt("google.com:80", net.TCPFastOpen())
c, err := net.DialOpt("google.com:80", net.LocalAddr(..))
c, err := net.DialOpt("google.com:53", net.Network("udp6"))

And then: (clustered in godoc)

type DialOption interface { /* private only */ }
  func Deadline(time.Time) DialOption
  func LocalAddr(Addr) DialOption
  func Network(string) DialOption
  func TCPFastOpen() DialOption
  func Timeout(time.Duration) DialOption

I'm pretty confident we could add Happy Eyeballs to this too.

Fixes #3097
Update #3610
Update #4842

R=golang-dev, r, dave, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/7365049
2013-02-27 11:59:36 -08:00
Dmitriy Vyukov
6cdfb00f4e runtime: more changes in preparation to the new scheduler
add per-P cache of dead G's
add global runnable queue (not used for now)
add list of idle P's (not used for now)

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7397061
2013-02-27 21:17:53 +02:00
Volker Dobler
73c21b1312 sort: use proper mass unit in example
The values for the planet masses are given in
earth mass, not solar mass.

R=golang-dev, dave, r
CC=golang-dev
https://golang.org/cl/7368054
2013-02-27 10:44:50 -08:00
Brad Fitzpatrick
839d47add5 net/http: add Transport.ResponseHeaderTimeout
Update #3362

R=golang-dev, adg, rsc
CC=golang-dev
https://golang.org/cl/7369055
2013-02-27 08:47:08 -08:00
Alan Donovan
37cb6f809a exp/ssa: resolve botched merge.
While submitting CL 7371051 I accidentally reverted much of CL
7395052.  This change restores it.

R=gri
TBR=gri
CC=golang-dev
https://golang.org/cl/7364051
2013-02-27 11:39:39 -05:00
Jan Ziak
01ab9a012a runtime: improve precision of GC_REGION
R=rsc
CC=golang-dev
https://golang.org/cl/7383054
2013-02-27 08:28:53 -08:00
Alan Donovan
5a09f1b3be exp/ssa: make invokation of deferred procedure calls explicit.
The correct semantics of named result parameters and deferred
procedures cannot be implemented with the existing Ret
instruction alone, since the required sequence is:
(1) evaluate return operands and parallel-assign them to
    named result parameters
(2) invoke deferred procedures
(3) load named result parameters to form result tuple.

We introduce a new 'rundefers' instruction that explicitly
invokes the deferred procedure calls, and we generate code
that follows the sequence above.

Most functions do not use deferred procedures but this cannot
be known in a single pass.  So, we add an optimisation to
eliminate redundant 'rundefers'; it is piggybacked on the
existing pass done for "lifting".

Added tests.

R=gri
CC=golang-dev
https://golang.org/cl/7411043
2013-02-27 10:35:23 -05:00
Alan Donovan
3fc8cd054a exp/ssa: perform all packages' BUILD phases in parallel.
Details:
- move Builder.nTo1Vars into package => thread-safe.
- add BuildSerially builder mode flag to disable concurrency.
- add Builder.BuildAllPackages method.

Benchmark: BuildAllPackages for $GOROOT/test/append.go drops
to 83ms from 190ms (GOMAXPROCS=8).

R=gri
CC=golang-dev
https://golang.org/cl/7371051
2013-02-27 10:26:24 -05:00
Marcel van Lohuizen
7add9b7f6a exp/locale/collate: fixed go vet error.
R=r, dave
CC=golang-dev
https://golang.org/cl/7403055
2013-02-27 14:09:42 +01:00
Marcel van Lohuizen
5afa271ce3 exp/locale/collate: several changes based on comments on CL 7060051
which was submitted earlier.

R=r
CC=golang-dev
https://golang.org/cl/7402048
2013-02-27 11:08:18 +01:00
Matthew Dempsky
f853e9aa4e syscall: Fix FD passing on OpenBSD
Fixes #3349.

R=bradfitz, dave, minux.ma
CC=golang-dev
https://golang.org/cl/7383056
2013-02-27 15:19:23 +11:00
Russ Cox
56a06db360 cmd/ld: change GC_CALL to 32-bit relative address
The current code uses 64-bit pc-relative on 64-bit systems,
but in ELF linkers there is no such thing, so we cannot
express this in a .o file. Change to 32-bit.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7383055
2013-02-26 19:42:56 -08:00
Russ Cox
c8dcaeb25d cmd/ld, runtime: adjust symbol table representation
This CL changes the encoding used for the Go symbol table,
stored in the binary and used at run time. It does not change
any of the semantics or structure: the bits are just packed
a little differently.

The comment at the top of runtime/symtab.c describes the new format.

Compared to the Go 1.0 format, the main changes are:

* Store symbol addresses as full-pointer-sized host-endian values.
  (For 6g, this means addresses are 64-bit little-endian.)

* Store other values (frame sizes and so on) varint-encoded.

The second change more than compensates for the first:
for the godoc binary on OS X/amd64, the new symbol table
is 8% smaller than the old symbol table (1,425,668 down from 1,546,276).

This is a required step for allowing the host linker (gcc) to write
the final Go binary, since it will have to fill in the symbol address slots
(so the slots must be host-endian) and on 64-bit systems it may
choose addresses above 4 GB.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7403054
2013-02-26 22:38:14 -05:00
Nigel Tao
15cce227c7 exp/cookiejar: add a test for canonicalHost errors.
R=dr.volker.dobler
CC=golang-dev
https://golang.org/cl/7389048
2013-02-27 13:05:57 +11:00
Rob Pike
2c2934eeb5 sort: add an example showing sorting struct by different keys
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/7376058
2013-02-26 17:17:44 -08:00
Brad Fitzpatrick
65fcb39dc7 net/http: fix a bunch of test leaks
And one real leak in TimeoutHandler.

Fixes #4821

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7369056
2013-02-26 17:12:50 -08:00
Robert Griesemer
60066754fd go/types: be more robust in presence of multiple errors
- better documentation of Check
- better handling of (explicit) internal panics
- gotype: don't stop after 1st error

R=adonovan, r
CC=golang-dev
https://golang.org/cl/7406052
2013-02-26 14:33:24 -08:00
Dave Cheney
98d44d140d syscall: fix FD passing on FreeBSD and NetBSD
Fixes #3348.

R=devon.odell, minux.ma, bradfitz, mdempsky
CC=golang-dev
https://golang.org/cl/7406050
2013-02-27 09:13:15 +11:00
Alan Donovan
c8c16cfbb9 exp/ssa: support multiple labels on same statement.
Actually it already worked since the spec only requires that
the one immediately preceding a for/switch/... be usable as
the target of a break or continue statement.

Added a test.
Also: allocate Function.lblocks on first use.

R=gri
CC=golang-dev
https://golang.org/cl/7365058
2013-02-26 14:07:03 -05:00
Rob Pike
6c2cbdb142 cmd/vet: fix printf test for unsafe Pointer
And fix test. Pointer to unsafe.Pointer tests nothing important...
Also identify the incorrect type: go/types.Type is a Stringer.

Also fix a couple of incorrect format verbs found by new printf checker,
now that we can run it on more files.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7385051
2013-02-26 10:36:13 -08:00
Alan Donovan
bd92dd6a5f exp/ssa: reimplement logic for field selection.
The previous approach desugared the ast.SelectorExpr
to make implicit field selections explicit.  But:
1) it was clunky since it required allocating temporary
   syntax trees.
2) it was not thread-safe since it required poking
   types into the shared type map for the new ASTs.
3) the desugared syntax had no place to represent the
   package lexically enclosing each implicit field
   selection, so it was as if they all occurred in the
   same package as the explicit field selection.
   This meant unexported field names changed meaning.

This CL does what I should have done all along: just
generate the SSA instructions directly from the original
AST and the promoted field information.

Also:
- add logStack util for paired start/end log messages.
  Useful for debugging crashes.

R=gri
CC=golang-dev
https://golang.org/cl/7395052
2013-02-26 13:32:22 -05:00
Anthony Martin
16eb2c0b7a runtime: fix stack cache typos
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7370050
2013-02-26 09:59:17 -08:00
Anthony Martin
2b39e418be all: clean up C function prototypes
R=minux.ma, rsc, akumar, bradfitz
CC=golang-dev
https://golang.org/cl/7313070
2013-02-26 09:51:33 -08:00
Akshat Kumar
fa625fb39a os/exec: Pass tests on Plan 9
Adjust the exit status string for Plan 9.

Upon allocating >100 file descriptors, Plan 9
raises a warning. Moreover, the Go runtime for
32-bit version of Plan 9 keeps /dev/bintime
open for its implementation of runtime.nanotime().
This change accounts for these things in
TestExtraFiles.

R=rsc, rminnich, ality, bradfitz
CC=golang-dev
https://golang.org/cl/7363056
2013-02-26 09:40:55 -08:00
Robert Griesemer
a5e42f2611 go/types: fix sizeof computations
Context.Alignof/Offsetsof/Sizeof now provide means
to customize the type checker for a given platform.

- provide Context.Offsetsof to specify the
  offsets of struct fields
- use the correct sizes for ints, uint, uintptrs
  in constant computations
- moved all size computations into separate file
  (sizes.go)
- fixed a bug with string constant slicing

R=adonovan, axwalk
CC=golang-dev
https://golang.org/cl/7363054
2013-02-25 22:06:58 -08:00
Robert Griesemer
3f132a8236 go/types: more robust imports
- imported objects don't have position information
- gc exported data contains non-exported objects at
  the top-level, guard against them
- better error message when dot-imports conflict
  with local declarations

R=adonovan, r
CC=golang-dev
https://golang.org/cl/7379052
2013-02-25 20:43:35 -08:00
Robert Griesemer
1caaff6b5a go/types: embedded fields can be predeclared types
R=adonovan, r
CC=golang-dev
https://golang.org/cl/7376055
2013-02-25 20:42:29 -08:00
Cosmos Nicolaou
d6a057c90e cmd/godoc: add support for display Notes parsed by pkg/go/doc
pkg/go/doc: move BUG notes from Package.Bugs to the general Package.Notes field.
Removing .Bugs would break existing code so it's left in for now.

R=gri, gri, gary.burd, dsymonds, rsc, kevlar
CC=golang-dev
https://golang.org/cl/7341053
2013-02-25 20:34:09 -08:00
Alex Brainman
26498684cb os: use windows ReadConsole to read from console
Fixes #4760.

R=golang-dev, minux.ma, bradfitz
CC=golang-dev
https://golang.org/cl/7312053
2013-02-26 14:18:48 +11:00
Akshat Kumar
d2326febd5 syscall, runtime: Plan 9: use nanotime syscall on amd64
Separates the implementation of nanotime on 64-bit
version of Plan 9 from that on the 32-bit version.
The former uses a syscall.

R=rsc, rminnich, ality
CC=golang-dev
https://golang.org/cl/7379051
2013-02-26 01:56:08 +01:00
Nigel Tao
ffa0f83060 exp/cookiejar: implement IDNA/Punycode's toASCII.
R=dr.volker.dobler
CC=golang-dev
https://golang.org/cl/7398049
2013-02-26 11:55:41 +11:00
Akshat Kumar
b461fe660d net: Implement FileListener, FileConn, and File methods for Plan 9
Functions for representing network connections as files
and vice versa, on Plan 9.

Representing network connections as files is not so
straight-forward, because a network connection on Plan 9
is represented by a host of files rather than a single
file descriptor (as is the case on UNIX). We use the
type system to distinguish between listeners and
connections, returning the control file in the former
case and the data file in the latter case.

R=rsc, rminnich, ality, akumar, bradfitz
CC=golang-dev
https://golang.org/cl/7235068
2013-02-26 01:26:40 +01:00
Rémy Oudompheng
9fe60801ae cmd/gc: apply escape analysis results to closures.
This avoids an allocation when closures are used
as "macros", in Walk idioms, or as argument to defer.

benchmark                old ns/op    new ns/op    delta
BenchmarkSearchWrappers       1171          354  -69.77%
BenchmarkCallClosure             3            3  -12.54%
BenchmarkCallClosure1          119            7  -93.95%
BenchmarkCallClosure2          183           74  -59.18%
BenchmarkCallClosure3          187           75  -59.57%
BenchmarkCallClosure4          187           76  -58.98%

Compared to Go 1:
benchmark                  old ns/op    new ns/op    delta
BenchmarkSearchWrappers         3208          354  -88.97%

Fixes #3520.

R=daniel.morsing, bradfitz, minux.ma, dave, rsc
CC=golang-dev
https://golang.org/cl/7397056
2013-02-26 00:40:28 +01:00
Shenghou Ma
4692711d7f strconv, fmt: clarify behavior of CanBackquote and "%#q".
Fixes #4858.

R=golang-dev, bradfitz, r, rsc
CC=golang-dev
https://golang.org/cl/7387044
2013-02-26 06:33:59 +08:00
Andrew Gerrand
89cf67eb20 time: handle very large sleep durations
Fixes #4903.

R=golang-dev, daniel.morsing, dave, r
CC=golang-dev
https://golang.org/cl/7388056
2013-02-26 09:23:58 +11:00
Akshat Kumar
b6e322dcf5 syscall: Plan9, amd64: fix syscall error handling in assembly
Syscalls return `-1' on error and the representation is always
32-bits. The `$-1' literal in 64-bit assembly is always the
64-bit representation. So this change makes sure that we
always do a 32-bit comparison when checking for error.
Also makes sure that in the error case, we return a 64-bit
`-1' from runtime.seek.

Fixes the arithmetic for handling the error-string in
runtime.Syscall6.

R=golang-dev, rminnich, rsc, ality, minux.ma
CC=golang-dev
https://golang.org/cl/7399052
2013-02-25 22:40:14 +01:00
Dmitriy Vyukov
4eb7ba743d runtime/cgo: fix deadlock involving signals on darwin
sigprocmask() is process-wide on darwin, so two concurrent
libcgo_sys_thread_start() can result in all signals permanently
blocked, which in particular blocks handling of nil derefs.
Fixes #4833.

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/7324058
2013-02-25 16:36:29 -05:00
Brad Fitzpatrick
e3ed4cace0 net/http/cgi: make tests compile on plan9
Don't reference the non-portable syscall.Signal(0).

Maybe they'll pass too. Untested. plan9 bit from
Akshat Kumar.

R=golang-dev, akumar
CC=golang-dev
https://golang.org/cl/7370049
2013-02-25 13:27:15 -08:00
Jan Ziak
a656f82071 runtime: precise garbage collection of channels
This changeset adds a mostly-precise garbage collection of channels.
The garbage collection support code in the linker isn't recognizing
channel types yet.

Fixes issue http://stackoverflow.com/questions/14712586/memory-consumption-skyrocket

R=dvyukov, rsc, bradfitz
CC=dave, golang-dev, minux.ma, remyoudompheng
https://golang.org/cl/7307086
2013-02-25 15:58:23 -05:00
Rob Pike
707ab1347f all: fix some vet-found printf errors
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7393059
2013-02-25 12:43:03 -08:00
Robert Griesemer
a411b104f0 go/parser: more precise comment
See also CL 7383051 for details.

R=adonovan, bradfitz
CC=golang-dev
https://golang.org/cl/7378063
2013-02-25 08:29:46 -08:00
Roger Peppe
7edd13355f net/rpc: avoid racy use of closing flag.
It's accessed without mutex protection
in a different goroutine from the one that
sets it.

Also make sure that Client.Call after Client.Close
will reliably return ErrShutdown, and that clients
see ErrShutdown rather than io.EOF when appropriate.

Suggestions welcome for a way to reliably test
the mutex issue.

R=r, iant
CC=golang-dev
https://golang.org/cl/7338045
2013-02-25 16:22:00 +00:00
Mikio Hara
cd81db8299 net: make use of testing.B.Skip and reflect.DeepEqual in test
This CL addresses the comments on CL 7368046 that I've overlooked.

Update #4866.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/7369052
2013-02-25 23:05:40 +09:00
Rémy Oudompheng
670f6b602d go/types: unresolved literal keys must be looked up in universe.
Fixes #4888.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/7383051
2013-02-24 21:57:16 -08:00
Rémy Oudompheng
b582ef3855 crypto/rsa: fix infinite loop in GenerateMultiPrimeKey for large nprimes
The heuristics for BitLen of a product of randomly generated primes
are wrong, and the generated candidates never match the required
size for nprimes > 10. This corner case is not expected to be used in
practice.

R=agl
CC=golang-dev
https://golang.org/cl/7397052
2013-02-24 17:19:09 +01:00