]> Cypherpunks repositories - gostls13.git/log
gostls13.git
11 years agonet/mail: AddressList fails to parse addresses with a dot
Ryan Slade [Thu, 8 Aug 2013 17:00:24 +0000 (10:00 -0700)]
net/mail: AddressList fails to parse addresses with a dot

Fixes #4938.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12657044

11 years agodoc/go1.2.txt: document previously committed features
Pieter Droogendijk [Thu, 8 Aug 2013 16:57:31 +0000 (09:57 -0700)]
doc/go1.2.txt: document previously committed features

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12585044

11 years agoruntime: use GetQueuedCompletionStatusEx on windows if available
Dmitriy Vyukov [Thu, 8 Aug 2013 13:41:57 +0000 (17:41 +0400)]
runtime: use GetQueuedCompletionStatusEx on windows if available
GetQueuedCompletionStatusEx allows to dequeue a batch of completion
notifications, which is more efficient than dequeueing one by one.

benchmark                           old ns/op    new ns/op    delta
BenchmarkClientServerParallel4         100605        90945   -9.60%
BenchmarkClientServerParallel4-2        90225        74504  -17.42%

R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/12436044

11 years agonet: use SetFileCompletionNotificationModes on windows if available
Dmitriy Vyukov [Thu, 8 Aug 2013 13:36:43 +0000 (17:36 +0400)]
net: use SetFileCompletionNotificationModes on windows if available
This allows to skip GetQueuedCompletionStatus if an IO operation completes synchronously.
benchmark                    old ns/op    new ns/op    delta
BenchmarkTCP4Persistent          27669        25863   -6.53%
BenchmarkTCP4Persistent-2        18173        15908  -12.46%
BenchmarkTCP4Persistent-4        10390         9766   -6.01%

R=golang-dev, mikioh.mikioh, alex.brainman
CC=golang-dev
https://golang.org/cl/12409044

11 years agoregexp/syntax: make it clearer that \b and \B are ASCII-defined
Rob Pike [Thu, 8 Aug 2013 03:26:39 +0000 (13:26 +1000)]
regexp/syntax: make it clearer that \b and \B are ASCII-defined
Fixes #5896.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12645043

11 years agocontainer/list: fix typo in comment
Rob Pike [Thu, 8 Aug 2013 02:41:19 +0000 (12:41 +1000)]
container/list: fix typo in comment
Fixes #6058.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12643043

11 years agodoc/go1.2.txt: flag now exports CommandLine
Rob Pike [Thu, 8 Aug 2013 02:40:09 +0000 (12:40 +1000)]
doc/go1.2.txt: flag now exports CommandLine

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/12642043

11 years agoflag: export commandLine, the previously internal default FlagSet
Rob Pike [Thu, 8 Aug 2013 01:50:58 +0000 (11:50 +1000)]
flag: export commandLine, the previously internal default FlagSet
s/commandLine/CommandLine/g

Fixes #4209.

R=golang-dev, dsymonds, bradfitz
CC=golang-dev
https://golang.org/cl/12587043

11 years agoruntime: Record jmpdefer's argument size.
Keith Randall [Wed, 7 Aug 2013 21:03:50 +0000 (14:03 -0700)]
runtime: Record jmpdefer's argument size.
Fixes bug 6055.

R=golang-dev, bradfitz, dvyukov, khr
CC=golang-dev
https://golang.org/cl/12536045

11 years agobuild: change how cmd/api is run in run.bash and run.bat
Brad Fitzpatrick [Wed, 7 Aug 2013 20:49:37 +0000 (13:49 -0700)]
build: change how cmd/api is run in run.bash and run.bat

In prep for Robert's forthcoming cmd/api rewrite which
depends on the go.tools subrepo, we'll need to be more
careful about how and when we run cmd/api.

Rather than implement this policy in both run.bash and
run.bat, this change moves the policy and mechanism into
cmd/api/run.go, which will then evolve.

The plan is in a TODO in run.go.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/12482044

11 years agoruntime: fix traceback in cgo programs
Dmitriy Vyukov [Wed, 7 Aug 2013 20:31:52 +0000 (00:31 +0400)]
runtime: fix traceback in cgo programs
Fixes #6061.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12609043

11 years agoruntime: do not run TestCgoSignalDeadlock on windows in short mode
Dmitriy Vyukov [Wed, 7 Aug 2013 20:04:28 +0000 (00:04 +0400)]
runtime: do not run TestCgoSignalDeadlock on windows in short mode
The test takes up to 64 seconds on windows builders.
I've tried to reduce number of iterations in the test,
but it does not affect run time.
Fixes #6054.

R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/12531043

11 years agocmd/cc, cmd/gc, runtime: emit bitmaps for scanning locals.
Carl Shapiro [Wed, 7 Aug 2013 19:47:01 +0000 (12:47 -0700)]
cmd/cc, cmd/gc, runtime: emit bitmaps for scanning locals.

Previously, all word aligned locations in the local variables
area were scanned as conservative roots.  With this change, a
bitmap is generated describing the locations of pointer values
in local variables.

With this change the argument bitmap information has been
changed to only store information about arguments.  The locals
member, has been removed.  In its place, the bitmap data for
local variables is now used to store the size of locals.  If
the size is negative, the magnitude indicates the size of the
local variables area.

R=rsc
CC=golang-dev
https://golang.org/cl/12328044

11 years agoruntime: convert .s textflags from numbers to symbolic constants.
Keith Randall [Wed, 7 Aug 2013 19:20:05 +0000 (12:20 -0700)]
runtime: convert .s textflags from numbers to symbolic constants.
Remove NOPROF/DUPOK from everything.

