]> Cypherpunks repositories - gostls13.git/log
gostls13.git
11 years agotime: make Time implement encoding interfaces
Russ Cox [Wed, 14 Aug 2013 04:34:00 +0000 (00:34 -0400)]
time: make Time implement encoding interfaces

See golang.org/s/go12encoding for design.

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

11 years agonet: make IP implement encoding.MarshalerText, encoding.UnmarshalerText
Russ Cox [Wed, 14 Aug 2013 04:33:20 +0000 (00:33 -0400)]
net: make IP implement encoding.MarshalerText, encoding.UnmarshalerText

See golang.org/s/go12encoding for design.

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

11 years agoundo CL 12603044 / 2ca230b93195
Russ Cox [Wed, 14 Aug 2013 04:20:55 +0000 (00:20 -0400)]
undo CL 12603044 / 2ca230b93195

fat fingers - did not intend to submit.
depends on the Unmarshaler CL anyway.

««« original CL description
encoding/xml: add, support Marshaler interface

See golang.org/s/go12xml for design.

Fixes #2771.
Fixes #4169.
Fixes #5975.
Fixes #6125.

R=golang-dev, iant, dan.kortschak
CC=golang-dev
https://golang.org/cl/12603044
»»»

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

11 years agoencoding/gob: support new generic interfaces in package encoding
Russ Cox [Wed, 14 Aug 2013 04:18:48 +0000 (00:18 -0400)]
encoding/gob: support new generic interfaces in package encoding

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

11 years agoencoding: new package
Russ Cox [Wed, 14 Aug 2013 04:18:20 +0000 (00:18 -0400)]
encoding: new package

See golang.org/s/go12encoding for design.

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

11 years agoencoding/xml: add, support Marshaler interface
Russ Cox [Wed, 14 Aug 2013 04:17:42 +0000 (00:17 -0400)]
encoding/xml: add, support Marshaler interface

See golang.org/s/go12xml for design.

Fixes #2771.
Fixes #4169.
Fixes #5975.
Fixes #6125.

R=golang-dev, iant, dan.kortschak
CC=golang-dev
https://golang.org/cl/12603044

11 years agomisc/notepadplus: support Calltips
ChaiShushan [Wed, 14 Aug 2013 03:41:36 +0000 (13:41 +1000)]
misc/notepadplus: support Calltips

Fixes #5789.

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

11 years agocmd/go: add -t flag to 'go get' to download test dependencies
Andrew Gerrand [Wed, 14 Aug 2013 01:01:17 +0000 (11:01 +1000)]
cmd/go: add -t flag to 'go get' to download test dependencies

Fixes #5126.

R=golang-dev, dsymonds, bradfitz, r, rsc, rogpeppe
CC=golang-dev
https://golang.org/cl/12566046

11 years agoruntime: fix build on arm
Russ Cox [Tue, 13 Aug 2013 23:37:54 +0000 (19:37 -0400)]
runtime: fix build on arm

Do not use ? :
I cannot say this enough.

TBR=dvyukov
CC=golang-dev
https://golang.org/cl/12903043

11 years agoarchive/zip: add File.DataOffset
Brad Fitzpatrick [Tue, 13 Aug 2013 23:29:51 +0000 (16:29 -0700)]
archive/zip: add File.DataOffset

Accessor to find where the bytes of a file start.

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

11 years agonet: make Dial, Listen and ListenPacket return consistent error value
Mikio Hara [Tue, 13 Aug 2013 22:04:39 +0000 (07:04 +0900)]
net: make Dial, Listen and ListenPacket return consistent error value

Update #4856

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

11 years agodatabase/sql: add a disabled broken test
Brad Fitzpatrick [Tue, 13 Aug 2013 21:56:40 +0000 (14:56 -0700)]
database/sql: add a disabled broken test

Update #6081

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

11 years agoarchive/zip: remove an allocation, speed up a test
Brad Fitzpatrick [Tue, 13 Aug 2013 21:48:08 +0000 (14:48 -0700)]
archive/zip: remove an allocation, speed up a test

Update #6138

TestOver65kFiles spends all its time garbage collecting.
Removing the 1.4 MB of allocations per each of the 65k
files brings this from 34 seconds to 0.23 seconds.

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

11 years agoencoding/binary: make Write work like Read
Rob Pike [Tue, 13 Aug 2013 21:03:56 +0000 (07:03 +1000)]
encoding/binary: make Write work like Read
Use the fast path calculation to shorten the code.
No effect on benchmarks.

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

11 years agocmd/go: nicer error diagnosis in go test
Rob Pike [Tue, 13 Aug 2013 21:03:18 +0000 (07:03 +1000)]
cmd/go: nicer error diagnosis in go test
Before,
        go test -bench .
would just dump the long generic "go help" message. Confusing and
unhelpful. Now the message is short and on point and also reminds the
user about the oft-forgotten "go help testflag".

        % go test -bench
        go test: missing argument for flag bench
        run "go help test" or "go help testflag" for more information
        %

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

