]> Cypherpunks repositories - gostls13.git/log
gostls13.git
12 years agocmd/gc: fix export of inlined function body with type guard
Russ Cox [Thu, 8 Nov 2012 21:07:05 +0000 (16:07 -0500)]
cmd/gc: fix export of inlined function body with type guard

When exporting a body containing
        x, ok := v.(Type)

the definition for Type was not being included, so when the body
was actually used, it would cause an "unknown type" compiler error.

Fixes #4370.

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

12 years agonet: fix non-unixen build
Mikio Hara [Thu, 8 Nov 2012 17:09:09 +0000 (02:09 +0900)]
net: fix non-unixen build

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

12 years agotest: run some more tests by default
Ian Lance Taylor [Thu, 8 Nov 2012 17:04:27 +0000 (09:04 -0800)]
test: run some more tests by default

R=golang-dev, remyoudompheng, iant, rsc
CC=golang-dev
https://golang.org/cl/6833043

12 years agoruntime: re-enable crash test on NetBSD
Joel Sing [Thu, 8 Nov 2012 16:41:43 +0000 (03:41 +1100)]
runtime: re-enable crash test on NetBSD

Re-enable the crash tests on NetBSD now that the issue has been
identified and fixed.

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

12 years agoruntime: fix instrumentation of slice append for race detection
Dmitriy Vyukov [Thu, 8 Nov 2012 16:37:05 +0000 (20:37 +0400)]
runtime: fix instrumentation of slice append for race detection

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

12 years agonet: close fds eagerly in DialTimeout
Brad Fitzpatrick [Thu, 8 Nov 2012 16:35:16 +0000 (10:35 -0600)]
net: close fds eagerly in DialTimeout

Integrates with the pollserver now.

Uses the old implementation on windows and plan9.

Fixes #2631

R=paul, iant, adg, bendaglish, rsc
CC=golang-dev
https://golang.org/cl/6815049

12 years agocmd/api: bug fix for goapi's lame type checker
Brad Fitzpatrick [Thu, 8 Nov 2012 16:34:54 +0000 (10:34 -0600)]
cmd/api: bug fix for goapi's lame type checker

This is blocking me submitting the net fd timeout
CL, since goapi chokes on my constant.

The much more extensive fix to goapi's type checker
in pending review in https://golang.org/cl/6742050

But I'd rather get this quick fix in first.

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

12 years agotime: clarify why timer.Stop and ticker.Stop don't close the channel
Shenghou Ma [Thu, 8 Nov 2012 15:25:48 +0000 (23:25 +0800)]
time: clarify why timer.Stop and ticker.Stop don't close the channel

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

12 years agolib9: remove unreferenced externs and getuser()
Carl Mastrangelo [Thu, 8 Nov 2012 14:39:24 +0000 (09:39 -0500)]
lib9: remove unreferenced externs and getuser()

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

12 years agoruntime: use vDSO for gettimeofday on linux/amd64
Anthony Martin [Thu, 8 Nov 2012 02:29:31 +0000 (18:29 -0800)]
runtime: use vDSO for gettimeofday on linux/amd64

Intel Core 2 Duo (2.16 GHz) running 3.6.5-1-ARCH

benchmark       old ns/op    new ns/op    delta
BenchmarkNow         1856         1034  -44.29%

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

12 years agocmd/go: say that -race flag can be used on windows/amd64
Alex Brainman [Thu, 8 Nov 2012 02:00:54 +0000 (13:00 +1100)]
cmd/go: say that -race flag can be used on windows/amd64

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

12 years agocmd/gc: warn about slice indexes larger than int in typecheck pass
Ian Lance Taylor [Thu, 8 Nov 2012 01:34:06 +0000 (17:34 -0800)]
cmd/gc: warn about slice indexes larger than int in typecheck pass

Fixes GOARCH=386 build.

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

12 years agodoc/effective_go: don't use ALL_CAPS for variable names.
Nigel Tao [Thu, 8 Nov 2012 00:55:46 +0000 (11:55 +1100)]
doc/effective_go: don't use ALL_CAPS for variable names.

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

12 years agoimage/jpeg: handle fill bytes.
Nigel Tao [Wed, 7 Nov 2012 23:36:29 +0000 (10:36 +1100)]
image/jpeg: handle fill bytes.

Fixes #4337.

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

12 years agocmd/gc: fix internal compiler error with broken structs.
Rémy Oudompheng [Wed, 7 Nov 2012 22:09:01 +0000 (23:09 +0100)]
cmd/gc: fix internal compiler error with broken structs.

Fixes #4359.

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

12 years agoarchive/tar: avoid writing ModTime that is out of range.
David Symonds [Wed, 7 Nov 2012 21:22:40 +0000 (08:22 +1100)]
archive/tar: avoid writing ModTime that is out of range.

Update #4358
Still to do: support binary numeric format in Reader.

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