Edits done with a script, except pclinetest.asm which depended
on the DUPOK flag on main().

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12613044

11 years agonet/http: Various fixes to Basic authentication
Pieter Droogendijk [Wed, 7 Aug 2013 18:58:59 +0000 (11:58 -0700)]
net/http: Various fixes to Basic authentication

There were some issues with the code sometimes using base64.StdEncoding,
and sometimes base64.URLEncoding.
Encoding basic authentication is now always done by the same code.

Fixes #5970.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12397043

11 years agotest: add cases to return.go that gccgo got wrong
Ian Lance Taylor [Wed, 7 Aug 2013 18:31:01 +0000 (11:31 -0700)]
test: add cases to return.go that gccgo got wrong

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12620043

11 years agotest: fix return.go to remove unused labels
Ian Lance Taylor [Wed, 7 Aug 2013 18:19:07 +0000 (11:19 -0700)]
test: fix return.go to remove unused labels

The gc compiler only gives an error about an unused label if
it has not given any errors in an earlier pass.  Remove all
unused labels in this test because they don't test anything
useful and they cause gccgo to give unexpected errors.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12580044

11 years agotest: fix return.go to not use fallthrough in a type switch
Ian Lance Taylor [Wed, 7 Aug 2013 18:05:19 +0000 (11:05 -0700)]
test: fix return.go to not use fallthrough in a type switch

The gc compiler only gives an error about fallthrough in a
type switch if it has not given any errors in an earlier pass.
Remove all functions in this test that use fallthrough in a
type switch because they don't test anything useful and they
cause gccgo to give unexpected errors.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12614043

11 years agocmd/ld: Put the textflag constants in a separate file.
Keith Randall [Wed, 7 Aug 2013 17:23:24 +0000 (10:23 -0700)]
cmd/ld: Put the textflag constants in a separate file.
We can then include this file in assembly to replace
cryptic constants like "7" with meaningful constants
like "(NOPROF|DUPOK|NOSPLIT)".

Converting just pkg/runtime/asm*.s for now.  Dropping NOPROF
and DUPOK from lots of places where they aren't needed.
More .s files to come in a subsequent changelist.

A nonzero number in the textflag field now means
"has not been converted yet".

R=golang-dev, daniel.morsing, rsc, khr
CC=golang-dev
https://golang.org/cl/12568043

11 years agonet: fix small bug introduced by 48f7c4dd87fe
Alex Brainman [Wed, 7 Aug 2013 03:36:41 +0000 (13:36 +1000)]
net: fix small bug introduced by 48f7c4dd87fe

Fixes #6063

R=golang-dev, r, dave
CC=dvyukov, golang-dev
https://golang.org/cl/12586043

11 years agonet/http: do not send redundant Connection: close header in HTTP/1.0 responses
Josh Bleecher Snyder [Wed, 7 Aug 2013 01:37:34 +0000 (18:37 -0700)]
net/http: do not send redundant Connection: close header in HTTP/1.0 responses

HTTP/1.0 connections are closed implicitly, unless otherwise specified.

Note that this change does not test or fix "request too large" responses.
Reasoning: (a) it complicates tests and fixes, (b) they should be rare,
and (c) this is just a minor wire optimization, and thus not really worth worrying
about in this context.

Fixes #5955.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12435043

11 years agonet/http: treat HEAD requests like GET requests
Brad Fitzpatrick [Wed, 7 Aug 2013 01:33:03 +0000 (18:33 -0700)]
net/http: treat HEAD requests like GET requests

A response to a HEAD request is supposed to look the same as a
response to a GET request, just without a body.

HEAD requests are incredibly rare in the wild.

The Go net/http package has so far treated HEAD requests
specially: a Write on our default ResponseWriter returned
ErrBodyNotAllowed, telling handlers that something was wrong.
This was to optimize the fast path for HEAD requests, but:

1) because HEAD requests are incredibly rare, they're not
   worth having a fast path for.

2) Letting the http.Handler handle but do nop Writes is still
   very fast.

3) this forces ugly error handling into the application.
   e.g. https://code.google.com/p/go/source/detail?r=6f596be7a31e
   and related.

4) The net/http package nowadays does Content-Type sniffing,
   but you don't get that for HEAD.

5) The net/http package nowadays does Content-Length counting
   for small (few KB) responses, but not for HEAD.

6) ErrBodyNotAllowed was useless. By the time you received it,
   you had probably already done all your heavy computation
   and I/O to calculate what to write.

So, this change makes HEAD requests like GET requests.

We now count content-length and sniff content-type for HEAD
requests. If you Write, it doesn't return an error.

