]> Cypherpunks repositories - gostls13.git/log
gostls13.git
12 years agocmd/gc: do not crash on struct with _ field
Russ Cox [Thu, 7 Jun 2012 06:05:08 +0000 (02:05 -0400)]
cmd/gc: do not crash on struct with _ field

Fixes #3607.

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

12 years agocmd/gc: preserve side effects during inlining of function with _ argument
Russ Cox [Thu, 7 Jun 2012 05:54:07 +0000 (01:54 -0400)]
cmd/gc: preserve side effects during inlining of function with _ argument

Fixes #3593.

R=ken2
CC=golang-dev, lvd
https://golang.org/cl/6305061

12 years agoencoding/json: fix panic unmarshaling into non-nil interface value
Russ Cox [Thu, 7 Jun 2012 05:48:55 +0000 (01:48 -0400)]
encoding/json: fix panic unmarshaling into non-nil interface value

Fixes #3614.

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

12 years agocmd/gc: mark output of typename as type-checked
Russ Cox [Thu, 7 Jun 2012 04:51:11 +0000 (00:51 -0400)]
cmd/gc: mark output of typename as type-checked

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

12 years agoexp/html: when parsing, compare atoms (ints) instead of strings.
Nigel Tao [Thu, 7 Jun 2012 03:46:57 +0000 (13:46 +1000)]
exp/html: when parsing, compare atoms (ints) instead of strings.

This is the mechanical part of the 2-part change that started with
https://golang.org/cl/6305053/

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

12 years agoexp/html: make the tokenizer return atoms for tag tokens.
Nigel Tao [Thu, 7 Jun 2012 03:05:35 +0000 (13:05 +1000)]
exp/html: make the tokenizer return atoms for tag tokens.

This is part 1 of a 2 part changelist. Part 2 contains the mechanical
change to parse.go to compare atoms (ints) instead of strings.

The overall effect of the two changes are:
benchmark                      old ns/op    new ns/op    delta
BenchmarkParser                  4462274      4058254   -9.05%
BenchmarkRawLevelTokenizer        913202       912917   -0.03%
BenchmarkLowLevelTokenizer       1268626      1267836   -0.06%
BenchmarkHighLevelTokenizer      1947305      1968944   +1.11%

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

12 years agotest/bench/go1: add go/parser benchmark
Dave Cheney [Thu, 7 Jun 2012 00:23:45 +0000 (10:23 +1000)]
test/bench/go1: add go/parser benchmark

As discussed in

https://groups.google.com/d/msg/golang-dev/Na9XE6mcQyY/zbeBI7R-vnoJ