12 years agocmd/6g, cmd/8g: mark used registers in indirect addressing.
Rémy Oudompheng [Wed, 7 Nov 2012 20:36:15 +0000 (21:36 +0100)]
cmd/6g, cmd/8g: mark used registers in indirect addressing.

Fixes #4094.
Fixes #4353.

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

12 years agoruntime: use runtime·callers when racefuncenter's pc is on the heap.
Rémy Oudompheng [Wed, 7 Nov 2012 20:35:21 +0000 (21:35 +0100)]
runtime: use runtime·callers when racefuncenter's pc is on the heap.

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

12 years agotest: run index test by default
Ian Lance Taylor [Wed, 7 Nov 2012 20:33:54 +0000 (12:33 -0800)]
test: run index test by default

Running this test via "bash run" uncovered three different
bugs (4344, 4348, 4353).  We need to run it by default.

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

12 years agoapi: refresh next.txt
Russ Cox [Wed, 7 Nov 2012 20:26:41 +0000 (15:26 -0500)]
api: refresh next.txt

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

12 years agocmd/gc: fix escape analysis bug
Russ Cox [Wed, 7 Nov 2012 20:15:21 +0000 (15:15 -0500)]
cmd/gc: fix escape analysis bug

The code assumed that the only choices were EscNone, EscScope, and EscHeap,
so that it makes sense to set EscScope only if the current setting is EscNone.
Now that we have the many variants of EscReturn, this logic is false, and it was
causing important EscScopes to be ignored in favor of EscReturn.

Fixes #4360.

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

12 years agoruntime/race: add Windows support
Dmitriy Vyukov [Wed, 7 Nov 2012 19:59:09 +0000 (23:59 +0400)]
runtime/race: add Windows support
This is copy of https://golang.org/cl/6810080
but sent from another account (dvyukov@gmail.com is not in CONTRIBUTORS).

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

12 years agoreflect: fix test of whether structs are identical
Ian Lance Taylor [Wed, 7 Nov 2012 19:55:35 +0000 (11:55 -0800)]
reflect: fix test of whether structs are identical

The old code worked with gc, I assume because the linker
unified identical strings, but it failed with gccgo.

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

12 years agocrypto/x509: fix DecryptPEMBlock
Roger Peppe [Wed, 7 Nov 2012 15:16:34 +0000 (15:16 +0000)]
crypto/x509: fix DecryptPEMBlock

The current implement can fail when the
block size is not a multiple of 8 bytes.
This CL makes it work, and also checks that the
data is in fact a multiple of the block size.

R=agl, agl
CC=golang-dev
https://golang.org/cl/6827058

12 years agocmd/gc: annotate local variables with unique ids for inlining
Russ Cox [Wed, 7 Nov 2012 14:59:19 +0000 (09:59 -0500)]
cmd/gc: annotate local variables with unique ids for inlining

Avoids problems with local declarations shadowing other names.
We write a more explicit form than the incoming program, so there
may be additional type annotations. For example:

        int := "hello"
        j := 2

would normally turn into

        var int string = "hello"
        var j int = 2

but the int variable shadows the int type in the second line.

This CL marks all local variables with a per-function sequence number,
so that this would instead be:

        var int·1 string = "hello"
        var j·2 int = 2

Fixes #4326.

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

12 years agocmd/gc: fix go:nointerface export comment
Russ Cox [Wed, 7 Nov 2012 14:14:21 +0000 (09:14 -0500)]
cmd/gc: fix go:nointerface export comment

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

12 years agonet: fix protocol number for IPv6 test
Mikio Hara [Wed, 7 Nov 2012 12:55:29 +0000 (21:55 +0900)]
net: fix protocol number for IPv6 test

The protocol number of ICMP for IPv6 is 58, not 1.

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

12 years agoruntime/race: lazily allocate shadow memory
Dmitriy Vyukov [Wed, 7 Nov 2012 08:48:58 +0000 (12:48 +0400)]
runtime/race: lazily allocate shadow memory
Currently race detector runtime maps shadow memory eagerly at process startup.
It works poorly on Windows, because Windows requires reservation in swap file
(especially problematic if several Go program runs at the same, each consuming GBs
of memory).
With this change race detector maps shadow memory lazily, so Go runtime must notify
about all new heap memory.
It will help with Windows port, but also eliminates scary 16TB virtual mememory
consumption in top output (which sometimes confuses some monitoring scripts).

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

12 years agocmd/gc: racewalk: instrument returnsfromheap params
Dmitriy Vyukov [Wed, 7 Nov 2012 08:10:35 +0000 (12:10 +0400)]
cmd/gc: racewalk: instrument returnsfromheap params
Fixes #4307.

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

12 years agocmd/gc: racewalk: do not double function calls
Dmitriy Vyukov [Wed, 7 Nov 2012 08:06:27 +0000 (12:06 +0400)]
cmd/gc: racewalk: do not double function calls
Current racewalk transformation looks like:
x := <-makeChan().c
\/\/\/\/\/\/\/\/\/
runtime.raceread(&makeChan().c)
x := <-makeChan().c
and so makeChan() is called twice.
With this CL the transformation looks like:
x := <-makeChan().c
\/\/\/\/\/\/\/\/\/
chan *tmp = &(makeChan().c)
raceread(&*tmp)
x := <-(*tmp)
Fixes #4245.

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