If you want a fast-path in your code for HEAD, you have to do
it early and set all the response headers yourself. Just like
before. If you choose not to Write in HEAD requests, be sure
to set Content-Length if you know it. We won't write
"Content-Length: 0" because you might've just chosen to not
write (or you don't know your Content-Length in advance).

Fixes #5454

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/12583043

11 years agoall: fix up language in a couple of comments
Rob Pike [Tue, 6 Aug 2013 23:35:06 +0000 (09:35 +1000)]
all: fix up language in a couple of comments
Leftovers from 11699043

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12558046

11 years agodoc/articles/laws_of_reflection.html: fix name of variable
Rob Pike [Tue, 6 Aug 2013 23:34:39 +0000 (09:34 +1000)]
doc/articles/laws_of_reflection.html: fix name of variable
Thanks to c.emil.hessman@gmail.com for pointing out the error.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12572043

11 years agofmt: fix up zero padding
Rob Pike [Tue, 6 Aug 2013 22:38:46 +0000 (08:38 +1000)]
fmt: fix up zero padding
If the padding is huge, we crashed by blowing the buffer. That's easy: make sure
we have a big enough buffer by allocating in problematic cases.
Zero padding floats was just wrong in general: the space would appear in the
middle.

Fixes #6044.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12498043

11 years agostrings: add IndexByte benchmark
Brad Fitzpatrick [Tue, 6 Aug 2013 21:41:07 +0000 (14:41 -0700)]
strings: add IndexByte benchmark

Like existing Index, IndexRune, IndexHardN, etc.

R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/12486044

11 years agoruntime: don't mark the new call trampolines as NOSPLIT.
Keith Randall [Tue, 6 Aug 2013 21:33:55 +0000 (14:33 -0700)]
runtime: don't mark the new call trampolines as NOSPLIT.
They may call other NOSPLIT routines, and that might
overflow the stack.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12563043

11 years agonet: add dial, listenStream and listenDatagram methods to netFD
Mikio Hara [Tue, 6 Aug 2013 21:15:50 +0000 (06:15 +0900)]
net: add dial, listenStream and listenDatagram methods to netFD

This CL refactors the existing listenerSockaddr function into several
methods on netFD.

This is in preparation for runtime-integrated network pollster for BSD
variants.

Update #5199

R=golang-dev, dave, alex.brainman, dvyukov, remyoudompheng
CC=golang-dev
https://golang.org/cl/12023043

11 years agoruntime: use correct types for maxstring and concatstring
Rob Pike [Tue, 6 Aug 2013 20:49:11 +0000 (06:49 +1000)]
runtime: use correct types for maxstring and concatstring

Updates #6046.
This CL just does maxstring and concatstring. There are other functions
to fix but doing them a few at a time will help isolate any (unlikely)
breakages these changes bring up in architectures I can't test
myself.

R=golang-dev, dave, iant
CC=golang-dev
https://golang.org/cl/12519044

11 years agoos: fix plan9 build
Brad Fitzpatrick [Tue, 6 Aug 2013 19:04:08 +0000 (12:04 -0700)]
os: fix plan9 build

I broke it with the darwin getwd attrlist stuff (0583e9d36dd).
plan9 doesn't have syscall.ENOTSUP.

It's in api/go1.txt as a symbol always available (not context-specific):

pkg syscall, const ENOTSUP Errno

... but plan9 isn't considered by cmd/api, so it only looks
universally available.  Alternatively, we could add a fake ENOTSUP
to plan9, but they were making efforts earlier to clean their
syscall package, so I'd prefer not to dump more in it.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12509044

11 years agoarchive/zip: allow user-extensible compression methods
Dustin Sallings [Tue, 6 Aug 2013 19:03:38 +0000 (12:03 -0700)]
archive/zip: allow user-extensible compression methods

This change replaces the hard-coded switch on compression method
in zipfile reader and writer with a map into which users can
register compressors and decompressors in their init()s.

R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/12421043

11 years agoA+C: Dustin Sallings (individual CLA)
Brad Fitzpatrick [Tue, 6 Aug 2013 19:00:46 +0000 (12:00 -0700)]
A+C: Dustin Sallings (individual CLA)

Generated by addca.

R=gobot
CC=golang-dev
https://golang.org/cl/12557043

11 years agoruntime/pprof: adjust test
Russ Cox [Tue, 6 Aug 2013 18:49:55 +0000 (14:49 -0400)]
runtime/pprof: adjust test

NetBSD and OpenBSD are broken like OS X is. Good to know.

Drop required count from avg/2 to avg/3, because the
Plan 9 builder just barely missed avg/2 in one of its runs.

R=golang-dev, dvyukov
CC=golang-dev
https://golang.org/cl/12548043

11 years agonet: test that Read/Write do 0 allocations
Dmitriy Vyukov [Tue, 6 Aug 2013 17:29:35 +0000 (21:29 +0400)]
net: test that Read/Write do 0 allocations
It turned out that change 12413043 did not break
any builders. So let's lock this in.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12545043

11 years agosyscall: fix IPv6 wrong network mask on latest FreeBSD
Mikio Hara [Tue, 6 Aug 2013 15:25:23 +0000 (00:25 +0900)]
syscall: fix IPv6 wrong network mask on latest FreeBSD

Looks like latest FreeBSD doesn't set address family identifer
for RTAX_NETMASK stuff; probably RTAX_GENMASK too, not confirmed.
This CL tries to identify address families by using the length of
each socket address if possible.

The issue is confirmed on FreeBSD 9.1.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12332043

11 years agomisc/notepadplus: simplify Function List regex
ChaiShushan [Tue, 6 Aug 2013 14:57:51 +0000 (07:57 -0700)]
misc/notepadplus: simplify Function List regex

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12508043

11 years agonet: separate pollster initialization from network file descriptor allocation
Mikio Hara [Tue, 6 Aug 2013 14:42:33 +0000 (23:42 +0900)]
net: separate pollster initialization from network file descriptor allocation

Unlike the existing net package own pollster, runtime-integrated
network pollster on BSD variants, actually kqueue, requires a socket
that has beed passed to syscall.Listen previously for a stream
listener.

This CL separates pollDesc.Init (actually runtime_pollOpen) from newFD
to allow control of each state of sockets and adds init method to netFD
instead. Upcoming CLs will rearrange the call order of runtime-integrated
pollster and syscall functions like the following;

- For dialers that open active connections, runtime_pollOpen will be
  called in between syscall.Bind and syscall.Connect.

- For stream listeners that open passive stream connections,
  runtime_pollOpen will be called just after syscall.Listen.

- For datagram listeners that open datagram connections,
  runtime_pollOpen will be called just after syscall.Bind.

This is in preparation for runtime-integrated network pollster for BSD
variants.

Update #5199

R=dvyukov, alex.brainman, minux.ma
CC=golang-dev
https://golang.org/cl/8608044

11 years agoruntime: fix Plan 9 build
David du Colombier [Tue, 6 Aug 2013 14:37:26 +0000 (07:37 -0700)]
runtime: fix Plan 9 build

The current failures were:

fatal error: runtime: stack split during syscall
goroutine 1 [stack split]:
runtime.findnull(0x105a9080)
        /usr/go/src/pkg/runtime/string.goc:14 fp=0x305aefb8
runtime: unexpected return pc for runtime.errstr called from 0x80
runtime.errstr()
        /usr/go/src/pkg/runtime/sys_plan9_386.s:196 +0x2f fp=0x305aefc8

fatal error: runtime: stack split during syscall
goroutine 2 [stack split]:
runtime.nanotime(0x305bff3c)
        /usr/go/src/pkg/runtime/time_plan9_386.c:9 fp=0x305bff34
notetsleep(0x305bff9c, 0xf8475800, 0xd, 0x0, 0x0, ...)
        /usr/go/src/pkg/runtime/lock_sema.c:195 +0x87 fp=0x305bff48
runtime.notetsleepg(0x305bff9c, 0xf8475800, 0xd)
        /usr/go/src/pkg/runtime/lock_sema.c:266 +0xa4 fp=0x305bff68
runtime.MHeap_Scavenger()
        /usr/go/src/pkg/runtime/mheap.c:463 +0xc2 fp=0x305bffd0
runtime.goexit()
        /usr/go/src/pkg/runtime/proc.c:1332 fp=0x305bffd4
created by runtime.main
        /usr/go/src/pkg/runtime/proc.c:168

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12128043

11 years agonet: detect bad F_DUPFD_CLOEXEC on OS X 10.6
Brad Fitzpatrick [Tue, 6 Aug 2013 14:18:06 +0000 (07:18 -0700)]
net: detect bad F_DUPFD_CLOEXEC on OS X 10.6

On 10.6, OS X's fcntl returns EBADF instead of EINVAL.

R=golang-dev, iant, dave
CC=golang-dev
https://golang.org/cl/12493043

11 years agoruntime: change int32 to intgo in findnull and findnullw
Rob Pike [Tue, 6 Aug 2013 11:49:03 +0000 (21:49 +1000)]
runtime: change int32 to intgo in findnull and findnullw

Update #6046.
This CL just does findnull and findnullw. There are other functions
to fix but doing them a few at a time will help isolate any (unlikely)
breakages these changes bring up in architectures I can't test
myself.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/12520043

11 years agonet: fix intentional build breakage introduced in 12413043
Dmitriy Vyukov [Tue, 6 Aug 2013 10:43:36 +0000 (14:43 +0400)]
net: fix intentional build breakage introduced in 12413043

R=alex.brainman
CC=golang-dev
https://golang.org/cl/12502044

11 years agonet: reduce number of memory allocations during IO operations
Dmitriy Vyukov [Tue, 6 Aug 2013 10:40:10 +0000 (14:40 +0400)]
net: reduce number of memory allocations during IO operations
Embed all data necessary for read/write operations directly into netFD.

benchmark                    old ns/op    new ns/op    delta
BenchmarkTCP4Persistent          27669        23341  -15.64%
BenchmarkTCP4Persistent-2        18173        12558  -30.90%
BenchmarkTCP4Persistent-4        10390         7319  -29.56%

This change will intentionally break all builders to see
how many allocations they do per read/write.
This will be fixed soon afterwards.

R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/12413043

11 years agoruntime: use gcpc/gcsp during traceback of goroutines in syscalls
Dmitriy Vyukov [Tue, 6 Aug 2013 09:38:44 +0000 (13:38 +0400)]
runtime: use gcpc/gcsp during traceback of goroutines in syscalls
gcpc/gcsp are used by GC in similar situation.
gcpc/gcsp are also more stable than gp->sched,
because gp->sched is mutated by entersyscall/exitsyscall
in morestack and mcall. So it has higher chances of being inconsistent.
Also, rename gcpc/gcsp to syscallpc/syscallsp.

This is the same as reverted change 12250043
with save marked as textflag 7.
The problem was that if save calls morestack,
then subsequent lessstack spoils g->sched.pc/sp.
And that bad values were remembered in g->syscallpc/sp.
Entersyscallblock had the same problem,
but it was never triggered to date.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12478043

11 years agoflag: document the zero value of FlagSet
Kyle Lemons [Tue, 6 Aug 2013 06:48:19 +0000 (16:48 +1000)]
flag: document the zero value of FlagSet

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12403043

11 years agoruntime: Use old reflect.call implementation from cgo.
Keith Randall [Tue, 6 Aug 2013 00:53:08 +0000 (17:53 -0700)]
runtime: Use old reflect.call implementation from cgo.

Basically a partial rollback of 12053043 until I can
figure out what is really going on.
Fixes bug 6051.

R=golang-dev
CC=golang-dev
https://golang.org/cl/12496043

11 years agoapi: update next.txt
Brad Fitzpatrick [Tue, 6 Aug 2013 00:23:12 +0000 (17:23 -0700)]
api: update next.txt

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12490043

11 years agoruntime/pprof: test multithreaded profile, remove OS X workarounds
Russ Cox [Mon, 5 Aug 2013 23:49:02 +0000 (19:49 -0400)]
runtime/pprof: test multithreaded profile, remove OS X workarounds

This means that pprof will no longer report profiles on OS X.
That's unfortunate, but the profiles were often wrong and, worse,
it was difficult to tell whether the profile was wrong or not.

The workarounds were making the scheduler more complex,
possibly caused a deadlock (see issue 5519), and did not actually
deliver reliable results.

It may be possible for adventurous users to apply a patch to
their kernels to get working results, or perhaps having no results
will encourage someone to do the work of creating a profiling
thread like on Windows. Issue 6047 has details.

Fixes #5519.
Fixes #6047.

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/12429045

11 years agoundo CL 12486043 / ab644299d124
Brad Fitzpatrick [Mon, 5 Aug 2013 23:27:24 +0000 (16:27 -0700)]
undo CL 12486043 / ab644299d124

Uglier.

««« original CL description
all: use strings.IndexByte instead of Index where possible

R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/12486043
»»»

R=golang-dev
CC=golang-dev
https://golang.org/cl/12485044

11 years agoall: use strings.IndexByte instead of Index where possible
Brad Fitzpatrick [Mon, 5 Aug 2013 22:46:06 +0000 (15:46 -0700)]
all: use strings.IndexByte instead of Index where possible

R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/12486043

11 years agocontainer/heap: add Fix and document the min is element 0.
Pieter Droogendijk [Mon, 5 Aug 2013 22:45:39 +0000 (15:45 -0700)]
container/heap: add Fix and document the min is element 0.

Fixes #5372.
Fixes #5577.

R=gri, rsc, bradfitz, r
CC=golang-dev
https://golang.org/cl/12265043

11 years agonet: use F_DUPFD_CLOEXEC when duping fds
Brad Fitzpatrick [Mon, 5 Aug 2013 22:43:45 +0000 (15:43 -0700)]
net: use F_DUPFD_CLOEXEC when duping fds

This means that in the common case (modern kernel), we only
make 1 system call to dup instead of two, and we also avoid
grabbing the syscall.ForkLock.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/12476043

11 years agoreflect: Get rid of the test for the error message when
Keith Randall [Mon, 5 Aug 2013 22:08:37 +0000 (15:08 -0700)]
reflect: Get rid of the test for the error message when
you do reflect.call with too big an argument list.
Not worth the hassle.

Fixes #6023
Fixes #6033

R=golang-dev, bradfitz, dave
CC=golang-dev
https://golang.org/cl/12485043

11 years agostrings: use runtime assembly for IndexByte
Brad Fitzpatrick [Mon, 5 Aug 2013 22:04:05 +0000 (15:04 -0700)]
strings: use runtime assembly for IndexByte

Fixes #3751

R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/12483043

11 years agoruntime: tune append crossover on amd64 and 386
Dave Cheney [Mon, 5 Aug 2013 21:51:37 +0000 (07:51 +1000)]
runtime: tune append crossover on amd64 and 386

Fixes #4963.

Sets the append crossover to 0 on intel platforms.

Results for linux/amd64 Core i5 SNB

benchmark                     old ns/op    new ns/op    delta
BenchmarkAppend                     102          104   +1.96%
BenchmarkAppend1Byte                 10           11   +0.92%
BenchmarkAppend4Bytes                15           11  -28.10%
BenchmarkAppend7Bytes                17           12  -32.58%
BenchmarkAppend8Bytes                18           12  -36.17%
BenchmarkAppend15Bytes               24           11  -55.02%
BenchmarkAppend16Bytes               25           11  -56.03%
BenchmarkAppend32Bytes               11           12   +4.31%
BenchmarkAppendStr1Byte               8            9  +13.99%
BenchmarkAppendStr4Bytes             11            9  -17.52%
BenchmarkAppendStr8Bytes             14            9  -35.70%
BenchmarkAppendStr16Bytes            21            9  -55.19%
BenchmarkAppendStr32Bytes            10           10   -5.66%
BenchmarkAppendSpecialCase           49           52   +7.96%

Results for linux/386 Atom(TM) CPU 330 @ 1.60GHz

benchmark                     old ns/op    new ns/op    delta
BenchmarkAppend                     219          218   -0.46%
BenchmarkAppend1Byte                 75           72   -3.44%
BenchmarkAppend4Bytes                92           73  -19.87%
BenchmarkAppend7Bytes               108           74  -31.20%
BenchmarkAppend8Bytes               116           74  -35.95%
BenchmarkAppend15Bytes              162           77  -52.22%
BenchmarkAppend16Bytes              169           77  -54.20%
BenchmarkAppend32Bytes               88           86   -2.38%
BenchmarkAppendStr1Byte              57           59   +3.32%
BenchmarkAppendStr4Bytes             72           59  -17.40%
BenchmarkAppendStr8Bytes             92           60  -34.70%
BenchmarkAppendStr16Bytes           141           63  -54.89%
BenchmarkAppendStr32Bytes            75           73   -2.64%
BenchmarkAppendSpecialCase          270          270   +0.00%

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12440044

11 years agocmd/gc: get rid of redundant slice bound check.
Keith Randall [Mon, 5 Aug 2013 20:24:33 +0000 (13:24 -0700)]
cmd/gc: get rid of redundant slice bound check.

For normal slices a[i:j] we're generating 3 bounds
checks: j<={len(string),cap(slice)}, j<=j (!), and i<=j.
Somehow snuck in as part of the [i:j:k] implementation
where the second check does something.
Remove the second check when we don't need it.

R=rsc, r
CC=golang-dev
https://golang.org/cl/12311046

11 years agocmd/gc: fix inlining of unnamed structs with embedded fields.
Rémy Oudompheng [Mon, 5 Aug 2013 20:09:53 +0000 (22:09 +0200)]
cmd/gc: fix inlining of unnamed structs with embedded fields.

Update #5910.

R=golang-dev, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/11373044

11 years agocompress/bzip2: support concatenated files
Russ Cox [Mon, 5 Aug 2013 20:08:08 +0000 (16:08 -0400)]
compress/bzip2: support concatenated files

While we're here, add a test for the same functionality in gzip,
which was already implemented, and add bzip2 CRC checks.

Fixes #5772.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12387044

11 years agoruntime: remove debugging knob to turn off preemption
Russ Cox [Mon, 5 Aug 2013 20:06:24 +0000 (16:06 -0400)]
runtime: remove debugging knob to turn off preemption

It's still easy to turn off, but the builders are happy.
Also document.

R=golang-dev, iant, dvyukov
CC=golang-dev
https://golang.org/cl/12371043

11 years agoundo CL 12250043 / e911f94c4902
Dmitriy Vyukov [Mon, 5 Aug 2013 19:33:50 +0000 (23:33 +0400)]
undo CL 12250043 / e911f94c4902

Break all 386 builders.

««« original CL description
runtime: use gcpc/gcsp during traceback of goroutines in syscalls
gcpc/gcsp are used by GC in similar situation.
gcpc/gcsp are also more stable than gp->sched,
because gp->sched is mutated by entersyscall/exitsyscall
in morestack and mcall. So it has higher chances of being inconsistent.
Also, rename gcpc/gcsp to syscallpc/syscallsp.

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

R=rsc
CC=golang-dev
https://golang.org/cl/12424045

11 years agoos, syscall: implement Getwd on darwin using getattrlist
Brad Fitzpatrick [Mon, 5 Aug 2013 19:26:05 +0000 (12:26 -0700)]
os, syscall: implement Getwd on darwin using getattrlist

Fixes #4807

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12349044

11 years agoruntime: remove singleproc var
Dmitriy Vyukov [Mon, 5 Aug 2013 18:58:02 +0000 (22:58 +0400)]
runtime: remove singleproc var
It was needed for the old scheduler,
because there temporary could be more threads than gomaxprocs.
In the new scheduler gomaxprocs is always respected.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12438043

11 years agoruntime: use gcpc/gcsp during traceback of goroutines in syscalls
Dmitriy Vyukov [Mon, 5 Aug 2013 18:55:54 +0000 (22:55 +0400)]
runtime: use gcpc/gcsp during traceback of goroutines in syscalls
gcpc/gcsp are used by GC in similar situation.
gcpc/gcsp are also more stable than gp->sched,
because gp->sched is mutated by entersyscall/exitsyscall
in morestack and mcall. So it has higher chances of being inconsistent.
Also, rename gcpc/gcsp to syscallpc/syscallsp.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12250043

11 years agocrypto/cipher: add GCM mode.
Adam Langley [Mon, 5 Aug 2013 18:31:58 +0000 (14:31 -0400)]
crypto/cipher: add GCM mode.

GCM is Galois Counter Mode, an authenticated encryption mode that is,
nearly always, used with AES.

R=rsc
CC=golang-dev
https://golang.org/cl/12375043

11 years agocrypto: include hash number in panic message.
Adam Langley [Mon, 5 Aug 2013 18:23:32 +0000 (14:23 -0400)]
crypto: include hash number in panic message.

In the event that code tries to use a hash function that isn't compiled
in and panics, give the developer a fighting chance of figuring out
which hash function it needed.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12420045

11 years agomisc/notepadplus: add Function List support
ChaiShushan [Mon, 5 Aug 2013 15:24:55 +0000 (08:24 -0700)]
misc/notepadplus: add Function List support

Fixes #6045.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12463043

11 years agodoc/progs/slices.go: fix typo in comment
Rob Pike [Mon, 5 Aug 2013 03:35:42 +0000 (13:35 +1000)]
doc/progs/slices.go: fix typo in comment

Fixes #6025.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/12387046

11 years agonet: fix some test bug
ChaiShushan [Mon, 5 Aug 2013 01:59:59 +0000 (11:59 +1000)]
net: fix some test bug

Fixes #5785.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/10587043

11 years agodoc/effective_go.html: remove spurious word
Rob Pike [Mon, 5 Aug 2013 01:24:27 +0000 (11:24 +1000)]
doc/effective_go.html: remove spurious word

Fixes #6003.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12387045

11 years agotime: match month and day names only when not followed immediately by a lower-case...
Rob Pike [Mon, 5 Aug 2013 00:53:46 +0000 (10:53 +1000)]
time: match month and day names only when not followed immediately by a lower-case letter
Avoids seeing "Janet" as "Januaryet".

Fixes #6020.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/12448044

11 years agoruntime: remove unused scheduler knob
Dmitriy Vyukov [Sun, 4 Aug 2013 19:32:40 +0000 (23:32 +0400)]
runtime: remove unused scheduler knob
Blockingsyscall was used in net package on windows,
it's not used anymore.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12436043

11 years agoruntime: remove dead code
Dmitriy Vyukov [Sun, 4 Aug 2013 19:32:06 +0000 (23:32 +0400)]
runtime: remove dead code
Remove dead code related to allocation of type metadata with SysAlloc.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12311045

11 years agonet: fix concurrent Accept on windows
Dmitriy Vyukov [Sun, 4 Aug 2013 19:31:23 +0000 (23:31 +0400)]
net: fix concurrent Accept on windows
Runtime netpoll supports at most one read waiter
and at most one write waiter. It's responsibility
of net package to ensure that. Currently windows
implementation allows more than one waiter in Accept.
It leads to "fatal error: netpollblock: double wait".

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12400045

11 years agonet/http: fix Response.Header documentation for multiple headers with same key
Josh Bleecher Snyder [Sun, 4 Aug 2013 18:23:17 +0000 (11:23 -0700)]
net/http: fix Response.Header documentation for multiple headers with same key

Whether the keys are concatenated or separate (or a mixture) depends on the server.

Fixes #5979.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12433043

11 years agoruntime: disable dynamic priority boosting on windows
Dmitriy Vyukov [Sun, 4 Aug 2013 10:08:13 +0000 (14:08 +0400)]
runtime: disable dynamic priority boosting on windows
Windows dynamic priority boosting assumes that a process has different types
of dedicated threads -- GUI, IO, computational, etc. Go processes use
equivalent threads that all do a mix of GUI, IO, computations, etc.
In such context dynamic priority boosting does nothing but harm, so turn it off.
In particular, if 2 goroutines do heavy IO on a server uniprocessor machine,
windows rejects to schedule timer thread for 2+ seconds when priority boosting is enabled.
Fixes #5971.

R=alex.brainman
CC=golang-dev
https://golang.org/cl/12406043

11 years agohtml/template: delete panic recovery code from test
Rob Pike [Sat, 3 Aug 2013 23:06:14 +0000 (09:06 +1000)]
html/template: delete panic recovery code from test

The test isn't checking deliberate panics so catching them just makes the code longer.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/12420043

11 years agohtml/template: handle nils during indirection
Josh Bleecher Snyder [Sat, 3 Aug 2013 22:41:19 +0000 (08:41 +1000)]
html/template: handle nils during indirection

Fixes #5982.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12387043

11 years agoA+C: Josh Bleecher Snyder (individual CLA)
Rob Pike [Sat, 3 Aug 2013 22:41:02 +0000 (08:41 +1000)]
A+C: Josh Bleecher Snyder (individual CLA)

Generated by addca.

R=gobot
CC=golang-dev
https://golang.org/cl/12419043

11 years agolibbio: add casts to remove -Wconversion warnings
Ian Lance Taylor [Sat, 3 Aug 2013 18:36:47 +0000 (11:36 -0700)]
libbio: add casts to remove -Wconversion warnings

Update #5764

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

11 years agocmd/dist: generate cmd/cgo/zdefaultcc.go on windows (fixes windows build)
Alex Brainman [Sat, 3 Aug 2013 08:32:14 +0000 (18:32 +1000)]
cmd/dist: generate cmd/cgo/zdefaultcc.go on windows (fixes windows build)

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12404043

11 years agovarious: deleted unused items
Rob Pike [Sat, 3 Aug 2013 06:01:04 +0000 (16:01 +1000)]
various: deleted unused items

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/12396043

11 years agonet: reduce unnecessary syscall.Sockaddr conversions
Mikio Hara [Sat, 3 Aug 2013 04:32:22 +0000 (13:32 +0900)]
net: reduce unnecessary syscall.Sockaddr conversions

This CL makes IPAddr, UDPAddr and TCPAddr implement sockaddr
interface, UnixAddr is already sockaddr interface compliant, and
reduces unnecessary conversions between net.Addr, net.sockaddr and
syscall.Sockaddr.

This is in preparation for runtime-integrated network pollster for BSD
variants.

Update #5199

R=golang-dev, dave, bradfitz
CC=golang-dev
https://golang.org/cl/12010043

11 years agonet: make IP address selection work correctly on IPv6-only kernel
Mikio Hara [Sat, 3 Aug 2013 03:17:01 +0000 (12:17 +0900)]
net: make IP address selection work correctly on IPv6-only kernel

Update #3610
Update #5267
Update #5707

R=golang-dev, bradfitz, dave, fvbommel
CC=golang-dev
https://golang.org/cl/11958043

11 years agobuild: ignore new zfiles, delete temp goplay binary in run.bash
Brad Fitzpatrick [Sat, 3 Aug 2013 02:14:13 +0000 (19:14 -0700)]
build: ignore new zfiles, delete temp goplay binary in run.bash

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12320045

11 years agocmd/dist: fix windows build.
Rémy Oudompheng [Fri, 2 Aug 2013 21:29:04 +0000 (14:29 -0700)]
cmd/dist: fix windows build.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12351045

11 years agocmd/go: fix build
Brad Fitzpatrick [Fri, 2 Aug 2013 21:28:52 +0000 (14:28 -0700)]
cmd/go: fix build

This was missed in c3b45d0dc5c0

R=golang-dev
CC=golang-dev
https://golang.org/cl/12379043

11 years agocmd/go: Fix go get when the fetched XML uses ASCII encoding
Alberto García Hierro [Fri, 2 Aug 2013 21:15:33 +0000 (14:15 -0700)]
cmd/go: Fix go get when the fetched XML uses ASCII encoding

Also, add a meaningful error message when an encoding which
can't be parsed is found.

Fixes #5801.

R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/12343043

11 years agoapi: update next.txt
Brad Fitzpatrick [Fri, 2 Aug 2013 20:15:49 +0000 (13:15 -0700)]
api: update next.txt

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12360043

11 years agoruntime: reimplement reflect.call to not use stack splitting.
Keith Randall [Fri, 2 Aug 2013 20:03:14 +0000 (13:03 -0700)]
runtime: reimplement reflect.call to not use stack splitting.

R=golang-dev, r, khr, rsc
CC=golang-dev
https://golang.org/cl/12053043

11 years agocmd/dist: fix build again
Russ Cox [Fri, 2 Aug 2013 19:20:42 +0000 (15:20 -0400)]
cmd/dist: fix build again

I am really bad at this. Didn't hg add this file.

TBR=bradfitz
CC=golang-dev
https://golang.org/cl/12372043

11 years agocmd/dist: fix build
Russ Cox [Fri, 2 Aug 2013 19:13:06 +0000 (15:13 -0400)]
cmd/dist: fix build

TBR=bradfitz
CC=golang-dev
https://golang.org/cl/12369043

11 years agobuild: on OS X 10.8 and later, use clang instead of gcc
Russ Cox [Fri, 2 Aug 2013 18:58:27 +0000 (14:58 -0400)]
build: on OS X 10.8 and later, use clang instead of gcc

Fixes #5822.
Will no doubt cause other problems, but Apple has forced our hand.

R=golang-dev, bradfitz, khr
CC=golang-dev
https://golang.org/cl/12350044

11 years agotesting: make parsing of -cpu more lenient
Russ Cox [Fri, 2 Aug 2013 17:51:45 +0000 (13:51 -0400)]
testing: make parsing of -cpu more lenient

Also add \n to error message.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12261044

11 years agoruntime: in newstack, double-check calling goroutine
Russ Cox [Fri, 2 Aug 2013 17:51:28 +0000 (13:51 -0400)]
runtime: in newstack, double-check calling goroutine

Checking this condition helped me find the arm problem last night.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12267043

11 years agomisc/dist: don't ship cmd/api
Brad Fitzpatrick [Fri, 2 Aug 2013 17:19:52 +0000 (10:19 -0700)]
misc/dist: don't ship cmd/api

cmd/api is a tool to prevent the Go developers from breaking
the Go 1 API promise. It has no utility to end users and
doesn't run on arbitrary packages (it's always been full of
hacks for its bespoke type checker to work on the standard
library)

