]> Cypherpunks repositories - gostls13.git/log
gostls13.git
11 years agomisc/emacs: add support for mode=count coverage
Dominik Honnef [Fri, 9 Aug 2013 21:42:43 +0000 (14:42 -0700)]
misc/emacs: add support for mode=count coverage

Use the same algorithm that go tool cover uses when producing HTML
output to render coverage intensity.

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

11 years agonet: fix LookupSRV ordering on plan 9
Nicolas Owens [Fri, 9 Aug 2013 21:16:43 +0000 (14:16 -0700)]
net: fix LookupSRV ordering on plan 9

lookup_plan9.go's lookupSRV is using the wrong order for srv results. order should be weight, priority, port, following the response from /net/dns:

  chi Aug  9 20:31:13 Rread tag 20 count 61 '_xmpp-client._tcp.offblast.org srv 5 0 5222 iota.offblast.org' 72

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

11 years agomime: escape backslash in attribute values
Pieter Droogendijk [Fri, 9 Aug 2013 20:10:53 +0000 (13:10 -0700)]
mime: escape backslash in attribute values

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

11 years agocmd/cc: use a temporary bitmap when constructing pointer maps
Carl Shapiro [Fri, 9 Aug 2013 20:02:33 +0000 (13:02 -0700)]
cmd/cc: use a temporary bitmap when constructing pointer maps

This change makes the way cc constructs pointer maps closer to
what gc does and is being done in preparation for changes to
the internal content of the pointer map such as a change to
distinguish interface pointers from ordinary pointers.

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

11 years agostrings: add test for Count
Pieter Droogendijk [Fri, 9 Aug 2013 19:51:21 +0000 (12:51 -0700)]
strings: add test for Count

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

11 years agoio/ioutil: add WriteString to Discard
Brad Fitzpatrick [Fri, 9 Aug 2013 18:27:29 +0000 (11:27 -0700)]
io/ioutil: add WriteString to Discard

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

11 years agoruntime: fix netbsd build
Dmitriy Vyukov [Fri, 9 Aug 2013 18:17:12 +0000 (22:17 +0400)]
runtime: fix netbsd build
I've placed net.runtime_Semacquire into netpoll.goc,
but netbsd does not yet use netpoll.goc.

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

11 years agonet: add special netFD mutex
Dmitriy Vyukov [Fri, 9 Aug 2013 17:43:00 +0000 (21:43 +0400)]
net: add special netFD mutex
The mutex, fdMutex, handles locking and lifetime of sysfd,
and serializes Read and Write methods.
This allows to strip 2 sync.Mutex.Lock calls,
2 sync.Mutex.Unlock calls, 1 defer and some amount
of misc overhead from every network operation.

On linux/amd64, Intel E5-2690:
benchmark                             old ns/op    new ns/op    delta
BenchmarkTCP4Persistent                    9595         9454   -1.47%
BenchmarkTCP4Persistent-2                  8978         8772   -2.29%
BenchmarkTCP4ConcurrentReadWrite           4900         4625   -5.61%
BenchmarkTCP4ConcurrentReadWrite-2         2603         2500   -3.96%

In general it strips 70-500 ns from every network operation depending
on processor model. On my relatively new E5-2690 it accounts to ~5%
of network op cost.

Fixes #6074.

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

11 years agoencoding/json: faster encoding
Brad Fitzpatrick [Fri, 9 Aug 2013 16:46:47 +0000 (09:46 -0700)]
encoding/json: faster encoding

The old code was caching per-type struct field info. Instead,
cache type-specific encoding funcs, tailored for that
particular type to avoid unnecessary reflection at runtime.
Once the machine is built once, future encodings of that type
just run the func.

benchmark               old ns/op    new ns/op    delta
BenchmarkCodeEncoder     48424939     36975320  -23.64%

benchmark                old MB/s     new MB/s  speedup
BenchmarkCodeEncoder        40.07        52.48    1.31x