12 years agocmd/gc: refactor racewalk
Dmitriy Vyukov [Wed, 7 Nov 2012 08:01:31 +0000 (12:01 +0400)]
cmd/gc: refactor racewalk
It is refactoring towards generic walk
+ it handles mode nodes.
Partially fixes 4228 issue.

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

12 years agonet: implement IPv6 support for windows
Alex Brainman [Wed, 7 Nov 2012 05:58:20 +0000 (16:58 +1100)]
net: implement IPv6 support for windows

Thank you zhoumichaely for original CL 5175042.

Fixes #1740.
Fixes #2315.

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

12 years agocrypto/sha1: Make sha-1 do block mixup in place
Carl Mastrangelo [Wed, 7 Nov 2012 02:41:02 +0000 (13:41 +1100)]
crypto/sha1: Make sha-1 do block mixup in place

Benchmarks:

benchmark              old ns/op    new ns/op    delta
BenchmarkHash8Bytes          762          674  -11.55%
BenchmarkHash1K             8791         7375  -16.11%
BenchmarkHash8K            65094        54881  -15.69%

benchmark               old MB/s     new MB/s  speedup
BenchmarkHash8Bytes        10.50        11.86    1.13x
BenchmarkHash1K           116.48       138.84    1.19x
BenchmarkHash8K           125.85       149.27    1.19x

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

12 years agoCONTRIBUTORS: Add Carl Mastrangelo (Google CLA).
Ian Lance Taylor [Tue, 6 Nov 2012 23:58:18 +0000 (15:58 -0800)]
CONTRIBUTORS: Add Carl Mastrangelo (Google CLA).

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

12 years agocmd/6g: fix use of large integers as indexes or array sizes.
Rémy Oudompheng [Tue, 6 Nov 2012 21:53:57 +0000 (22:53 +0100)]
cmd/6g: fix use of large integers as indexes or array sizes.

A check for smallintconst was missing before generating the
comparisons.

Fixes #4348.

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

12 years agocmd/go: invoke gcc -print-libgcc-file-name only once
Shenghou Ma [Tue, 6 Nov 2012 21:09:54 +0000 (05:09 +0800)]
cmd/go: invoke gcc -print-libgcc-file-name only once

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

12 years agosort: fix comment for various Search routines
Shenghou Ma [Tue, 6 Nov 2012 21:07:46 +0000 (05:07 +0800)]
sort: fix comment for various Search routines
Fixes #4205 (again).

R=r, 0xjnml
CC=golang-dev
https://golang.org/cl/6819082

12 years agonet/rpc: give hint to pass a pointer to Register
Shenghou Ma [Tue, 6 Nov 2012 21:03:16 +0000 (05:03 +0800)]
net/rpc: give hint to pass a pointer to Register
Fixes #4325.

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

12 years agocmd/godoc: initialize filesystem and metadata for -url
Péter Surányi [Tue, 6 Nov 2012 20:59:21 +0000 (04:59 +0800)]
cmd/godoc: initialize filesystem and metadata for -url

Unlike when using -http, godoc -url didn't initialize the "filesystem"
and metadata that are used when generating responses. This CL adds this
initialization, so that -url provides the same results as an HTTP
request when using -http.

Fixes #4335.

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

12 years agocmd/gc, runtime: avoid unnecessary copy on type assertion.
Daniel Morsing [Tue, 6 Nov 2012 19:40:40 +0000 (20:40 +0100)]
cmd/gc, runtime: avoid unnecessary copy on type assertion.

When the first result of a type assertion is blank, the compiler would still copy out a potentially large non-interface type.

Fixes #1021.

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

12 years agotest: fix index.go to pass with recent index checks
Ian Lance Taylor [Tue, 6 Nov 2012 19:38:16 +0000 (11:38 -0800)]
test: fix index.go to pass with recent index checks

The compiler now gives an error for out of bounds constant
indexes for arrays, and for negative constant indexes for both
arrays and slices.

With this change the index.go test passes if CLs 6815085,
6815088, and 6812089 are committed.

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

12 years agocmd/gc: don't require that slice index constants be small ints
Ian Lance Taylor [Tue, 6 Nov 2012 19:36:59 +0000 (11:36 -0800)]
cmd/gc: don't require that slice index constants be small ints

The test for this is test/index.go, which is not run by
default.

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

12 years agocmd/gc: check for array bounds overflow in slice expression
Ian Lance Taylor [Tue, 6 Nov 2012 19:35:58 +0000 (11:35 -0800)]
cmd/gc: check for array bounds overflow in slice expression

The test for this is test/index.go, which is not run by
default.  That test does not currently pass even after this is
applied, due to issue 4348.