Robert's in-progress rewrite depends on the go.tools repo for
go/types, so we won't be able to ship this tool later
anyway. Just remove it from binary distributions.

A future change to run.bash can conditionally build & run
cmd/api, perhaps automatically fetching go/types if
necessary. I assume people don't want to vendor go/types into
a private gopath just for cmd/api.

I will need help with run.bat.

R=golang-dev, adg, dsymonds, rsc
CC=golang-dev
https://golang.org/cl/12316043

11 years agocmd/go: change error message to refer to correct bootstrap command
Alex Brainman [Fri, 2 Aug 2013 05:55:21 +0000 (15:55 +1000)]
cmd/go: change error message to refer to correct bootstrap command

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12317043

11 years agoimage/draw: fix typos found by "go vet".
Nigel Tao [Fri, 2 Aug 2013 03:29:45 +0000 (13:29 +1000)]
image/draw: fix typos found by "go vet".

R=r, adg, bradfitz
CC=golang-dev
https://golang.org/cl/12312043

11 years agofmt: clean up some errors found by vet
Rob Pike [Fri, 2 Aug 2013 01:38:19 +0000 (11:38 +1000)]
fmt: clean up some errors found by vet
Includes deleting some unused items.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/12305043

11 years agoruntime: disable preemption during software fp routines
Russ Cox [Fri, 2 Aug 2013 00:07:01 +0000 (20:07 -0400)]
runtime: disable preemption during software fp routines