Additionally, the numbers seem stable now at ~52 MB/s, whereas
the numbers for the old code were all over the place: 11 MB/s,
40 MB/s, 13 MB/s, 39 MB/s, etc.  In the benchmark above I compared
against the best I saw the old code do.

R=rsc, adg
CC=gobot, golang-dev, r
https://golang.org/cl/9129044

11 years agonet: give C.getaddrinfo a hint that we only want SOCK_STREAM answers
Ian Lance Taylor [Fri, 9 Aug 2013 16:23:27 +0000 (09:23 -0700)]
net: give C.getaddrinfo a hint that we only want SOCK_STREAM answers

This should be more efficient everywhere, and appears to be
required on Solaris.

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

11 years agomisc/emacs: clear previous overlays before adding new ones
Dominik Honnef [Fri, 9 Aug 2013 15:56:15 +0000 (08:56 -0700)]
misc/emacs: clear previous overlays before adding new ones

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

11 years agotest: update bug086.go for current gccgo behaviour
Ian Lance Taylor [Fri, 9 Aug 2013 15:43:19 +0000 (08:43 -0700)]
test: update bug086.go for current gccgo behaviour

bug086.go:14:1: error: missing return at end of function

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

11 years agoencoding/binary: fix 32-bit build
Rob Pike [Fri, 9 Aug 2013 13:23:34 +0000 (23:23 +1000)]
encoding/binary: fix 32-bit build
Sigh.

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

11 years agoencoding/binary: speed up writing slices of integers
Rob Pike [Fri, 9 Aug 2013 13:15:08 +0000 (23:15 +1000)]
encoding/binary: speed up writing slices of integers

Simple approach. Still generates garbage, but not as much.

benchmark                        old ns/op    new ns/op    delta
BenchmarkWriteSlice1000Int32s        40260        18791  -53.33%

benchmark                         old MB/s     new MB/s  speedup
BenchmarkWriteSlice1000Int32s        99.35       212.87    2.14x

Fixes #2634.

R=golang-dev, crawshaw
CC=golang-dev
https://golang.org/cl/12680046

11 years agocmd/go: cgo programs depend on syscall
Russ Cox [Fri, 9 Aug 2013 13:03:25 +0000 (09:03 -0400)]
cmd/go: cgo programs depend on syscall

Fixes #5048.

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

11 years agoruntime: traceback running goroutines
Dmitriy Vyukov [Fri, 9 Aug 2013 08:53:35 +0000 (12:53 +0400)]
runtime: traceback running goroutines
Introduce freezetheworld function that is a best-effort attempt to stop any concurrently running goroutines. Call it during crash.
Fixes #5873.

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

11 years agoencoding/binary: document its goals better
Rob Pike [Fri, 9 Aug 2013 07:08:02 +0000 (17:08 +1000)]
encoding/binary: document its goals better
It's a modest package with modest goals and limitations.
Make that clear.

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

11 years agocmd/gc: make missing package error fatal
Rick Arnold [Fri, 9 Aug 2013 06:05:40 +0000 (16:05 +1000)]
cmd/gc: make missing package error fatal

No longer continue assuming package main.

Fixes #4776.

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

11 years agoencoding/csv: always allow trailing commas
Pieter Droogendijk [Fri, 9 Aug 2013 05:46:01 +0000 (15:46 +1000)]
encoding/csv: always allow trailing commas

Original CL by rsc (11916045):

The motivation for disallowing them was RFC 4180 saying
"The last field in the record must not be followed by a comma."
I believe this is an admonition to CSV generators, not readers.
When reading, anything followed by a comma is not the last field.

Fixes #5892.

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

11 years agocmd/5c, cmd/5g, cmd/5l: turn MOVB, MOVH into plain moves, optimize short arithmetic.
Rémy Oudompheng [Fri, 9 Aug 2013 04:43:17 +0000 (06:43 +0200)]
cmd/5c, cmd/5g, cmd/5l: turn MOVB, MOVH into plain moves, optimize short arithmetic.

