]> Cypherpunks repositories - gostls13.git/log
gostls13.git
12 years agocmd/gc: fix uintptr(nil) issues.
Rémy Oudompheng [Mon, 7 Jan 2013 23:23:02 +0000 (00:23 +0100)]
cmd/gc: fix uintptr(nil) issues.

A constant node of type uintptr with a nil literal could
happen in two cases: []int(nil)[1:] and
uintptr(unsafe.Pointer(nil)).

Fixes #4614.

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

12 years agocmd/go: use filepath.SplitList when inspecting GOPATH
Dave Cheney [Mon, 7 Jan 2013 23:00:21 +0000 (10:00 +1100)]
cmd/go: use filepath.SplitList when inspecting GOPATH

There exists a test case for this condition, but it only runs on unix systems, which neatly dovetails into the code always using ':' as the list separator.

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

12 years agogo/doc: recursively inspect selector expressions
Andrew Gerrand [Mon, 7 Jan 2013 08:36:38 +0000 (19:36 +1100)]
go/doc: recursively inspect selector expressions

Also adds a couple of simple tests for doc.Examples.

Fixes #4561.

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

12 years agoimage/jpeg: handle those (unusual) grayscale images whose sampling
Nigel Tao [Mon, 7 Jan 2013 05:16:11 +0000 (16:16 +1100)]
image/jpeg: handle those (unusual) grayscale images whose sampling
ratio isn't 1x1.

Fixes #4259.

The test data was generated by
cjpeg -quality 50 -sample 2x2 video-005.gray.pgm > video-005.gray.q50.2x2.jpeg
cjpeg -quality 50 -sample 2x2 -progressive video-005.gray.pgm > video-005.gray.q50.2x2.progressive.jpeg

similarly to video-005.gray.q50.* from
http://code.google.com/p/go/source/detail?r=51f26e36ba98
the key difference being the "-sample 2x2".

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

12 years agocmd/vet: %#q is a valid format (uses raw quotes).
David Symonds [Mon, 7 Jan 2013 04:31:51 +0000 (15:31 +1100)]
cmd/vet: %#q is a valid format (uses raw quotes).

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

12 years agocmd/gc, cmd/ld: rename -b to -race
Russ Cox [Mon, 7 Jan 2013 03:47:39 +0000 (22:47 -0500)]
cmd/gc, cmd/ld: rename -b to -race

There's no b in race detector.
The new flag matches the one in the go command
(go test -race math).

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

12 years agoos: document that Exit does not run deferred calls
Andrew Gerrand [Mon, 7 Jan 2013 03:46:41 +0000 (14:46 +1100)]
os: document that Exit does not run deferred calls

Fixes #4101.

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

12 years ago doc: two minor edits to contribute.html
Caleb Spare [Mon, 7 Jan 2013 03:44:16 +0000 (22:44 -0500)]
  doc: two minor edits to contribute.html

- Missing parenthesis
- Fix bad phrasing

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

12 years agobytes: Fix missing godoc punctuation.
Matthew Dempsky [Mon, 7 Jan 2013 03:44:04 +0000 (22:44 -0500)]
bytes: Fix missing godoc punctuation.

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

12 years agobytes: Change Compare example to be consistent with sort.Search's.
Matthew Dempsky [Mon, 7 Jan 2013 03:43:32 +0000 (22:43 -0500)]
bytes: Change Compare example to be consistent with sort.Search's.

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

12 years agogo/doc: trim only first space or newline from example output comment
Andrew Gerrand [Mon, 7 Jan 2013 02:42:25 +0000 (13:42 +1100)]
go/doc: trim only first space or newline from example output comment

Fixes #4487.

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

12 years agogo/types: Set Signature.Recv for imported types
Andrew Wilkins [Mon, 7 Jan 2013 02:08:58 +0000 (18:08 -0800)]
go/types: Set Signature.Recv for imported types

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

12 years agoos: fix Open for empty root directories on windows
Alex Brainman [Mon, 7 Jan 2013 01:48:32 +0000 (12:48 +1100)]
os: fix Open for empty root directories on windows

Fixes #4601.

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

12 years agospec: Use "non-negative" instead of "positive"
Matthew Dempsky [Mon, 7 Jan 2013 00:56:06 +0000 (16:56 -0800)]
spec: Use "non-negative" instead of "positive"

Replacing division-by-power-of-2 with right-shift is valid for
zero too.

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

12 years agomisc/dashboard/builder: set GOPATH before building subrepos
Dave Cheney [Mon, 7 Jan 2013 00:24:01 +0000 (11:24 +1100)]
misc/dashboard/builder: set GOPATH before building subrepos

This proposal updates the dashboard builder to avoid relying on the (soon to be removed) support for using go get to download to $GOROOT. The result is

WORKSPACE=$(the value of the -buildRoot flag / $BUILDER_NAME + hg revision)
GOROOT=$WORKSPACE/go
GOPATH=$WORKSPACE