11 years agonet: fix build fix
Dmitriy Vyukov [Tue, 13 Aug 2013 20:55:18 +0000 (00:55 +0400)]
net: fix build fix
Now builders say:
pkg/net/dnsclient_unix_test.go:10: imported and not used: "runtime"

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

11 years agonet: fix windows build
Dmitriy Vyukov [Tue, 13 Aug 2013 20:44:57 +0000 (00:44 +0400)]
net: fix windows build
Windows builders say:
pkg\net\dnsclient_unix_test.go:24: undefined: dnsConfig
pkg\net\dnsclient_unix_test.go:25: undefined: exchange

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

11 years agoruntime: dump scheduler state if GODEBUG=schedtrace is set
Dmitriy Vyukov [Tue, 13 Aug 2013 20:30:55 +0000 (00:30 +0400)]
runtime: dump scheduler state if GODEBUG=schedtrace is set
The schedtrace value sets dump period in milliseconds.
In default mode the trace looks as follows:
SCHED 0ms: gomaxprocs=4 idleprocs=0 threads=3 idlethreads=0 runqueue=0 [1 0 0 0]
SCHED 1001ms: gomaxprocs=4 idleprocs=3 threads=6 idlethreads=3 runqueue=0 [0 0 0 0]
SCHED 2008ms: gomaxprocs=4 idleprocs=1 threads=6 idlethreads=1 runqueue=0 [0 1 0 0]
If GODEBUG=scheddetail=1 is set as well, then the detailed trace is printed:
SCHED 0ms: gomaxprocs=4 idleprocs=0 threads=3 idlethreads=0 runqueue=0 singleproc=0 gcwaiting=1 mlocked=0 nmspinning=0 stopwait=0 sysmonwait=0
  P0: status=3 tick=1 m=0 runqsize=1/128 gfreecnt=0
  P1: status=3 tick=0 m=-1 runqsize=0/128 gfreecnt=0
  P2: status=3 tick=0 m=-1 runqsize=0/128 gfreecnt=0
  P3: status=3 tick=0 m=-1 runqsize=0/128 gfreecnt=0
  M2: p=-1 curg=-1 mallocing=0 throwing=0 gcing=0 locks=1 dying=0 helpgc=0 spinning=0 lockedg=-1
  M1: p=-1 curg=-1 mallocing=0 throwing=0 gcing=0 locks=1 dying=0 helpgc=0 spinning=0 lockedg=-1
  M0: p=0 curg=1 mallocing=0 throwing=0 gcing=0 locks=1 dying=0 helpgc=0 spinning=0 lockedg=1
  G1: status=2() m=0 lockedm=0
  G2: status=1() m=-1 lockedm=-1

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

11 years agosync/atomic: update comment for ARM 64-bit atomics
Russ Cox [Tue, 13 Aug 2013 20:16:05 +0000 (16:16 -0400)]
sync/atomic: update comment for ARM 64-bit atomics

They don't work on older chips, just like the x86-32 64-bit atomics.

Update #6134

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

11 years agoundo CL 12840043 / 3b9f54db72a1
Keith Randall [Tue, 13 Aug 2013 19:59:39 +0000 (12:59 -0700)]
undo CL 12840043 / 3b9f54db72a1

Breaks the build.  Old bucket arrays kept by iterators
still need to be scanned.

««« original CL description
runtime: tell GC not to scan internal hashmap structures.
We'll do it ourselves via hash_gciter, thanks.
Fixes bug 6119.

R=golang-dev, dvyukov, cookieo9, rsc
CC=golang-dev
https://golang.org/cl/12840043
»»»

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

11 years agoruntime: tell GC not to scan internal hashmap structures.
Keith Randall [Tue, 13 Aug 2013 19:36:03 +0000 (12:36 -0700)]
runtime: tell GC not to scan internal hashmap structures.
We'll do it ourselves via hash_gciter, thanks.
Fixes bug 6119.

R=golang-dev, dvyukov, cookieo9, rsc
CC=golang-dev
https://golang.org/cl/12840043

11 years agoundo CL 12787044 / ed695cdf962b
Russ Cox [Tue, 13 Aug 2013 19:33:49 +0000 (23:33 +0400)]
undo CL 12787044 / ed695cdf962b

The NetBSD and OpenBSD failures are apparently real,
not due to the test bug fixed in 100b9fc0c46f.

««« original CL description
runtime/pprof: test netbsd and openbsd again

Maybe these will work now.

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

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

11 years agoruntime: fix LockOSThread
Dmitriy Vyukov [Tue, 13 Aug 2013 18:37:04 +0000 (22:37 +0400)]
runtime: fix LockOSThread
Fixes #6100.

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

11 years agoruntime: more reliable preemption
Dmitriy Vyukov [Tue, 13 Aug 2013 18:14:04 +0000 (22:14 +0400)]
runtime: more reliable preemption
Currently it's possible that a goroutine
that periodically executes non-blocking
cgo/syscalls is never preempted.
This change splits scheduler and syscall
ticks to prevent such situation.

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