Fixes #4344.

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

12 years agoruntime: mark race instrumentation callbacks as nosplitstack
Dmitriy Vyukov [Tue, 6 Nov 2012 16:54:22 +0000 (20:54 +0400)]
runtime: mark race instrumentation callbacks as nosplitstack
It speedups the race detector somewhat, but also prevents
getcallerpc() from obtaining lessstack().

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

12 years agocmd/go: use correct paths with race detector
Dmitriy Vyukov [Tue, 6 Nov 2012 16:11:49 +0000 (20:11 +0400)]
cmd/go: use correct paths with race detector
Currently the build fails with -race if a package in GOPATH
imports another package in GOPATH.

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

12 years agoruntime: fix deadlock in parallel for test
Dmitriy Vyukov [Tue, 6 Nov 2012 16:11:16 +0000 (20:11 +0400)]
runtime: fix deadlock in parallel for test
The deadlock occurs when another goroutine requests GC
during the test. When wait=true the test expects physical parallelism,
that is, that P goroutines are all active at the same time.
If GC is requested, then part of the goroutines are not scheduled,
so other goroutines deadlock.
With wait=false, goroutines finish parallel for w/o waiting for all
other goroutines.
Fixes #3954.

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

12 years agoruntime: disable parallel for tests under race detector.
Dmitriy Vyukov [Tue, 6 Nov 2012 08:09:40 +0000 (12:09 +0400)]
runtime: disable parallel for tests under race detector.
The race detector does not understand ParFor synchronization, because it's implemented in C.
If run with -cpu=2 currently race detector says:
 WARNING: DATA RACE
 Read by goroutine 5:
  runtime_test.TestParForParallel()
      src/pkg/runtime/parfor_test.go:118 +0x2e0
  testing.tRunner()
      src/pkg/testing/testing.go:301 +0x8f
 Previous write by goroutine 6:
  runtime_test.func·024()
      src/pkg/runtime/parfor_test.go:111 +0x52

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

12 years agoA+C: Péter Surányi (individual CLA)
Andrew Gerrand [Mon, 5 Nov 2012 21:48:27 +0000 (22:48 +0100)]
A+C: Péter Surányi (individual CLA)

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

12 years agocmd/godoc: use normal gofmt printer settings for playground fmt
Andrew Gerrand [Mon, 5 Nov 2012 21:46:28 +0000 (22:46 +0100)]
cmd/godoc: use normal gofmt printer settings for playground fmt

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

12 years agonet: fix timeout slack calculation
Shenghou Ma [Sun, 4 Nov 2012 10:07:59 +0000 (18:07 +0800)]
net: fix timeout slack calculation

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

12 years agocmd/5g: improve shift code generation
Dave Cheney [Sun, 4 Nov 2012 09:06:37 +0000 (20:06 +1100)]
cmd/5g: improve shift code generation

This CL is a backport of 6012049 which improves code
generation for shift operations.

benchmark       old ns/op    new ns/op    delta
BenchmarkLSL            9            5  -49.67%
BenchmarkLSR            9            4  -50.00%

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

12 years agonet: do not test TestReadWriteDeadline timeout upper bound during short test
Alex Brainman [Sun, 4 Nov 2012 01:41:49 +0000 (12:41 +1100)]
net: do not test TestReadWriteDeadline timeout upper bound during short test

It also increases timeout deltas to allow for longer wait.
Also disables this test on plan9.

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

12 years agosort: make return value for 'not found' clearer in docs
Rob Pike [Fri, 2 Nov 2012 23:17:34 +0000 (16:17 -0700)]
sort: make return value for 'not found' clearer in docs
It was well-defined but easy to miss that the return value for
"not found" is len(input) not -1 as many expect.

Fixes #4205.

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

12 years agocmd/gc: instrument blocks for race detection.
Rémy Oudompheng [Fri, 2 Nov 2012 23:11:06 +0000 (00:11 +0100)]
cmd/gc: instrument blocks for race detection.

It happens that blocks are used for function calls in a
quite low-level way so they cannot be instrumented as
usual.

Blocks are also used for inlined functions.

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

12 years agonet/http: fix data race in test
Dmitriy Vyukov [Fri, 2 Nov 2012 20:26:36 +0000 (00:26 +0400)]
net/http: fix data race in test
The issue is that server still sends body,
when client closes the fd.
Fixes #4329.

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

12 years agoruntime/cgo, go/build: cgo support for FreeBSD/ARM
Shenghou Ma [Fri, 2 Nov 2012 18:22:37 +0000 (02:22 +0800)]
runtime/cgo, go/build: cgo support for FreeBSD/ARM
This is the last CL for FreeBSD/ARM support.
Also update cmd/ld/doc.go for 5l support of -Hfreebsd.

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

12 years agomisc/benchcmp: show memory statistics, when available
Jeff R. Allen [Fri, 2 Nov 2012 18:13:51 +0000 (02:13 +0800)]
misc/benchcmp: show memory statistics, when available