Pseudo-instructions MOVBS and MOVHS are used to clarify
the semantics of short integers vs. registers:
 * 8-bit and 16-bit values in registers are assumed to always
   be zero-extended or sign-extended depending on their type.
 * MOVB is truncation or move of an already extended value
   between registers.
 * MOVBU enforces zero-extension at the destination (register).
 * MOVBS enforces sign-extension at the destination (register).
And similarly for MOVH/MOVS/MOVHU.

The linker is adapted to assemble MOVB and MOVH to an ordinary
mov. Also a peephole pass in 5g that aims at eliminating
redundant zero/sign extensions is improved.

encoding/binary:
benchmark                              old ns/op    new ns/op    delta
BenchmarkReadSlice1000Int32s              220387       217185   -1.45%
BenchmarkReadStruct                        12839        12910   +0.55%
BenchmarkReadInts                           5692         5534   -2.78%
BenchmarkWriteInts                          6137         6016   -1.97%
BenchmarkPutUvarint32                        257          241   -6.23%
BenchmarkPutUvarint64                        812          754   -7.14%
benchmark                               old MB/s     new MB/s  speedup
BenchmarkReadSlice1000Int32s               18.15        18.42    1.01x
BenchmarkReadStruct                         5.45         5.42    0.99x
BenchmarkReadInts                           5.27         5.42    1.03x
BenchmarkWriteInts                          4.89         4.99    1.02x
BenchmarkPutUvarint32                      15.56        16.57    1.06x
BenchmarkPutUvarint64                       9.85        10.60    1.08x

crypto/des:
benchmark                              old ns/op    new ns/op    delta
BenchmarkEncrypt                            7002         5169  -26.18%
BenchmarkDecrypt                            7015         5195  -25.94%
benchmark                               old MB/s     new MB/s  speedup
BenchmarkEncrypt                            1.14         1.55    1.36x
BenchmarkDecrypt                            1.14         1.54    1.35x

strconv:
benchmark                              old ns/op    new ns/op    delta
BenchmarkAtof64Decimal                       457          385  -15.75%
BenchmarkAtof64Float                         574          479  -16.55%
BenchmarkAtof64FloatExp                     1035          906  -12.46%
BenchmarkAtof64Big                          1793         1457  -18.74%
BenchmarkAtof64RandomBits                   2267         2066   -8.87%
BenchmarkAtof64RandomFloats                 1416         1194  -15.68%
BenchmarkAtof32Decimal                       451          379  -15.96%
BenchmarkAtof32Float                         547          435  -20.48%
BenchmarkAtof32FloatExp                     1095          986   -9.95%
BenchmarkAtof32Random                       1154         1006  -12.82%
BenchmarkAtoi                               1415         1380   -2.47%
BenchmarkAtoiNeg                            1414         1401   -0.92%
BenchmarkAtoi64                             1744         1671   -4.19%
BenchmarkAtoi64Neg                          1737         1662   -4.32%

Fixes #1837.

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

11 years agocmd/go: install godoc into correct directory
Russ Cox [Fri, 9 Aug 2013 03:48:03 +0000 (23:48 -0400)]
cmd/go: install godoc into correct directory

Fixes #6043.

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

11 years agomisc/pprof: pprof on windows does not provide demangled names
Shivakumar GN [Fri, 9 Aug 2013 03:42:24 +0000 (13:42 +1000)]
misc/pprof: pprof on windows does not provide demangled names

Fixes #6034.

R=golang-dev, bradfitz, alex.brainman, dan.kortschak
CC=golang-dev
https://golang.org/cl/12311044

11 years agotext/template/parse: nicer error when comment ends before final delimiter
Rob Pike [Fri, 9 Aug 2013 02:57:21 +0000 (12:57 +1000)]
text/template/parse: nicer error when comment ends before final delimiter
By separating finding the end of the comment from the end of the action,
we can diagnose malformed comments better.
Also tweak the documentation to make the comment syntax clearer.

