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

13225 Commits

Author SHA1 Message Date
Brad Fitzpatrick
de04bf24e5 net/http: fix early side effects in the ResponseWriter's ReadFrom
The ResponseWriter's ReadFrom method was causing side effects on
the output before any data was read.

Now, bail out early and do a normal copy (which does a read
before writing) when our input and output are known to not to
be the pair of types we need for sendfile.

Fixes #5660

R=golang-dev, rsc, nightlyone
CC=golang-dev
https://golang.org/cl/12632043
2013-08-08 14:02:54 -07:00
Russ Cox
390656affd cmd/gc: fix stkptrsize calculation
I moved the pointer block from one end of the frame
to the other toward the end of working on the last CL,
and of course that made the optimization no longer work.

Now it works again:

0030 (bug361.go:12) DATA    gclocals·0+0(SB)/4,$4
0030 (bug361.go:12) DATA    gclocals·0+4(SB)/4,$3
0030 (bug361.go:12) GLOBL   gclocals·0+0(SB),8,$8

Fixes arm build (this time for sure!).

TBR=golang-dev
CC=cshapiro, golang-dev, iant
https://golang.org/cl/12627044
2013-08-08 16:44:16 -04:00
Russ Cox
f91e682cca cmd/gc: make bitmaps shorter
Sort non-pointer-containing data to the low end of the
stack frame, and make the bitmaps only cover the
pointer-containing top end.

Generates significantly less garbage collection bitmap
for programs with large byte buffers on the stack.

Only 2% shorter for godoc, but 99.99998% shorter
in some test cases.

Fixes arm build.

TBR=golang-dev
CC=cshapiro, golang-dev, iant
https://golang.org/cl/12541047
2013-08-08 16:38:02 -04:00
Brad Fitzpatrick
9a9e541c4d cmd/api: show output of api tool even if exit status is 0
We weren't seeing additions. (stuff to put in next.txt)

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12678043
2013-08-08 13:36:22 -07:00
Brad Fitzpatrick
8378804640 os: fix windows and plan9 builds
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12519046
2013-08-08 11:13:00 -07:00
Brad Fitzpatrick
9497e5e2f0 cmd/api: update run.go to fetch from go.tools when needed
R=gri
CC=golang-dev
https://golang.org/cl/12639043
2013-08-08 11:06:38 -07:00
Dmitriy Vyukov
9f46efce52 runtime: print scavenger details when forced with debug.FreeOSMemory
Fixes #5900.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12669043
2013-08-08 21:55:04 +04:00
Russ Cox
1f4d58ad5d cmd/gc: move large stack variables to heap
Individual variables bigger than 10 MB are now
moved to the heap, as if they had escaped on
their own.

This avoids ridiculous stacks for programs that
do things like
        x := [1<<30]byte{}
        ... use x ...

If 10 MB is too small, we can raise the limit.

Fixes #6077.

R=ken2
CC=golang-dev
https://golang.org/cl/12650045
2013-08-08 13:46:30 -04:00
Pieter Droogendijk
bdbd5418f4 os: make Readdir work as documented
Readdir's result should never contain a nil.

Fixes #5960.

R=golang-dev, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/12261043
2013-08-08 10:44:01 -07:00
Dmitriy Shelenin
547f1a6fe7 encoding/xml: allow attributes stored in pointers to be marshaled.
Fixes #5334.

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/8653047
2013-08-08 10:40:51 -07:00
Ryan Slade
73b8baa1bd net/mail: AddressList fails to parse addresses with a dot
Fixes #4938.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12657044
2013-08-08 10:00:24 -07:00
Dmitriy Vyukov
65834685d3 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
2013-08-08 17:41:57 +04:00
Dmitriy Vyukov
ed8c5501c7 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
2013-08-08 17:36:43 +04:00
Rob Pike
b4f370ca57 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
2013-08-08 13:26:39 +10:00
Rob Pike
077989cf94 container/list: fix typo in comment
Fixes #6058.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12643043
2013-08-08 12:41:19 +10:00
Rob Pike
6ac93e2ac8 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
2013-08-08 11:50:58 +10:00
Keith Randall
a97a91de06 runtime: Record jmpdefer's argument size.
Fixes bug 6055.

R=golang-dev, bradfitz, dvyukov, khr
CC=golang-dev
https://golang.org/cl/12536045
2013-08-07 14:03:50 -07:00
Brad Fitzpatrick
d5e97ea2f5 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
2013-08-07 13:49:37 -07:00
Dmitriy Vyukov
326ae8d14e runtime: fix traceback in cgo programs
Fixes #6061.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12609043
2013-08-08 00:31:52 +04:00
Dmitriy Vyukov
1590abef03 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
2013-08-08 00:04:28 +04:00
Carl Shapiro
73c93a404c 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
2013-08-07 12:47:01 -07:00
Keith Randall
0273dc131e 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
2013-08-07 12:20:05 -07:00
Pieter Droogendijk
a08b1d13ea 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
2013-08-07 11:58:59 -07:00
Keith Randall
5a54696d78 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
2013-08-07 10:23:24 -07:00
Alex Brainman
60aa48c127 net: fix small bug introduced by 48f7c4dd87fe
Fixes #6063

R=golang-dev, r, dave
CC=dvyukov, golang-dev
https://golang.org/cl/12586043
2013-08-07 13:36:41 +10:00
Josh Bleecher Snyder
1535727e57 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
2013-08-06 18:37:34 -07:00
Brad Fitzpatrick
ebe91d1105 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
2013-08-06 18:33:03 -07:00
Rob Pike
a4ebad79b4 all: fix up language in a couple of comments
Leftovers from 11699043

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12558046
2013-08-07 09:35:06 +10:00
Rob Pike
f59064de80 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
2013-08-07 08:38:46 +10:00
Brad Fitzpatrick
1104a2afb1 strings: add IndexByte benchmark
Like existing Index, IndexRune, IndexHardN, etc.

R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/12486044
2013-08-06 14:41:07 -07:00
Keith Randall
12e46e42ec 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
2013-08-06 14:33:55 -07:00
Mikio Hara
b29d035fe6 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
2013-08-07 06:15:50 +09:00
Rob Pike
98a80b95b4 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
2013-08-07 06:49:11 +10:00
Brad Fitzpatrick
ad119b9c4d 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
2013-08-06 12:04:08 -07:00
Dustin Sallings
9115345925 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
2013-08-06 12:03:38 -07:00
Russ Cox
8dc7a31d77 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
2013-08-06 14:49:55 -04:00
Dmitriy Vyukov
905f296552 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
2013-08-06 21:29:35 +04:00
Mikio Hara
262d6f58c7 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
2013-08-07 00:25:23 +09:00
Mikio Hara
6a76bca362 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
2013-08-06 23:42:33 +09:00
David du Colombier
33bd9694cd 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
2013-08-06 07:37:26 -07:00
Brad Fitzpatrick
b2fcdfa5fd 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
2013-08-06 07:18:06 -07:00
Rob Pike
82f5ca1ef0 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
2013-08-06 21:49:03 +10:00
Dmitriy Vyukov
429a67e300 net: fix intentional build breakage introduced in 12413043
R=alex.brainman
CC=golang-dev
https://golang.org/cl/12502044
2013-08-06 14:43:36 +04:00
Dmitriy Vyukov
04b1cfa946 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
2013-08-06 14:40:10 +04:00
Dmitriy Vyukov
9c0500b466 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
2013-08-06 13:38:44 +04:00
Kyle Lemons
321ede78e3 flag: document the zero value of FlagSet
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12403043
2013-08-06 16:48:19 +10:00
Keith Randall
034d5fcc30 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
2013-08-05 17:53:08 -07:00
Russ Cox
d3066e47b1 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
2013-08-05 19:49:02 -04:00
Brad Fitzpatrick
d8e27db395 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
2013-08-05 16:27:24 -07:00
Brad Fitzpatrick
4c772cda54 all: use strings.IndexByte instead of Index where possible
R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/12486043
2013-08-05 15:46:06 -07:00
Pieter Droogendijk
dd6f49ddca 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
2013-08-05 15:45:39 -07:00
Brad Fitzpatrick
37feacf623 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
2013-08-05 15:43:45 -07:00
Keith Randall
f7910128e7 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
2013-08-05 15:08:37 -07:00
Brad Fitzpatrick
598c78967f strings: use runtime assembly for IndexByte
Fixes #3751