11 years agoruntime: do no lose CPU profiling signals
Dmitriy Vyukov [Tue, 13 Aug 2013 18:12:02 +0000 (22:12 +0400)]
runtime: do no lose CPU profiling signals
Currently we lose lots of profiling signals.
Most notably, GC is not accounted at all.
But stack splits, scheduler, syscalls, etc are lost as well.
This creates seriously misleading profile.
With this change all profiling signals are accounted.
Now I see these additional entries that were previously absent:
161  29.7%  29.7%      164  30.3% syscall.Syscall
 12   2.2%  50.9%       12   2.2% scanblock
 11   2.0%  55.0%       11   2.0% markonly
 10   1.8%  58.9%       10   1.8% sweepspan
  2   0.4%  85.8%        2   0.4% runtime.newstack
It is still impossible to understand what causes stack splits,
but at least it's clear how many time is spent on them.
Update #2197.
Update #5659.

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

11 years agoruntime: fix false deadlock crash
Dmitriy Vyukov [Tue, 13 Aug 2013 18:07:42 +0000 (22:07 +0400)]
runtime: fix false deadlock crash
Fixes #6070.
Update #6055.

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

11 years agosync/atomic: fix ARM nomenclature in comments
Dmitriy Vyukov [Tue, 13 Aug 2013 18:07:21 +0000 (22:07 +0400)]
sync/atomic: fix ARM nomenclature in comments

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

11 years agoio: prevent write to PipeWriter after Close
Rick Arnold [Tue, 13 Aug 2013 18:04:09 +0000 (11:04 -0700)]
io: prevent write to PipeWriter after Close

Return an ErrClosedPipe rather than allowing the write to proceed.

Fixes #5330.

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

11 years agosync/atomic: add Swap to nil deref test
Dmitriy Vyukov [Tue, 13 Aug 2013 17:18:33 +0000 (21:18 +0400)]
sync/atomic: add Swap to nil deref test

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

11 years agosync/atomic: trigger paging fault early on linux/arm
Dmitriy Vyukov [Tue, 13 Aug 2013 17:15:47 +0000 (21:15 +0400)]
sync/atomic: trigger paging fault early on linux/arm
so that we don't need to traceback through __kuser_cmpxchg

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

11 years agonet: implement DNS TCP fallback query if UDP response is truncated
Alex A Skinner [Tue, 13 Aug 2013 16:44:12 +0000 (09:44 -0700)]
net: implement DNS TCP fallback query if UDP response is truncated

Fixes #5686.

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

11 years agocmd/cgo: Add support for C function pointers
Alberto García Hierro [Tue, 13 Aug 2013 16:42:21 +0000 (12:42 -0400)]
cmd/cgo: Add support for C function pointers

* Add a new kind of Name, "fpvar" which stands for function pointer variable
* When walking the AST, find functions used as expressions and create a new Name object for them
* Track functions which are only used in expr contexts, and avoid generating bridge code for them

R=golang-dev, minux.ma, fullung, rsc, iant
CC=golang-dev
https://golang.org/cl/9835047

11 years agoruntime/pprof: test netbsd and openbsd again
Russ Cox [Tue, 13 Aug 2013 16:35:37 +0000 (12:35 -0400)]
runtime/pprof: test netbsd and openbsd again

Maybe these will work now.

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

11 years agotest/run: process build tags like go/build
Anthony Martin [Tue, 13 Aug 2013 16:25:41 +0000 (12:25 -0400)]
test/run: process build tags like go/build

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

11 years agoruntime/pprof: fix test
Dmitriy Vyukov [Tue, 13 Aug 2013 16:18:29 +0000 (12:18 -0400)]
runtime/pprof: fix test

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

11 years agoruntime: fix handling of network deadlines
Dmitriy Vyukov [Tue, 13 Aug 2013 15:11:42 +0000 (19:11 +0400)]
runtime: fix handling of network deadlines
Ensure that deadlines affect already issued IO.

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

11 years agodoc: update go1.2.txt
Dmitriy Vyukov [Tue, 13 Aug 2013 13:21:33 +0000 (17:21 +0400)]
doc: update go1.2.txt

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

11 years agosync/atomic: add Swap functions
Dmitriy Vyukov [Tue, 13 Aug 2013 11:26:48 +0000 (15:26 +0400)]
sync/atomic: add Swap functions
Fixes #5722.

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

11 years agonet: make deadline helpers join to netFD as its methods
Mikio Hara [Tue, 13 Aug 2013 11:00:58 +0000 (20:00 +0900)]
net: make deadline helpers join to netFD as its methods

Just for readability reasons; to prevent overlooking deadline stuff
across over platforms.

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

11 years agosync: faster Cond
Dmitriy Vyukov [Tue, 13 Aug 2013 10:45:36 +0000 (14:45 +0400)]
sync: faster Cond
The new version does not require any memory allocations and is 30-50% faster.
Also detect and painc if Cond is copied after first.