Required for CL 6941058.

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

12 years agocmd/gofmt, bufio, image: Consistency and error handling.
Robin Eklind [Mon, 7 Jan 2013 00:15:53 +0000 (11:15 +1100)]
cmd/gofmt, bufio, image: Consistency and error handling.

cmd/gofmt: Add error handling for ioutil.WriteFile.
bufio: Consistency, rename e to err.
image: Consistency, fix comment for asReader.

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

12 years agobytes: fix docs: s/array/slice/.
Nigel Tao [Sun, 6 Jan 2013 23:48:06 +0000 (10:48 +1100)]
bytes: fix docs: s/array/slice/.

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

12 years agosrc: Use bytes.Equal instead of bytes.Compare where possible.
Matthew Dempsky [Sun, 6 Jan 2013 23:03:49 +0000 (10:03 +1100)]
src: Use bytes.Equal instead of bytes.Compare where possible.

bytes.Equal is simpler to read and should also be faster because
of short-circuiting and assembly implementations.

Change generated automatically using:
  gofmt -r 'bytes.Compare(a, b) == 0 -> bytes.Equal(a, b)'
  gofmt -r 'bytes.Compare(a, b) != 0 -> !bytes.Equal(a, b)'

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

12 years agobytes: Examples recommending bytes.Compare(a, b) rel_op 0 to test a rel_op b.
Matthew Dempsky [Sun, 6 Jan 2013 22:59:37 +0000 (09:59 +1100)]
bytes: Examples recommending bytes.Compare(a, b) rel_op 0 to test a rel_op b.

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

12 years agoencoding/json: documented that ,string applies only to string and numeric fields.
Caleb Spare [Sun, 6 Jan 2013 22:44:35 +0000 (09:44 +1100)]
encoding/json: documented that ,string applies only to string and numeric fields.

Fixes #4437.

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

12 years agoA+C: Caleb Spare (individual CLA)
Andrew Gerrand [Sun, 6 Jan 2013 22:43:53 +0000 (09:43 +1100)]
A+C: Caleb Spare (individual CLA)

Generated by addca.

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

12 years agogo/types: less closure creations in gcimporter.
Rémy Oudompheng [Sun, 6 Jan 2013 22:38:38 +0000 (23:38 +0100)]
go/types: less closure creations in gcimporter.

Closures are incredibly expensive on linux/arm due to
repetitive flush of instruction cache.

go test -short on ODROID-X:

Before:
ok      exp/gotype      17.091s
ok      go/types        2.225s

After:
ok      exp/gotype      7.193s
ok      go/types        1.143s

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

12 years agodoc: Updated links for sub-repository documentation.
Robin Eklind [Sun, 6 Jan 2013 22:10:09 +0000 (09:10 +1100)]
doc: Updated links for sub-repository documentation.

Use godoc.org instead of gopkgdoc.appspot.com.

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

12 years agocmd/5l, cmd/6l, cmd/8l, cmd/cc, cmd/gc: new flag parsing
Russ Cox [Sun, 6 Jan 2013 20:24:47 +0000 (15:24 -0500)]
cmd/5l, cmd/6l, cmd/8l, cmd/cc, cmd/gc: new flag parsing

This CL adds a flag parser that matches the semantics of Go's
package flag. It also changes the linkers and compilers to use
the new flag parser.

Command lines that used to work, like
        8c -FVw
        6c -Dfoo
        5g -I/foo/bar
now need to be split into separate arguments:
        8c -F -V -w
        6c -D foo
        5g -I /foo/bar
The new spacing will work with both old and new tools.

The new parser also allows = for arguments, as in
        6c -D=foo
        5g -I=/foo/bar
but that syntax will not work with the old tools.

In addition to matching standard Go binary flag parsing,
the new flag parser generates more detailed usage messages
and opens the door to long flag names.

The recently added gc flag -= has been renamed -complete.

R=remyoudompheng, daniel.morsing, minux.ma, iant
CC=golang-dev
https://golang.org/cl/7035043

12 years agocmd/ld: move symtab, ELF generation to portable code
Russ Cox [Sun, 6 Jan 2013 19:32:45 +0000 (14:32 -0500)]
cmd/ld: move symtab, ELF generation to portable code

More cleanup in preparation for fixing issue 4069.

This CL replaces the three nearly identical copies of the
asmb ELF code with a single asmbelf function in elf.c.

In addition to the ELF code movement, remove the elfstr
array in favor of a simpler lookup, and identify sections by
name throughout instead of computing fragile indices.

The CL also replaces the three nearly identical copies of the
genasmsym code with a single genasmsym function in lib.c.

The ARM linker still compiles and generates binaries,
but I haven't tested the binaries. They may not work.

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

12 years agocmd/go: avoid leaking timer if test process failed to start
Dave Cheney [Sat, 5 Jan 2013 10:15:51 +0000 (21:15 +1100)]
cmd/go: avoid leaking timer if test process failed to start

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