R=minux.ma, dave, extraterrestrial.neighbour, rsc
CC=golang-dev
https://golang.org/cl/6587069

12 years agonet: add missing locking in windows Shutdown
Alex Brainman [Fri, 2 Nov 2012 09:46:47 +0000 (20:46 +1100)]
net: add missing locking in windows Shutdown

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

12 years agocmd/5g, cmd/6g: fix out of registers with array indexing.
Rémy Oudompheng [Fri, 2 Nov 2012 06:50:59 +0000 (07:50 +0100)]
cmd/5g, cmd/6g: fix out of registers with array indexing.

Compiling expressions like:
    s[s[s[s[s[s[s[s[s[s[s[s[i]]]]]]]]]]]]
make 5g and 6g run out of registers. Such expressions can arise
if a slice is used to represent a permutation and the user wants
to iterate it.

This is due to the usual problem of allocating registers before
going down the expression tree, instead of allocating them in a
postfix way.

The functions cgenr and agenr (that generate a value to a newly
allocated register instead of an existing location), are either
introduced or modified when they already existed to allocate
the new register as late as possible, and sudoaddable is disabled
for OINDEX nodes so that igen/agenr is used instead.

Update #4207.

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

12 years agoimage/png: update palette out-of-bounds comment.
Nigel Tao [Fri, 2 Nov 2012 06:20:19 +0000 (17:20 +1100)]
image/png: update palette out-of-bounds comment.

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

12 years agospec: we're now at Unicode 6.2.0
Oling Cat [Fri, 2 Nov 2012 05:57:01 +0000 (22:57 -0700)]
spec: we're now at Unicode 6.2.0

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

12 years agocmd/gc, cmd/ld: struct field tracking
Russ Cox [Fri, 2 Nov 2012 04:17:21 +0000 (00:17 -0400)]
cmd/gc, cmd/ld: struct field tracking

This is an experiment in static analysis of Go programs
to understand which struct fields a program might use.
It is not part of the Go language specification, it must
be enabled explicitly when building the toolchain,
and it may be removed at any time.

After building the toolchain with GOEXPERIMENT=fieldtrack,
a specific field can be marked for tracking by including
`go:"track"` in the field tag:

        package pkg

        type T struct {
                F int `go:"track"`
                G int // untracked
        }

To simplify usage, only named struct types can have
tracked fields, and only exported fields can be tracked.

The implementation works by making each function begin
with a sequence of no-op USEFIELD instructions declaring
which tracked fields are accessed by a specific function.
After the linker's dead code elimination removes unused
functions, the fields referred to by the remaining
USEFIELD instructions are the ones reported as used by
the binary.

The -k option to the linker specifies the fully qualified
symbol name (such as my/pkg.list) of a string variable that
should be initialized with the field tracking information
for the program. The field tracking string is a sequence
of lines, each terminated by a \n and describing a single
tracked field referred to by the program. Each line is made
up of one or more tab-separated fields. The first field is
the name of the tracked field, fully qualified, as in
"my/pkg.T.F". Subsequent fields give a shortest path of
reverse references from that field to a global variable or
function, corresponding to one way in which the program
might reach that field.

A common source of false positives in field tracking is
types with large method sets, because a reference to the
type descriptor carries with it references to all methods.
To address this problem, the CL also introduces a comment
annotation

        //go:nointerface

that marks an upcoming method declaration as unavailable
for use in satisfying interfaces, both statically and
dynamically. Such a method is also invisible to package
reflect.

Again, all of this is disabled by default. It only turns on
if you have GOEXPERIMENT=fieldtrack set during make.bash.

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

12 years agonet: use better error messages on windows
Alex Brainman [Fri, 2 Nov 2012 00:07:22 +0000 (11:07 +1100)]
net: use better error messages on windows

Fixes #4320.

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

12 years agogo/ast: document use of Data field for method objects
Robert Griesemer [Thu, 1 Nov 2012 23:27:43 +0000 (16:27 -0700)]
go/ast: document use of Data field for method objects

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

12 years agoexp/types: move exp/types/staging -> exp/types
Robert Griesemer [Thu, 1 Nov 2012 22:38:17 +0000 (15:38 -0700)]
exp/types: move exp/types/staging -> exp/types

- removes exp/types/staging
- the only code change is in exp/gotype/gotype.go

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

12 years agoexp/types, exp/gotype: remove exp/types
Robert Griesemer [Thu, 1 Nov 2012 22:25:51 +0000 (15:25 -0700)]
exp/types, exp/gotype: remove exp/types

The only code change is in exp/gotype/gotype.go.
The latest reviewed version of exp/types is now
exp/types/staging.

First step toward replacing exp/types with
exp/types/staging.

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

12 years agomisc/cgo/test: changes to pass when using gccgo
Ian Lance Taylor [Thu, 1 Nov 2012 20:54:09 +0000 (13:54 -0700)]
misc/cgo/test: changes to pass when using gccgo

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