benchmark            old ns/op    new ns/op    delta
BenchmarkCond1             317          195  -38.49%
BenchmarkCond1-2           875          607  -30.63%
BenchmarkCond1-4          1116          548  -50.90%
BenchmarkCond1-8          1013          613  -39.49%
BenchmarkCond1-16          983          450  -54.22%
BenchmarkCond2             559          352  -37.03%
BenchmarkCond2-2          1916         1378  -28.08%
BenchmarkCond2-4          1518         1322  -12.91%
BenchmarkCond2-8          2313         1291  -44.19%
BenchmarkCond2-16         1885         1078  -42.81%
BenchmarkCond4            1070          614  -42.62%
BenchmarkCond4-2          4899         3047  -37.80%
BenchmarkCond4-4          3813         3006  -21.16%
BenchmarkCond4-8          3605         3045  -15.53%
BenchmarkCond4-16         4148         2637  -36.43%
BenchmarkCond8            2086         1264  -39.41%
BenchmarkCond8-2          9961         6736  -32.38%
BenchmarkCond8-4          8135         7689   -5.48%
BenchmarkCond8-8          9623         7517  -21.89%
BenchmarkCond8-16        11661         8093  -30.60%

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

11 years agoruntime: eliminate excessive notewakeup calls in timers
Dmitriy Vyukov [Tue, 13 Aug 2013 10:14:24 +0000 (14:14 +0400)]
runtime: eliminate excessive notewakeup calls in timers
If the timer goroutine is wakeup by timeout,
other goroutines will still notewakeup because sleeping is still set.

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

11 years agosyscall: disable cpu profiling around fork
Dmitriy Vyukov [Tue, 13 Aug 2013 09:01:30 +0000 (13:01 +0400)]
syscall: disable cpu profiling around fork
Fixes #5517.
Fixes #5659.

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

11 years agoruntime: fix network timers related crash
Dmitriy Vyukov [Tue, 13 Aug 2013 08:55:57 +0000 (12:55 +0400)]
runtime: fix network timers related crash
Fixes #6103.

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

11 years agotag go1.1.2
Andrew Gerrand [Tue, 13 Aug 2013 06:33:59 +0000 (16:33 +1000)]
tag go1.1.2

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

11 years agogo/doc: permit a package synopsis to end with ":\n".
David Symonds [Tue, 13 Aug 2013 06:20:17 +0000 (16:20 +1000)]
go/doc: permit a package synopsis to end with ":\n".

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

11 years agodoc: release notes for go1.1.2
Andrew Gerrand [Tue, 13 Aug 2013 05:08:10 +0000 (15:08 +1000)]
doc: release notes for go1.1.2

R=golang-dev, go.peter.90, rsc, r
CC=golang-dev
https://golang.org/cl/12016043

11 years agocmd/gc: add temporary-merging optimization pass
Russ Cox [Tue, 13 Aug 2013 04:09:31 +0000 (00:09 -0400)]
cmd/gc: add temporary-merging optimization pass

The compilers assume they can generate temporary variables
as needed to preserve the right semantics or simplify code
generation and the back end will still generate good code.
This turns out not to be true. The back ends will only
track the first 128 variables per function and give up
on the remainder. That needs to be fixed too, in a later CL.

This CL merges temporary variables with equal types and
non-overlapping lifetimes using the greedy algorithm in
Poletto and Sarkar, "Linear Scan Register Allocation",
ACM TOPLAS 1999.

The result can be striking in the right functions.

Top 20 frame size changes in a 6g godoc binary by bytes saved:

5464 1984 (-3480, -63.7%) go/build.(*Context).Import
4456 1824 (-2632, -59.1%) go/printer.(*printer).expr1
2560   80 (-2480, -96.9%) time.nextStdChunk
3496 1608 (-1888, -54.0%) go/printer.(*printer).stmt
1896  272 (-1624, -85.7%) net/http.init
2688 1400 (-1288, -47.9%) fmt.(*pp).printReflectValue
2800 1512 (-1288, -46.0%) main.main
3296 2016 (-1280, -38.8%) crypto/tls.(*Conn).clientHandshake
1664  488 (-1176, -70.7%) time.loadZoneZip
1760  608 (-1152, -65.5%) time.parse
4104 3072 (-1032, -25.1%) runtime/pprof.writeHeap
1680  712 ( -968, -57.6%) go/ast.Walk
2488 1560 ( -928, -37.3%) crypto/x509.parseCertificate
1128  392 ( -736, -65.2%) math/big.nat.divLarge
1528  864 ( -664, -43.5%) go/printer.(*printer).fieldList
1360  712 ( -648, -47.6%) regexp/syntax.(*parser).factor
2104 1528 ( -576, -27.4%) encoding/asn1.parseField
1064  504 ( -560, -52.6%) encoding/xml.(*Decoder).text
 584   48 ( -536, -91.8%) html.init
1400  864 ( -536, -38.3%) go/doc.playExample

In the same godoc build, cuts the number of functions with
too many vars from 83 to 32.

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

11 years agodoc/go1.2.txt: bufio.{Writer,Reader}.Reset
Rob Pike [Tue, 13 Aug 2013 03:39:45 +0000 (13:39 +1000)]
doc/go1.2.txt: bufio.{Writer,Reader}.Reset

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

11 years agocmd/api: don't fail API check if there's no network
Brad Fitzpatrick [Tue, 13 Aug 2013 02:18:47 +0000 (19:18 -0700)]
cmd/api: don't fail API check if there's no network