R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/12483043
2013-08-05 15:04:05 -07:00
Dave Cheney
8ce8adbe7a 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
2013-08-06 07:51:37 +10:00
Keith Randall
19e2922688 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
2013-08-05 13:24:33 -07:00
Rémy Oudompheng
49da9a8e44 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
2013-08-05 22:09:53 +02:00
Russ Cox
8a0779f9b9 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
2013-08-05 16:08:08 -04:00
Russ Cox
10ebb84d48 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
2013-08-05 16:06:24 -04:00
Dmitriy Vyukov
f38ff9e5ea 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
2013-08-05 23:33:50 +04:00
Brad Fitzpatrick
7963ba6a4a os, syscall: implement Getwd on darwin using getattrlist
Fixes #4807

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12349044
2013-08-05 12:26:05 -07:00
Dmitriy Vyukov
d5ab784611 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
2013-08-05 22:58:02 +04:00
Dmitriy Vyukov
f73972fa33 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
2013-08-05 22:55:54 +04:00
Adam Langley
20a2b96089 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
2013-08-05 14:31:58 -04:00
Adam Langley
5e36877d2a 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
2013-08-05 14:23:32 -04:00
ChaiShushan
6ab49fbc6e net: fix some test bug
Fixes #5785.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/10587043
2013-08-05 11:59:59 +10:00
Rob Pike
af8426eebe 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
2013-08-05 10:53:46 +10:00
Dmitriy Vyukov
49217cf5fd 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
2013-08-04 23:32:40 +04:00
Dmitriy Vyukov
0a904a3f2e 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
2013-08-04 23:32:06 +04:00
Dmitriy Vyukov
77f21eea59 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
2013-08-04 23:31:23 +04:00
Josh Bleecher Snyder
910caf9345 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
2013-08-04 11:23:17 -07:00
Dmitriy Vyukov
a574822f80 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
2013-08-04 14:08:13 +04:00
Rob Pike
7d4ea6cc9e 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
2013-08-04 09:06:14 +10:00
Josh Bleecher Snyder
53d9b6fcf3 html/template: handle nils during indirection
Fixes #5982.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12387043
2013-08-04 08:41:19 +10:00
Ian Lance Taylor
5437eefa65 libbio: add casts to remove -Wconversion warnings
Update #5764

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/12388043
2013-08-03 11:36:47 -07:00
Alex Brainman
a039bf20be cmd/dist: generate cmd/cgo/zdefaultcc.go on windows (fixes windows build)
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12404043
2013-08-03 18:32:14 +10:00
Rob Pike
16c9d3616a various: deleted unused items
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/12396043
2013-08-03 16:01:04 +10:00
Mikio Hara
8a7def2b3b 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
2013-08-03 13:32:22 +09:00
Mikio Hara
f0291a8e10 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
2013-08-03 12:17:01 +09:00
Brad Fitzpatrick
74d2e096db build: ignore new zfiles, delete temp goplay binary in run.bash
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12320045
2013-08-02 19:14:13 -07:00
Rémy Oudompheng
0fe65c4f49 cmd/dist: fix windows build.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12351045
2013-08-02 14:29:04 -07:00
Brad Fitzpatrick
7acf9e93de cmd/go: fix build
This was missed in c3b45d0dc5c0

R=golang-dev
CC=golang-dev
https://golang.org/cl/12379043
2013-08-02 14:28:52 -07:00
Alberto García Hierro
bbf1430021 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
2013-08-02 14:15:33 -07:00
Keith Randall
9cd570680b runtime: reimplement reflect.call to not use stack splitting.
R=golang-dev, r, khr, rsc
CC=golang-dev
https://golang.org/cl/12053043
2013-08-02 13:03:14 -07:00
Russ Cox
b8c8cb8509 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
2013-08-02 15:20:42 -04:00
Russ Cox
e6ddddadda cmd/dist: fix build
TBR=bradfitz
CC=golang-dev
https://golang.org/cl/12369043
2013-08-02 15:13:06 -04:00
Russ Cox
2ddb672ddc 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
2013-08-02 14:58:27 -04:00
Russ Cox
337407d847 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
2013-08-02 13:51:45 -04:00
Russ Cox
ebc5513be6 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
2013-08-02 13:51:28 -04:00
Brad Fitzpatrick
b8b48abe0f 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
2013-08-02 10:19:52 -07:00
Alex Brainman
6f8acd5fb9 cmd/go: change error message to refer to correct bootstrap command
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12317043
2013-08-02 15:55:21 +10:00
Nigel Tao
97863bb8af image/draw: fix typos found by "go vet".
R=r, adg, bradfitz
CC=golang-dev
https://golang.org/cl/12312043
2013-08-02 13:29:45 +10:00
Rob Pike
fba7b04dcb 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
2013-08-02 11:38:19 +10:00
Russ Cox
e03dd07981 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
2013-08-01 20:07:01 -04:00
Brad Fitzpatrick
e2a1bd68b3 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
2013-08-01 16:11:19 -07:00
Scott Ferguson
39679ca88f 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
2013-08-01 15:52:56 -07:00
Russ Cox
13507e0697 runtime: fix traceback across morestack
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12287043
2013-08-01 18:51:55 -04:00
Pieter Droogendijk
df1eeeba4a compress/flate: Fixed two panics on bad data
I used just enough of the data provided by Matt in Issue 5915 to trigger
issue 5915. As luck would have it, using slightly less of it triggered
issue 5962.

Fixes #5915.
Fixes #5962.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12288043
2013-08-01 15:20:01 -07:00
Brad Fitzpatrick
17d803d251 net/http: don't write out invalid cookie lines
Fixes #3033

R=golang-dev, fvbommel, rsc
CC=golang-dev
https://golang.org/cl/12204043
2013-08-01 12:16:37 -07:00
Andrew Balholm
334761a666 net/http: document that Error is to be used with plain text
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12276043
2013-08-01 12:05:05 -07:00
Brad Fitzpatrick
9742003ffc strings: add IndexByte, for consistency with bytes package
I always forget which package has it.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12214044
2013-08-01 11:17:26 -07:00
Russ Cox
b99fa81555 cmd/ld: report pclntab, funcdata sizes in 6l -v output
Also move chatty recent additions to -v -v.

For what it's worth:

$ go build -o /dev/null -ldflags -v cmd/go
...
 0.87 pclntab=1110836 bytes, funcdata total 69700 bytes
...
$

This broke the ELF builds last time because I tried to dedup
the funcdata in case the same funcdata was pointed at by
multiple functions. That doesn't currently happen, so I've
removed that test.

If we start doing bitmap coalescing we'll need to figure out
how to measure the size more carefully, but I think at that
point the bitmaps will be an extra indirection away from the
funcdata anyway, so the dedup I used before wouldn't help.

R=ken2
CC=golang-dev
https://golang.org/cl/12269043
2013-08-01 12:58:27 -04:00
Russ Cox
c24e60eebb strconv: fix doc comment for IntSize
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12258043
2013-08-01 11:34:25 -04:00
Dmitriy Vyukov
c33d490020 runtime: print "created by" for running goroutines in traceback
This allows to at least determine goroutine "identity".
Now it looks like:
goroutine 12 [running]:
        goroutine running on other thread; stack unavailable
created by testing.RunTests
        src/pkg/testing/testing.go:440 +0x88e

R=golang-dev, r, rsc
CC=golang-dev
https://golang.org/cl/12248043
2013-08-01 19:28:38 +04:00
Dmitriy Vyukov
3cbc2716a9 runtime: remove unused var
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12249043
2013-08-01 18:26:21 +04:00
Dmitriy Vyukov
d8bbbd2537 runtime: make new tests shorter in short mode
We see timeouts in these tests on some platforms,
but not on the others.  The hypothesis is that
the problematic platforms are slow uniprocessors.
Stack traces do not suggest that the process
is completely hang, and it is able to schedule
the alarm goroutine. And if it actually hangs,
we still will be able to detect that.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12253043
2013-08-01 18:25:36 +04:00
Dmitriy Vyukov
bd0a14fe40 testing: say what was the timeout if it fires
It looks reasonable here and may be useful.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12252043
2013-08-01 17:24:24 +04:00
Dmitriy Vyukov
21315c3428 runtime: fix netbsd/arm build
Currently fails with:
fatal error: runtime: stack split during syscall
goroutine 2 [stack split]:
_vasop(0x3ac4a0, 0x505f8f00, 0x7a5a8, 0x7, 0x1ed3797f, ...)
        src/pkg/runtime/vlrt_arm.c:513 fp=0x505f8ecc
runtime.semasleep(0xf8475800, 0xd)
        src/pkg/runtime/os_netbsd.c:97 +0x178 fp=0x505f8efc

R=rsc
CC=golang-dev
https://golang.org/cl/12246043
2013-08-01 15:19:45 +04:00
Brad Fitzpatrick
c8d49cf56f syscall: add Dup3 on Linux
With dup3, we can avoid an extra system call on some machines
while holding syscall.ForkLock. Currently we have to
syscall.Dup + syscall.CloseOnExec.

On machines with Linux and a new enough kernel, this can just
be dup3.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12170045
2013-07-31 23:38:53 -07:00
Brad Fitzpatrick
252c107f2f net/http: don't MIME sniff if handler set an empty string Content-Type
Fixes #5953

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/12117043
2013-07-31 23:38:32 -07:00
Rémy Oudompheng
184b02ea9f runtime: fix arm build.
More functions needs to be marked as no stack split.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/11963044
2013-08-01 07:48:21 +02:00
Russ Cox
f4f2cf16b0 runtime: mark arm _lsvh nosplit (may fix arm build)
Mark the 386 one too for consistency,
although most of that code is no longer used.

