]> Cypherpunks repositories - gostls13.git/log
gostls13.git
11 years agomisc/cgo/test: skip test for issue 3250, the runtime isn't ready yet.
Shenghou Ma [Mon, 15 Jul 2013 06:37:36 +0000 (14:37 +0800)]
misc/cgo/test: skip test for issue 3250, the runtime isn't ready yet.
see issue 5885.

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

11 years agoimage/gif: add writer implementation
Andrew Bonventre [Mon, 15 Jul 2013 00:57:01 +0000 (10:57 +1000)]
image/gif: add writer implementation

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

11 years agodist: fix postinstall script for Darwin
Alexandre Normand [Mon, 15 Jul 2013 00:52:38 +0000 (10:52 +1000)]
dist: fix postinstall script for Darwin

The postinstall script causes the installation to fail because the last
step that copies files for Xcode is broken. Two details can cause the
command to fail:
  1. The XCODE_MISC_DIR value has a space. Without quotes in the cp
     command, cp will just complain that this is an invalid syntax.
  2. The source of the cp is a directory with two subdirectories.
     We actually want the files for either Xcode 3 or Xcode 4 to be copied.
     Using xcodebuild -version, we check for the Xcode version and
     select which of xcode/3/* or xcode/4/* should be the source
     of the copy.

Fixes #5874.

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

11 years agoA+C: Alexandre Normand (individual CLA)
Andrew Gerrand [Mon, 15 Jul 2013 00:52:21 +0000 (10:52 +1000)]
A+C: Alexandre Normand (individual CLA)

Generated by addca.

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

11 years agoA+C: Andrew Bonventre (individual CLA).
Nigel Tao [Mon, 15 Jul 2013 00:45:53 +0000 (10:45 +1000)]
A+C: Andrew Bonventre (individual CLA).

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

11 years agolog/syslog: fix typo: change Wanring to Warning
Joseph Holsten [Sun, 14 Jul 2013 02:56:11 +0000 (12:56 +1000)]
log/syslog: fix typo: change Wanring to Warning

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

11 years agoA+C: Joseph Holsten (individual CLA)
Rob Pike [Sun, 14 Jul 2013 02:54:45 +0000 (12:54 +1000)]
A+C: Joseph Holsten (individual CLA)

Generated by addca.

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

11 years agocmd/6l, cmd/8l: use one-byte XCHG forms when possible
Russ Cox [Sat, 13 Jul 2013 00:58:38 +0000 (20:58 -0400)]
cmd/6l, cmd/8l: use one-byte XCHG forms when possible

Pointed out by khr.

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

11 years agoencoding/json: add more tests for UTF-8 coercion
Russ Cox [Sat, 13 Jul 2013 00:40:50 +0000 (20:40 -0400)]
encoding/json: add more tests for UTF-8 coercion

Suggested by Rob in CL 11211045, but the mail arrived
moments after hg submit completed.

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

11 years agocmd/go, testing: streamline direct use of test binaries
Russ Cox [Sat, 13 Jul 2013 00:40:30 +0000 (20:40 -0400)]
cmd/go, testing: streamline direct use of test binaries

Before:

        $ go test -c -cover fmt
        $ ./fmt.test -test.covermode=set
        PASS
        coverage: 65.1% of statements in strconv
        $

After:

        $ go test -c -cover fmt
        $ ./fmt.test
        PASS
        coverage: 65.1% of statements in strconv
        $

In addition to being cumbersome, the old flag didn't make sense:
the cover mode cannot be changed after the binary has been built.

Another useful effect of this CL is that if you happen to do

        $ go test -c -covermode=atomic fmt

and then forget you did that and run benchmarks,
the final line of the output (the coverage summary) reminds you
that you are benchmarking with coverage enabled, which might
not be what you want.

        $ ./fmt.test -test.bench .
        PASS
        BenchmarkSprintfEmpty 10000000        217 ns/op
        BenchmarkSprintfString  2000000        755 ns/op
        BenchmarkSprintfInt  2000000        774 ns/op
        BenchmarkSprintfIntInt  1000000       1363 ns/op
        BenchmarkSprintfPrefixedInt  1000000       1501 ns/op
        BenchmarkSprintfFloat  1000000       1257 ns/op
        BenchmarkManyArgs   500000       5346 ns/op
        BenchmarkScanInts     1000    2562402 ns/op
        BenchmarkScanRecursiveInt      500    3189457 ns/op
        coverage: 91.4% of statements
        $

As part of passing the new mode setting in via _testmain.go, merge
the two registration mechanisms into one extensible mechanism
(a struct).

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

11 years agoundo CL 11161044 / ba455262a9db
Russ Cox [Fri, 12 Jul 2013 21:42:01 +0000 (17:42 -0400)]
undo CL 11161044 / ba455262a9db

I want to think more carefully about this.

We put this in because Marshal encoded named []byte but Unmarshal rejected them.
And we noticed that Marshal's behavior was undocumented so we documented it.
But I am starting to think the docs and Unmarshal were correct and Marshal's
behavior was the problem.

Rolling back to give us more time to think.

««« original CL description
json: unmarshal types that are byte slices.

The json package cheerfully would marshal

        type S struct {
                IP net.IP
        }

but would give an error when unmarshalling.  This change allows any
type whose concrete type is a byte slice to be unmarshalled from a
string.

Fixes #5086.

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

»»»

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

11 years agoencoding/json: coerce invalid UTF-8 to valid UTF-8 during Marshal
Russ Cox [Fri, 12 Jul 2013 21:37:10 +0000 (17:37 -0400)]
encoding/json: coerce invalid UTF-8 to valid UTF-8 during Marshal

In practice, rejecting an entire structure due to a single invalid byte
in a string is just too picky, and too hard to track down.
Be consistent with the bulk of the standard library by converting
invalid UTF-8 into UTF-8 with replacement runes.

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

11 years agocmd/dist: allow assembly code to use enumerated constants.
Keith Randall [Fri, 12 Jul 2013 19:24:57 +0000 (12:24 -0700)]
cmd/dist: allow assembly code to use enumerated constants.

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

11 years agocmd/5a, cmd/6a, cmd/8a: fix flag parsing
Russ Cox [Fri, 12 Jul 2013 18:23:36 +0000 (14:23 -0400)]
cmd/5a, cmd/6a, cmd/8a: fix flag parsing

go tool 6a -$(unicode fffd) was crashing.

Fixes #5878.

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

11 years agorun.bash: enlarge timeout of runtime tests
Shenghou Ma [Fri, 12 Jul 2013 18:00:07 +0000 (02:00 +0800)]
run.bash: enlarge timeout of runtime tests
Recently addition to runtime test makes it take very close to 720s
of timeout limit on the netbsd-arm-qemu builder.

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

11 years agocmd/5g, cmd/6g, cmd/8g: fix line number of caller of deferred func
Russ Cox [Fri, 12 Jul 2013 17:47:55 +0000 (13:47 -0400)]
cmd/5g, cmd/6g, cmd/8g: fix line number of caller of deferred func

Deferred functions are not run by a call instruction. They are run by
the runtime editing registers to make the call start with a caller PC
returning to a
        CALL deferreturn
instruction.

That instruction has always had the line number of the function's
closing brace, but that instruction's line number is irrelevant.
Stack traces show the line number of the instruction before the
return PC, because normally that's what started the call. Not so here.
The instruction before the CALL deferreturn could be almost anywhere
in the function; it's unrelated and its line number is incorrect to show.

Fix the line number by inserting a true hardware no-op with the right
line number before the returned-to CALL instruction. That is, the deferred
calls now appear to start with a caller PC returning to the second instruction
in this sequence:
        NOP
        CALL deferreturn

The traceback will show the line number of the NOP, which we've set
to be the line number of the function's closing brace.

The NOP here is not the usual pseudo-instruction, which would be
elided by the linker. Instead it is the real hardware instruction:
XCHG AX, AX on 386 and amd64, and AND.EQ R0, R0, R0 on ARM.

Fixes #5856.

R=ken2, ken
CC=golang-dev
https://golang.org/cl/11223043

11 years agocmd/ld: fix large stack split for preempt check
Russ Cox [Fri, 12 Jul 2013 16:12:56 +0000 (12:12 -0400)]
cmd/ld: fix large stack split for preempt check

If the stack frame size is larger than the known-unmapped region at the
bottom of the address space, then the stack split prologue cannot use the usual
condition:

        SP - size >= stackguard

because SP - size may wrap around to a very large number.
Instead, if the stack frame is large, the prologue tests:

        SP - stackguard >= size

(This ends up being a few instructions more expensive, so we don't do it always.)

Preemption requests register by setting stackguard to a very large value, so
that the first test (SP - size >= stackguard) cannot possibly succeed.
Unfortunately, that same very large value causes a wraparound in the
second test (SP - stackguard >= size), making it succeed incorrectly.

To avoid *that* wraparound, we have to amend the test:

        stackguard != StackPreempt && SP - stackguard >= size

This test is only used for functions with large frames, which essentially
always split the stack, so the cost of the few instructions is noise.

This CL and CL 11085043 together fix the known issues with preemption,
at the beginning of a function, so we will be able to try turning it on again.

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

11 years agocmd/go, testing: remove redundant "for pkg" in coverage message
Russ Cox [Fri, 12 Jul 2013 11:34:16 +0000 (07:34 -0400)]
cmd/go, testing: remove redundant "for pkg" in coverage message

This is a transcript before this change. I've capitalized the text being removed.
Note that it is always near another line that already says fmt, marked with <<<

$ cd $GOROOT/src/pkg/fmt

$ go test -cover
PASS
coverage FOR FMT: 91.3% of statements
ok   fmt 0.040s <<<

$ go test -coverpkg strconv
PASS
coverage FOR FMT: 64.9% of statements in strconv
ok   fmt 0.039s <<<

$ go test -cover -c
$ ./fmt.test -test.covermode=set <<<
PASS
coverage FOR FMT: 91.3% of statements

$ go test -coverpkg strconv -c
$ ./fmt.test -test.covermode=set <<<
PASS
coverage FOR FMT: 64.9% of statements in strconv

That the summary printed by 'go test [options] fmt' is unchanged:

$ go test -cover fmt
ok   fmt 0.040s coverage: 91.3% of statements

$ go test -coverpkg strconv fmt
ok   fmt 0.038s coverage: 64.9% of statements in strconv

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

11 years agomisc/cgo/test: relax the threshold in test3250.
Shenghou Ma [Fri, 12 Jul 2013 06:13:59 +0000 (14:13 +0800)]
misc/cgo/test: relax the threshold in test3250.
Fixes build for some slow FreeBSD/NetBSD/Darwin builder.

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

11 years agoruntime: fix 386 build after cas64 change
Russ Cox [Fri, 12 Jul 2013 04:42:46 +0000 (00:42 -0400)]
runtime: fix 386 build after cas64 change

Missed this in CL 10909045.

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

11 years agoencoding/json: escape U+2028 and U+2029.
David Symonds [Fri, 12 Jul 2013 04:35:55 +0000 (14:35 +1000)]
encoding/json: escape U+2028 and U+2029.

Fixes #5836.

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

11 years agoruntime: make cas64 like cas32 and casp
Russ Cox [Fri, 12 Jul 2013 04:03:32 +0000 (00:03 -0400)]
runtime: make cas64 like cas32 and casp

The current cas64 definition hard-codes the x86 behavior
of updating *old with the new value when the cas fails.
This is inconsistent with cas32 and casp.
Make it consistent.

This means that the cas64 uses will be epsilon less efficient
than they might be, because they have to do an unnecessary
memory load on x86. But so be it. Code clarity and consistency
is more important.

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

11 years agorun.bash: actually stop on cgo failures
Russ Cox [Fri, 12 Jul 2013 03:24:57 +0000 (23:24 -0400)]
run.bash: actually stop on cgo failures

I hate bash.

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

11 years agomisc/cgo/test: make test work with -linkmode=internal
Russ Cox [Fri, 12 Jul 2013 03:24:35 +0000 (23:24 -0400)]
misc/cgo/test: make test work with -linkmode=internal

The static func named thread in issue5337.go's C snippet
conflicts with the static func named thread in issue3350.go's C snippet.
I don't know why (they're both static) but I also don't care,
because -linkmode=internal only needs to be able to handle
the cgo in the standard library, and it does.

Change the test to avoid this problem.

Fixes build (after run.bash is fixed to detect the breakage).

R=minux.ma
TBR=minux.ma
CC=golang-dev
https://golang.org/cl/11201043

11 years agocmd/ld: place read-only data in non-executable segment
Russ Cox [Fri, 12 Jul 2013 02:52:48 +0000 (22:52 -0400)]
cmd/ld: place read-only data in non-executable segment

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

11 years agocmd/5l, cmd/6l, cmd/8l: increase error buffer size
Russ Cox [Fri, 12 Jul 2013 02:49:15 +0000 (22:49 -0400)]
cmd/5l, cmd/6l, cmd/8l: increase error buffer size

STRINGSZ (200) is fine for lines generated by things like
instruction dumps, but an error containing a couple file
names can easily exceed that, especially on Macs with
the ridiculous default $TMPDIR.

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

11 years agocmd/gc: fix error message for import as 'init'
Russ Cox [Fri, 12 Jul 2013 02:40:21 +0000 (22:40 -0400)]
cmd/gc: fix error message for import as 'init'

Fixes #5853.

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

11 years agojson: unmarshal types that are byte slices.
Paul Borman [Fri, 12 Jul 2013 02:34:09 +0000 (22:34 -0400)]
json: unmarshal types that are byte slices.

The json package cheerfully would marshal

        type S struct {
                IP net.IP
        }

but would give an error when unmarshalling.  This change allows any
type whose concrete type is a byte slice to be unmarshalled from a
string.

Fixes #5086.

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

11 years agomake.bat: incease runtime test timeout to 300s (fixes build)
Alex Brainman [Fri, 12 Jul 2013 02:30:18 +0000 (12:30 +1000)]
make.bat: incease runtime test timeout to 300s (fixes build)

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

11 years agomisc/goplay: use `go run x.go` instead of `go build x.go`
ChaiShushan [Thu, 11 Jul 2013 23:41:10 +0000 (09:41 +1000)]
misc/goplay: use `go run x.go` instead of `go build x.go`

when the program is not main package, `go run x.go` can't return the
link error message. so use `go run x.go` in instead `go build x.go`.

Fixes #5865.

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

11 years agospec: move decl in example closer to use
Robert Griesemer [Thu, 11 Jul 2013 21:41:46 +0000 (14:41 -0700)]
spec: move decl in example closer to use

Fixes #5862.

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

11 years agoruntime: fix build for windows.
Shenghou Ma [Thu, 11 Jul 2013 21:06:43 +0000 (05:06 +0800)]
runtime: fix build for windows.

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

11 years agoruntime: correctly handle signals received on foreign threads
Shenghou Ma [Thu, 11 Jul 2013 20:39:39 +0000 (04:39 +0800)]
runtime: correctly handle signals received on foreign threads
Fixes #3250.

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

11 years agocmd/cgo: silence two gcc warnings for *.cgo2.c
Shenghou Ma [Thu, 11 Jul 2013 20:35:53 +0000 (04:35 +0800)]
cmd/cgo: silence two gcc warnings for *.cgo2.c
1. "int e;" is unused, generating "unused variable" error.
2. a->e was typed void *[2], but was accessed with *(int *)(a->e), this
generated "dereferencing type-punned pointer will break strict-aliasing rules" error.

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

11 years agosyscall: implement Sendfile for Darwin.
Shenghou Ma [Thu, 11 Jul 2013 20:34:54 +0000 (04:34 +0800)]
syscall: implement Sendfile for Darwin.
Update #5847
Summary: syscall: implement Sendfile for OpenBSD and NetBSD

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

11 years agocmd/cgo: clarify the underscore prefix rule and C union representation in Go.
Shenghou Ma [Thu, 11 Jul 2013 20:34:04 +0000 (04:34 +0800)]
cmd/cgo: clarify the underscore prefix rule and C union representation in Go.

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

11 years agoruntime: fix CPU underutilization
Dmitriy Vyukov [Thu, 11 Jul 2013 19:57:36 +0000 (15:57 -0400)]
runtime: fix CPU underutilization
runtime.newproc/ready are deliberately sloppy about waking new M's,
they only ensure that there is at least 1 spinning M.
Currently to compensate for that, schedule() checks if the current P
has local work and there are no spinning M's, it wakes up another one.
It does not work if goroutines do not call schedule.
With this change a spinning M wakes up another M when it finds work to do.
It's also not ideal, but it fixes the underutilization.
A proper check would require to know the exact number of runnable G's,
but it's too expensive to maintain.
Fixes #5586.
This is reincarnation of cl/9776044 with the bug fixed.
The bug was due to code added after cl/9776044 was created:
if(tick - (((uint64)tick*0x4325c53fu)>>36)*61 == 0 && runtime·sched.runqsize > 0) {
        runtime·lock(&runtime·sched);
        gp = globrunqget(m->p, 1);
        runtime·unlock(&runtime·sched);
}
If M gets gp from global runq here, it does not reset m->spinning.

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

11 years agonet/rpc: fix a test bug
ChaiShushan [Thu, 11 Jul 2013 19:55:08 +0000 (15:55 -0400)]
net/rpc: fix a test bug

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

11 years agoruntime: adjust traceback for new preemptive reality
Dmitriy Vyukov [Thu, 11 Jul 2013 17:52:20 +0000 (13:52 -0400)]
runtime: adjust traceback for new preemptive reality
Currently it crashes as follows:
fatal error: unknown pc
...
goroutine 71698 [runnable]:
runtime.racegoend()
        src/pkg/runtime/race.c:171
runtime.goexit()
        src/pkg/runtime/proc.c:1276 +0x9
created by runtime_test.testConcurrentReadsAfterGrowth
        src/pkg/runtime/map_test.go:264 +0x332

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

11 years agoimage/draw: add the Quantizer type.
Nigel Tao [Thu, 11 Jul 2013 05:17:32 +0000 (15:17 +1000)]
image/draw: add the Quantizer type.

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

11 years agocmd/ld: correct assignment of sizes to mach-o symbols
Russ Cox [Thu, 11 Jul 2013 02:06:52 +0000 (22:06 -0400)]
cmd/ld: correct assignment of sizes to mach-o symbols

If you compute the size by subtraction from the address
of the next symbol, it helps to wait until the symbols have
been sorted by address.

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

11 years agoimage/draw: add Drawer, FloydSteinberg and the op.Draw method.
Nigel Tao [Wed, 10 Jul 2013 22:47:29 +0000 (08:47 +1000)]
image/draw: add Drawer, FloydSteinberg and the op.Draw method.

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

11 years agogo/format: fix failing test (fix build)
Robert Griesemer [Wed, 10 Jul 2013 21:19:35 +0000 (14:19 -0700)]
go/format: fix failing test (fix build)

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

11 years agogo/parser: more tolerant parsing of const and var decls
Robert Griesemer [Wed, 10 Jul 2013 19:01:07 +0000 (12:01 -0700)]
go/parser: more tolerant parsing of const and var decls

Instead, rely on the type checker.

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

11 years agohtml: add escaping tests
Andrew Gerrand [Wed, 10 Jul 2013 07:31:46 +0000 (17:31 +1000)]
html: add escaping tests

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

11 years agotime: find correct zone abbreviations even on non-English windows systems
Alex Brainman [Wed, 10 Jul 2013 05:34:24 +0000 (15:34 +1000)]
time: find correct zone abbreviations even on non-English windows systems

Fixes #5783

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

11 years agospec: define notion of named type
Robert Griesemer [Wed, 10 Jul 2013 04:12:53 +0000 (21:12 -0700)]
spec: define notion of named type

The notion of a named type is crucial for the definition
of type identity, assignability, definitions of methods.
Explicitly introduce the notion with an extra sentence.

Fixes #5682.

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

11 years agonet/http: in ServeContent, don't seek on content until necessary
Brad Fitzpatrick [Wed, 10 Jul 2013 03:29:52 +0000 (13:29 +1000)]
net/http: in ServeContent, don't seek on content until necessary

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

11 years agoencoding/xml: fix typo in docs
Andrew Gerrand [Wed, 10 Jul 2013 00:14:31 +0000 (10:14 +1000)]
encoding/xml: fix typo in docs

Fixes #5843.

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

11 years agocmd/go: fix a couple of bugs in coverage tooling
Rob Pike [Tue, 9 Jul 2013 23:52:36 +0000 (09:52 +1000)]
cmd/go: fix a couple of bugs in coverage tooling
Merging a couple of CLs into one, since they collided in my client
and I'm lazy.

1) Fix up output in "go test -cover" case.
We need to tell the testing package the name of the package being tested
and the name of the package being covered. It can then sort out the report.

2) Filter out the _test.go files from coverage processing. We want to measure
what the tests cover, not what's covered in the tests,
The coverage for encoding/gob goes from 82.2% to 88.4%.
There may be a cleaner way to do this - suggestions welcome - but ça suffit.

Fixes #5810.

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

11 years agobuiltin: document print and println
Robert Griesemer [Tue, 9 Jul 2013 23:20:19 +0000 (16:20 -0700)]
builtin: document print and println

Fixes #5787.

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

11 years agoimage/color: add Plan9Palette and WebSafePalette.
Nigel Tao [Tue, 9 Jul 2013 09:17:17 +0000 (19:17 +1000)]
image/color: add Plan9Palette and WebSafePalette.

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

11 years agocmd/ld: trivial: fix unhandled switch case
Dave Cheney [Tue, 9 Jul 2013 02:14:32 +0000 (21:14 -0500)]
cmd/ld: trivial: fix unhandled switch case

Fix warning found by clang 3.3.

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

11 years agonet/rpc: use log.Print and return error instead log.Fatal
ChaiShushan [Tue, 9 Jul 2013 01:12:05 +0000 (11:12 +1000)]
net/rpc: use log.Print and return error instead log.Fatal

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

11 years agomisc/dist: clean files from GOPATH after building tour
Andrew Gerrand [Mon, 8 Jul 2013 01:45:33 +0000 (11:45 +1000)]
misc/dist: clean files from GOPATH after building tour

Fixes #5503.

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

11 years agocmd/go: fix "go get -u" for git repositories.
Shenghou Ma [Sun, 7 Jul 2013 15:06:30 +0000 (23:06 +0800)]
cmd/go: fix "go get -u" for git repositories.
CL 10869046 changed cmd/go to checkout master branch, so
for "go get -u" to work, it must "git pull" instead of
"git fetch". Added "--ff-only" so that it won't accidentally
overwrite user changes.

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

11 years agocmd/6g, cmd/8g: prevent constant propagation of non-constant LEA.
Daniel Morsing [Fri, 5 Jul 2013 14:11:22 +0000 (16:11 +0200)]
cmd/6g, cmd/8g: prevent constant propagation of non-constant LEA.

Fixes #5809.

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

11 years agoencoding/json: Correct description of stateNeg function.
Oliver Hookins [Fri, 5 Jul 2013 04:26:09 +0000 (14:26 +1000)]
encoding/json: Correct description of stateNeg function.

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

11 years agosyscall: reduce duplication between *bsd and linux
Dave Cheney [Fri, 5 Jul 2013 03:25:23 +0000 (13:25 +1000)]
syscall: reduce duplication between *bsd and linux

Part 3 of several.

* Linux has grown a SetsockoptByte.
* SetsockoptIPMreqn is handled directly by syscall_linux.go and syscall_freebsd.go.

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

11 years agoA+C: Oliver Hookins (individual CLA)
Andrew Gerrand [Fri, 5 Jul 2013 02:53:01 +0000 (12:53 +1000)]
A+C: Oliver Hookins (individual CLA)

Generated by addca.

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

11 years agoimage/gif: close the lzw.Reader we create.
Nigel Tao [Fri, 5 Jul 2013 00:12:13 +0000 (10:12 +1000)]
image/gif: close the lzw.Reader we create.

The lzw.NewReader doc comment says, "It is the caller's responsibility
to call Close on the ReadCloser when finished reading."

Thanks to Andrew Bonventre for noticing this.

R=r, dsymonds, adg
CC=andybons, golang-dev
https://golang.org/cl/10821043

11 years agodoc: update playground.js
Andrew Gerrand [Thu, 4 Jul 2013 04:24:21 +0000 (14:24 +1000)]
doc: update playground.js

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

11 years agogo/parser: accept optional indices for all parts of an index expression
Robert Griesemer [Wed, 3 Jul 2013 17:43:24 +0000 (10:43 -0700)]
go/parser: accept optional indices for all parts of an index expression

Instead, leave the error testing to the type checker, eventually.

Fixes #5827.

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

11 years agonet/textproto: reduce allocations in ReadMIMEHeader
Brad Fitzpatrick [Wed, 3 Jul 2013 05:37:19 +0000 (22:37 -0700)]
net/textproto: reduce allocations in ReadMIMEHeader

ReadMIMEHeader is used by net/http, net/mail, and
mime/multipart.

Don't do so many small allocations. Calculate up front
how much we'll probably need.

benchmark                  old ns/op    new ns/op    delta
BenchmarkReadMIMEHeader         8433         7467  -11.45%

benchmark                 old allocs   new allocs    delta
BenchmarkReadMIMEHeader           23           14  -39.13%

benchmark                  old bytes    new bytes    delta
BenchmarkReadMIMEHeader         1705         1343  -21.23%

R=golang-dev, r, iant, adg
CC=golang-dev
https://golang.org/cl/8179043

11 years agoA+C: Brian Gitonga Marete (individual CLA)
Brad Fitzpatrick [Wed, 3 Jul 2013 03:35:44 +0000 (20:35 -0700)]
A+C: Brian Gitonga Marete (individual CLA)

Generated by addca.

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

11 years agocmd/go: git checkout the correct default branch.
David Symonds [Wed, 3 Jul 2013 01:56:02 +0000 (11:56 +1000)]
cmd/go: git checkout the correct default branch.

origin/master is always a remote branch, and it doesn't make sense to
switch to a remote branch. master is the default branch that tracks it.

R=adg
CC=golang-dev, matt.jibson
https://golang.org/cl/10869046

11 years agodoc/go1.2.txt: stable sort
Rob Pike [Wed, 3 Jul 2013 01:46:09 +0000 (11:46 +1000)]
doc/go1.2.txt: stable sort

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

11 years agonet/rpc: remove unnecessary code
ChaiShushan [Wed, 3 Jul 2013 00:29:21 +0000 (17:29 -0700)]
net/rpc: remove unnecessary code

Fixes #5760.

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

11 years agocrypto/tls: implement TLS 1.2.
Adam Langley [Tue, 2 Jul 2013 23:58:56 +0000 (19:58 -0400)]
crypto/tls: implement TLS 1.2.

This does not include AES-GCM yet. Also, it assumes that the handshake and
certificate signature hash are always SHA-256, which is true of the ciphersuites
that we currently support.

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

11 years agogo/ast: improve doc for FuncDecl's Type field.
David Symonds [Tue, 2 Jul 2013 22:16:08 +0000 (08:16 +1000)]
go/ast: improve doc for FuncDecl's Type field.

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

11 years agoruntime: fix runtime.sigreturn_tramp for NetBSD/ARM
Shenghou Ma [Tue, 2 Jul 2013 16:33:38 +0000 (00:33 +0800)]
runtime: fix runtime.sigreturn_tramp for NetBSD/ARM
using m->tls[0] to save ucontext pointer is not re-entry safe, and
the old code didn't set it before the early return when signal is
received on non-Go threads.

so misc/cgo/test used to hang when testing issue 5337.

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

11 years agocmd/gc: fix issue with method wrappers not having escape analysis run on them.
Daniel Morsing [Tue, 2 Jul 2013 15:12:08 +0000 (17:12 +0200)]
cmd/gc: fix issue with method wrappers not having escape analysis run on them.

Escape analysis needs the right curfn value on a dclfunc node, otherwise it will not analyze the function.
When generating method value wrappers, we forgot to set the curfn correctly.

Fixes #5753.

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

11 years agocmd/gc: fix computation of equality class of types.
Rémy Oudompheng [Tue, 2 Jul 2013 07:08:43 +0000 (09:08 +0200)]
cmd/gc: fix computation of equality class of types.

A struct with a single field was considered as equivalent to the
field type, which is incorrect is the field is blank.

Fields with padding could make the compiler think some
types are comparable when they are not.

Fixes #5698.

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

11 years agomisc/vim: Allow multiple GOOS/GOARCH.
Yasuhiro Matsumoto [Tue, 2 Jul 2013 05:24:09 +0000 (15:24 +1000)]
misc/vim: Allow multiple GOOS/GOARCH.

R=golang-dev, dsymonds, dominik.honnef
CC=golang-dev
https://golang.org/cl/9293043

11 years agosort: fix 32-bit build
Russ Cox [Tue, 2 Jul 2013 01:44:14 +0000 (21:44 -0400)]
sort: fix 32-bit build

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

11 years agotime: prevent a panic from leaving the timer mutex held
Jeff R. Allen [Tue, 2 Jul 2013 01:42:29 +0000 (21:42 -0400)]
time: prevent a panic from leaving the timer mutex held

When deleting a timer, a panic due to nil deref
would leave a lock held, possibly leading to a deadlock
in a defer. Instead return false on a nil timer.

Fixes #5745.

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

11 years agonet/rpc/jsonrpc: remove unused serverCodec.resp field
ChaiShushan [Tue, 2 Jul 2013 01:20:42 +0000 (21:20 -0400)]
net/rpc/jsonrpc: remove unused serverCodec.resp field

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

11 years agosort: implement stable sorting
Volker Dobler [Tue, 2 Jul 2013 01:20:33 +0000 (21:20 -0400)]
sort: implement stable sorting

This CL provides stable in-place sorting by use of
bottom up merge sort with in-place merging done by
the SymMerge algorithm from P.-S. Kim and A. Kutzner.

The additional space needed for stable sorting (in the form of
stack space) is logarithmic in the inputs size n.
Number of calls to Less and Swap grow like O(n * log n) and
O(n * log n * log n):
Stable sorting random data uses significantly more calls
to Swap than the unstable quicksort implementation (5 times more
on n=100, 10 times more on n=1e4 and 23 times more on n=1e8).
The number of calls to Less is practically the same for Sort and
Stable.

Stable sorting 1 million random integers takes 5 times longer
than using Sort.

BenchmarkSortString1K      50000       328662 ns/op
BenchmarkStableString1K    50000       380231 ns/op  1.15 slower
BenchmarkSortInt1K         50000       157336 ns/op
BenchmarkStableInt1K       50000       191167 ns/op  1.22 slower
BenchmarkSortInt64K         1000     14466297 ns/op
BenchmarkStableInt64K        500     16190266 ns/op  1.12 slower

BenchmarkSort1e2          200000        64923 ns/op
BenchmarkStable1e2         50000       167128 ns/op  2.57 slower
BenchmarkSort1e4            1000     14540613 ns/op
BenchmarkStable1e4           100     58117289 ns/op  4.00 slower
BenchmarkSort1e6               5   2429631508 ns/op
BenchmarkStable1e6             1  12077036952 ns/op  4.97 slower

R=golang-dev, bradfitz, iant, 0xjnml, rsc
CC=golang-dev
https://golang.org/cl/9612044

11 years agoreflect: add Value.Slice3 and Value.SetCap methods, to match x[i:j:k]
Russ Cox [Tue, 2 Jul 2013 00:32:53 +0000 (20:32 -0400)]
reflect: add Value.Slice3 and Value.SetCap methods, to match x[i:j:k]

Design doc at golang.org/s/go12slice.

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

11 years agocmd/gc: support x[i:j:k]
Russ Cox [Tue, 2 Jul 2013 00:32:36 +0000 (20:32 -0400)]
cmd/gc: support x[i:j:k]

Design doc at golang.org/s/go12slice.
This is an experimental feature and may not be included in the release.

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

11 years agocmd/godoc: set up playground for examples that are already visible
Andrew Gerrand [Mon, 1 Jul 2013 22:44:25 +0000 (08:44 +1000)]
cmd/godoc: set up playground for examples that are already visible

This fixes an issue where linking directly to an example makes it not
runnable and visible only in a tiny window. To see the bug in action,
link: http://golang.org/pkg/strings/#example_Map
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/10679050

11 years agoruntime: disable preemption test (fix build)
Russ Cox [Mon, 1 Jul 2013 22:10:03 +0000 (18:10 -0400)]
runtime: disable preemption test (fix build)

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

11 years agoruntime: disable preemption
Russ Cox [Mon, 1 Jul 2013 21:57:09 +0000 (17:57 -0400)]
runtime: disable preemption

There are various problems, and both Dmitriy and I
will be away for the next week. Make the runtime a bit
more stable while we're gone.

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

11 years agoruntime: fix memory leaks due to defers
Dmitriy Vyukov [Mon, 1 Jul 2013 21:36:08 +0000 (17:36 -0400)]
runtime: fix memory leaks due to defers
fn can clearly hold a closure in memory.
argp/pc point into stack and so can hold
in memory a block that was previously
a large stack serment.

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

11 years agosync/atomic: remove test dependency on net/http
Russ Cox [Mon, 1 Jul 2013 21:27:19 +0000 (17:27 -0400)]
sync/atomic: remove test dependency on net/http

Depending on net/http means depending on cgo.
When the tree is in a shaky state it's nice to see sync/atomic
pass even if cgo or net causes broken binaries.

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

11 years agomisc/vim: Add compiler plugin for Go
David Bürgin [Mon, 1 Jul 2013 06:20:50 +0000 (16:20 +1000)]
misc/vim: Add compiler plugin for Go

This change adds a basic compiler plugin for Go. The plugin
integrates "go build" with Vim's ":make" command and the
quickfix list.

Fixes #5751.

R=golang-dev, dsymonds, niklas.schnelle, 0xjnml
CC=golang-dev
https://golang.org/cl/10466043

11 years agoimage/gif: do not allow pixels outside the current palette
Jeff R. Allen [Mon, 1 Jul 2013 04:11:45 +0000 (14:11 +1000)]
image/gif: do not allow pixels outside the current palette

After loading a frame of a GIF, check that each pixel
is inside the frame's palette.

Fixes #5401.

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

11 years agolib9: restore printing of signed integers
Russ Cox [Sun, 30 Jun 2013 23:53:36 +0000 (19:53 -0400)]
lib9: restore printing of signed integers

A casualty of https://golang.org/cl/10195044.

If x is an 32-bit int and u is a 64-bit ulong,
        u = (uint)x // converts to uint before extension, so zero fills
        u = (ulong)x // sign-extends

TBR=iant, r
CC=golang-dev
https://golang.org/cl/10814043

11 years agocmd/gc: fix missing export data for inlining in a few other cases.
Rémy Oudompheng [Fri, 28 Jun 2013 21:29:13 +0000 (23:29 +0200)]
cmd/gc: fix missing export data for inlining in a few other cases.

Exported inlined functions that perform a string conversion
using a non-exported named type may miss it in export data.

Fixes #5755.

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

11 years agotest: match gccgo error strings.
Rémy Oudompheng [Fri, 28 Jun 2013 21:08:07 +0000 (23:08 +0200)]
test: match gccgo error strings.

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

11 years agoruntime: shorten hash lookup stack frames
Russ Cox [Fri, 28 Jun 2013 20:37:07 +0000 (13:37 -0700)]
runtime: shorten hash lookup stack frames

On amd64 the frames are very close to the limit for a
nosplit (textflag 7) function, in part because the C compiler
does not make any attempt to reclaim space allocated for
completely registerized variables. Avoid a few short-lived
variables to reclaim two words.

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

11 years agonet/http: fix memory leak in Transport
Brad Fitzpatrick [Fri, 28 Jun 2013 19:57:54 +0000 (12:57 -0700)]
net/http: fix memory leak in Transport

Fixes #5794

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

11 years agonet/smtp: preserve Auth errors
Rick Arnold [Fri, 28 Jun 2013 19:24:45 +0000 (12:24 -0700)]
net/smtp: preserve Auth errors

If authentication failed, the initial error was being thrown away.

Fixes #5700.

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

11 years agoinclude/plan9: define size_t to fix build breakage
Ian Lance Taylor [Fri, 28 Jun 2013 19:16:33 +0000 (12:16 -0700)]
include/plan9: define size_t to fix build breakage

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

11 years agocmd/5g, cmd/6g, cmd/8g: fix comment
Russ Cox [Fri, 28 Jun 2013 19:06:25 +0000 (12:06 -0700)]
cmd/5g, cmd/6g, cmd/8g: fix comment

Keeping the string "compactframe" because that's what
I always search for to find this code. But point to the real place too.

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

11 years agoruntime: introduce GODEBUG env var
Dmitriy Vyukov [Fri, 28 Jun 2013 14:37:06 +0000 (18:37 +0400)]
runtime: introduce GODEBUG env var
Currently it replaces GOGCTRACE env var (GODEBUG=gctrace=1).
The plan is to extend it with other type of debug tracing,
e.g. GODEBUG=gctrace=1,schedtrace=100.

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

11 years agoruntime: preempt goroutines for GC
Dmitriy Vyukov [Fri, 28 Jun 2013 13:52:17 +0000 (17:52 +0400)]
runtime: preempt goroutines for GC
The last patch for preemptive scheduler,
with this change stoptheworld issues preemption
requests every 100us.
Update #543.

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

11 years agoruntime: remove declaration of function that does not exist
Ian Lance Taylor [Fri, 28 Jun 2013 05:43:30 +0000 (22:43 -0700)]
runtime: remove declaration of function that does not exist

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

11 years agoflag: add Getter interface; implement for all Value types
Rick Arnold [Thu, 27 Jun 2013 22:30:45 +0000 (15:30 -0700)]
flag: add Getter interface; implement for all Value types

Fixes #5383.

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

11 years agocrypto/x509: Added RFC 5280, section 4.2.2.1 Authority Information Access
Paul van Brouwershaven [Thu, 27 Jun 2013 21:16:25 +0000 (17:16 -0400)]
crypto/x509: Added RFC 5280, section 4.2.2.1 Authority Information Access

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