Here is a static copy of the go/parser benchmark. I ended up using
fancy encodings because the original parser.go had a number of `s
scattered throughout which made it hard to embed the source directly.

Curiously on my laptop this benchmark always scores roughly 10% higher
than the standalone benchmark. This may be down to the generation of
the fasta data set triggering the cpu governor to raise the cpu speed.
However the benchmark is consistent with itself across multiple runs.

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

12 years agoruntime: include "typekind.h" to fix windows build
Alex Brainman [Wed, 6 Jun 2012 23:37:05 +0000 (09:37 +1000)]
runtime: include "typekind.h" to fix windows build

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

12 years agoexp/html/atom: add more atoms.
Nigel Tao [Wed, 6 Jun 2012 23:35:35 +0000 (09:35 +1000)]
exp/html/atom: add more atoms.

This completely covers the tags used by exp/html's parser.

Before:
295 atoms; 1406 string bytes + 2048 tables = 3454 total data
BenchmarkLookup    50000         59841 ns/op

After:
322 atoms; 1508 string bytes + 2048 tables = 3556 total data
BenchmarkLookup    50000         60159 ns/op

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

12 years ago misc/dashboard/app: fix build failure notifications
Andrew Gerrand [Wed, 6 Jun 2012 23:27:39 +0000 (09:27 +1000)]
  misc/dashboard/app: fix build failure notifications

The datastore.Query methods once mutated the Query value, but now they return
a derivative query, so the Hash= and ParentHash= filters were not being
applied.

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

12 years agonet: pass tests on Plan 9 again
Fazlul Shahriar [Wed, 6 Jun 2012 22:38:56 +0000 (18:38 -0400)]
net: pass tests on Plan 9 again

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

12 years agoruntime: move type kinds into a separate file
Jan Ziak [Wed, 6 Jun 2012 21:20:02 +0000 (17:20 -0400)]
runtime: move type kinds into a separate file

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

12 years agofmt: fix doc typo
Daniel Morsing [Wed, 6 Jun 2012 20:54:02 +0000 (16:54 -0400)]
fmt: fix doc typo

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

12 years agoA+C: Daniel Morsing (individual CLA)
Russ Cox [Wed, 6 Jun 2012 20:52:38 +0000 (16:52 -0400)]
A+C: Daniel Morsing (individual CLA)

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

12 years agocrypto/rand: enable rand.Reader on plan9
Markus Sonderegger [Wed, 6 Jun 2012 20:05:47 +0000 (16:05 -0400)]
crypto/rand: enable rand.Reader on plan9

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

12 years agoA+C: Markus Sonderegger (individual CLA)
Russ Cox [Wed, 6 Jun 2012 20:05:27 +0000 (16:05 -0400)]
A+C: Markus Sonderegger (individual CLA)

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

12 years agofmt: fix inadvertent change to %#v
Russ Cox [Wed, 6 Jun 2012 19:08:00 +0000 (15:08 -0400)]
fmt: fix inadvertent change to %#v

The reordering speedup in CL 6245068 changed the semantics
of %#v by delaying the clearing of some flags.  Restore the old
semantics and add a test.

Fixes #3706.

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

12 years agonet: fix cgoAddrInfoFlags() on FreeBSD
Shenghou Ma [Wed, 6 Jun 2012 14:03:31 +0000 (22:03 +0800)]
net: fix cgoAddrInfoFlags() on FreeBSD
        CL 6250075 removed AI_MASK mask on all BSD variants,
        however FreeBSD's AI_MASK does not include AI_V4MAPPED
        and AI_ALL, and its libc is strict about the ai_flags.

        This will fix the FreeBSD builder.

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

12 years agobuild: restore PATH before "dist banner"
Shenghou Ma [Wed, 6 Jun 2012 12:19:16 +0000 (20:19 +0800)]
build: restore PATH before "dist banner"
        Fixes #3699.

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

12 years agoruntime: fix tv_sec handling for netbsd/386
Joel Sing [Wed, 6 Jun 2012 10:39:27 +0000 (20:39 +1000)]
runtime: fix tv_sec handling for netbsd/386

On netbsd/386, tv_sec is a 64-bit integer for both timeval and timespec.
Fix the time handling code so that it works correctly.

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

12 years agocmd/5c, cmd/5g, cmd/5l: fix array indexing warning under Clang 3.1
Dave Cheney [Tue, 5 Jun 2012 22:18:55 +0000 (08:18 +1000)]
cmd/5c, cmd/5g, cmd/5l: fix array indexing warning under Clang 3.1

This should be the last of them.

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

12 years agotest/bench/go1: reduce fasta data size for linux/arm
Dave Cheney [Tue, 5 Jun 2012 21:49:58 +0000 (07:49 +1000)]
test/bench/go1: reduce fasta data size for linux/arm

As discussed on golang-dev, reduce the size of the fasta
dataset to make it possible to run the go1 benchmarks on
small ARM systems.

Also, remove the 25m suffix from fasta data and Revcomp.

linux/arm: pandaboard OMAP4

BenchmarkBinaryTree17          1        70892426000 ns/op
BenchmarkFannkuch11            1        35712066000 ns/op
BenchmarkGobDecode            10         137146000 ns/op           5.60 MB/s
BenchmarkGobEncode            50          64953000 ns/op          11.82 MB/s
BenchmarkGzip          1        5675690000 ns/op           3.42 MB/s
BenchmarkGunzip        1        1207001000 ns/op          16.08 MB/s
BenchmarkJSONEncode            5         860424800 ns/op           2.26 MB/s
BenchmarkJSONDecode            1        3321839000 ns/op           0.58 MB/s
BenchmarkMandelbrot200        50          45893560 ns/op
BenchmarkRevcomp              10         135220300 ns/op          18.80 MB/s
BenchmarkTemplate              1        6385681000 ns/op           0.30 MB/s

R=rsc, minux.ma, dsymonds
CC=golang-dev
https://golang.org/cl/6278048

12 years agoruntime: use OS X vsyscall for gettimeofday (amd64)
Russ Cox [Tue, 5 Jun 2012 20:24:37 +0000 (16:24 -0400)]
runtime: use OS X vsyscall for gettimeofday (amd64)

Thanks to Dave Cheney for the magic words "comm page".

benchmark       old ns/op    new ns/op    delta
BenchmarkNow          197           33  -83.05%

This should make profiling a little better on OS X.
The raw time saved is unlikely to matter: what likely matters
more is that it seems like OS X sends profiling signals on the
way out of system calls more often than it should; avoiding
the system call should increase the accuracy of cpu profiles.

The 386 version would be similar but needs to do different
math for CPU speeds less than 1 GHz. (Apparently Apple has
never shipped a 64-bit CPU with such a slow clock.)

R=golang-dev, bradfitz, dave, minux.ma, r
CC=golang-dev
https://golang.org/cl/6275056

12 years agoruntime: use OS X vsyscall for gettimeofday (386)
Russ Cox [Tue, 5 Jun 2012 20:23:30 +0000 (16:23 -0400)]
runtime: use OS X vsyscall for gettimeofday (386)

amd64 was done in CL 6275056.

We don't attempt to handle machines with clock speeds
less than 1 GHz. Those will fall back to the system call.

benchmark       old ns/op    new ns/op    delta
BenchmarkNow          364           38  -89.53%

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

12 years agoruntime: use uintptr for block length in scanblock
Dave Cheney [Tue, 5 Jun 2012 08:55:14 +0000 (18:55 +1000)]
runtime: use uintptr for block length in scanblock

Using an int64 for a block size doesn't make
sense on 32bit platforms but extracts a performance
penalty dealing with double word quantities on Arm.

linux/arm

benchmark                 old ns/op    new ns/op    delta
BenchmarkGobDecode        155401600    144589300   -6.96%
BenchmarkGobEncode         72772220     62460940  -14.17%
BenchmarkGzip               5822632      2604797  -55.26%
BenchmarkGunzip              326321       151721  -53.51%

benchmark                  old MB/s     new MB/s  speedup
BenchmarkGobDecode             4.94         5.31    1.07x
BenchmarkGobEncode            10.55        12.29    1.16x

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

12 years agocmd/[568]g: correct freeing of allocated Regs.
Rémy Oudompheng [Tue, 5 Jun 2012 04:43:15 +0000 (06:43 +0200)]
cmd/[568]g: correct freeing of allocated Regs.

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

12 years agogc: fix typo.
Nigel Tao [Tue, 5 Jun 2012 01:56:32 +0000 (11:56 +1000)]
gc: fix typo.

There already is a "Phase 6" a few lines above.

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

12 years agonet/http/httputil: fix typo in comment.
Rob Pike [Tue, 5 Jun 2012 01:37:31 +0000 (18:37 -0700)]
net/http/httputil: fix typo in comment.

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

12 years agotest: avoid interface conversion in rotate.go
Rémy Oudompheng [Mon, 4 Jun 2012 21:31:31 +0000 (23:31 +0200)]
test: avoid interface conversion in rotate.go

It is not necessary for the test to be effective and uses a
lot of resources in the compiler. Memory usage is halved and
compilation around 8x faster.

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

12 years agogo spec: clarify promotion rules for methods/fields of anonymous fields
Robert Griesemer [Mon, 4 Jun 2012 21:24:10 +0000 (14:24 -0700)]
go spec: clarify promotion rules for methods/fields of anonymous fields

Fixes #3635.

R=rsc, r, iant, kevlar, iant
CC=golang-dev
https://golang.org/cl/6217045

12 years agocmd/gc: introduce hidden closure functions earlier
Russ Cox [Mon, 4 Jun 2012 21:07:59 +0000 (17:07 -0400)]
cmd/gc: introduce hidden closure functions earlier

The original implementation of closures created the
underlying top-level function during walk, which is fairly
late in the compilation process and caused ordering-based
complications due to earlier stages that had to be repeated
any number of times.

Create the underlying function during typecheck, much
earlier, so that later stages can be run just once.

The result is a simpler compilation sequence.

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

12 years agolib9: fix memory leak in p9getwd()
Shenghou Ma [Mon, 4 Jun 2012 17:31:23 +0000 (01:31 +0800)]
lib9: fix memory leak in p9getwd()
        although the comment says it uses libc's getenv, without NOPLAN9DEFINES
        it actually uses p9getenv which strdups.

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

12 years agotime: accept .999 in Parse
Russ Cox [Mon, 4 Jun 2012 17:09:19 +0000 (13:09 -0400)]
time: accept .999 in Parse

The recent shuffle in parsing formats exposed probably unintentional
behavior in time.Parse, namely that it was mostly ignoring ".99999"
in the format, producing the following behavior:

fmt.Println(time.Parse("03:04:05.999 MST", "12:00:00.888 PDT")) // error (.888 unexpected)
fmt.Println(time.Parse("03:04:05.999", "12:00:00")) // error (input too short)
fmt.Println(time.Parse("03:04:05.999 MST", "12:00:00 PDT"))  // ok (extra bytes on input make it ok)

http://play.golang.org/p/ESJ1UYXzq2

API CHANGE:

This CL makes all three examples valid: ".999" can match an
empty string or else a fractional second with at most nine digits.

Fixes #3701.

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

12 years agomath/big: improved karatsuba calibration code, better mul benchmark
Robert Griesemer [Mon, 4 Jun 2012 16:48:27 +0000 (09:48 -0700)]
math/big: improved karatsuba calibration code, better mul benchmark

An attempt to profit from CL 6176043 (fix to superpolinomial
runtime of karatsuba multiplication) and determine a better
karatsuba threshold. The result indicates that 32 is still
a reasonable value. Left the threshold as is (== 32), but
made some minor changes to the calibrate code which are
worthwhile saving (use of existing benchmarking code for
better results, better use of package time).

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

12 years agoexp/locale/collate: somehow an incorrect version of tables was checked in earlier.
Marcel van Lohuizen [Mon, 4 Jun 2012 16:35:26 +0000 (18:35 +0200)]
exp/locale/collate: somehow an incorrect version of tables was checked in earlier.
Regenerated tables using maketables.

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

12 years agotest/bench/go1: fix gzip test
Shenghou Ma [Mon, 4 Jun 2012 16:14:39 +0000 (00:14 +0800)]
test/bench/go1: fix gzip test
      We can't depend on init() order, and certainly we don't want to
register all future benchmarks that use jsonbytes or jsondata to init()
in json_test.go, so we use a more general solution: make generation of
jsonbytes and jsondata their own function so that the compiler will take
care of the order.

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

12 years agonet: fix botched cgo netbsd merge
Joel Sing [Mon, 4 Jun 2012 16:12:23 +0000 (02:12 +1000)]
net: fix botched cgo netbsd merge

Fix botched cgo_netbsd.go merge and remove redundant +build directive.

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

12 years agocgo: enable cgo on netbsd/386 and netbsd/amd64
Joel Sing [Mon, 4 Jun 2012 15:43:04 +0000 (01:43 +1000)]
cgo: enable cgo on netbsd/386 and netbsd/amd64

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

12 years agomisc/cgo/stdio: split stdout/stderr into a separate file
Joel Sing [Mon, 4 Jun 2012 15:38:55 +0000 (01:38 +1000)]
misc/cgo/stdio: split stdout/stderr into a separate file

Split stdout/stderr into a separate file so that can be handled
differently on some platforms. Both NetBSD and OpenBSD have defines
for stdout/stderr that require some coercion in order for cgo to
handle them correctly.

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

12 years agosyscall: use pipe instead of pipe2 on NetBSD
Benny Siegert [Mon, 4 Jun 2012 15:29:34 +0000 (01:29 +1000)]
syscall: use pipe instead of pipe2 on NetBSD

pipe2 is equivalent to pipe with flags set to 0.
However, pipe2 was only added recently. Using pipe
instead improves compatibility with NetBSD 5.

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

12 years agonet/http: add new Server benchmark
Brad Fitzpatrick [Mon, 4 Jun 2012 15:04:40 +0000 (08:04 -0700)]
net/http: add new Server benchmark

The new BenchmarkServer avoids profiling the client code
by running it in a child process.

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

12 years ago doc: mention 'hg update default' in contribution guidelines
Andrew Gerrand [Mon, 4 Jun 2012 14:55:45 +0000 (00:55 +1000)]
  doc: mention 'hg update default' in contribution guidelines

Fixes #3634.

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

12 years agodoc/install: we don't print 'The compiler is 6g' anymore
Russ Cox [Mon, 4 Jun 2012 14:41:30 +0000 (10:41 -0400)]
doc/install: we don't print 'The compiler is 6g' anymore

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

12 years agomisc/emacs: make compilation-mode's next-error understand test failure output.
Ryan Barrett [Mon, 4 Jun 2012 14:36:24 +0000 (10:36 -0400)]
misc/emacs: make compilation-mode's next-error understand test failure output.

specifically, adds a go-test element to compilation-error-regexp-alist[-alist].
Fixes #3629.

R=golang-dev, rsc, sameer
CC=golang-dev, jba
https://golang.org/cl/6197091

12 years agonet/textproto: add benchmark, cleanup, update comment
Brad Fitzpatrick [Mon, 4 Jun 2012 14:18:06 +0000 (07:18 -0700)]
net/textproto: add benchmark, cleanup, update comment

The cleanup also makes it ~5% faster, but that's
not the point of this CL.

Optimizations can come in future CLs.

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

12 years agonet/http: simplify ParseHTTPVersion
Brad Fitzpatrick [Mon, 4 Jun 2012 14:06:05 +0000 (07:06 -0700)]
net/http: simplify ParseHTTPVersion

Removes code. No need for atoi helper.

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

12 years agocmd/gc: recognize u<<1 op u>>31 as a rotate when op is ^, not just |.
Nigel Tao [Mon, 4 Jun 2012 10:53:32 +0000 (20:53 +1000)]
cmd/gc: recognize u<<1 op u>>31 as a rotate when op is ^, not just |.

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

12 years agoapi: add Linux/ARM to go1 API
Shenghou Ma [Mon, 4 Jun 2012 07:21:58 +0000 (15:21 +0800)]
api: add Linux/ARM to go1 API
It's very unfortunate that the type of Data field of struct
RawSockaddr is [14]uint8 on Linux/ARM instead of [14]int8
on all the others.
btw, it should be [14]int8 according to my header files.

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

12 years agonet/http: change a Del to delete
Brad Fitzpatrick [Mon, 4 Jun 2012 05:40:16 +0000 (22:40 -0700)]
net/http: change a Del to delete

No need to fix case of "Host" string literal.

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

12 years agopath/filepath: fix test
Mikio Hara [Mon, 4 Jun 2012 00:57:03 +0000 (09:57 +0900)]
path/filepath: fix test

Make it possible to run test over symlinked GOROOT.

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

12 years agotime: make Format 2.7x faster
Russ Cox [Sun, 3 Jun 2012 15:08:17 +0000 (11:08 -0400)]
time: make Format 2.7x faster

benchmark             old ns/op    new ns/op    delta
BenchmarkFormat            2495          937  -62.44%
BenchmarkFormatNow         2308          889  -61.48%

Update #3679.

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

12 years agonet: move cgo address info flags to per-platform files
Joel Sing [Sun, 3 Jun 2012 13:54:14 +0000 (23:54 +1000)]
net: move cgo address info flags to per-platform files

Move address info flags to per-platform files. This is needed to
enable cgo on NetBSD (and later OpenBSD), as some of the currently
used AI_* defines do not exist on these platforms.

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

12 years agosyscall: correct Win32finddata definition
Alex Brainman [Sun, 3 Jun 2012 09:27:17 +0000 (19:27 +1000)]
syscall: correct Win32finddata definition

Fixes #3685.

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

12 years agocmd/5g: fix typo
Russ Cox [Sun, 3 Jun 2012 03:57:38 +0000 (23:57 -0400)]
cmd/5g: fix typo

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

12 years agoapi: add net.UnixConn's CloseRead and CloseWrite methods
Russ Cox [Sun, 3 Jun 2012 03:02:39 +0000 (23:02 -0400)]
api: add net.UnixConn's CloseRead and CloseWrite methods

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

12 years agocmd/gc: inline slice[arr,str] in the frontend (mostly).
Luuk van Dijk [Sun, 3 Jun 2012 02:50:57 +0000 (22:50 -0400)]
cmd/gc: inline slice[arr,str] in the frontend (mostly).

R=rsc, ality, rogpeppe, minux.ma, dave
CC=golang-dev
https://golang.org/cl/5966075

12 years agoexp/html/atom: faster Lookup with smaller tables
Russ Cox [Sun, 3 Jun 2012 02:43:11 +0000 (22:43 -0400)]
exp/html/atom: faster Lookup with smaller tables

Use perfect cuckoo hash, to avoid binary search.
Define Atom bits as offset+len in long string instead
of enumeration, to avoid string headers.

Before: 1909 string bytes + 6060 tables = 7969 total data
After: 1406 string bytes + 2048 tables = 3454 total data

benchmark          old ns/op    new ns/op    delta
BenchmarkLookup        83878        64681  -22.89%

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

12 years agosyscall: fix 32-bit uid calls
Shenghou Ma [Sat, 2 Jun 2012 22:49:57 +0000 (06:49 +0800)]
syscall: fix 32-bit uid calls
        16-bit uid calls are not always supported in newer kernels.

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

12 years agoruntime: remove unnecessary macros in vlop_arm.s
Shenghou Ma [Sat, 2 Jun 2012 20:03:09 +0000 (04:03 +0800)]
runtime: remove unnecessary macros in vlop_arm.s

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

12 years agocmd/5a, cmd/5l, math: add CLZ instruction for ARM
Shenghou Ma [Sat, 2 Jun 2012 19:08:49 +0000 (03:08 +0800)]
cmd/5a, cmd/5l, math: add CLZ instruction for ARM
        Supported in ARMv5 and above.

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

12 years agoruntime: add (unused for now) gc field to type information
Jan Ziak [Sat, 2 Jun 2012 18:02:44 +0000 (14:02 -0400)]
runtime: add (unused for now) gc field to type information

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

12 years agomath: amd64 versions of Ceil, Floor and Trunc
Charles L. Dorian [Sat, 2 Jun 2012 17:06:12 +0000 (13:06 -0400)]
math: amd64 versions of Ceil, Floor and Trunc

Ceil  to 4.81 from 20.6 ns/op
Floor to 4.37 from 13.5 ns/op
Trunc to 3.97 from 14.3 ns/op
Also changed three MOVSDs to MOVAPDs in log_amd64.s

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

12 years agopath/filepath: implement documented SkipDir behavior
Jan Mercl [Sat, 2 Jun 2012 17:00:09 +0000 (13:00 -0400)]
path/filepath: implement documented SkipDir behavior

Currently walk() doesn't check for err == SkipDir when iterating
a directory list, but such promise is made in the docs for WalkFunc.

Fixes #3486.

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

12 years agocmd/5c, cmd/5g, cmd/5l: enable use of R12, F8-F15
Shenghou Ma [Sat, 2 Jun 2012 16:54:28 +0000 (12:54 -0400)]
cmd/5c, cmd/5g, cmd/5l: enable use of R12, F8-F15

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

12 years agoapi: add FreeBSD to go1 API
Brad Fitzpatrick [Sat, 2 Jun 2012 01:42:36 +0000 (18:42 -0700)]
api: add FreeBSD to go1 API

Now that gri has made go/parser 15% faster, I offer this
change to slow back down cmd/api ~proportionately, adding
FreeBSD to the go1-checked set of platforms.

Really we should have done this earlier. This will prevent us
from breaking FreeBSD compatibility accidentally in the
future.

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

12 years agotext/template/parse: restore the goroutine
Rob Pike [Sat, 2 Jun 2012 01:34:14 +0000 (18:34 -0700)]
text/template/parse: restore the goroutine
To avoid goroutines during init, the nextItem function was a
clever workaround. Now that init goroutines are permitted,
restore the original, simpler design.

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

12 years agogo/parser: ~15% faster parsing
Robert Griesemer [Fri, 1 Jun 2012 23:27:49 +0000 (16:27 -0700)]
go/parser: ~15% faster parsing

- only compute current line position if needed
  (i.e., if a comment is present)

- added benchmark

benchmark         old ns/op    new ns/op    delta
BenchmarkParse     10902990      9313330  -14.58%

benchmark          old MB/s     new MB/s  speedup
BenchmarkParse         5.31         6.22    1.17x

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

12 years agomisc/emacs: stop go-mode from spuriously marking the buffer modified when it loads
Ryan Barrett [Fri, 1 Jun 2012 20:55:03 +0000 (16:55 -0400)]
misc/emacs: stop go-mode from spuriously marking the buffer modified when it loads

R=golang-dev, sameer, bradfitz
CC=golang-dev, jba
https://golang.org/cl/6213056

12 years agocmd/6l: loop alignment, disabled
Russ Cox [Fri, 1 Jun 2012 14:23:15 +0000 (10:23 -0400)]
cmd/6l: loop alignment, disabled

Saving the code in case we improve things enough that
it matters later, but at least right now it is not worth doing.

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

12 years agocmd/5g, cmd/6g, cmd/8g: delete clearstk
Russ Cox [Fri, 1 Jun 2012 14:10:59 +0000 (10:10 -0400)]
cmd/5g, cmd/6g, cmd/8g: delete clearstk

Dreg from https://golang.org/cl/4629042

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

12 years agomisc/dashboard/codereview: handle abandoned CLs.
David Symonds [Fri, 1 Jun 2012 00:55:55 +0000 (10:55 +1000)]
misc/dashboard/codereview: handle abandoned CLs.

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

12 years agoexp/html/atom: faster, hash-based lookup.
Nigel Tao [Thu, 31 May 2012 23:36:05 +0000 (09:36 +1000)]
exp/html/atom: faster, hash-based lookup.

exp/html/atom benchmark:
benchmark          old ns/op    new ns/op    delta
BenchmarkLookup       199226        80770  -59.46%

exp/html benchmark:
benchmark                      old ns/op    new ns/op    delta
BenchmarkParser                  4864890      4510834   -7.28%
BenchmarkHighLevelTokenizer      2209192      1969684  -10.84%
benchmark                       old MB/s     new MB/s  speedup
BenchmarkParser                    16.07        17.33    1.08x
BenchmarkHighLevelTokenizer        35.38        39.68    1.12x

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

12 years agoruntime: lower memory overhead of heap profiling.
Rémy Oudompheng [Thu, 31 May 2012 21:30:55 +0000 (23:30 +0200)]
runtime: lower memory overhead of heap profiling.

The previous code was preparing arrays of entries that would be
filled if there was one entry every 128 bytes. Moving to a 4096
byte interval reduces the overhead per megabyte of address space
to 2kB from 64kB (on 64-bit systems).
The performance impact will be negative for very small MemProfileRate.

test/bench/garbage/tree2 -heapsize 800000000 (default memprofilerate)
Before: mprof 65993056 bytes (1664 bucketmem + 65991392 addrmem)
After:  mprof  1989984 bytes (1680 bucketmem +  1988304 addrmem)

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

12 years agoCONTRIBUTORS: Add Ryan Barrett (Google CLA)
Sameer Ajmani [Thu, 31 May 2012 20:51:49 +0000 (16:51 -0400)]
CONTRIBUTORS: Add Ryan Barrett (Google CLA)

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

12 years agoruntime/pprof, misc/pprof: correct profile of total allocations.
Rémy Oudompheng [Thu, 31 May 2012 05:57:49 +0000 (07:57 +0200)]
runtime/pprof, misc/pprof: correct profile of total allocations.

The previous heap profile format did not include buckets with
zero used bytes. Also add several missing MemStats fields in
debug mode.

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

12 years agoexp/html/atom: new package.
Nigel Tao [Thu, 31 May 2012 05:37:18 +0000 (15:37 +1000)]
exp/html/atom: new package.

50% fewer mallocs in HTML tokenization, resulting in 25% fewer mallocs
in parsing go1.html.

Making the parser use integer comparisons instead of string comparisons
will be a follow-up CL, to be co-ordinated with Andy Balholm's work.

exp/html benchmarks before/after:

BenchmarkParser      500    4754294 ns/op   16.44 MB/s
        parse_test.go:409: 500 iterations, 14651 mallocs per iteration
BenchmarkRawLevelTokenizer     2000     903481 ns/op   86.51 MB/s
        token_test.go:678: 2000 iterations, 28 mallocs per iteration
BenchmarkLowLevelTokenizer     2000    1260485 ns/op   62.01 MB/s
        token_test.go:678: 2000 iterations, 41 mallocs per iteration
BenchmarkHighLevelTokenizer     1000    2165964 ns/op   36.09 MB/s
        token_test.go:678: 1000 iterations, 6616 mallocs per iteration

BenchmarkParser      500    4664912 ns/op   16.76 MB/s
        parse_test.go:409: 500 iterations, 11266 mallocs per iteration
BenchmarkRawLevelTokenizer     2000     903065 ns/op   86.55 MB/s
        token_test.go:678: 2000 iterations, 28 mallocs per iteration
BenchmarkLowLevelTokenizer     2000    1260032 ns/op   62.03 MB/s
        token_test.go:678: 2000 iterations, 41 mallocs per iteration
BenchmarkHighLevelTokenizer     1000    2143356 ns/op   36.47 MB/s
        token_test.go:678: 1000 iterations, 3231 mallocs per iteration

R=r, rsc, rogpeppe
CC=andybalholm, golang-dev
https://golang.org/cl/6255062

12 years agoregexp: fix a couple of bugs in the documentation
Rob Pike [Thu, 31 May 2012 04:57:50 +0000 (21:57 -0700)]
regexp: fix a couple of bugs in the documentation
Byte slices are not strings.

Fixes #3687.

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

12 years agomisc/dashboard/app: add debug logging to notifyOnFailure; remove unused Result.OK...
Andrew Gerrand [Thu, 31 May 2012 04:09:50 +0000 (14:09 +1000)]
misc/dashboard/app: add debug logging to notifyOnFailure; remove unused Result.OK function

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

12 years agomisc/dashboard/app: fix tests
Andrew Gerrand [Thu, 31 May 2012 04:09:24 +0000 (14:09 +1000)]
misc/dashboard/app: fix tests

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

12 years agocmd/go: add -ccflags
Dave Cheney [Wed, 30 May 2012 23:10:03 +0000 (09:10 +1000)]
cmd/go: add -ccflags

Add -ccflags to pass arguments to {5,6,8}c
similar to -gcflags for {5,6,8}g.

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

12 years agocmd/gc: contiguous loop layout
Russ Cox [Wed, 30 May 2012 22:07:39 +0000 (18:07 -0400)]
cmd/gc: contiguous loop layout

Drop expecttaken function in favor of extra argument
to gbranch and bgen. Mark loop condition as likely to
be true, so that loops are generated inline.

The main benefit here is contiguous code when trying
to read the generated assembly. It has only minor effects
on the timing, and they mostly cancel the minor effects
that aligning function entry points had.  One exception:
both changes made Fannkuch faster.

Compared to before CL 6244066 (before aligned functions)
benchmark                 old ns/op    new ns/op    delta
BenchmarkBinaryTree17    4222117400   4201958800   -0.48%
BenchmarkFannkuch11      3462631800   3215908600   -7.13%
BenchmarkGobDecode         20887622     20899164   +0.06%
BenchmarkGobEncode          9548772      9439083   -1.15%
BenchmarkGzip                151687       152060   +0.25%
BenchmarkGunzip                8742         8711   -0.35%
BenchmarkJSONEncode        62730560     62686700   -0.07%
BenchmarkJSONDecode       252569180    252368960   -0.08%
BenchmarkMandelbrot200      5267599      5252531   -0.29%
BenchmarkRevcomp25M       980813500    985248400   +0.45%
BenchmarkTemplate         361259100    357414680   -1.06%

Compared to tip (aligned functions):
benchmark                 old ns/op    new ns/op    delta
BenchmarkBinaryTree17    4140739800   4201958800   +1.48%
BenchmarkFannkuch11      3259914400   3215908600   -1.35%
BenchmarkGobDecode         20620222     20899164   +1.35%
BenchmarkGobEncode          9384886      9439083   +0.58%
BenchmarkGzip                150333       152060   +1.15%
BenchmarkGunzip                8741         8711   -0.34%
BenchmarkJSONEncode        65210990     62686700   -3.87%
BenchmarkJSONDecode       249394860    252368960   +1.19%
BenchmarkMandelbrot200      5273394      5252531   -0.40%
BenchmarkRevcomp25M       996013800    985248400   -1.08%
BenchmarkTemplate         360620840    357414680   -0.89%

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

12 years agonet: fix test to avoid unintentional nil pointer dereference
Mikio Hara [Wed, 30 May 2012 21:12:24 +0000 (06:12 +0900)]
net: fix test to avoid unintentional nil pointer dereference

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

12 years agocmd/5l: fix PLD
Russ Cox [Wed, 30 May 2012 21:01:25 +0000 (17:01 -0400)]
cmd/5l: fix PLD

Was missing break.

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

12 years agocmd/6l, cmd/8l, cmd/5l: add AUNDEF instruction
Russ Cox [Wed, 30 May 2012 20:47:56 +0000 (16:47 -0400)]
cmd/6l, cmd/8l, cmd/5l: add AUNDEF instruction

On 6l and 8l, this is a real instruction, guaranteed to
cause an 'undefined instruction' exception.

On 5l, we simulate it as BL to address 0.

The plan is to use it as a signal to the linker that this
point in the instruction stream cannot be reached
(hence the changes to nofollow).  This will help the
compiler explain that panicindex and friends do not
return without having to put a list of these functions
in the linker.

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

12 years agocmd/ld: align function entry on arch-specific boundary
Russ Cox [Wed, 30 May 2012 20:26:38 +0000 (16:26 -0400)]
cmd/ld: align function entry on arch-specific boundary

16 seems pretty standard on x86 for function entry.
I don't know if ARM would benefit, so I used just 4
(single instruction alignment).

This has a minor absolute effect on the current timings.
The main hope is that it will make them more consistent from
run to run.

benchmark                 old ns/op    new ns/op    delta
BenchmarkBinaryTree17    4222117400   4140739800   -1.93%
BenchmarkFannkuch11      3462631800   3259914400   -5.85%
BenchmarkGobDecode         20887622     20620222   -1.28%
BenchmarkGobEncode          9548772      9384886   -1.72%
BenchmarkGzip                151687       150333   -0.89%
BenchmarkGunzip                8742         8741   -0.01%
BenchmarkJSONEncode        62730560     65210990   +3.95%
BenchmarkJSONDecode       252569180    249394860   -1.26%
BenchmarkMandelbrot200      5267599      5273394   +0.11%
BenchmarkRevcomp25M       980813500    996013800   +1.55%
BenchmarkTemplate         361259100    360620840   -0.18%

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

12 years agocmd/6l, cmd/8l: fix chaining bug in jump rewrite
Russ Cox [Wed, 30 May 2012 20:10:53 +0000 (16:10 -0400)]
cmd/6l, cmd/8l: fix chaining bug in jump rewrite

The code was inconsistent about when it used
brchain(x) and when it used x directly, with the result
that you could end up emitting code for brchain(x) but
leave the jump pointing at an unemitted x.

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

12 years agocompress/flate: fix overflow on 2GB input. Reset hashOffset every 16 MB.
Ivan Krasin [Wed, 30 May 2012 20:08:38 +0000 (16:08 -0400)]
compress/flate: fix overflow on 2GB input. Reset hashOffset every 16 MB.

This bug has been introduced in the following revision:

changeset:   11404:26dceba5c610
user:        Ivan Krasin <krasin@golang.org>
date:        Mon Jan 23 09:19:39 2012 -0500
summary:     compress/flate: reduce memory pressure at cost of additional arithmetic operation.

This is the review page for that CL: https://golang.org/cl/5555070/

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

12 years agogo-mode: Works for both GNU-Emacs and XEmacs-21.5
Mats Lidell [Wed, 30 May 2012 20:04:29 +0000 (16:04 -0400)]
go-mode: Works for both GNU-Emacs and XEmacs-21.5

Fixes some portability issues between the Emacsen.

R=golang-dev, sameer, bradfitz, ryanb
CC=golang-dev
https://golang.org/cl/6206043

12 years agotest/bench/shootout: more speedups
Rob Pike [Wed, 30 May 2012 19:31:28 +0000 (12:31 -0700)]
test/bench/shootout: more speedups
Most significant in mandelbrot, from avoiding MOVSD between registers,
but there are others.

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

12 years agocmd/6g: avoid MOVSD between registers
Russ Cox [Wed, 30 May 2012 18:41:19 +0000 (14:41 -0400)]
cmd/6g: avoid MOVSD between registers

MOVSD only copies the low half of the packed register pair,
while MOVAPD copies both halves.  I assume the internal
register renaming works better with the latter, since it makes
our code run 25% faster.

Before:
mandelbrot 16000
        gcc -O2 mandelbrot.c 28.44u 0.00s 28.45r
        gc mandelbrot 44.12u 0.00s 44.13r
        gc_B mandelbrot 44.17u 0.01s 44.19r

After:
mandelbrot 16000
        gcc -O2 mandelbrot.c 28.22u 0.00s 28.23r
        gc mandelbrot 32.81u 0.00s 32.82r
        gc_B mandelbrot 32.82u 0.00s 32.83r

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

12 years agoshootout: make mandelbrot.go more like mandelbrot.c
Russ Cox [Wed, 30 May 2012 18:40:59 +0000 (14:40 -0400)]
shootout: make mandelbrot.go more like mandelbrot.c

Surprise! The C code is using floating point values for its counters.
Its off the critical path, but the Go code and C code are supposed to
be as similar as possible to make comparisons meaningful.

It doesn't have a significant effect.

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

12 years agoA+C: add Mats Lidell. He signed the agreement with the Sweden email
Sameer Ajmani [Wed, 30 May 2012 18:38:40 +0000 (14:38 -0400)]
A+C: add Mats Lidell.  He signed the agreement with the Sweden email
address, but his changelist is under the Gmail address.

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

12 years ago misc/emacs: Use patch output of gofmt instead of replacing the buffer.
Jean-Marc Eurin [Wed, 30 May 2012 18:18:58 +0000 (14:18 -0400)]
misc/emacs: Use patch output of gofmt instead of replacing the buffer.

This uses the patch output of gofmt (-d option) and applies each
chunk to the buffer, instead of replacing the whole buffer.  The
main advantage is that the undo history is kept across gofmt'ings,
so it can really be used as a before-save-hook.

R=sameer, sameer
CC=golang-dev
https://golang.org/cl/6198047

12 years agotest/bench/shootout/timing.log: mandelbrot is restored
Rob Pike [Wed, 30 May 2012 17:35:47 +0000 (10:35 -0700)]
test/bench/shootout/timing.log: mandelbrot is restored

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

12 years agoruntime: always initialise procid on netbsd
Joel Sing [Wed, 30 May 2012 17:27:04 +0000 (03:27 +1000)]
runtime: always initialise procid on netbsd

The correct procid is needed for unparking LWPs on NetBSD - always
initialise procid in minit() so that cgo works correctly. The non-cgo
case already works correctly since procid is initialised via
lwp_create().

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

12 years agoruntime: update field types in preparation for GC changes
Jan Ziak [Wed, 30 May 2012 17:07:52 +0000 (13:07 -0400)]
runtime: update field types in preparation for GC changes

R=rsc, remyoudompheng, minux.ma, ality
CC=golang-dev
https://golang.org/cl/6242061

12 years agocmd/ld: increase number of ELF sections
Joel Sing [Wed, 30 May 2012 17:06:38 +0000 (03:06 +1000)]
cmd/ld: increase number of ELF sections

On NetBSD a cgo enabled binary has more than 32 sections - bump NSECTS
so that we can actually link them successfully.

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

12 years agoruntime: hide symbol table from garbage collector
Jan Ziak [Wed, 30 May 2012 17:04:48 +0000 (13:04 -0400)]
runtime: hide symbol table from garbage collector

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

12 years agoexp/locale/collate: avoid double building in maketables.go. Also added check.
Marcel van Lohuizen [Wed, 30 May 2012 15:47:56 +0000 (17:47 +0200)]
exp/locale/collate: avoid double building in maketables.go.  Also added check.

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

12 years agotest/bench/go1: add mandelbrot for floating point
Russ Cox [Wed, 30 May 2012 14:26:59 +0000 (10:26 -0400)]
test/bench/go1: add mandelbrot for floating point

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