TBR=dvyukov
CC=golang-dev
https://golang.org/cl/12227043
2013-08-01 00:23:30 -04:00
Russ Cox
cba880e04a runtime: fix arm preemption
Preemption during the software floating point code
could cause m (R9) to change, so that when the
original registers were restored at the end of the
floating point handler, the changed and correct m
would be replaced by the old and incorrect m.

TBR=dvyukov
CC=golang-dev
https://golang.org/cl/11883045
2013-08-01 00:16:31 -04:00
Andrew Gerrand
5f1af1608f build: remove builder from test suite (fix build)
R=golang-dev, dave, dsymonds
CC=golang-dev
https://golang.org/cl/12225043
2013-08-01 13:49:00 +10:00
Andrew Gerrand
4fa83edf06 cmd/godoc: delete from core repository
The godoc command now lives at code.google.com/p/go.tools/cmd/godoc.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12206044
2013-08-01 11:21:17 +10:00
Andrew Gerrand
e011ac5420 cmd/go: install go.tools/cmd/godoc to $GOROOT/bin/godoc
Also suggest "go get" if godoc not found when running "go doc".

R=golang-dev, r, rsc
CC=golang-dev
https://golang.org/cl/12214043
2013-08-01 11:17:42 +10:00
Brad Fitzpatrick
b08d0c2c62 undo CL 12193043 / cc5858966b08
Breaks all ELF builds.

««« original CL description
       cmd/ld: report pclntab, funcdata sizes in 6l -v output
       Also move chatty recent additions to -v -v.

       For what it's worth:

       $ go build -o /dev/null -ldflags -v cmd/godoc
       ...
        0.73 pclntab=1259976 bytes, funcdata total 79788 bytes
       ...
       $

R=ken2
CC=cshapiro, golang-dev
https://golang.org/cl/12193043
»»»

R=rsc
CC=golang-dev
https://golang.org/cl/12202043
2013-07-31 15:31:43 -07:00
Rémy Oudompheng
a05237f20a runtime: save 8 stack bytes in timediv on arm.
Operations on int64 are very stack consuming with 5c.
Fixes netbsd/arm build.

Before: TEXT    runtime.timediv+0(SB),7,$52-16
After:  TEXT    runtime.timediv+0(SB),7,$44-16

The stack usage is unchanged on 386:
        TEXT    runtime.timediv+0(SB),7,$8-16

R=golang-dev, dvyukov, bradfitz
CC=golang-dev
https://golang.org/cl/12182044
2013-07-31 23:37:23 +02:00
Pieter Droogendijk
fbcc24bb9d container/list: added MoveBefore and MoveAfter
Fixes #4940.

R=golang-dev, bradfitz, gri
CC=golang-dev
https://golang.org/cl/12021044
2013-07-31 14:11:25 -07:00
Rémy Oudompheng
441ef7978d crypto/des: faster permutation.
This patch introduces specialized functions for initial
and final permutations, and precomputes the output of the
third permutation on the S-box elements.

benchmark           old ns/op    new ns/op    delta
BenchmarkEncrypt         3581         1226  -65.76%
BenchmarkDecrypt         3590         1224  -65.91%

benchmark            old MB/s     new MB/s  speedup
BenchmarkEncrypt         2.23         6.52    2.92x
BenchmarkDecrypt         2.23         6.53    2.93x

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12072045
2013-07-31 22:06:48 +02:00
Russ Cox
d43ee1b714 cmd/ld: report pclntab, funcdata sizes in 6l -v output
Also move chatty recent additions to -v -v.

       For what it's worth:

       $ go build -o /dev/null -ldflags -v cmd/godoc
       ...
	0.73 pclntab=1259976 bytes, funcdata total 79788 bytes
       ...
       $

R=ken2
CC=cshapiro, golang-dev
https://golang.org/cl/12193043
2013-07-31 15:36:49 -04:00
Dmitriy Vyukov
98d94b589c runtime: better debug output for inconsistent Note
Update #5139.
Double wakeup on Note was reported several times,
but no reliable reproducer.
There also was a strange report about weird value of epoll fd.
Maybe it's corruption of global data...

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12182043
2013-07-31 22:03:59 +04:00
Dmitriy Vyukov
658d19a53f runtime: do not park sysmon thread if any goroutines are running
Sysmon thread parks if no goroutines are running (runtime.sched.npidle ==
runtime.gomaxprocs).
Currently it's unparked when a goroutine enters syscall, it was enough
to retake P's from blocking syscalls.
But it's not enough for reliable goroutine preemption. We need to ensure that
sysmon runs if any goroutines are running.

R=rsc
CC=golang-dev
https://golang.org/cl/12176043
2013-07-31 20:09:03 +04:00
Dmitriy Vyukov
6ee69a9726 undo CL 12167043 / 475e11851fc1
Submitted with some unrelated changes that were not intended to go in.

««« original CL description
runtime: do not park sysmon thread if any goroutines are running
Sysmon thread parks if no goroutines are running (runtime.sched.npidle == runtime.gomaxprocs).
Currently it's unparked when a goroutine enters syscall, it was enough
to retake P's from blocking syscalls.
But it's not enough for reliable goroutine preemption. We need to ensure that
sysmon runs if any goroutines are running.

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

R=rsc
CC=golang-dev
https://golang.org/cl/12171044
2013-07-31 20:03:05 +04:00
Dmitriy Vyukov
8679d5f2b5 cmd/gc: record argument size for all indirect function calls
This is required to properly unwind reflect.methodValueCall/makeFuncStub.
Fixes #5954.
Stats for 'go install std':
61849 total INSTCALL
24655 currently have ArgSize metadata
27278 have ArgSize metadata with this change
godoc size before: 11351888, after: 11364288

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12163043
2013-07-31 20:00:33 +04:00
Dmitriy Vyukov
156e8b306d runtime: do not park sysmon thread if any goroutines are running
Sysmon thread parks if no goroutines are running (runtime.sched.npidle == runtime.gomaxprocs).
Currently it's unparked when a goroutine enters syscall, it was enough
to retake P's from blocking syscalls.
But it's not enough for reliable goroutine preemption. We need to ensure that
sysmon runs if any goroutines are running.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12167043
2013-07-31 19:59:27 +04:00
Russ Cox
e8018fbebe runtime: rewrite map size test
I don't know why the memstats code is flaky.

TBR=bradfitz
CC=golang-dev
https://golang.org/cl/12160043
2013-07-31 08:35:43 -04:00
Pieter Droogendijk
27032fddee path/filepath: Panic in Match when parsing invalid character range.
Fixes #5668.

R=golang-dev, rsc, r
CC=golang-dev
https://golang.org/cl/12001056
2013-07-31 16:58:28 +10:00
Robert Daniel Kortschak
53b61057b2 fmt: make all errors begin with the string "%!", always.
Fixes #5730.

R=dsymonds, r, kamil.kisiel
CC=golang-dev
https://golang.org/cl/11998044
2013-07-31 16:11:12 +10:00
Ulf Holm Nielsen
aa38aeaeaf time: Allow Parse and Format to handle time zone offsets with seconds
Adds layout cases with seconds for stdISO8601 and stdNumTZ with and without colons. Update time.Format to append seconds for those cases.

Fixes #4934.

R=golang-dev, r, bradfitz
CC=golang-dev
https://golang.org/cl/8132044
2013-07-31 16:11:02 +10:00
Rob Pike
df4de948a5 text/template/parse: print TextNodes using %s not %q
This means that printing a Node will produce output that can be used as valid input.
It won't be exactly the same - some spacing may be different - but it will mean the same.

Fixes #4593.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/12006047
2013-07-31 15:09:13 +10:00
Rob Pike
221af5c12f fmt: treat \r\n as \n in Scan
When scanning input and "white space" is permitted, a carriage return
followed immediately by a newline (\r\n) is treated exactly the same
as a plain newline (\n). I hope this makes it work better on Windows.

We do it everywhere, not just on Windows, since why not?

Fixes #5391.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/12142043
2013-07-31 15:00:08 +10:00
Keith Randall
a696ae56db runtime: optimize some hash lookups.
When comparing strings, check these (in order):
- length mismatch => not equal
- string pointer equal => equal
- if length is short:
  - memeq on body
- if length is long:
  - compare first&last few bytes, if different => not equal
  - save entry as a possible match
  - after checking every entry, if there is only one possible
    match, use memeq on that entry.  Otherwise, fallback to hash.

benchmark                 old ns/op    new ns/op    delta
BenchmarkSameLengthMap           43            4  -89.77%

Fixes #5194.
Update #3885.

R=golang-dev, bradfitz, khr, rsc
CC=golang-dev
https://golang.org/cl/12128044
2013-07-30 21:39:57 -07:00
Rob Pike
609d742e79 fmt: remove "Scan:" prefix from error messages
The prefix was not uniformly applied and is probably better left off anyway.