12 years agocmd/ld: use native-endian symbol values in symbol table
Russ Cox [Fri, 4 Jan 2013 22:03:57 +0000 (17:03 -0500)]
cmd/ld: use native-endian symbol values in symbol table

The Plan 9 symbol table format defines big-endian symbol values
for portability, but we want to be able to generate an ELF object file
and let the host linker link it, as part of the solution to issue 4069.
The symbol table itself, since it is loaded into memory at run time,
must be filled in by the final host linker, using relocation directives
to set the symbol values. On a little-endian machine, the linker will
only fill in little-endian values during relocation, so we are forced
to use little-endian symbol values.

To preserve most of the original portability of the symbol table
format, we make the table itself say whether it uses big- or
little-endian values. If the table begins with the magic sequence
        fe ff ff ff 00 00
then the actual table begins after those six bytes and contains
little-endian symbol values. Otherwise, the table is in the original
format and contains big-endian symbol values. The magic sequence
looks like an "end of table" entry (the fifth byte is zero), so legacy
readers will see a little-endian table as an empty table.

All the gc architectures are little-endian today, so the practical
effect of this CL is to make all the generated tables little-endian,
but if a big-endian system comes along, ld will not generate
the magic sequence, and the various readers will fall back to the
original big-endian interpretation.

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

12 years agocmd/5g, cmd/6g, cmd/8g: flush return parameters in case of panic.
Daniel Morsing [Fri, 4 Jan 2013 16:07:21 +0000 (17:07 +0100)]
cmd/5g, cmd/6g, cmd/8g: flush return parameters in case of panic.

Fixes #4066.

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

12 years agocmd/5g, cmd/5l, cmd/ld: Small adjustments for the Plan 9 native tools
Lucio De Re [Fri, 4 Jan 2013 16:02:49 +0000 (11:02 -0500)]
cmd/5g, cmd/5l, cmd/ld: Small adjustments for the Plan 9 native tools

A few USED(xxx) additions and a couple of deletions of variable
initialisations that go unused.  One questionable correction,
mirrored in 8l/asm.c, where the result of invocation of a function
shouldn't be used.

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

12 years agocmd/dist: sse auto-detect
Russ Cox [Fri, 4 Jan 2013 15:59:10 +0000 (10:59 -0500)]
cmd/dist: sse auto-detect

R=golang-dev, dsymonds, minux.ma, iant, alex.brainman
CC=golang-dev
https://golang.org/cl/7035055

12 years agoruntime: always incorporate hash seed at start of hash computation
Ian Lance Taylor [Fri, 4 Jan 2013 15:53:42 +0000 (07:53 -0800)]
runtime: always incorporate hash seed at start of hash computation

Otherwise we can get predictable collisions.

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

12 years agolog/syslog: remove RFC5424 version number for greater compatibility
John Graham-Cumming [Fri, 4 Jan 2013 15:21:43 +0000 (10:21 -0500)]
log/syslog: remove RFC5424 version number for greater compatibility

RFC5424 specifies a version number (currently 1) after the facility and
severity in a syslog message (e.g. <7>1 TIMESTAMP ...).  This causes
rsyslog to fail to parse syslog message because the rest of the message
is not fully compliant with RFC5424.