Fixes #6022.

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

11 years agocmd/cc: restore correct meaning of %Q
Russ Cox [Fri, 9 Aug 2013 01:06:06 +0000 (21:06 -0400)]
cmd/cc: restore correct meaning of %Q

g% 6c ~/x.c
/Users/rsc/x.c:1 duplicate types given: STRUCT s and VOID
/Users/rsc/x.c:1 no return at end of function: f
g%

Fixes #6083.

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

11 years agoreflect: avoid allocation when interface's contents are not addressable
Rob Pike [Fri, 9 Aug 2013 00:49:01 +0000 (10:49 +1000)]
reflect: avoid allocation when interface's contents are not addressable
See issue 4949 for a full explanation.

Allocs go from 1 to zero in the non-addressable case.
Fixes #4949.

BenchmarkInterfaceBig             90           14  -84.01%
BenchmarkInterfaceSmall           14           14   +0.00%

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

11 years agonet/mail: comment our divergence from RFC 5322.
David Symonds [Fri, 9 Aug 2013 00:17:57 +0000 (10:17 +1000)]
net/mail: comment our divergence from RFC 5322.

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

11 years agonet: separate unix pollster initialization from network file descriptor allocation
Mikio Hara [Fri, 9 Aug 2013 00:02:27 +0000 (09:02 +0900)]
net: separate unix 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 of Unix network pollster from newFD
to avoid any breakages in the transition from Unix network pollster
to runtime-integrated pollster. Upcoming CLs will rearrange the call
order of pollster and syscall functions like the following;

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

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

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

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

Update #5199

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

11 years agonet: avoid string operation and make valid domain names explicit
Volker Dobler [Thu, 8 Aug 2013 23:33:57 +0000 (16:33 -0700)]
net: avoid string operation and make valid domain names explicit

Having a trailing dot in the string doesn't really simplify
the checking loop in isDomainName. Avoid this unnecessary allocation.
Also make the valid domain names more explicit by adding some more
test cases.

benchmark            old ns/op    new ns/op    delta
BenchmarkDNSNames       2420.0        983.0  -59.38%

benchmark           old allocs   new allocs    delta
BenchmarkDNSNames           12            0  -100.00%

benchmark            old bytes    new bytes    delta
BenchmarkDNSNames          336            0  -100.00%

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

11 years agomisc/emacs: Add support for code coverage output of go test
Dominik Honnef [Thu, 8 Aug 2013 22:54:26 +0000 (15:54 -0700)]
misc/emacs: Add support for code coverage output of go test

Renders code coverage as an overlay, replicating the look of the
HTML that go tool cover produces.

Also some cleanups.

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

11 years agocmd/api: add a benchmark over the standard library
Brad Fitzpatrick [Thu, 8 Aug 2013 22:25:15 +0000 (15:25 -0700)]
cmd/api: add a benchmark over the standard library

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

11 years agocmd/5c, cmd/5g, cmd/5l: introduce MOVBS and MOVHS instructions.
Rémy Oudompheng [Thu, 8 Aug 2013 21:28:53 +0000 (23:28 +0200)]
cmd/5c, cmd/5g, cmd/5l: introduce MOVBS and MOVHS instructions.

MOVBS and MOVHS are defined as duplicates of MOVB and MOVH,
and perform sign-extension moving.
No change is made to code generation.

Update #1837

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

11 years agocmd/api: rewrite using go/types
Robert Griesemer [Thu, 8 Aug 2013 21:10:59 +0000 (14:10 -0700)]
cmd/api: rewrite using go/types

- adjusted test files so that they actually type-check
- adjusted go1.txt, go1.1.txt, next.txt
- to run, provide build tag: api_tool

Fixes #4538.

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

11 years agonet/http: fix early side effects in the ResponseWriter's ReadFrom
Brad Fitzpatrick [Thu, 8 Aug 2013 21:02:54 +0000 (14:02 -0700)]
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