Fixes #4944.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/12140043
2013-07-31 14:09:19 +10:00
Rob Pike
02ad82fe15 fmt: put a ! in all error output generated by Printf-like functions
Fixes #5730.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/12141043
2013-07-31 14:08:47 +10:00
Mikio Hara
fa673bd872 net: add simple SetKeepAlivePeriod call test
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/12090043
2013-07-31 12:34:14 +09:00
Russ Cox
1794880299 runtime: fix build on FreeBSD
This is what I get for being talked into a test.

TBR=bradfitz
CC=golang-dev
https://golang.org/cl/12045044
2013-07-30 23:21:07 -04:00
Rob Pike
5fea8c030b text/template: fix type of ComplexZero in test
Was stupidly float64; should be complex128.
The tests still pass.

Fixes #5649.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12107044
2013-07-31 13:04:57 +10:00
Russ Cox
6a13897bc6 runtime: ARM _sfloat has no arguments
Fixes one build failure.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/12139043
2013-07-30 22:58:38 -04:00
Russ Cox
57933b86b1 cmd/go: send timed out test SIGQUIT before SIGKILL
There is a chance that the SIGQUIT will make the test process
dump its stacks as part of exiting, which would be nice for
finding out what it is doing.

Right now the builders are occasionally timing out running
the runtime test. I hope this will give us some information
about the state of the runtime.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/12041051
2013-07-30 22:52:10 -04:00
Russ Cox
4042b77776 runtime: cut struct Hmap back to 48-byte allocation
struct Hmap is the header for a map value.

CL 8377046 made flags a uint32 so that it could be updated atomically,
but that bumped the struct to 56 bytes, which allocates as 64 bytes (on amd64).

hash0 is initialized from runtime.fastrand1, which returns a uint32,
so the top 32 bits were always zero anyway. Declare it as a uint32
to reclaim 4 bytes and bring the Hmap size back down to a 48-byte allocation.

Fixes #5237.

R=golang-dev, khr, khr
CC=bradfitz, dvyukov, golang-dev
https://golang.org/cl/12034047
2013-07-30 22:48:03 -04:00
Shivakumar GN
3abaf5cae0 net/http: skip TestDirJoin on Windows, even if /etc/hosts exists
Fixes #5460.

R=golang-dev, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/12123043
2013-07-30 18:25:08 -07:00
Robert Griesemer
12a38d5b95 container/list: document complexity of Len
Fixes #5972.

R=golang-dev, adonovan
CC=golang-dev
https://golang.org/cl/12125043
2013-07-30 13:35:14 -07:00
Dmitriy Vyukov
3d6bce411c runtime: fix code formatting
This is mainly to force another build
with goroutine preemption.

R=rsc
CC=golang-dev
https://golang.org/cl/12006045
2013-07-30 23:48:18 +04:00
Dmitriy Vyukov
a20784bdaf runtime: enable goroutine preemption
All known issues with preemption have beed fixed.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12008044
2013-07-30 22:17:38 +04:00
Dmitriy Vyukov
5c8ad2e13d runtime: fix race builders
Do not run Syscall benchmarks under race detector,
they split stack in syscall status.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12093045
2013-07-30 22:13:51 +04:00
Dmitriy Vyukov
3b6de5e847 net: fix memory leak on unix
If netFD is closed by finalizer, runtime netpoll descriptor is not freed.

R=golang-dev, dave, alex.brainman
CC=golang-dev
https://golang.org/cl/12037043
2013-07-30 19:47:16 +04:00
Russ Cox
cd2eb48722 cmd/gc: don't report mark if other things are broken
Fixes #5598.

R=ken2
CC=golang-dev
https://golang.org/cl/12104043
2013-07-30 10:27:26 -04:00
Russ Cox
27d17255db cmd/gc: insert \n at end of every input file
Not just the first one.

Fixes #5433.
Fixes #5913.

R=ken2
CC=golang-dev
https://golang.org/cl/12028049
2013-07-30 10:27:08 -04:00
Mikio Hara
28138f1364 net: fix comment on SetKeepAlivePeriod
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/12091043
2013-07-30 16:31:57 +09:00
Mikio Hara
8f32df5455 net: add missing SetKeepAlivePeriod for Plan 9
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/12082045
2013-07-30 16:29:51 +09:00
Alex A Skinner
789e1c351e encoding/xml: Do not pass through invalid utf8 bytes
EscapeText now escapes 0xFFFD returned from DecodeRune as 0xFFFD, rather than passing through the original byte.
Fixes #5880.

R=golang-dev, r, bradfitz, adg
CC=golang-dev
https://golang.org/cl/11975043
2013-07-30 14:11:47 +10:00
Rémy Oudompheng
4eaf91a7a7 cmd/gc: make bisonerrors compatible with GNU Bison 3.0
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/11990043
2013-07-30 04:31:15 +02:00
Andrew Gerrand
fc32bfa9cc doc/codewalk: test source code
Fixes #2648.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/11331043
2013-07-30 09:42:53 +10:00
Robert Griesemer
3eb9adeeb8 go/parser: don't report name errors if DeclarationErrors is not set
R=adonovan
CC=golang-dev
https://golang.org/cl/12072043
2013-07-29 16:00:28 -07:00
Russ Cox
fdb69cb0a3 build: fix build
As promised.

TBR=dvyukov
CC=golang-dev
https://golang.org/cl/12063043
2013-07-29 16:52:40 -04:00
Robert Griesemer
340918a8a3 go/parser: selectors may be method expressions
R=adonovan
CC=golang-dev
https://golang.org/cl/12062043
2013-07-29 13:52:15 -07:00
Russ Cox
46437f0028 build: break builds
I want to see the timing information in build logs,
and we can't see the logs for "ok" builds.
So make the build fail everywhere.

Will roll back immediately.

TBR=dvyukov
CC=golang-dev
https://golang.org/cl/12058046
2013-07-29 16:52:03 -04:00
Russ Cox
c7d5c438a2 runtime: adjust timediv to avoid _vasop; mark _subv okay
R=dvyukov
CC=golang-dev
https://golang.org/cl/12028046
2013-07-29 16:42:07 -04:00
Russ Cox
98cc58e2c7 runtime: fix timediv calls on NetBSD, OpenBSD
Document endian-ness assumption.

R=dvyukov
CC=golang-dev
https://golang.org/cl/12056044
2013-07-29 16:31:42 -04:00
Dmitriy Vyukov
14e3540430 runtime: fix arm build
The current failure is:
fatal error: runtime: stack split during syscall
goroutine 2 [stack split]:
_si2v(0xb6ebaebc, 0x3b9aca00)
        /usr/local/go/src/pkg/runtime/vlrt_arm.c:628 fp=0xb6ebae9c
runtime.timediv(0xf8475800, 0xd, 0x3b9aca00, 0xb6ebaef4)
        /usr/local/go/src/pkg/runtime/runtime.c:424 +0x1c fp=0xb6ebaed4

Just adding textflag 7 causes the following error:
notetsleep: nosplit stack overflow
        128	assumed on entry to notetsleep
        96	after notetsleep uses 32
        60	after runtime.futexsleep uses 36
        4	after runtime.timediv uses 56
        -4	after _si2v uses 8

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12001045
2013-07-30 00:08:30 +04:00
Robert Griesemer
5bd61e0603 math/big: better documentation for Rat.Float64
R=adonovan, r
CC=golang-dev
https://golang.org/cl/11961043
2013-07-29 13:06:34 -07:00
Dmitriy Vyukov
64db2ec915 runtime: fix arm build
The current failure is:
fatal error: runtime: stack split during syscall
goroutine 2 [stack split]:
_addv(0xb6fa0f28, 0xd0a5112e, 0x13156d6e, 0xf8475800, 0xd)
        /usr/local/go/src/pkg/runtime/vlrt_arm.c:66 fp=0xb6fa0ef8
notetsleep(0xb6fa0f9c, 0xf8475800, 0xd, 0x0, 0x0, ...)
        /usr/local/go/src/pkg/runtime/lock_futex.c:156 +0xd0 fp=0xb6fa0f18
runtime.notetsleepg(0xb6fa0f9c, 0xf8475800, 0xd)
        /usr/local/go/src/pkg/runtime/lock_futex.c:197 +0x74 fp=0xb6fa0f3c

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12052043
2013-07-29 23:41:12 +04:00
Dmitriy Vyukov
d91219e458 runtime: fix linux/arm build
notetsleep: nosplit stack overflow
        128	assumed on entry to notetsleep
        80	after notetsleep uses 48
        44	after runtime.futexsleep uses 36
        -12	after runtime.timediv uses 56

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12049043
2013-07-29 22:59:30 +04:00
Dmitriy Vyukov
ddc01d5b06 runtime: fix openbsd build
notetsleep: nosplit stack overflow
        120	assumed on entry to notetsleep
        96	after notetsleep uses 24
        88	on entry to runtime.semasleep
        32	after runtime.semasleep uses 56
        24	on entry to runtime.nanotime
        -8	after runtime.nanotime uses 32