12 years agocrypto: use better hash benchmarks
Eric Roshan-Eisner [Thu, 1 Nov 2012 20:21:18 +0000 (16:21 -0400)]
crypto: use better hash benchmarks

Labels the existing benchmark as stream, and add benchmarks that
compute the checksum.

R=golang-dev, agl
CC=golang-dev
https://golang.org/cl/6814060

12 years agonet: fix race in TestReadWriteDeadline.
Rémy Oudompheng [Thu, 1 Nov 2012 19:52:30 +0000 (20:52 +0100)]
net: fix race in TestReadWriteDeadline.

Discovered by adding OBLOCK support to race
instrumentation.

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

12 years agoencoding/binary: skip blank fields when (en/de)coding structs
Robert Griesemer [Thu, 1 Nov 2012 19:39:20 +0000 (12:39 -0700)]
encoding/binary: skip blank fields when (en/de)coding structs

- minor unrelated cleanups
- performance impact in the noise

benchmark                       old ns/op    new ns/op    delta
BenchmarkReadSlice1000Int32s        83462        83346   -0.14%
BenchmarkReadStruct                  4141         4247   +2.56%
BenchmarkReadInts                    1588         1586   -0.13%
BenchmarkWriteInts                   1550         1489   -3.94%
BenchmarkPutUvarint32                  39           39   +1.02%
BenchmarkPutUvarint64                 142          144   +1.41%

benchmark                        old MB/s     new MB/s  speedup
BenchmarkReadSlice1000Int32s        47.93        47.99    1.00x
BenchmarkReadStruct                 16.90        16.48    0.98x
BenchmarkReadInts                   18.89        18.91    1.00x
BenchmarkWriteInts                  19.35        20.15    1.04x
BenchmarkPutUvarint32              101.90       100.82    0.99x
BenchmarkPutUvarint64               56.11        55.45    0.99x

Fixes #4185.

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

12 years agobuild: do not run race tests with cgo disabled
Russ Cox [Thu, 1 Nov 2012 19:13:00 +0000 (15:13 -0400)]
build: do not run race tests with cgo disabled

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

12 years agocmd/gc: fix build
Dmitriy Vyukov [Thu, 1 Nov 2012 18:59:53 +0000 (22:59 +0400)]
cmd/gc: fix build

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

12 years agocmd/gc: racewalk: fix a bunch of minor issues
Dmitriy Vyukov [Thu, 1 Nov 2012 18:56:04 +0000 (22:56 +0400)]
cmd/gc: racewalk: fix a bunch of minor issues
1. Prepend racefuncenter() to fn->enter -- fn->enter can contain new() calls,
and we want them to be in the scope of the function.
2. Dump fn->enter and fn->exit.
3. Add TODO that OTYPESW expression can contain interesting memory accesses.
4. Ignore only _ names instead of all names starting with _.

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

12 years agosyscall: add {Get,Set,List,Remove}xattr on Linux.
Han-Wen Nienhuys [Thu, 1 Nov 2012 18:49:38 +0000 (14:49 -0400)]
syscall: add {Get,Set,List,Remove}xattr on Linux.

R=golang-dev, minux.ma, fullung, dave, rsc, hanwenn
CC=golang-dev
https://golang.org/cl/6350074

12 years agocmd/gc, runtime: pass PC directly to racefuncenter.
Rémy Oudompheng [Thu, 1 Nov 2012 18:43:29 +0000 (19:43 +0100)]
cmd/gc, runtime: pass PC directly to racefuncenter.

go test -race -run none -bench . encoding/json
benchmark                      old ns/op    new ns/op    delta
BenchmarkCodeEncoder          3207689000   1716149000  -46.50%
BenchmarkCodeMarshal          3206761000   1715677000  -46.50%
BenchmarkCodeDecoder          8647304000   4482709000  -48.16%
BenchmarkCodeUnmarshal        8032217000   3451248000  -57.03%
BenchmarkCodeUnmarshalReuse   8016722000   3480502000  -56.58%
BenchmarkSkipValue           10340453000   4560313000  -55.90%

benchmark                       old MB/s     new MB/s  speedup
BenchmarkCodeEncoder                0.60         1.13    1.88x
BenchmarkCodeMarshal                0.61         1.13    1.85x
BenchmarkCodeDecoder                0.22         0.43    1.95x
BenchmarkCodeUnmarshal              0.24         0.56    2.33x
BenchmarkCodeUnmarshalReuse         0.24         0.56    2.33x
BenchmarkSkipValue                  0.19         0.44    2.32x

Fixes #4248.

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

12 years agoexp/types/staging: filling in more blanks
Robert Griesemer [Thu, 1 Nov 2012 18:23:27 +0000 (11:23 -0700)]
exp/types/staging: filling in more blanks

- simplified assignment checking by removing duplicate code
- implemented field lookup (methods, structs, embedded fields)
- importing methods (not just parsing them)
- type-checking functions and methods
- typechecking more statements (inc/dec, select, return)
- tracing support for easier debugging
- handling nil more correctly (comparisons)
- initial support for [...]T{} arrays
- initial support for method expressions
- lots of bug fixes