If the hg checkout of go.tools fails, check for Internet
connectivity before failing.

R=golang-dev, shivakumar.gn
CC=golang-dev
https://golang.org/cl/12814043

11 years agocmd/6l: fix printing of frame size in TEXT instruction
Russ Cox [Tue, 13 Aug 2013 02:04:24 +0000 (22:04 -0400)]
cmd/6l: fix printing of frame size in TEXT instruction

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

11 years agocmd/gc: move flow graph into portable opt
Russ Cox [Tue, 13 Aug 2013 02:02:10 +0000 (22:02 -0400)]
cmd/gc: move flow graph into portable opt

Now there's only one copy of the flow graph construction
and dominator computation, and different optimizations
can attach different annotations to the instructions.

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

11 years agogo/build: change the wording of NoGoError and comment it better
Rob Pike [Tue, 13 Aug 2013 01:32:32 +0000 (11:32 +1000)]
go/build: change the wording of NoGoError and comment it better
Out of context, it can be very confusing because there can be lots of Go
files in the directory, but the error message says there aren't.

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

11 years agotext/template: Make function call builtin handle nil errors correctly
Elias Naur [Tue, 13 Aug 2013 01:11:05 +0000 (11:11 +1000)]
text/template: Make function call builtin handle nil errors correctly

The call builtin unconditionally tries to convert a second return value from a function to the error type. This fails in case nil is returned, effectively making call useless for functions returning two values.

This CL adds a nil check for the second return value, and adds a test.

Note that for regular function and method calls the nil error case is handled correctly and is verified by a test.

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

11 years agocmd/6g, cmd/8g: proginfo carry fixes
Russ Cox [Tue, 13 Aug 2013 01:02:55 +0000 (21:02 -0400)]
cmd/6g, cmd/8g: proginfo carry fixes

Bugs pointed out by cshapiro in CL 12637051.

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

11 years agocmd/gc: support for "portable" optimization logic
Russ Cox [Mon, 12 Aug 2013 23:14:02 +0000 (19:14 -0400)]
cmd/gc: support for "portable" optimization logic

Code in gc/popt.c is compiled as part of 5g, 6g, and 8g,
meaning it can use arch-specific headers but there's
just one copy of the code.

This is the same arrangement we use for the portable
code generation logic in gc/pgen.c.

Move fixjmp and noreturn there to get the ball rolling.

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

11 years agonet/http: do not send malformed cookie domain attribute
Volker Dobler [Mon, 12 Aug 2013 22:14:34 +0000 (15:14 -0700)]
net/http: do not send malformed cookie domain attribute

Malformed domain attributes are not sent in a Set-Cookie header.
Instead the domain attribute is dropped which turns the cookie
into a host-only cookie. This is much safer than dropping characters
from domain attribute.

Domain attributes with a leading dot '.' are still allowed, even
if discouraged by RFC 6265 section 4.1.1.

Fixes #6013

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

11 years agoruntime: change textflags from numbers to symbols
Keith Randall [Mon, 12 Aug 2013 20:47:18 +0000 (13:47 -0700)]
runtime: change textflags from numbers to symbols

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

11 years agoruntime/race: add end-to-end test
Dmitriy Vyukov [Mon, 12 Aug 2013 18:04:10 +0000 (22:04 +0400)]
runtime/race: add end-to-end test
Fixes #5933.

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

11 years agoruntime: remove unused m->racepc
Dmitriy Vyukov [Mon, 12 Aug 2013 17:48:19 +0000 (21:48 +0400)]
runtime: remove unused m->racepc
The original plan was to collect allocation stacks
for all memory blocks. But it was never implemented
and it's not in near plans and it's unclear how to do it at all.

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

11 years agosync/atomic: specify argsize for asm routines
Dmitriy Vyukov [Mon, 12 Aug 2013 17:46:33 +0000 (21:46 +0400)]
sync/atomic: specify argsize for asm routines
Fixes #6098.

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

11 years agocmd/5g: factor out prog information
Russ Cox [Mon, 12 Aug 2013 17:42:23 +0000 (13:42 -0400)]
cmd/5g: factor out prog information

Like CL 12637051, but for 5g instead of 6g.

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

11 years agocmd/5l: fix encoding of new MOVB, MOVH instructions
Russ Cox [Mon, 12 Aug 2013 17:42:04 +0000 (13:42 -0400)]
cmd/5l: fix encoding of new MOVB, MOVH instructions

They are just like MOVW and should be setting only
two register fields, not three.

R=ken2
CC=golang-dev, remyoudompheng
https://golang.org/cl/12781043

11 years agoruntime: fix ARM assembly formatting
Dmitriy Vyukov [Mon, 12 Aug 2013 17:36:33 +0000 (21:36 +0400)]
runtime: fix ARM assembly formatting

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

11 years agoall: change textflags from numbers to symbols.
Keith Randall [Mon, 12 Aug 2013 17:25:36 +0000 (10:25 -0700)]
all: change textflags from numbers to symbols.

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