Nanotime seems to be using only 24 bytes of stack space.
Unless I am missing something.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12041044
2013-07-29 22:58:58 +04:00
Dmitriy Vyukov
d83688165a runtime: fix freebsd build
notetsleep: nosplit stack overflow
        120	assumed on entry to notetsleep
        80	after notetsleep uses 40
        72	on entry to runtime.futexsleep
        16	after runtime.futexsleep uses 56
        8	on entry to runtime.printf
        -16	after runtime.printf uses 24

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12047043
2013-07-29 22:58:26 +04:00
Dmitriy Vyukov
e84d9e1fb3 runtime: do not split stacks in syscall status
Split stack checks (morestack) corrupt g->sched,
but g->sched must be preserved consistent for GC/traceback.
The change implements runtime.notetsleepg function,
which does entersyscall/exitsyscall and is carefully arranged
to not call any split functions in between.

R=rsc
CC=golang-dev
https://golang.org/cl/11575044
2013-07-29 22:22:34 +04:00
Dmitriy Vyukov
b8734748b6 net: fix memory leaks on windows
Close netpoll descriptor along with socket.
Ensure that error paths close the descriptor as well.

R=golang-dev, mikioh.mikioh, alex.brainman
CC=golang-dev
https://golang.org/cl/11987043
2013-07-29 20:01:13 +04:00
Pieter Droogendijk
6350e45892 runtime: allow SetFinalizer with a func(interface{})
Fixes #5368.

R=golang-dev, dvyukov
CC=golang-dev, rsc
https://golang.org/cl/11858043
2013-07-29 19:43:08 +04:00
Mikio Hara
3398322d5e net: remove redundant comment on isWildcard
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/11985043
2013-07-29 23:26:11 +09:00
Mikio Hara
442e614cab net: document sockaddr interface
This is in preparation for runtime-integrated network pollster for BSD
variants.

Update #5199

R=golang-dev, fvbommel, dave
CC=golang-dev
https://golang.org/cl/11984043
2013-07-29 23:25:39 +09:00
Rémy Oudompheng
b7c3d06a1f all: move examples into package *_test.
Fixes #5677.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/11992043
2013-07-29 01:25:51 +02:00
Rémy Oudompheng
05026c4ebd compress/flate: reduce tiny allocs done by encoder.
benchmark                          old allocs   new allocs    delta
BenchmarkEncodeDigitsSpeed1e4             942           91  -90.34%
BenchmarkEncodeDigitsSpeed1e5            1919          178  -90.72%
BenchmarkEncodeDigitsSpeed1e6           18539         1517  -91.82%
BenchmarkEncodeDigitsDefault1e4           734          100  -86.38%
BenchmarkEncodeDigitsDefault1e5          1958          193  -90.14%
BenchmarkEncodeDigitsDefault1e6         17338         1426  -91.78%
BenchmarkEncodeDigitsCompress1e4          734          100  -86.38%
BenchmarkEncodeDigitsCompress1e5         1958          193  -90.14%
BenchmarkEncodeDigitsCompress1e6        17338         1426  -91.78%
BenchmarkEncodeTwainSpeed1e4             1865          109  -94.16%
BenchmarkEncodeTwainSpeed1e5             3943          211  -94.65%
BenchmarkEncodeTwainSpeed1e6            31279         1595  -94.90%
BenchmarkEncodeTwainDefault1e4           1811          103  -94.31%
BenchmarkEncodeTwainDefault1e5           3708          199  -94.63%
BenchmarkEncodeTwainDefault1e6          26738         1330  -95.03%
BenchmarkEncodeTwainCompress1e4          1811          103  -94.31%
BenchmarkEncodeTwainCompress1e5          3693          190  -94.86%
BenchmarkEncodeTwainCompress1e6         26902         1333  -95.04%

benchmark                           old bytes    new bytes    delta
BenchmarkEncodeDigitsSpeed1e4         1469438      1453920   -1.06%
BenchmarkEncodeDigitsSpeed1e5         1490898      1458961   -2.14%
BenchmarkEncodeDigitsSpeed1e6         1858819      1542407  -17.02%
BenchmarkEncodeDigitsDefault1e4       1465903      1454160   -0.80%
BenchmarkEncodeDigitsDefault1e5       1491841      1459361   -2.18%
BenchmarkEncodeDigitsDefault1e6       1825424      1531545  -16.10%
BenchmarkEncodeDigitsCompress1e4      1465903      1454160   -0.80%
BenchmarkEncodeDigitsCompress1e5      1491681      1459361   -2.17%
BenchmarkEncodeDigitsCompress1e6      1825424      1531545  -16.10%
BenchmarkEncodeTwainSpeed1e4          1485308      1454400   -2.08%
BenchmarkEncodeTwainSpeed1e5          1526065      1459878   -4.34%
BenchmarkEncodeTwainSpeed1e6          2066627      1536296  -25.66%
BenchmarkEncodeTwainDefault1e4        1484380      1454240   -2.03%
BenchmarkEncodeTwainDefault1e5        1521793      1459558   -4.09%
BenchmarkEncodeTwainDefault1e6        1977504      1523388  -22.96%
BenchmarkEncodeTwainCompress1e4       1484380      1454240   -2.03%
BenchmarkEncodeTwainCompress1e5       1521457      1459318   -4.08%
BenchmarkEncodeTwainCompress1e6       1980000      1523609  -23.05%

benchmark                           old ns/op    new ns/op    delta
BenchmarkEncodeDigitsSpeed1e4         1472128      1384343   -5.96%
BenchmarkEncodeDigitsSpeed1e5         8283663      8112304   -2.07%
BenchmarkEncodeDigitsSpeed1e6        77459311     76364216   -1.41%
BenchmarkEncodeDigitsDefault1e4       1813090      1746552   -3.67%
BenchmarkEncodeDigitsDefault1e5      26221292     26052516   -0.64%
BenchmarkEncodeDigitsDefault1e6     286512472    286099039   -0.14%
BenchmarkEncodeDigitsCompress1e4      1809373      1747230   -3.43%
BenchmarkEncodeDigitsCompress1e5     26231580     26038456   -0.74%
BenchmarkEncodeDigitsCompress1e6    286140002    286025372   -0.04%
BenchmarkEncodeTwainSpeed1e4          1594094      1438600   -9.75%
BenchmarkEncodeTwainSpeed1e5          7669724      7316288   -4.61%
BenchmarkEncodeTwainSpeed1e6         68731353     65938994   -4.06%
BenchmarkEncodeTwainDefault1e4        2063497      1866488   -9.55%
BenchmarkEncodeTwainDefault1e5       22602689     22221377   -1.69%
BenchmarkEncodeTwainDefault1e6      233376842    232114297   -0.54%
BenchmarkEncodeTwainCompress1e4       2062441      1949676   -5.47%
BenchmarkEncodeTwainCompress1e5      28264344     27930627   -1.18%
BenchmarkEncodeTwainCompress1e6     304369641    303704330   -0.22%

benchmark                            old MB/s     new MB/s  speedup
BenchmarkEncodeDigitsSpeed1e4            6.79         7.22    1.06x
BenchmarkEncodeDigitsSpeed1e5           12.07        12.33    1.02x
BenchmarkEncodeDigitsSpeed1e6           12.91        13.10    1.01x
BenchmarkEncodeDigitsDefault1e4          5.52         5.73    1.04x
BenchmarkEncodeDigitsDefault1e5          3.81         3.84    1.01x
BenchmarkEncodeDigitsDefault1e6          3.49         3.50    1.00x
BenchmarkEncodeDigitsCompress1e4         5.53         5.72    1.03x
BenchmarkEncodeDigitsCompress1e5         3.81         3.84    1.01x
BenchmarkEncodeDigitsCompress1e6         3.49         3.50    1.00x
BenchmarkEncodeTwainSpeed1e4             6.27         6.95    1.11x
BenchmarkEncodeTwainSpeed1e5            13.04        13.67    1.05x
BenchmarkEncodeTwainSpeed1e6            14.55        15.17    1.04x
BenchmarkEncodeTwainDefault1e4           4.85         5.36    1.11x
BenchmarkEncodeTwainDefault1e5           4.42         4.50    1.02x
BenchmarkEncodeTwainDefault1e6           4.28         4.31    1.01x
BenchmarkEncodeTwainCompress1e4          4.85         5.13    1.06x
BenchmarkEncodeTwainCompress1e5          3.54         3.58    1.01x
BenchmarkEncodeTwainCompress1e6          3.29         3.29    1.00x

R=imkrasin, golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/10006043
2013-07-28 09:42:40 +02:00
Mikio Hara
a64bea5c99 net: make UnixAddr implement sockaddr interface
This is in preparation for runtime-integrated network pollster for BSD
variants.

Update #5199

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/11932044
2013-07-28 16:15:07 +09:00
Mikio Hara
e257cd8aae net: extend sockaddr interface to the all address families
This CL extends existing sockaddr interface to accommodate not only
internet protocol family endpoint addressess but unix network family
endpoint addresses.

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

Update #5199

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/11979043
2013-07-28 12:52:30 +09:00
Mikio Hara
bf61a97f24 net: simplify socket option helpers
Also consolidates syscall.IPPROTO_TCP level option helper files.