All packages under pkg/go as well as pkg/exp/types typecheck
now with pkg/exp/gotype applied to them; i.e., a significant
amount of typechecking works now (several statements are not
implemented yet, but handling statements is almost trivial in
comparison with typechecking expressions).

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

12 years agocmd/cgo: improve gccgo support
Ian Lance Taylor [Thu, 1 Nov 2012 18:21:30 +0000 (11:21 -0700)]
cmd/cgo: improve gccgo support

Use wrapper functions to tell scheduler what we are doing.

With this patch, and a separate patch to the go tool, all the
cgo tests pass with gccgo.

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

12 years agocmd/go: fixes to gccgo support
Ian Lance Taylor [Thu, 1 Nov 2012 18:13:50 +0000 (11:13 -0700)]
cmd/go: fixes to gccgo support

* Use -fgo-pkgpath and -gccgopkgpath rather than -fgo-prefix
  and -gccgoprefix.
* Define GOPKGPATH when compiling .c or .s files for gccgo.
* Use -fgo-relative-import-path.
* Produce .o files for gccgo, not .[568] files.
* Pass -E when linking if using cgo.

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

12 years agogo/build: support compiler as build constraint
Ian Lance Taylor [Thu, 1 Nov 2012 18:12:15 +0000 (11:12 -0700)]
go/build: support compiler as build constraint

This supports writing different .c/.s code when using gccgo.

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

12 years agocmd/gc: racewalk: fix instrumentation of ninit lists
Dmitriy Vyukov [Thu, 1 Nov 2012 18:11:12 +0000 (22:11 +0400)]
cmd/gc: racewalk: fix instrumentation of ninit lists
The idea is to (1) process ninit of all nodes,
and (2) put instrumentation of ninit into the nodes themselves (not the top-level statement ninit).
Fixes #4304.

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

12 years agocmd/gc: fix incomplete export data when inlining with local variables.
Rémy Oudompheng [Thu, 1 Nov 2012 18:06:52 +0000 (19:06 +0100)]
cmd/gc: fix incomplete export data when inlining with local variables.

When local declarations needed unexported types, these could
be missing in the export data.

Fixes build with -gcflags -lll, except for exp/gotype.

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

12 years agorun.bash: add sanity test for race detector
Dmitriy Vyukov [Thu, 1 Nov 2012 18:02:52 +0000 (22:02 +0400)]
run.bash: add sanity test for race detector

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

12 years agocmd/gc: fix inlining bug with local variables.
Rémy Oudompheng [Thu, 1 Nov 2012 17:59:32 +0000 (18:59 +0100)]
cmd/gc: fix inlining bug with local variables.

Fixes #4323.

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

12 years agocompress/flate: shrink decompressor struct for better performance
Ryan Hitchman [Thu, 1 Nov 2012 17:57:24 +0000 (13:57 -0400)]
compress/flate: shrink decompressor struct for better performance

Helps with issue 2703.

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

12 years agocmd/gc: do simple bounds checking of constant indices/slices in typecheck.
Daniel Morsing [Thu, 1 Nov 2012 17:45:19 +0000 (18:45 +0100)]
cmd/gc: do simple bounds checking of constant indices/slices in typecheck.

This should make the compiler emit errors specific to the bounds checking instead of overflow errors on the underlying types.

Updates #4232.

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

12 years agospec: clarify returns, defer statements, and panics
Robert Griesemer [Thu, 1 Nov 2012 17:13:48 +0000 (10:13 -0700)]
spec: clarify returns, defer statements, and panics

This is an attempt at making the interaction between
these three constructs clearer. Specifically:

- return statements terminate a function, execute deferred
  functions, return to the caller, and then execution
  continues after the call

- panic calls terminate a function, execute deferred
  functions, return to the caller, and then re-panic

- deferred functions are executed before a function _returns_
  to its caller

The hope is that with this change it becomes clear when a
deferred function is executed (when a function returns),
and when it is not (when a program exits).

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

12 years agoruntime: move Itab to runtime.h
Jan Ziak [Thu, 1 Nov 2012 17:13:20 +0000 (13:13 -0400)]
runtime: move Itab to runtime.h

The 'type' field of Itab will be used by the garbage collector.

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

12 years agonet: fix a bad cast in dnsmsg.go
Alexey Borzenkov [Thu, 1 Nov 2012 16:57:44 +0000 (12:57 -0400)]
net: fix a bad cast in dnsmsg.go

Incorrect cast was causing panics when
calling String() on dnsMsg with dnsRR_A
answers.

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

12 years agoruntime: add memorydump() debugging function
Jan Ziak [Thu, 1 Nov 2012 16:56:25 +0000 (12:56 -0400)]
runtime: add memorydump() debugging function

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