11 years agomath: convert textflags from numbers to symbols
Keith Randall [Mon, 12 Aug 2013 17:25:18 +0000 (10:25 -0700)]
math: convert textflags from numbers to symbols

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

11 years agosyscall: Convert textflags from numbers to symbols.
Keith Randall [Mon, 12 Aug 2013 17:24:30 +0000 (10:24 -0700)]
syscall: Convert textflags from numbers to symbols.

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

11 years agocmd/8g: factor out prog information
Russ Cox [Mon, 12 Aug 2013 17:05:40 +0000 (13:05 -0400)]
cmd/8g: factor out prog information

Like CL 12637051, but for 8g instead of 6g.
Fix a few minor 6g errors too.

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

11 years agobufio: add Writer example
Andrew Gerrand [Mon, 12 Aug 2013 03:03:50 +0000 (13:03 +1000)]
bufio: add Writer example

Update #5530

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

11 years agobufio: make it clear that the client must call Writer.Flush
Rob Pike [Mon, 12 Aug 2013 02:55:33 +0000 (12:55 +1000)]
bufio: make it clear that the client must call Writer.Flush

Fixes #5530.

R=golang-dev, iant, com.liigo
CC=golang-dev
https://golang.org/cl/12688044

11 years agocrypto/rand: simplify example to exploit properties of ReadFull
Rob Pike [Mon, 12 Aug 2013 02:52:23 +0000 (12:52 +1000)]
crypto/rand: simplify example to exploit properties of ReadFull
No need for the complex condition.
Fixes #6089

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

11 years agocmd/6g: move opt instruction decode into common function
Russ Cox [Mon, 12 Aug 2013 01:46:38 +0000 (21:46 -0400)]
cmd/6g: move opt instruction decode into common function

Add new proginfo function that returns information about a
Prog*. The information includes various instruction
description bits as well as a list of required registers set
and used and indexing registers used.

Convert the large instruction switches to use proginfo.

This information was formerly duplicated in multiple
optimization passes, inconsistently. For example, the
information about which registers an instruction requires
appeared three times for most instructions.

Most of the switches were incomplete or incorrect in some way.
For example, the switch in copyu did not list cases for INCB,
JPS, MOVAPD, MOVBWSX, MOVBWZX, PCDATA, POPQ, PUSHQ, STD,
TESTB, TESTQ, and XCHGL. Those were all falling into the
"unknown instruction" default case and stopping the rewrite,
perhaps unnecessarily. Similarly, the switch in needc only
listed a handful of the instructions that use or set the carry bit.

We still need to decide whether to use proginfo to generalize
a few of the remaining smaller switches in peep.c.

If this goes well, we'll make similar changes in 8g and 5g.

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

11 years agodoc/go1.2.txt: json and ampersands
Rob Pike [Mon, 12 Aug 2013 01:28:25 +0000 (11:28 +1000)]
doc/go1.2.txt: json and ampersands

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

11 years agoruntime/pprof: add block profile test
Dmitriy Vyukov [Sun, 11 Aug 2013 09:05:51 +0000 (13:05 +0400)]
runtime/pprof: add block profile test
Fixes #5993.

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

11 years agonet/http: simplify server, use bufio Reader.Reset and Writer.Reset
Brad Fitzpatrick [Sun, 11 Aug 2013 02:22:44 +0000 (19:22 -0700)]
net/http: simplify server, use bufio Reader.Reset and Writer.Reset

Update #5100
Update #6086

Remove switchReader, switchWriter, switchReaderPair,
switchWriterPair, etc.

Now it only maintains pools of bufio Readers and Writers, but
uses Reset instead of working around all their
previously-associated state.

Compared to before the bufio Reset change, it's the same number of
allocations, and also faster:

benchmark                                   old ns/op    new ns/op    delta
BenchmarkClientServer                          111218       109828   -1.25%
BenchmarkClientServerParallel4                  70580        70013   -0.80%
BenchmarkClientServerParallel64                 72636        68919   -5.12%
BenchmarkServer                                139858       137068   -1.99%
BenchmarkServerFakeConnNoKeepAlive              14619        14314   -2.09%
BenchmarkServerFakeConnWithKeepAlive            12390        11361   -8.31%
BenchmarkServerFakeConnWithKeepAliveLite         7630         7306   -4.25%
BenchmarkServerHandlerTypeLen                    9688         9342   -3.57%
BenchmarkServerHandlerNoLen                      8700         8470   -2.64%
BenchmarkServerHandlerNoType                     9255         8949   -3.31%
BenchmarkServerHandlerNoHeader                   7058         6806   -3.57%

benchmark                                  old allocs   new allocs    delta
BenchmarkClientServer                              61           61    0.00%
BenchmarkClientServerParallel4                     61           61    0.00%
BenchmarkClientServerParallel64                    61           61    0.00%
BenchmarkServer                                    16           16    0.00%
BenchmarkServerFakeConnNoKeepAlive                 24           24    0.00%
BenchmarkServerFakeConnWithKeepAlive               19           19    0.00%
BenchmarkServerFakeConnWithKeepAliveLite            9            9    0.00%
BenchmarkServerHandlerTypeLen                      17           17    0.00%
BenchmarkServerHandlerNoLen                        14           14    0.00%
BenchmarkServerHandlerNoType                       15           15    0.00%
BenchmarkServerHandlerNoHeader                      9            9    0.00%