R=golang-dev, dave, alex.brainman
CC=golang-dev
https://golang.org/cl/8637049
2013-07-28 11:18:06 +09:00
Dmitriy Vyukov
d5c7ef6216 cmd/dist: fix crash on windows
currently 'dist install' always crashes on windows

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/11919043
2013-07-27 13:53:18 +04:00
Dmitriy Vyukov
91d35ad1b8 runtime: fix potential deadlock in netpoll on windows
If netpoll has been told to block, it must not return with nil,
otherwise scheduler assumes that netpoll is disabled.

R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/11920044
2013-07-27 13:46:40 +04:00
Dmitriy Vyukov
29f17fb01c net: temporary skip hanging test on windows
Update #5971.

R=alex.brainman
CC=golang-dev
https://golang.org/cl/11938046
2013-07-27 13:36:27 +04:00
Russ Cox
14062efb16 runtime: handle runtime.Goexit during init
Fixes #5963.

R=golang-dev, dsymonds, dvyukov
CC=golang-dev
https://golang.org/cl/11879045
2013-07-26 13:54:44 -04:00
Dmitriy Vyukov
f8a850b250 runtime: refactor mallocgc
Make it accept type, combine flags.
Several reasons for the change:
1. mallocgc and settype must be atomic wrt GC
2. settype is called from only one place now
3. it will help performance (eventually settype
functionality must be combined with markallocated)
4. flags are easier to read now (no mallocgc(sz, 0, 1, 0) anymore)

R=golang-dev, iant, nightlyone, rsc, dave, khr, bradfitz, r
CC=golang-dev
https://golang.org/cl/10136043
2013-07-26 21:17:24 +04:00
Rémy Oudompheng
a0f74093b2 crypto/des: faster block expansion.
On amd64:

benchmark           old ns/op    new ns/op    delta
BenchmarkEncrypt         6170         3593  -41.77%
BenchmarkDecrypt         6209         3564  -42.60%

benchmark            old MB/s     new MB/s  speedup
BenchmarkEncrypt         1.30         2.23    1.72x
BenchmarkDecrypt         1.29         2.24    1.74x

Update #4299.

R=golang-dev, agl, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/11874043
2013-07-26 09:10:29 +02:00
Alex Brainman
a79e125b2f cmd/pack: support removing of leading file prefix on windows
Fixes #5550

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/11904043
2013-07-26 16:56:24 +10:00
Alex Brainman
32a3ce6799 gc: fix line directive processing on windows
This change should have been part of 5671737303a0.

Fixes #5904

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/11894043
2013-07-26 13:38:24 +10:00
Keith Randall
ad5cd931d8 undo CL 11788043 / 62d06cccc261
Reason for breakage fixed with CL 11888043.

««« original CL description
undo CL 11683043 / bb75d03e6ccb

Broke arm build.
R=dave

««« original CL description
cc: generate argument pointer maps for C functions.

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

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

TBR=dave
CC=golang-dev
https://golang.org/cl/11789043
2013-07-25 17:51:33 -07:00
Keith Randall
de6da4a8bd 5c: fix pc recalculation in the presence of AFUNCDATA
This makes CL 11683043 not break arm anymore.

R=golang-dev, bradfitz, dave
CC=golang-dev
https://golang.org/cl/11888043
2013-07-25 17:40:29 -07:00
Robert Griesemer
4a695d2c18 go/parser: restrict ParseDir to files with suffix ".go"
Fixes #5956.

R=rsc, r
CC=golang-dev
https://golang.org/cl/11813043
2013-07-25 09:36:22 -07:00
Mikio Hara
cdd3598334 net: give more detail when test panics
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/11811043
2013-07-26 00:21:37 +09:00
Peter Mundy
5852760088 syscall: prlimit argument error for Getrlimit and Setrlimit on Linux 32-bit
The rlimit arguments for prlimit are reversed for linux 32-bit (386 and arm).
Getrlimit becomes Setrlimit and vice versa.
Fixes #5949.

R=iant, mikioh.mikioh, rsc
CC=golang-dev
https://golang.org/cl/11803043
2013-07-25 09:56:06 -04:00
Ian Lance Taylor
d9d3debee5 cmd/cgo: gccgo fixes
Don't require a full-scale callback for calls to the special
prologue functions.

Always use a simple wrapper function for C functions, so that
we can handle static functions defined in the import "C"
comment.

Disable a test that relies on gc-specific function names.

Fixes #5905.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/11406047
2013-07-25 09:53:57 -04:00
Rémy Oudompheng
d7c99cdf9f cmd/gc: avoid passing unevaluated constant expressions to backends.
Backends do not exactly expect receiving binary operators with
constant operands or use workarounds to move them to
register/stack in order to handle them.

Fixes #5841.

R=golang-dev, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/11107044
2013-07-25 09:42:05 -04:00
Mikio Hara
c0a4ce52c6 net: simplify probeIPv6Stack
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/11807043
2013-07-25 19:29:20 +09:00
Nick Craig-Wood
085159da26 crypto/md5: native arm assembler version
An ARM version of md5block.go with a big improvement in
throughput (up to 2.5x) and a reduction in object size (21%).

Code size

  Before 3100 bytes
  After 2424 bytes
  21% smaller

Benchmarks on Rasperry Pi

benchmark                       old ns/op    new ns/op    delta
BenchmarkHash8Bytes                 11703         6636  -43.30%
BenchmarkHash1K                     38057        21881  -42.50%
BenchmarkHash8K                    208131       142735  -31.42%
BenchmarkHash8BytesUnaligned        11457         6570  -42.66%
BenchmarkHash1KUnaligned            69334        26841  -61.29%
BenchmarkHash8KUnaligned           455120       182223  -59.96%

benchmark                        old MB/s     new MB/s  speedup
BenchmarkHash8Bytes                  0.68         1.21    1.78x
BenchmarkHash1K                     26.91        46.80    1.74x
BenchmarkHash8K                     39.36        57.39    1.46x
BenchmarkHash8BytesUnaligned         0.70         1.22    1.74x
BenchmarkHash1KUnaligned            14.77        38.15    2.58x
BenchmarkHash8KUnaligned            18.00        44.96    2.50x

benchmark                      old allocs   new allocs    delta
BenchmarkHash8Bytes                     1            0  -100.00%
BenchmarkHash1K                         2            0  -100.00%
BenchmarkHash8K                         2            0  -100.00%
BenchmarkHash8BytesUnaligned            1            0  -100.00%
BenchmarkHash1KUnaligned                2            0  -100.00%
BenchmarkHash8KUnaligned                2            0  -100.00%

benchmark                       old bytes    new bytes    delta
BenchmarkHash8Bytes                    64            0  -100.00%
BenchmarkHash1K                       128            0  -100.00%
BenchmarkHash8K                       128            0  -100.00%
BenchmarkHash8BytesUnaligned           64            0  -100.00%
BenchmarkHash1KUnaligned              128            0  -100.00%
BenchmarkHash8KUnaligned              128            0  -100.00%

This also adds another test which makes sure that the sums
over larger blocks work properly. I wrote this test when I was
worried about memory corruption.

R=golang-dev, dave, bradfitz, rsc, ajstarks
CC=golang-dev, minux.ma, remyoudompheng
https://golang.org/cl/11648043
2013-07-25 13:28:27 +10:00
Andrew Gerrand
93c6d0ef8f bufio: check buffer availability before reading in ReadFrom
Fixes #5947.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/11801043
2013-07-25 11:29:13 +10:00
Kevin Klues
f7dfeea90f cmd/cgo: Fix issue with cgo cdefs
The problem is that the cdecl() function in cmd/cgo/godefs.go isn't
properly translating the Go array type to a C array type when an
asterisk follows the [] in the array type declaration (it is perfectly
legal to put the asterisk on either side of the [] in go syntax,
depending on how you set up your pointers).

That said, the cdefs tool is only designed to translate from Go types
generated using the cgo *godefs* tool -- where the godefs tool is
designed to translate gcc-style C types into Go types. In essence, the
cdefs tool translates from gcc-style C types to Go types (via the godefs
tool), then back to kenc-style C types. Because of this, cdefs does not
need to know how to translate arbitraty Go types into C, just the ones
produced by godefs.

The problem is that during this translation process, the logic is
slightly wrong when going from (e.g.):

char *array[10];
to:
array [10]*int8;
back to:
int8 *array[10];

In the current implementation of cdecl(), the translation from the Go
type declaration back to the kenc-style declaration looks for Go
types of the form:

name *[]type;
rather than the actual generated Go type declaration of:
name []*type;

Both are valid Go syntax, with slightly different semantics, but the
latter is the only one that can ever be generated by the godefs tools.
(The semantics of the former are not directly expressible in a
single C statement -- you would have to have to first typedef the array
type, then declare a pointer to that typedef'd type in a separate
statement).

This commit changes the logic of cdecl() to look properly for, and
translate, Go type declarations of the form:
name []*type;

Additionally, the original implementation only allowed for a single
asterisk and a single sized aray (i.e. only a single level of pointer
indirection, and only one set of []) on the type, whereas the patched
version allows for an arbitrary number of both.