12 years agocmd/gc: avoid %#x of 0
Russ Cox [Thu, 1 Nov 2012 16:55:21 +0000 (12:55 -0400)]
cmd/gc: avoid %#x of 0

Plan 9 and Go's lib9/fmt disagree on whether %#x includes the 0x prefix
when printing 0, because ANSI C gave bad advice long ago.

Avoiding that case makes binaries compiled on different systems compatible.

R=ken2
CC=akumar, golang-dev
https://golang.org/cl/6814066

12 years agowebsite: remove floating topbar
Andrew Gerrand [Thu, 1 Nov 2012 16:30:49 +0000 (03:30 +1100)]
website: remove floating topbar

This caused more problems than it was worth.

Fixes #4301.
Fixes #4317.

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

12 years agocmd/5g, cmd/6g, cmd/8g: remove width check for componentgen.
Rémy Oudompheng [Thu, 1 Nov 2012 13:36:08 +0000 (14:36 +0100)]
cmd/5g, cmd/6g, cmd/8g: remove width check for componentgen.

The move to 64-bit ints in 6g made componentgen ineffective.
In componentgen, the code already selects which values it can handle.

On amd64:
benchmark                 old ns/op    new ns/op    delta
BenchmarkBinaryTree17    9477970000   9582314000   +1.10%
BenchmarkFannkuch11      5928750000   5255080000  -11.36%
BenchmarkGobDecode         37103040     31451120  -15.23%
BenchmarkGobEncode         16042490     16844730   +5.00%
BenchmarkGzip             811337400    741373600   -8.62%
BenchmarkGunzip           197928700    192844500   -2.57%
BenchmarkJSONEncode       224164100    140064200  -37.52%
BenchmarkJSONDecode       258346800    231829000  -10.26%
BenchmarkMandelbrot200      7561780      7601615   +0.53%
BenchmarkParse             12970340     11624360  -10.38%
BenchmarkRevcomp         1969917000   1699137000  -13.75%
BenchmarkTemplate         296182000    263117400  -11.16%

R=nigeltao, dave, daniel.morsing
CC=golang-dev
https://golang.org/cl/6821052

12 years agorun.bat: make output consistent
Alex Brainman [Thu, 1 Nov 2012 02:04:08 +0000 (13:04 +1100)]
run.bat: make output consistent

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

12 years agoall: clear execute bit
Mikio Hara [Thu, 1 Nov 2012 01:04:42 +0000 (10:04 +0900)]
all: clear execute bit

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

12 years agoimage/png: degrade gracefully for palette index values that aren't
Nigel Tao [Thu, 1 Nov 2012 00:46:06 +0000 (11:46 +1100)]
image/png: degrade gracefully for palette index values that aren't
defined by the PLTE chunk. Such pixels decode to opaque black,
which matches what libpng does.

Fixes #4319.

On my reading, the PNG spec isn't clear whether palette index values
outside of those defined by the PLTE chunk is an error, and if not,
what to do.

Libpng 1.5.3 falls back to opaque black. png_set_PLTE says:

/* Changed in libpng-1.2.1 to allocate PNG_MAX_PALETTE_LENGTH instead
 * of num_palette entries, in case of an invalid PNG file that has
 * too-large sample values.
 */
png_ptr->palette = (png_colorp)png_calloc(png_ptr,
        PNG_MAX_PALETTE_LENGTH * png_sizeof(png_color));

ImageMagick 6.5.7 returns an error:

$ convert -version
Version: ImageMagick 6.5.7-8 2012-08-17 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC
Features: OpenMP
$ convert packetloss.png x.bmp
convert: Invalid colormap index `packetloss.png' @ image.c/SyncImage/3849.

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

12 years agoencoding/json: clarify correct usage of struct tags in associated article.
Dan Callahan [Wed, 31 Oct 2012 22:52:27 +0000 (15:52 -0700)]
encoding/json: clarify correct usage of struct tags in associated article.

Fixes #4297.

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

12 years agoA+C: adding Dan Callahan (individual CLA)
Robert Griesemer [Wed, 31 Oct 2012 22:52:15 +0000 (15:52 -0700)]
A+C: adding Dan Callahan (individual CLA)

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

12 years agospec: slight wording change to remove a formal contradiction
Robert Griesemer [Wed, 31 Oct 2012 22:07:25 +0000 (15:07 -0700)]
spec: slight wording change to remove a formal contradiction

Fixes #4324.

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

12 years agocrypto/cipher: add examples
Adam Langley [Wed, 31 Oct 2012 20:37:26 +0000 (16:37 -0400)]
crypto/cipher: add examples

Fixes #1390.

R=golang-dev, minux.ma, adg, agl
CC=golang-dev
https://golang.org/cl/6631044

12 years agogofmt: simplify slices of the form s[a : len(s)] to s[a:]
Robert Griesemer [Wed, 31 Oct 2012 18:48:55 +0000 (11:48 -0700)]
gofmt: simplify slices of the form s[a : len(s)] to s[a:]

Fixes #4314.

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