benchmark                                   old bytes    new bytes    delta
BenchmarkClientServer                            6988         6985   -0.04%
BenchmarkClientServerParallel4                   6979         6985    0.09%
BenchmarkClientServerParallel64                  7002         7019    0.24%
BenchmarkServer                                  1846         1848    0.11%
BenchmarkServerFakeConnNoKeepAlive               2420         2412   -0.33%
BenchmarkServerFakeConnWithKeepAlive             2126         2129    0.14%
BenchmarkServerFakeConnWithKeepAliveLite          989          990    0.10%
BenchmarkServerHandlerTypeLen                    1818         1819    0.06%
BenchmarkServerHandlerNoLen                      1775         1777    0.11%
BenchmarkServerHandlerNoType                     1783         1785    0.11%
BenchmarkServerHandlerNoHeader                    989          990    0.10%

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

11 years agobufio: drop buffer recycling, add Reader.Reset and Writer.Reset
Brad Fitzpatrick [Sun, 11 Aug 2013 02:22:19 +0000 (19:22 -0700)]
bufio: drop buffer recycling, add Reader.Reset and Writer.Reset

Fixes #6086

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

11 years agocmd/gc: zero pointers on entry to function
Russ Cox [Sat, 10 Aug 2013 03:10:58 +0000 (23:10 -0400)]
cmd/gc: zero pointers on entry to function

On entry to a function, zero the results and zero the pointer
section of the local variables.

This is an intermediate step on the way to precise collection
of Go frames.

This can incur a significant (up to 30%) slowdown, but it also ensures
that the garbage collector never looks at a word in a Go frame
and sees a stale pointer value that could cause a space leak.
(C frames and assembly frames are still possibly problematic.)

This CL is required to start making collection of interface values
as precise as collection of pointer values are today.
Since we have to dereference the interface type to understand
whether the value is a pointer, it is critical that the type field be
initialized.

A future CL by Carl will make the garbage collection pointer
bitmaps context-sensitive. At that point it will be possible to
remove most of the zeroing. The only values that will still need
zeroing are values whose addresses escape the block scoping
of the function but do not escape to the heap.

benchmark                         old ns/op    new ns/op    delta
BenchmarkBinaryTree17            4420289180   4331060459   -2.02%
BenchmarkFannkuch11              3442469663   3277706251   -4.79%
BenchmarkFmtFprintfEmpty                100          142  +42.00%
BenchmarkFmtFprintfString               262          310  +18.32%
BenchmarkFmtFprintfInt                  213          281  +31.92%
BenchmarkFmtFprintfIntInt               355          431  +21.41%
BenchmarkFmtFprintfPrefixedInt          321          383  +19.31%
BenchmarkFmtFprintfFloat                444          533  +20.05%
BenchmarkFmtManyArgs                   1380         1559  +12.97%
BenchmarkGobDecode                 10240054     11794915  +15.18%
BenchmarkGobEncode                 17350274     19970478  +15.10%
BenchmarkGzip                     455179460    460699139   +1.21%
BenchmarkGunzip                   114271814    119291574   +4.39%
BenchmarkHTTPClientServer             89051        89894   +0.95%
BenchmarkJSONEncode                40486799     52691558  +30.15%
BenchmarkJSONDecode                94193361    112428781  +19.36%
BenchmarkMandelbrot200              4747060      4748043   +0.02%
BenchmarkGoParse                    6363798      6675098   +4.89%
BenchmarkRegexpMatchEasy0_32            129          171  +32.56%
BenchmarkRegexpMatchEasy0_1K            365          395   +8.22%
BenchmarkRegexpMatchEasy1_32            106          152  +43.40%
BenchmarkRegexpMatchEasy1_1K            952         1245  +30.78%
BenchmarkRegexpMatchMedium_32           198          283  +42.93%
BenchmarkRegexpMatchMedium_1K         79006       101097  +27.96%
BenchmarkRegexpMatchHard_32            3478         5115  +47.07%
BenchmarkRegexpMatchHard_1K          110245       163582  +48.38%
BenchmarkRevcomp                  777384355    793270857   +2.04%
BenchmarkTemplate                 136713089    157093609  +14.91%
BenchmarkTimeParse                     1511         1761  +16.55%
BenchmarkTimeFormat                     535          850  +58.88%