Tests are included in misc/cgo/testcdefs and the all.bash script has been
updated to account for these.

R=golang-dev, bradfitz, dave, iant
CC=golang-dev
https://golang.org/cl/11377043
2013-07-24 17:27:42 -07:00
Keith Randall
b3defa2e8e undo CL 11683043 / bb75d03e6ccb
Broke arm build.
R=dave

««« original CL description
cc: generate argument pointer maps for C functions.

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

R=golang-dev
CC=golang-dev
https://golang.org/cl/11788043
2013-07-24 15:04:10 -07:00
Ian Lance Taylor
0738c7e977 log/syslog: restore use of serverConn interface
Revision 15629 (8d71734a0cb0) removed the serverConn interface
that was introduce in revision 7718 (ee5e80c62862).  The
serverConn interface was there for use by gccgo on Solaris,
and it is still needed there.  Solaris does not support
connecting to the syslog daemon over TCP, and gccgo simply
calls the C library function.  This CL restores the
interface.

R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/11737043
2013-07-24 10:28:57 -07:00
Keith Randall
3453a2204b runtime: only define SEH when we need it.
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/11769043
2013-07-24 09:59:47 -07:00
Keith Randall
9b1f1833de cc: generate argument pointer maps for C functions.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/11683043
2013-07-24 09:41:06 -07:00
Mikio Hara
8f746af65d runtime: drop EV_RECEIPT support from network pollster on kqueue
Currently Darwin and FreeBSD support and NetBSD and OpenBSD do not
support EV_RECEIPT flag. We will drop use of EV_RECEIPT for now.

Also enables to build runtime-integrated network pollster on
freebsd/amd64,386 and openbsd/amd64,386. It just does build but never
runs pollster stuff.

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

Update #5199

R=dvyukov, minux.ma
CC=golang-dev
https://golang.org/cl/11759044
2013-07-25 00:24:17 +09:00
Russ Cox
f011282578 runtime: more cgocallback_gofunc work
Debugging the Windows breakage I noticed that SEH
only exists on 386, so we can balance the two stacks
a little more on amd64 and reclaim another word.

Now we're down to just one word consumed by
cgocallback_gofunc, having reclaimed 25% of the
overall budget (4 words out of 16).

Separately, fix windows/386 - the SEH must be on the
m0 stack, as must the saved SP, so we are forced to have
a three-word frame for 386. It matters much less for
386, because there 128 bytes gives 32 words to use.

R=dvyukov, alex.brainman
CC=golang-dev
https://golang.org/cl/11551044
2013-07-24 09:01:57 -04:00
Mikio Hara
a0935cc979 runtime: fix throw message in netpoll
R=dvyukov, r
CC=golang-dev
https://golang.org/cl/11761043
2013-07-24 17:48:13 +09:00
Russ Cox
cefdb9c286 runtime: fix windows build
TBR=golang-dev
CC=golang-dev
https://golang.org/cl/11595045
2013-07-23 22:59:32 -04:00
Rob Pike
6a801539c5 unicode: add "In" function to test membership of a rune
The existing function, IsOneOf, is hard to use. Since the slice comes
before the rune, in parallelism with the other Is functions, the slice
is clumsy to build. This CL adds a nicer-signatured In function of
equivalent functionality (its implementation is identical) that's much
easier to use. Compare:
        unicode.IsOneOf([]*unicode.RangeTable{unicode.Letter, unicode.Number}, r)
        unicode.In(r, unicode.Letter, unicode.Number)

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/11672044
2013-07-24 10:27:58 +10:00
Mikio Hara
a0a45bbb71 net: consolidate listenerBacklog declaration
Also adds maxListenerBacklog placeholder for Plan 9.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/11674044
2013-07-24 08:43:08 +09:00
Russ Cox
dba623b1c7 runtime: reduce frame size for runtime.cgocallback_gofunc
Tying preemption to stack splits means that we have to able to
complete the call to exitsyscall (inside cgocallbackg at least for now)
without any stack split checks, meaning that the whole sequence
has to work within 128 bytes of stack, unless we increase the size
of the red zone. This CL frees up 24 bytes along that critical path
on amd64. (The 32-bit systems have plenty of space because all
their words are smaller.)

R=dvyukov
CC=golang-dev
https://golang.org/cl/11676043
2013-07-23 18:40:02 -04:00
Andrew Gerrand
e97c870692 math/rand: mention that the default Source is thread-safe
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/11709043
2013-07-24 08:27:20 +10:00
Andrew Gerrand
6efb6b9e38 math/rand: mention Seed in overview, add another top-level example
Fixes #5937.

R=golang-dev, mirtchovski, r
CC=golang-dev
https://golang.org/cl/11705043
2013-07-23 16:07:28 +10:00
Brad Fitzpatrick
baa9ca032b net/http: respect tls.Config.ServerName in Transport
When making an HTTPS client request, respect the
ServerName field in the tls.Config.

Fixes #5829

R=golang-dev, agl, adg
CC=golang-dev
https://golang.org/cl/11691043
2013-07-22 22:39:09 -07:00
Alex Brainman
a293065a39 database/sql: close statement before connection
Fixes #5936

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/11620046
2013-07-23 14:09:53 +10:00
Rob Pike
abe384f68a all: be more idiomatic when documenting boolean return values.
Phrases like "returns whether or not the image is opaque" could be
describing what the function does (it always returns, regardless of
the opacity) or what it returns (a boolean indicating the opacity).
Even when the "or not" is missing, the phrasing is bizarre.

Go with "reports whether", which is still clunky but at least makes
it clear we're talking about the return value.

These were edited by hand. A few were cleaned up in other ways.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/11699043
2013-07-23 11:59:49 +10:00
Mikio Hara
7d9a8fb8a9 net: make use of noDeadline instead of time.Time{}
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/11691044
2013-07-23 10:13:58 +09:00
Nick Craig-Wood
f8fd77baa9 runtime: Stop arm memmove corrupting its parameters
Change use of x+(SP) to access the stack frame into x-(SP)

Fixes #5925.

R=golang-dev, bradfitz, dave, remyoudompheng, nick, rsc
CC=dave cheney <dave, golang-dev
https://golang.org/cl/11647043
2013-07-23 09:29:25 +10:00
Brad Fitzpatrick
48b9be2b19 all: change "true iff" to "whether" in public docs
For consistency with Go documentation style.

R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/11697043
2013-07-22 16:20:30 -07:00
David du Colombier
b015af4117 cmd/ld: fix warnings on Plan 9
src/cmd/ld/lib.c:1379 set and not used: p
src/cmd/ld/lib.c:1426 format mismatch 6llux INT, arg 3
src/cmd/ld/lib.c:1437 format mismatch 6llux INT, arg 3
src/cmd/ld/lib.c:1456 format mismatch 6llux INT, arg 3
src/cmd/ld/lib.c:1477 format mismatch 6llux INT, arg 3
src/cmd/ld/lib.c:1459 set and not used: started

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/11615044
2013-07-22 17:33:41 -04:00
Dmitriy Vyukov
e97d677b4e runtime: introduce notetsleepg function
notetsleepg is the same as notetsleep, but is called on user g.
It includes entersyscall/exitsyscall and will help to avoid
split stack functions in syscall status.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/11681043
2013-07-22 23:02:27 +04:00
Dmitriy Vyukov
10d1e55103 runtime: allow stack split in body of closechan
This gives more space during the call to runtime.lock.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/11679043
2013-07-22 20:47:39 +04:00
Dmitriy Vyukov
27134567fa runtime: clarify comment for m->locked
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/11671043
2013-07-22 16:37:31 +04:00
Mikio Hara
5d14b89933 net: remove unnecessary bit masking
R=dave
CC=golang-dev
https://golang.org/cl/11537044
2013-07-22 20:08:58 +09:00
Alex Brainman
6ea7bf253c net: implement netpoll for windows
Moves the network poller from net package into runtime.

benchmark                           old ns/op    new ns/op    delta
BenchmarkTCP4OneShot                   316386       287061   -9.27%
BenchmarkTCP4OneShot-2                 339822       313424   -7.77%
BenchmarkTCP4OneShot-3                 330057       306589   -7.11%
BenchmarkTCP4OneShotTimeout            341775       287061  -16.01%
BenchmarkTCP4OneShotTimeout-2          380835       295849  -22.32%
BenchmarkTCP4OneShotTimeout-3          398412       328070  -17.66%
BenchmarkTCP4Persistent                 40622        33392  -17.80%
BenchmarkTCP4Persistent-2               44528        35736  -19.74%
BenchmarkTCP4Persistent-3               44919        36907  -17.84%
BenchmarkTCP4PersistentTimeout          45309        33588  -25.87%
BenchmarkTCP4PersistentTimeout-2        50289        38079  -24.28%
BenchmarkTCP4PersistentTimeout-3        51559        37103  -28.04%
BenchmarkTCP6OneShot                   361305       345645   -4.33%
BenchmarkTCP6OneShot-2                 361305       331976   -8.12%
BenchmarkTCP6OneShot-3                 376929       347598   -7.78%
BenchmarkTCP6OneShotTimeout            361305       322212  -10.82%
BenchmarkTCP6OneShotTimeout-2          378882       333928  -11.86%
BenchmarkTCP6OneShotTimeout-3          388647       335881  -13.58%
BenchmarkTCP6Persistent                 47653        35345  -25.83%
BenchmarkTCP6Persistent-2               49215        35736  -27.39%
BenchmarkTCP6Persistent-3               38474        37493   -2.55%
BenchmarkTCP6PersistentTimeout          56637        34369  -39.32%
BenchmarkTCP6PersistentTimeout-2        42575        38079  -10.56%
BenchmarkTCP6PersistentTimeout-3        44137        37689  -14.61%