It's okay to preempt at ordinary function calls because
compilers arrange that there are no live registers to save
on entry to the function call.

The software floating point routines are function calls
masquerading as individual machine instructions. They are
expected to keep all the registers intact. In particular,
they are expected not to clobber all the floating point
registers.

The floating point registers are kept per-M, because they
are not live at non-preemptive goroutine scheduling events,
and so keeping them per-M reduces the number of 132-byte
register blocks we are keeping in memory.

Because they are per-M, allowing the goroutine to be
rescheduled during software floating point simulation
would mean some other goroutine could overwrite the registers
or perhaps the goroutine would continue running on a different
M entirely.

Disallow preemption during the software floating point
routines to make sure that a function full of floating point
instructions has the same floating point registers throughout
its execution.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/12298043

11 years agobytes: move IndexByte assembly to pkg runtime
Brad Fitzpatrick [Thu, 1 Aug 2013 23:11:19 +0000 (16:11 -0700)]
bytes: move IndexByte assembly to pkg runtime

Per suggestion from Russ in February. Then strings.IndexByte
can be implemented in terms of the shared code in pkg runtime.

Update #3751

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12289043

11 years agonet/url: prepend slash to path in String()
Scott Ferguson [Thu, 1 Aug 2013 22:52:56 +0000 (15:52 -0700)]
net/url: prepend slash to path in String()

Previously if a path was set manually without a leading /, String()
would not insert the slash when writing its output. This would lead
to situations where a URL that should be http://www.google.com/search
is output as http://www.google.comsearch

Fixes #5927.

R=golang-dev, bradfitz, rsc, 0xjnml
CC=golang-dev
https://golang.org/cl/11698045