For the widest compatibility, drop the version (messages are in the
RFC3164 BSD syslog format (e.g. <7>TIMESTAMP ...). Have tested this with
syslog-ng, rsyslog and syslogd.

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

12 years agoruntime: introduce typedefs and delete struct keywords in mgc0.c
Jan Ziak [Fri, 4 Jan 2013 15:20:50 +0000 (10:20 -0500)]
runtime: introduce typedefs and delete struct keywords in mgc0.c

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

12 years agonet/http: Sync TimeoutHandler godoc with code.
Matthew Dempsky [Thu, 3 Jan 2013 18:06:04 +0000 (10:06 -0800)]
net/http: Sync TimeoutHandler godoc with code.

TimeoutHandler was changed from "ns int64" to "dt time.Duration" on
Nov 30, 2011, but the godoc still refers to "ns".

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

12 years agoCONTRIBUTORS: add Matthew Dempsky (Google CLA)
Ian Lance Taylor [Thu, 3 Jan 2013 18:05:28 +0000 (10:05 -0800)]
CONTRIBUTORS: add Matthew Dempsky (Google CLA)

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

12 years agogo/types: add more logging to gc import test
Dave Cheney [Thu, 3 Jan 2013 05:30:25 +0000 (16:30 +1100)]
go/types: add more logging to gc import test

* Extended deadline to 30 seconds
* Added logging of the duration of each package import
* Fail the test immediately if directories cannot be read

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

12 years agonet: fix docs for type IP: s/array/slice/.
Nigel Tao [Thu, 3 Jan 2013 03:25:13 +0000 (14:25 +1100)]
net: fix docs for type IP: s/array/slice/.

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

12 years agospec: clarify language about unary operator &
Robert Griesemer [Thu, 3 Jan 2013 02:11:49 +0000 (18:11 -0800)]
spec: clarify language about unary operator &

A composite literal may be parenthesized when
used as operand for the unary operator &.

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

12 years agocmd/8g: extend elimination of temporaries to SSE2 code.
Rémy Oudompheng [Wed, 2 Jan 2013 23:44:31 +0000 (00:44 +0100)]
cmd/8g: extend elimination of temporaries to SSE2 code.

Before:
(erf.go:188)    TEXT     Erf+0(SB),$220
(erf.go:265)    TEXT     Erfc+0(SB),$204
(lgamma.go:174) TEXT     Lgamma+0(SB),$948

After:
(erf.go:188)    TEXT     Erf+0(SB),$84
(erf.go:265)    TEXT     Erfc+0(SB),$84
(lgamma.go:174) TEXT     Lgamma+0(SB),$44

SSE before vs. SSE after:

benchmark             old ns/op    new ns/op    delta
BenchmarkAcosh               81           49  -39.14%
BenchmarkAsinh              109          109   +0.00%
BenchmarkAtanh               73           74   +0.68%
BenchmarkLgamma             138           42  -69.20%
BenchmarkModf                24           15  -36.95%
BenchmarkSqrtGo             565          556   -1.59%

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

12 years agocmd/dist: use separate args for separate compiler flags
Russ Cox [Wed, 2 Jan 2013 22:52:54 +0000 (17:52 -0500)]
cmd/dist: use separate args for separate compiler flags

This makes dist safe for CL 7035043 (but keeps working now too).

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

12 years agonet/http: make NewRequest pick a ContentLength from a *bytes.Reader too
Brad Fitzpatrick [Wed, 2 Jan 2013 22:40:27 +0000 (14:40 -0800)]
net/http: make NewRequest pick a ContentLength from a *bytes.Reader too

It already did so for its sibling, *strings.Reader, as well as *bytes.Buffer.

R=edsrzf, dave, adg, kevlar, remyoudompheng, adg, rsc
CC=golang-dev
https://golang.org/cl/7031045

12 years agoencoding/json: don't panic marshaling anonymous non-struct field
Thomas Kappler [Wed, 2 Jan 2013 22:39:41 +0000 (17:39 -0500)]
encoding/json: don't panic marshaling anonymous non-struct field

Add a check for this case and don't try to follow the anonymous
type's non-existent fields.

Fixes #4474.

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

12 years agoA+C: Thomas Kappler (individual CLA)
Russ Cox [Wed, 2 Jan 2013 22:39:20 +0000 (17:39 -0500)]
A+C: Thomas Kappler (individual CLA)

Generated by addca.

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

12 years agonet/http: document Request.URL
Rick Arnold [Wed, 2 Jan 2013 22:37:27 +0000 (17:37 -0500)]
net/http: document Request.URL

Request.URL had no documentation before and some people were expecting all fields to be populated.

Fixes #3805.

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

12 years agocmd/8g: fix possibly uninitialized variable in foptoas.
Rémy Oudompheng [Wed, 2 Jan 2013 22:20:52 +0000 (23:20 +0100)]
cmd/8g: fix possibly uninitialized variable in foptoas.

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

12 years agocmd/dist, cmd/8g: implement GO386=387/sse to choose FPU flavour.
Rémy Oudompheng [Wed, 2 Jan 2013 21:55:23 +0000 (22:55 +0100)]
cmd/dist, cmd/8g: implement GO386=387/sse to choose FPU flavour.

A new environment variable GO386 is introduced to choose between
code generation targeting 387 or SSE2. No auto-detection is
performed and the setting defaults to 387 to preserve previous
behaviour.

The patch is a reorganization of CL6549052 by rsc.

Fixes #3912.

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

12 years agosync/atomic: document that users must deal with 64-bit alignment
Russ Cox [Wed, 2 Jan 2013 20:44:00 +0000 (15:44 -0500)]
sync/atomic: document that users must deal with 64-bit alignment

Update #599.

R=dvyukov, iant, minux.ma
CC=golang-dev
https://golang.org/cl/7001056

12 years agocmd/gc: mark wrapper methods for unnamed types as DUPOK.
Rémy Oudompheng [Wed, 2 Jan 2013 20:42:26 +0000 (21:42 +0100)]
cmd/gc: mark wrapper methods for unnamed types as DUPOK.

Unnamed types like structs with embedded fields can have methods.
These methods are generated on-the-fly by the compiler and
it may happen for identical types in different packages.
The linker must accept these multiple definitions.

Fixes #4590.

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

12 years agocmd/gc: make redeclaration between import and func less confusing
Russ Cox [Wed, 2 Jan 2013 20:34:28 +0000 (15:34 -0500)]
cmd/gc: make redeclaration between import and func less confusing

Fixes #4510.

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

12 years agotest/run: handle compiledir and errorcheckdir with multi-file packages
Russ Cox [Wed, 2 Jan 2013 20:31:49 +0000 (15:31 -0500)]
test/run: handle compiledir and errorcheckdir with multi-file packages

Multiple files with the same package all get compiled together.

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

12 years agoapi: add go/types to next.txt
Russ Cox [Wed, 2 Jan 2013 20:28:30 +0000 (15:28 -0500)]
api: add go/types to next.txt

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

12 years agogo/types: remove most remaining uses of ast.Object from exported API
Robert Griesemer [Wed, 2 Jan 2013 17:27:33 +0000 (09:27 -0800)]
go/types: remove most remaining uses of ast.Object from exported API

Also: Return first error whether an error handler is set in the
      context or not (bug fix).

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

12 years agodoc: add race detector manual
Dmitriy Vyukov [Wed, 2 Jan 2013 12:38:47 +0000 (16:38 +0400)]
doc: add race detector manual

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

12 years agodoc: update standard copyright header
Andrew Gerrand [Wed, 2 Jan 2013 05:26:25 +0000 (16:26 +1100)]
doc: update standard copyright header

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

12 years agoA+C: Kamil Kisiel (individual CLA)
Andrew Gerrand [Wed, 2 Jan 2013 05:04:32 +0000 (16:04 +1100)]
A+C: Kamil Kisiel (individual CLA)

Generated by addca.

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

12 years agocmd/godoc: ignore misnamed examples and print a warning
Kamil Kisiel [Wed, 2 Jan 2013 05:00:41 +0000 (16:00 +1100)]
cmd/godoc: ignore misnamed examples and print a warning

Fixes #4211.

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

12 years agoruntime: fix freebsd/arm instruction cache flush
Dave Cheney [Tue, 1 Jan 2013 10:47:42 +0000 (21:47 +1100)]
runtime: fix freebsd/arm instruction cache flush

sysarch requires arguments to be passed on the stack, not in registers.

Credit to Shenghou Ma (minux) for the fix.

R=minux.ma, devon.odell
CC=golang-dev
https://golang.org/cl/7037043

12 years agogo/build: disable cgo on freebsd/arm
Dave Cheney [Tue, 1 Jan 2013 10:46:18 +0000 (21:46 +1100)]
go/build: disable cgo on freebsd/arm

Under FreeBSD-CURRENT on arm, cgo enabled binaries segfault. Disable cgo support for the moment so we can have a freebsd/arm builder on the dashboard.

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

12 years agocmd/gc: do not generate code for var _ = ... unless necessary
Russ Cox [Sun, 30 Dec 2012 17:01:53 +0000 (12:01 -0500)]
cmd/gc: do not generate code for var _ = ... unless necessary

Fixes #2443.

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

12 years agoencoding/json: encode map key is of string kind, decode only of string type
Ryan Slade [Sun, 30 Dec 2012 04:40:42 +0000 (15:40 +1100)]
encoding/json: encode map key is of string kind, decode only of string type

Allows encoding and decoding of maps with key of string kind, not just string type.
Fixes #3519.

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

12 years agoruntime: say 'fatal error' instead of 'throw'
Russ Cox [Sun, 30 Dec 2012 02:48:25 +0000 (21:48 -0500)]
runtime: say 'fatal error' instead of 'throw'

Fixes #4597.

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

12 years agocmd/dist: use -pipe during bootstrap
Dave Cheney [Sat, 29 Dec 2012 23:33:33 +0000 (10:33 +1100)]
cmd/dist: use -pipe during bootstrap

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

12 years agoruntime: handle locked mmap failure on Linux
Sébastien Paolacci [Sat, 29 Dec 2012 19:34:06 +0000 (14:34 -0500)]
runtime: handle locked mmap failure on Linux

Used to then die on a nil pointer situation. Most Linux standard setups are rather
restrictive regarding the default amount of lockable memory.

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

12 years agocrypto/rsa: ensure that RSA keys use the full number of bits.
Adam Langley [Sat, 29 Dec 2012 00:11:37 +0000 (19:11 -0500)]
crypto/rsa: ensure that RSA keys use the full number of bits.

While half of all numbers don't have their most-significant bit set,
this is becoming increasingly impermissible for RSA moduli. In an
attempt to exclude weak keys, several bits of software either do, or
will, enforce that RSA moduli are >= 1024-bits.

However, Go often generates 1023-bit RSA moduli which this software
would then reject.

This change causes crypto/rsa to regenerate the primes in the event
that the result is shorter than requested.

It also alters crypto/rand in order to remove the performance impact
of this:

The most important change to crypto/rand is that it will now set the
top two bits in a generated prime (OpenSSL does the same thing).
Multiplying two n/2 bit numbers, where each have the top two bits set,
will always result in an n-bit product. (The effectively makes the
crypto/rsa change moot, but that seems too fragile to depend on.)

Also this change adds code to crypto/rand to rapidly eliminate some
obviously composite numbers and reduce the number of Miller-Rabin
tests needed to generate a prime.

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

12 years agodoc: fix id attributes in links to godoc
Péter Surányi [Fri, 28 Dec 2012 23:41:39 +0000 (10:41 +1100)]
doc: fix id attributes in links to godoc

CL6449105 changed godoc id attributes to ensure uniqueness.
This CL updates links to godoc pages in documents that used
the old id attributes.

R=golang-dev, dsymonds
CC=golang-dev, speter.go1
https://golang.org/cl/7015051

12 years agogo/types: Steps towards removing ast.Object from exported API.
Robert Griesemer [Fri, 28 Dec 2012 22:30:36 +0000 (14:30 -0800)]
go/types: Steps towards removing ast.Object from exported API.

- introduced type Method for methods
- renamed StructField -> Field
- removed ObjList
- methods are not sorted anymore in interfaces (for now)

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

12 years agogo/types: moved from exp/types
Robert Griesemer [Fri, 28 Dec 2012 19:41:44 +0000 (11:41 -0800)]
go/types: moved from exp/types

This is a just a file move with no other changes
besides the manual import path adjustments in these
two files:

src/pkg/exp/gotype/gotype.go
src/pkg/exp/gotype/gotype_test.go

Note: The go/types API continues to be subject to
possibly significant changes until Go 1.1. Do not
rely on it being stable at this point.

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

12 years agoexp/types: resolve composite literal keys
Robert Griesemer [Fri, 28 Dec 2012 18:40:36 +0000 (10:40 -0800)]
exp/types: resolve composite literal keys

The parser/resolver cannot accurately resolve
composite literal keys that are identifiers;
it needs type information.
Instead, try to resolve them but leave final
judgement to the type checker.

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

12 years agoio/ioutil: fix Discard data race
Brad Fitzpatrick [Fri, 28 Dec 2012 17:33:22 +0000 (09:33 -0800)]
io/ioutil: fix Discard data race

Fixes #4589

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

12 years agoruntime: fix potential crash in sigqueue
Dmitriy Vyukov [Fri, 28 Dec 2012 11:36:06 +0000 (15:36 +0400)]
runtime: fix potential crash in sigqueue
Fixes #4383.

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

12 years agonet: consolidate fd_{free,net,open}bsd.go into fd_bsd.go
Dave Cheney [Fri, 28 Dec 2012 10:01:52 +0000 (21:01 +1100)]
net: consolidate fd_{free,net,open}bsd.go into fd_bsd.go

These files are identical, so probably pre date // +build.

With a little work, fd_darwin could be merged as well.

R=mikioh.mikioh, jsing, devon.odell, lucio.dere, minux.ma
CC=golang-dev
https://golang.org/cl/7004053

12 years agocmd/ld: fix valgrind warning in strnput
Dave Cheney [Fri, 28 Dec 2012 04:32:24 +0000 (15:32 +1100)]
cmd/ld: fix valgrind warning in strnput

Fixes #4592.

Thanks to minux for the suggestion.

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

12 years agoreflect: declare slice as *[]unsafe.Pointer instead of *[]byte
Jan Ziak [Thu, 27 Dec 2012 18:35:04 +0000 (02:35 +0800)]
reflect: declare slice as *[]unsafe.Pointer instead of *[]byte

The new garbage collector (CL 6114046) may find the fake *[]byte value
and interpret its contents as bytes rather than as potential pointers.
This may lead the garbage collector to free memory blocks that
shouldn't be freed.

R=dvyukov, rsc, dave, minux.ma, remyoudompheng, iant
CC=golang-dev
https://golang.org/cl/7000059

12 years agolog/syslog: add stub for Plan 9
Akshat Kumar [Thu, 27 Dec 2012 00:45:03 +0000 (11:45 +1100)]
log/syslog: add stub for Plan 9

Proper local system log semantics still need to be
created for Plan 9. In the meantime, the test suite
(viz., exp/gotype) expects there to be some Go
source for each import path. Thus, here is a stub,
equivalent to syslog_windows, for this purpose.

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

12 years agoexp/types: some comment fixes
Robert Griesemer [Wed, 26 Dec 2012 22:04:50 +0000 (14:04 -0800)]
exp/types: some comment fixes

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

12 years agoexp/types: configurable types.Check API
Robert Griesemer [Wed, 26 Dec 2012 20:48:26 +0000 (12:48 -0800)]
exp/types: configurable types.Check API

- added Context type for configuration of type checker
- type check all function and method bodies
- (partial) fixes to shift hinting (still not complete)
- revamped test harness - does not rely on specific position
  representation anymore, just a standard (compiler) error
  message
- lots of bug fixes

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

12 years agofmt: update an old comment; fix a typo.
Oling Cat [Tue, 25 Dec 2012 22:54:24 +0000 (14:54 -0800)]
fmt: update an old comment; fix a typo.

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

12 years agoruntime: diagnose double wakeup on Note
Dmitriy Vyukov [Mon, 24 Dec 2012 17:06:57 +0000 (21:06 +0400)]
runtime: diagnose double wakeup on Note
Double wakeup is prohibited by the Note interface
and checked in lock_sema.c.

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

12 years agoexp/norm: changed API of Iter.
Marcel van Lohuizen [Mon, 24 Dec 2012 15:53:25 +0000 (16:53 +0100)]
exp/norm: changed API of Iter.
Motivations:
 - Simpler UI. Previous API proved a bit awkward for practical purposes.
 - Iter is often used in cases where one want to be able to bail out early.
   The old implementaton had too much look-ahead to be efficient.
Disadvantages:
 - ASCII performance is bad. This is unavoidable for tiny iterations.
   Example is included to show how to work around this.

Description:
Iter now iterates per boundary/segment. It returns a slice of bytes that
either points to the input bytes, the internal decomposition strings,
or the small internal buffer that each iterator has. In many cases, copying
bytes is avoided.
The method Seek was added to support jumping around the input without
having to reinitialize.

Details:
 - Table adjustments: some decompositions exist of multiple segments.
   Decompositions that are of this type are now marked so that Iter can
   handle them separately.
 - The old iterator had a different next function for different normal forms
   that was assigned to a function pointer called by Next.
   The new iterator uses this mechanism to switch between different modes
   for handling different type of input as well.  This greatly improves
   performance for Hangul and ASCII. It is also used for multi-segment
   decompositions.
 - input is now a struct of sting and []byte, instead of an interface.
   This simplifies optimizing the ASCII case.

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

12 years agoexp/locale/collate: include composed characters into the table. This eliminates
Marcel van Lohuizen [Mon, 24 Dec 2012 15:42:29 +0000 (16:42 +0100)]
exp/locale/collate: include composed characters into the table. This eliminates
the need to decompose characters for the majority of cases.  This considerably
speeds up collation while increasing the table size minimally.

To detect non-normalized strings, rather than relying on exp/norm, the table
now includes CCC information. The inclusion of this information does not
increase table size.

DETAILS
 - Raw collation elements are now a struct that includes the CCC, rather
   than a slice of ints.
 - Builder now ensures that NFD and NFC counterparts are included in the table.
   This also fixes a bug for Korean which is responsible for most of the growth
   of the table size.
 - As there is no more normalization step, code should now handle both strings
   and byte slices as input. Introduced source type to facilitate this.

NOTES
 - This change does not handle normalization correctly entirely for contractions.
   This causes a few failures with the regtest. table_test.go contains a few
   uncommented tests that can be enabled once this is fixed.  The easiest is to
   fix this once we have the new norm.Iter.
 - Removed a test cases in table_test that covers cases that are now guaranteed
   to not exist.

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

12 years agoruntime/race: make test driver print compilation errors
Dmitriy Vyukov [Mon, 24 Dec 2012 11:33:32 +0000 (15:33 +0400)]
runtime/race: make test driver print compilation errors
Currently it silently "succeeds" saying that it run 0 tests
if there are compilations errors.
With this change it fails and outputs the compilation error.

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

12 years agocmd/gc: fix race instrumentation of unaddressable arrays.
Rémy Oudompheng [Mon, 24 Dec 2012 11:14:41 +0000 (12:14 +0100)]
cmd/gc: fix race instrumentation of unaddressable arrays.

Fixes #4578.

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

12 years agodoc/articles/wiki/test.bash: suppress unnecessary output
Shenghou Ma [Sun, 23 Dec 2012 19:48:17 +0000 (03:48 +0800)]
doc/articles/wiki/test.bash: suppress unnecessary output

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

12 years agonet/http: match curl and others' NO_PROXY wildcard handling
Brad Fitzpatrick [Sun, 23 Dec 2012 01:41:00 +0000 (17:41 -0800)]
net/http: match curl and others' NO_PROXY wildcard handling

NO_PROXY="example.com" should match "foo.example.com", just
the same as NO_PROXY=".example.com".  This is what curl and
Python do.

Fixes #4574

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

12 years agoruntime: zero d.free field
Russ Cox [Sat, 22 Dec 2012 23:23:26 +0000 (18:23 -0500)]
runtime: zero d.free field

Not programming in Go anymore:
have to clear fields in local variables.

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

12 years agoruntime/debug: document that Stack is deprecated
Russ Cox [Sat, 22 Dec 2012 22:23:50 +0000 (17:23 -0500)]
runtime/debug: document that Stack is deprecated

Fixes #4070.

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

12 years agocmd/gc: add diagnostic for var, type, const named init
Russ Cox [Sat, 22 Dec 2012 22:23:33 +0000 (17:23 -0500)]
cmd/gc: add diagnostic for var, type, const named init

Before this CL, defining the variable worked fine, but then when
the implicit package-level init func was created, that caused a
name collision and a confusing error about the redeclaration.

Also add a test for issue 3705 (func init() needs body).

Fixes #4517.

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

12 years agocmd/go: remove debugging flag introduced in CL 6996054
Russ Cox [Sat, 22 Dec 2012 22:04:56 +0000 (17:04 -0500)]
cmd/go: remove debugging flag introduced in CL 6996054

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

12 years agocmd/gc: make forward declaration in pure Go package an error
Russ Cox [Sat, 22 Dec 2012 21:46:46 +0000 (16:46 -0500)]
cmd/gc: make forward declaration in pure Go package an error

An error during the compilation can be more precise
than an error at link time.

For 'func init', the error happens always: you can't forward
declare an init func because the name gets mangled.

For other funcs, the error happens only with the special
(and never used by hand) -= flag, which tells 6g the
package is pure go.

The go command now passes -= for pure Go packages.

Fixes #3705.

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

12 years agocmd/gc: fix eval order in select
Russ Cox [Sat, 22 Dec 2012 21:46:01 +0000 (16:46 -0500)]
cmd/gc: fix eval order in select

Ordinary variable load was assumed to be not worth saving,
but not if one of the function calls later might change
its value.

Fixes #4313.

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

12 years agocmd/yacc: fix debug print of token name
Russ Cox [Sat, 22 Dec 2012 21:45:35 +0000 (16:45 -0500)]
cmd/yacc: fix debug print of token name

The array skips the first TOKSTART entries.

Fixes #4410.

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

12 years agoruntime: coalesce 0-size allocations
Russ Cox [Sat, 22 Dec 2012 21:42:22 +0000 (16:42 -0500)]
runtime: coalesce 0-size allocations

Fixes #3996.

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

12 years agoruntime: ignore failure from madvise
Russ Cox [Sat, 22 Dec 2012 20:06:28 +0000 (15:06 -0500)]
runtime: ignore failure from madvise

When we release memory to the OS, if the OS doesn't want us
to release it (for example, because the program executed
mlockall(MCL_FUTURE)), madvise will fail. Ignore the failure
instead of crashing.

Fixes #3435.

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

12 years agoruntime: aggregate defer allocations
Russ Cox [Sat, 22 Dec 2012 19:54:39 +0000 (14:54 -0500)]
runtime: aggregate defer allocations

benchmark             old ns/op    new ns/op    delta
BenchmarkDefer              165          113  -31.52%
BenchmarkDefer10            155          103  -33.55%
BenchmarkDeferMany          216          158  -26.85%

benchmark            old allocs   new allocs    delta
BenchmarkDefer                1            0  -100.00%
BenchmarkDefer10              1            0  -100.00%
BenchmarkDeferMany            1            0  -100.00%

benchmark             old bytes    new bytes    delta
BenchmarkDefer               64            0  -100.00%
BenchmarkDefer10             64            0  -100.00%
BenchmarkDeferMany           64           66    3.12%

Fixes #2364.

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

12 years agomisc/benchcmp: show byte allocation statistics
Shenghou Ma [Sat, 22 Dec 2012 19:51:16 +0000 (14:51 -0500)]
misc/benchcmp: show byte allocation statistics

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

12 years agotesting: fix example test fd leak
Emil Hessman [Sat, 22 Dec 2012 18:41:01 +0000 (13:41 -0500)]
testing: fix example test fd leak

Close the read side of the pipe.
Fixes #4551.

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

12 years agoencoding/json: A JSON tag can be any valid JSON string.
Stéphane Travostino [Sat, 22 Dec 2012 18:36:55 +0000 (13:36 -0500)]
encoding/json: A JSON tag can be any valid JSON string.

Fixes #3887.

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

12 years agofmt: document width and flags a bit more
Russ Cox [Sat, 22 Dec 2012 18:36:39 +0000 (13:36 -0500)]
fmt: document width and flags a bit more

Fixes #4581.

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

12 years agoflag: add implicit boolFlag interface
Rick Arnold [Sat, 22 Dec 2012 18:34:48 +0000 (13:34 -0500)]
flag: add implicit boolFlag interface

Any flag.Value that has an IsBoolFlag method that returns true
will be treated as a bool flag type during parsing.

Fixes #4262.

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

12 years agocmd/gc: fix wrong interaction between inlining and embedded builtins.
Rémy Oudompheng [Sat, 22 Dec 2012 18:16:31 +0000 (19:16 +0100)]
cmd/gc: fix wrong interaction between inlining and embedded builtins.

The patch makes the compile user an ordinary package-local
symbol for the name of embedded fields of builtin type.

This is incompatible with the fix delivered for issue 2687
(revision 3c060add43fb) but fixes it in a different way, because
the explicit symbol on the field makes the typechecker able to
find it in lookdot.

Fixes #3552.

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