R=dvyukov
CC=golang-dev
https://golang.org/cl/8670044
2013-07-22 12:49:57 +10:00
David Symonds
ae5991695c runtime: add a missing newline in a debug printf.
Trivial, but annoying while debugging this code.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/11656043
2013-07-22 12:42:42 +10:00
Rémy Oudompheng
21b9d14738 regexp: use a very fast random generator for benchmarks.
Calls into math/rand are very slow, especially under race
detector because of heap accesses.

go test -bench . -run none -benchtime .1s
Before: 23.0s
After:  17.4s

Fixes #5837.

R=golang-dev, dave, r
CC=golang-dev
https://golang.org/cl/11564044
2013-07-20 23:31:51 +02:00
Anthony Martin
87976e72a8 libmach: support more 386/amd64 instructions
R=golang-dev, dave, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/10030043
2013-07-20 00:38:26 -07:00
Alex Brainman
cae5213b91 libmach,lib9: override unused parameter warnings (fixes netbsd and openbsd builds)
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/11623043
2013-07-20 16:09:30 +10:00
Alex Brainman
dfbe467eda libmach,lib9: override unused parameter warnings (fixes windows build)
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/11620044
2013-07-20 12:43:50 +10:00
Russ Cox
c485b58912 cmd/dist, cmd/go: enable more warnings, make clang errors legible
This does not change the default compiler on OS X to clang.
It appears that for now we can keep using gcc as long as we
enable a few more warning settings that are on-by-default
elsewhere.

R=golang-dev, bradfitz, dave
CC=golang-dev
https://golang.org/cl/11610044
2013-07-19 19:36:15 -04:00
Russ Cox
c758841853 cmd/ld, runtime: remove unused fields from Func
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/11604043
2013-07-19 18:52:35 -04:00
Ian Lance Taylor
7666f24a84 cmd/gc, cmd/ld: fix build: remove unused var, use correct var in printf
Fixes #5924.

R=golang-dev, khr, rsc
CC=golang-dev
https://golang.org/cl/11606043
2013-07-19 15:04:53 -07:00
Russ Cox
48769bf546 runtime: use funcdata to supply garbage collection information
This CL introduces a FUNCDATA number for runtime-specific
garbage collection metadata, changes the C and Go compilers
to emit that metadata, and changes the runtime to expect it.

The old pseudo-instructions that carried this information
are gone, as is the linker code to process them.

R=golang-dev, dvyukov, cshapiro
CC=golang-dev
https://golang.org/cl/11406044
2013-07-19 16:04:09 -04:00
Russ Cox
5d340de1f6 cmd/dist: generate offsets for P structure
So far no checked-in assembly needs these,
but it matches having them for M and G.
I needed these for some manual testing.

R=golang-dev, dvyukov
CC=golang-dev
https://golang.org/cl/11595043
2013-07-19 15:40:32 -04:00
Keith Randall
c38173bcbd debug/gosym: put pclinetest file in temporary directory
where it belongs.

R=rsc
CC=golang-dev
https://golang.org/cl/11596043
2013-07-19 12:31:42 -07:00
Keith Randall
6fc49c1854 runtime: cleanup: use ArgsSizeUnknown to mark all functions
whose argument size is unknown (C vararg functions, and
assembly code without an explicit specification).

We used to use 0 to mean "unknown" and 1 to mean "zero".
Now we use ArgsSizeUnknown (0x80000000) to mean "unknown".

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/11590043
2013-07-19 11:19:18 -07:00
Dmitriy Vyukov
eb04df75cd runtime: prevent GC from seeing the contents of a frame in runfinq
This holds the last finalized object and arguments to its finalizer.
Fixes #5348.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/11454044
2013-07-19 18:01:33 +04:00
Dmitriy Vyukov
2a6520c2d3 runtime: hide mheap from GC
It contains pointers to first blocks of lots of spans.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/11416046
2013-07-19 17:47:40 +04:00
Dmitriy Vyukov
6857264457 runtime: prevent sysmon from polling network excessivly
If the network is not polled for 10ms, sysmon starts polling network
on every iteration (every 20us) until another thread blocks in netpoll.
Fixes #5922.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/11569043
2013-07-19 17:45:34 +04:00
David Symonds
9bfb69187f regexp: exclude exhaustive RE2 test from running under race detector.
It is an expensive test to run, and even more so with -race,
and causes timeouts on builders. It is doubtful that it would
find a race that other tests in this package wouldn't, so there
is little loss in excluding it.

Update #5837.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/11568043
2013-07-19 23:44:22 +10:00
Russ Cox
df3e6ce4b1 runtime: disable preemption during runtime.settype
It assumes that the m will not change, and the m may
change if the goroutine is preempted.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/11560043
2013-07-18 22:58:49 -04:00
Brad Fitzpatrick
b2b15d1230 net/http: document and test Client.Post treating Reader body as ReadCloser
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/11542044
2013-07-19 12:02:54 +10:00
Dmitriy Vyukov
bc31bcccd3 runtime: preempt long-running goroutines
If a goroutine runs for more than 10ms, preempt it.
Update #543.

R=rsc
CC=golang-dev
https://golang.org/cl/10796043
2013-07-19 01:22:26 +04:00
Russ Cox
58f12ffd79 runtime: handle morestack/lessstack in stack trace
If we start a garbage collection on g0 during a
stack split or unsplit, we'll see morestack or lessstack
at the top of the stack. Record an argument frame size
for those, and record that they terminate the stack.

R=golang-dev, dvyukov
CC=golang-dev
https://golang.org/cl/11533043
2013-07-18 16:53:45 -04:00
Russ Cox
8c741c97f7 cmd/6a, cmd/6l: make FUNCDATA work
R=ken2
CC=golang-dev
https://golang.org/cl/11397043
2013-07-18 15:38:19 -04:00
Daniel Morsing
b6f841733b regexp/syntax: update documentation for Parse.
Syntax description was moved to the top level comment of this package.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/11536043
2013-07-18 21:28:00 +02:00
Russ Cox
ef12bbfc9d runtime: disable preemption during deferreturn
Deferreturn is synthesizing a new call frame.
It must not be interrupted between copying the args there
and fixing up the program counter, or else the stack will
be in an inconsistent state, one that will confuse the
garbage collector.

R=golang-dev, dvyukov
CC=golang-dev
https://golang.org/cl/11522043
2013-07-18 12:26:47 -04:00
Russ Cox
8166b2da19 runtime: record full frame size for arm _sfloat2
With preemption, _sfloat2 can show up in stack traces.
Write the function prototype in a way that accurately
shows the frame size and the fact that it might contain
pointers.

R=golang-dev, dvyukov
CC=golang-dev
https://golang.org/cl/11523043
2013-07-18 12:23:38 -04:00
Russ Cox
249f807c39 runtime: mark concatstring as variadic (fixes 386 build)
Windows was the only one seeing this bug reliably in the builder,
but it was easy to reproduce using 'GOGC=1 go test strconv'.
concatstring looked like it took only one string, but in fact it
takes a long list of strings. Add an explicit ... so that the traceback
will not use the "fixed" frame size and instead look at the
frame size metadata recorded by the caller.

R=golang-dev
TBR=golang-dev
CC=golang-dev
https://golang.org/cl/11531043
2013-07-18 12:19:38 -04:00
Russ Cox
ff52cadc01 cmd/ld: refine test for history stack pop (fix Windows build)
This should fix the Windows build, or at least
what's breaking it at the moment.

Fixes #5904.

TBR=golang-dev
CC=golang-dev
https://golang.org/cl/11519044
2013-07-18 11:40:59 -04:00
Russ Cox
72bd1a7e36 debug/gosym: avoid test failure on Windows
Would fix build if build hadn't already been broken with something else.

TBR=golang-dev
CC=golang-dev
https://golang.org/cl/11525043
2013-07-18 11:01:58 -04:00
Russ Cox
c3de91bb15 cmd/ld, runtime: use new contiguous pcln table
R=golang-dev, r, dave
CC=golang-dev
https://golang.org/cl/11494043
2013-07-18 10:43:22 -04:00
Russ Cox
08ce3c3133 libmach: update for Go 1.2 pcln table
The change to addr2line makes it easy to test by hand.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/11485044
2013-07-18 10:12:28 -04:00
Russ Cox
d7b4a09ca8 debug/gosym: update for Go 1.2 pcln table
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/11495043
2013-07-18 10:12:14 -04:00