11 years agocmd/gc: fix stkptrsize calculation
Russ Cox [Thu, 8 Aug 2013 20:44:16 +0000 (16:44 -0400)]
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

11 years agocmd/gc: make bitmaps shorter
Russ Cox [Thu, 8 Aug 2013 20:38:02 +0000 (16:38 -0400)]
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

11 years agocmd/api: show output of api tool even if exit status is 0
Brad Fitzpatrick [Thu, 8 Aug 2013 20:36:22 +0000 (13:36 -0700)]
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

11 years agoos: fix windows and plan9 builds
Brad Fitzpatrick [Thu, 8 Aug 2013 18:13:00 +0000 (11:13 -0700)]
os: fix windows and plan9 builds

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

11 years agocmd/api: update run.go to fetch from go.tools when needed
Brad Fitzpatrick [Thu, 8 Aug 2013 18:06:38 +0000 (11:06 -0700)]
cmd/api: update run.go to fetch from go.tools when needed

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

11 years agomisc/notepadplus: fix functionList regex issue
ChaiShushan [Thu, 8 Aug 2013 17:57:32 +0000 (10:57 -0700)]
misc/notepadplus: fix functionList regex issue

The receiver name is optional. when Method's receiver name messing,
the functionList regex can't match the Method,
e.g. `func (*T) ProtoMessage() {}`.

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

11 years agoruntime: print scavenger details when forced with debug.FreeOSMemory
Dmitriy Vyukov [Thu, 8 Aug 2013 17:55:04 +0000 (21:55 +0400)]
runtime: print scavenger details when forced with debug.FreeOSMemory
Fixes #5900.

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

11 years agocmd/gc: move large stack variables to heap
Russ Cox [Thu, 8 Aug 2013 17:46:30 +0000 (13:46 -0400)]
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

11 years agoos: make Readdir work as documented
Pieter Droogendijk [Thu, 8 Aug 2013 17:44:01 +0000 (10:44 -0700)]
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

11 years agoencoding/xml: allow attributes stored in pointers to be marshaled.
Dmitriy Shelenin [Thu, 8 Aug 2013 17:40:51 +0000 (10:40 -0700)]
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

11 years agoA+C: add googlemail aliases for deemok
Brad Fitzpatrick [Thu, 8 Aug 2013 17:40:32 +0000 (10:40 -0700)]
A+C: add googlemail aliases for deemok

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

11 years agoA+C: Dmitriy Shelenin (individual CLA)
Brad Fitzpatrick [Thu, 8 Aug 2013 17:08:45 +0000 (10:08 -0700)]
A+C: Dmitriy Shelenin (individual CLA)

Generated by addca.

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

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

Fixes #4938.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Fixes #4209.

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

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

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

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

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

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

The plan is in a TODO in run.go.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Fixes #5970.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Fixes #6063

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

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

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

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

Fixes #5955.

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

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

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

HEAD requests are incredibly rare in the wild.

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

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

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

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

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

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

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

So, this change makes HEAD requests like GET requests.

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

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

Fixes #5454

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

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

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

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

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

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

Fixes #6044.

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

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

Like existing Index, IndexRune, IndexHardN, etc.

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

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

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

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

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

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

Update #5199

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

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

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

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

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

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

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

pkg syscall, const ENOTSUP Errno

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

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

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

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

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

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

Generated by addca.

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

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

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

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

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

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

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

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

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

The issue is confirmed on FreeBSD 9.1.

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

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

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

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

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

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

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

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

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

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

Update #5199

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

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

The current failures were:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Fixes #5519.
Fixes #6047.

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

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

Uglier.

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

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

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

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

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

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

Fixes #5372.
Fixes #5577.

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

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

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

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

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

Fixes #6023
Fixes #6033

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

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

Fixes #3751

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

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

Fixes #4963.

Sets the append crossover to 0 on intel platforms.

Results for linux/amd64 Core i5 SNB

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

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

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

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

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

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

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