benchmark                          old MB/s     new MB/s  speedup
BenchmarkGobDecode                    74.95        65.07    0.87x
BenchmarkGobEncode                    44.24        38.43    0.87x
BenchmarkGzip                         42.63        42.12    0.99x
BenchmarkGunzip                      169.81       162.67    0.96x
BenchmarkJSONEncode                   47.93        36.83    0.77x
BenchmarkJSONDecode                   20.60        17.26    0.84x
BenchmarkGoParse                       9.10         8.68    0.95x
BenchmarkRegexpMatchEasy0_32         247.24       186.31    0.75x
BenchmarkRegexpMatchEasy0_1K        2799.20      2591.93    0.93x
BenchmarkRegexpMatchEasy1_32         299.31       210.44    0.70x
BenchmarkRegexpMatchEasy1_1K        1074.71       822.45    0.77x
BenchmarkRegexpMatchMedium_32          5.04         3.53    0.70x
BenchmarkRegexpMatchMedium_1K         12.96        10.13    0.78x
BenchmarkRegexpMatchHard_32            9.20         6.26    0.68x
BenchmarkRegexpMatchHard_1K            9.29         6.26    0.67x
BenchmarkRevcomp                     326.95       320.40    0.98x
BenchmarkTemplate                     14.19        12.35    0.87x

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

11 years agodoc: update go1.2.txt
Russ Cox [Sat, 10 Aug 2013 02:25:49 +0000 (22:25 -0400)]
doc: update go1.2.txt

I skimmed the submitted CLs back to Monday.

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

11 years agostrconv: fix typo in docs
ChaiShushan [Sat, 10 Aug 2013 01:38:42 +0000 (11:38 +1000)]
strconv: fix typo in docs

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

11 years agonet: move InvalidAddrError type into net.go
Mikio Hara [Sat, 10 Aug 2013 00:46:22 +0000 (09:46 +0900)]
net: move InvalidAddrError type into net.go

Probably we should remove this type before Go 1 contract has settled,
but too late. Instead, keep InvalidAddrError close to package generic
error types.

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

11 years agodoc/go1.2.txt: Added missing changes since 1st of August
Pieter Droogendijk [Fri, 9 Aug 2013 23:48:43 +0000 (09:48 +1000)]
doc/go1.2.txt: Added missing changes since 1st of August

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

11 years agocmd/cc, cmd/gc, runtime: Uniquely encode iface and eface pointers in the pointer...
Carl Shapiro [Fri, 9 Aug 2013 23:48:12 +0000 (16:48 -0700)]
cmd/cc, cmd/gc, runtime: Uniquely encode iface and eface pointers in the pointer map.

Prior to this change, pointer maps encoded the disposition of
a word using a single bit.  A zero signaled a non-pointer
value and a one signaled a pointer value.  Interface values,
which are a effectively a union type, were conservatively
labeled as a pointer.

This change widens the logical element size of the pointer map
to two bits per word.  As before, zero signals a non-pointer
value and one signals a pointer value.  Additionally, a two
signals an iface pointer and a three signals an eface pointer.

Following other changes to the runtime, values two and three
will allow a type information to drive interpretation of the
subsequent word so only those interface values containing a
pointer value will be scanned.

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

11 years agoencoding/binary: better description for intReadSize
Rob Pike [Fri, 9 Aug 2013 23:11:58 +0000 (09:11 +1000)]
encoding/binary: better description for intReadSize
It used to be called intDestSize; the new name is better too.

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

11 years agocmd/api: eliminate duplicate package import work
Russ Cox [Fri, 9 Aug 2013 22:44:00 +0000 (18:44 -0400)]
cmd/api: eliminate duplicate package import work

On my Mac, cuts the API checks from 15 seconds to 6 seconds.
Also clean up some tag confusion: go run list-of-files ignores tags.

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

11 years agoencoding/binary: fast path for reading slices
Rob Pike [Fri, 9 Aug 2013 22:40:32 +0000 (08:40 +1000)]
encoding/binary: fast path for reading slices

Again, it still allocates but the code is simple.

benchmark                       old ns/op    new ns/op    delta
BenchmarkReadSlice1000Int32s        35580        11465  -67.78%

benchmark                        old MB/s     new MB/s  speedup
BenchmarkReadSlice1000Int32s       112.42       348.86    3.10x

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

11 years agogo/build: add AllTags to Package
Russ Cox [Fri, 9 Aug 2013 22:34:08 +0000 (18:34 -0400)]
go/build: add AllTags to Package

AllTags lists all the tags that can affect the decision
about which files to include. Tools scanning packages
can use this to decide how many variants there are
and what they are.

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

11 years agoencoding/json: escape & always
Russ Cox [Fri, 9 Aug 2013 22:33:57 +0000 (18:33 -0400)]
encoding/json: escape & always

There are a few different places in the code that escape
possibly-problematic characters like < > and &.
This one was the only one missing &, so add it.

This means that if you Marshal a string, you get the
same answer you do if you Marshal a string and
pass it through the compactor. (Ironically, the
compaction makes the string longer.)

Because html/template invokes json.Marshal to
prepare escaped strings for JavaScript, this changes
the form of some of the escaped strings, but not
their meaning.

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

11 years agoruntime: Better test tracebackability of jmpdefer when running a nil defer.
Keith Randall [Fri, 9 Aug 2013 22:27:45 +0000 (15:27 -0700)]
runtime: Better test tracebackability of jmpdefer when running a nil defer.

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

11 years agonet/http: Make ReadResponse work with a nil Request parameter
Taru Karttunen [Fri, 9 Aug 2013 22:11:03 +0000 (15:11 -0700)]
net/http: Make ReadResponse work with a nil Request parameter

Fixes #5583

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

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