]> Cypherpunks repositories - gostls13.git/log
gostls13.git
10 years agotest: avoid "declared but not used" errors in shift1.go
Ian Lance Taylor [Sun, 20 Jul 2014 19:25:24 +0000 (12:25 -0700)]
test: avoid "declared but not used" errors in shift1.go

I'm improving gccgo's detection of variables that are only set
but not used, and it triggers additional errors on this code.
The new gccgo errors are correct; gc seems to suppress them
due to the other, expected, errors.  This change uses the
variables so that no compiler will complain.

gccgo change is https://golang.org/cl/119920043 .

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/116050043

10 years agotest: add test for confusion with dot imports
Ian Lance Taylor [Sun, 20 Jul 2014 17:28:51 +0000 (10:28 -0700)]
test: add test for confusion with dot imports

The gccgo compiler would fail this test.  The fix for gccgo is
https://golang.org/cl/116960043 .

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/118000043

10 years agocmd/gc: do not mark PC as pointer on stack
Dmitriy Vyukov [Sun, 20 Jul 2014 14:52:46 +0000 (18:52 +0400)]
cmd/gc: do not mark PC as pointer on stack
GC thinks that it's an invalid pointer on plan9:
http://build.golang.org/log/f7da638a20544ef7f45e81f23fdbc4875044c296

LGTM=0intro
R=golang-codereviews, 0intro
CC=aram, golang-codereviews
https://golang.org/cl/113350043

10 years agocmd/gc: allocate select descriptor on stack
Dmitriy Vyukov [Sun, 20 Jul 2014 11:07:10 +0000 (15:07 +0400)]
cmd/gc: allocate select descriptor on stack

benchmark                      old ns/op     new ns/op     delta
BenchmarkSelectUncontended     220           165           -25.00%
BenchmarkSelectContended       209           161           -22.97%
BenchmarkSelectProdCons        1042          904           -13.24%

But more importantly this change will allow
to get rid of free function in runtime.

Fixes #6494.

LGTM=rsc, khr
R=golang-codereviews, rsc, dominik.honnef, khr
CC=golang-codereviews, remyoudompheng
https://golang.org/cl/107670043

10 years agosync/atomic: fix data races in tests
Dmitriy Vyukov [Sun, 20 Jul 2014 10:59:19 +0000 (14:59 +0400)]
sync/atomic: fix data races in tests
Fixes #8389.

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/111320044

10 years agobuild: be verbose when running tests on Plan 9
Anthony Martin [Sun, 20 Jul 2014 10:14:53 +0000 (13:14 +0300)]
build: be verbose when running tests on Plan 9

This is a temporary change to see how far the
builder gets when it times out.

LGTM=aram, 0intro
R=0intro, aram
CC=golang-codereviews, mischief
https://golang.org/cl/111400043

10 years agoruntime: fix stacks_sys accounting
Keith Randall [Sat, 19 Jul 2014 17:29:57 +0000 (10:29 -0700)]
runtime: fix stacks_sys accounting

subtract freed count before span gets merged during free.

LGTM=dvyukov
R=dmitry, dvyukov
CC=golang-codereviews
https://golang.org/cl/112450045

10 years agocmd/addr2line, cmd/objdump: fix on amd64 Plan 9
David du Colombier [Sat, 19 Jul 2014 09:16:16 +0000 (12:16 +0300)]
cmd/addr2line, cmd/objdump: fix on amd64 Plan 9

Fix virtual address of the start of the text segment
on amd64 Plan 9.

This issue has been partially fixed in cmd/add2line,
as part of CL 106460044, but we forgot to report the
change to cmd/objdump.

In the meantime, we also fixed the textStart address
in both cmd/add2line and cmd/objdump.

LGTM=aram, ality, mischief
R=rsc, mischief, aram, ality
CC=golang-codereviews, jas
https://golang.org/cl/117920043

10 years agotest: add some tests for mismatches between call results and uses
Ian Lance Taylor [Sat, 19 Jul 2014 08:12:42 +0000 (01:12 -0700)]
test: add some tests for mismatches between call results and uses

LGTM=dvyukov
R=golang-codereviews, dvyukov
CC=golang-codereviews
https://golang.org/cl/111360045

10 years agocodereview: abort 'hg commit' before entering commit message.
Shenghou Ma [Sat, 19 Jul 2014 01:04:56 +0000 (21:04 -0400)]
codereview: abort 'hg commit' before entering commit message.

Hook pre-commit runs before 'hg commit' command whereas hook precommit runs
after the user has entered commit message.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/106320043

10 years agocodereview: revive the tests.
Shenghou Ma [Sat, 19 Jul 2014 01:00:35 +0000 (21:00 -0400)]
codereview: revive the tests.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/105500043

10 years agotest: add test for issue8347
Shenghou Ma [Sat, 19 Jul 2014 00:59:55 +0000 (20:59 -0400)]
test: add test for issue8347

Fixes #8347.

LGTM=dave
R=golang-codereviews, dave
CC=golang-codereviews
https://golang.org/cl/109600044

10 years agoruntime: use uint32 arrays in BenchmarkClearFat*
Josh Bleecher Snyder [Fri, 18 Jul 2014 19:41:20 +0000 (12:41 -0700)]
runtime: use uint32 arrays in BenchmarkClearFat*

The CopyFat benchmarks were changed in CL 92760044. See CL 111350043 for discussion.

LGTM=khr
R=khr
CC=golang-codereviews
https://golang.org/cl/116000043

10 years agoruntime: add Benchmark[Clear|Copy]Fat[16|24]
Josh Bleecher Snyder [Fri, 18 Jul 2014 19:18:36 +0000 (12:18 -0700)]
runtime: add Benchmark[Clear|Copy]Fat[16|24]

These benchmarks are important for performance. When compiling the stdlib:

* 77.1% of the calls to sgen (copyfat) are for 16 bytes; another 8.7% are for 24 bytes. (The next most common is 32 bytes, at 5.7%.)
* Over half the calls to clearfat are for 16 or 24 bytes.

LGTM=khr
R=golang-codereviews, khr
CC=golang-codereviews
https://golang.org/cl/111350043

10 years agoos: broaden the range of errors understood by IsNotExist on Plan 9
Nicolas Owens [Fri, 18 Jul 2014 18:04:29 +0000 (11:04 -0700)]
os: broaden the range of errors understood by IsNotExist on Plan 9

Ken's standalone file server and its derivatives, like cwfs, return
error strings different from fossil when the user opens non-existent
files.

LGTM=aram, 0intro, r
R=0intro, aram, r
CC=golang-codereviews, ken
https://golang.org/cl/112420045

10 years agogo/ast: fix typo in comment
Josh Bleecher Snyder [Fri, 18 Jul 2014 16:58:54 +0000 (09:58 -0700)]
go/ast: fix typo in comment

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/111330043

10 years agobufio: fix UnreadSlice followed by UnreadRune
Egon Elbre [Fri, 18 Jul 2014 16:25:59 +0000 (09:25 -0700)]
bufio: fix UnreadSlice followed by UnreadRune

Also, fix a write check in writeBuf and make some bounds checks simpler.

LGTM=gri
R=golang-codereviews, adg, gri, r, minux
CC=golang-codereviews
https://golang.org/cl/113060043

10 years agoA+C: add Xia Bin (individual CLA)
Russ Cox [Fri, 18 Jul 2014 16:04:39 +0000 (12:04 -0400)]
A+C: add Xia Bin (individual CLA)

This CLA replaces the one for 'snyh'.
Verified by hand.

LGTM=minux
R=iant, minux
CC=golang-codereviews
https://golang.org/cl/112420043

10 years agoruntime: fix gctrace=1
Keith Randall [Fri, 18 Jul 2014 09:05:21 +0000 (13:05 +0400)]
runtime: fix gctrace=1

updatememstats is called on both the m and g stacks.
Call into flushallmcaches correctly.  flushallmcaches
can only run on the M stack.

This is somewhat temporary.  once ReadMemStats is in
Go we can have all of this code M-only.

LGTM=dvyukov
R=golang-codereviews, dvyukov
CC=golang-codereviews
https://golang.org/cl/116880043

10 years agogo/printer: simplify test
Dmitriy Vyukov [Fri, 18 Jul 2014 08:44:24 +0000 (12:44 +0400)]
go/printer: simplify test
Pre Go1?

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/115870043

10 years agoencoding/gob: remove unnecessary receivers
Dmitriy Vyukov [Fri, 18 Jul 2014 08:39:00 +0000 (12:39 +0400)]
encoding/gob: remove unnecessary receivers
Encoder compilation must be enc-independent,
because the resulting program is reused across
different encoders.

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/115860043

10 years agoundo CL 109640045 / f97fb06525e5
Shenghou Ma [Fri, 18 Jul 2014 06:59:54 +0000 (02:59 -0400)]
undo CL 109640045 / f97fb06525e5

Breaks build for FreeBSD. Probably clang related?

««« original CL description
cmd/cgo: disable inappropriate warnings when the gcc struct is empty

package main
//#cgo CFLAGS: -Wall
//void test() {}
import "C"
func main() {
    C.test()
}

This code will cause gcc issuing warnings about unused variable.

This commit use offset of the second return value of
Packages.structType to detect whether the gcc struct is empty,
and if it's directly invoke the C function instead of writing an
unused code.

LGTM=dave, minux
R=golang-codereviews, iant, minux, dave
CC=golang-codereviews
https://golang.org/cl/109640045

»»»

TBR=dfc
R=dave
CC=golang-codereviews
https://golang.org/cl/114990044

10 years agocmd/cgo: disable inappropriate warnings when the gcc struct is empty
snyh [Fri, 18 Jul 2014 06:47:21 +0000 (02:47 -0400)]
cmd/cgo: disable inappropriate warnings when the gcc struct is empty

package main
//#cgo CFLAGS: -Wall
//void test() {}
import "C"
func main() {
    C.test()
}

This code will cause gcc issuing warnings about unused variable.

This commit use offset of the second return value of
Packages.structType to detect whether the gcc struct is empty,
and if it's directly invoke the C function instead of writing an
unused code.

LGTM=dave, minux
R=golang-codereviews, iant, minux, dave
CC=golang-codereviews
https://golang.org/cl/109640045

10 years agoruntime: add throwgo
Dave Cheney [Fri, 18 Jul 2014 06:30:38 +0000 (16:30 +1000)]
runtime: add throwgo

Fixes #8380.

Also update hashmap.go to use throwgo rather than panic.

LGTM=khr
R=khr, rsc
CC=golang-codereviews
https://golang.org/cl/115860045

10 years agoundo CL 101570044 / 2c57aaea79c4
Keith Randall [Thu, 17 Jul 2014 21:41:46 +0000 (14:41 -0700)]
undo CL 101570044 / 2c57aaea79c4

redo stack allocation.  This is mostly the same as
the original CL with a few bug fixes.

1. add racemalloc() for stack allocations
2. fix poolalloc/poolfree to terminate free lists correctly.
3. adjust span ref count correctly.
4. don't use cache for sizes >= StackCacheSize.

Should fix bugs and memory leaks in original changelist.

««« original CL description
undo CL 104200047 / 318b04f28372

Breaks windows and race detector.
TBR=rsc

««« original CL description
runtime: stack allocator, separate from mallocgc

In order to move malloc to Go, we need to have a
separate stack allocator.  If we run out of stack
during malloc, malloc will not be available
to allocate a new stack.

Stacks are the last remaining FlagNoGC objects in the
GC heap.  Once they are out, we can get rid of the
distinction between the allocated/blockboundary bits.
(This will be in a separate change.)

Fixes #7468
Fixes #7424

LGTM=rsc, dvyukov
R=golang-codereviews, dvyukov, khr, dave, rsc
CC=golang-codereviews
https://golang.org/cl/104200047
»»»

TBR=rsc
CC=golang-codereviews
https://golang.org/cl/101570044
»»»

LGTM=dvyukov
R=dvyukov, dave, khr, alex.brainman
CC=golang-codereviews
https://golang.org/cl/112240044

10 years agosync: fix typo in benchmark name
Josh Bleecher Snyder [Thu, 17 Jul 2014 19:50:56 +0000 (12:50 -0700)]
sync: fix typo in benchmark name

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/118860043

10 years agoruntime: make NumGoroutines faster
Dmitriy Vyukov [Thu, 17 Jul 2014 17:51:03 +0000 (21:51 +0400)]
runtime: make NumGoroutines faster
Resolves TODO for not walking all goroutines in NumGoroutines.

LGTM=khr
R=golang-codereviews, khr
CC=golang-codereviews, rsc
https://golang.org/cl/107290044

10 years agoruntime: improve select benchmarks
Dmitriy Vyukov [Thu, 17 Jul 2014 17:49:45 +0000 (21:49 +0400)]
runtime: improve select benchmarks
1. Add select on sync channels benchmark.
2. Make channels in BenchmarkSelectNonblock shared.
With GOMAXPROCS=1 it is the same, but with GOMAXPROCS>1
it becomes a more interesting benchmark.

LGTM=khr
R=golang-codereviews, khr
CC=golang-codereviews
https://golang.org/cl/115780043

10 years agostrings: remove byteBitmap
Rui Ueyama [Thu, 17 Jul 2014 16:55:12 +0000 (09:55 -0700)]
strings: remove byteBitmap

Previously we had a bitmap to check whether or not a byte
appears in a string should be replaced. But we don't actually
need a separate bitmap for that purpose. Removing the bitmap
makes the code simpler.

LGTM=dave, iant, nigeltao
R=golang-codereviews, dave, gobot, nigeltao, iant, bradfitz, rsc
CC=golang-codereviews
https://golang.org/cl/110100043

10 years agogofmt: -s flag simplifies "for _ = range x"
Robert Griesemer [Thu, 17 Jul 2014 16:40:27 +0000 (09:40 -0700)]
gofmt: -s flag simplifies "for _ = range x"

LGTM=adonovan, rsc
R=rsc, adonovan
CC=golang-codereviews
https://golang.org/cl/117800043

10 years agoos: Implement symlink support for Windows
Michael Fraenkel [Thu, 17 Jul 2014 07:02:46 +0000 (17:02 +1000)]
os: Implement symlink support for Windows

Fixes #5750.

https://code.google.com/p/go/issues/detail?id=5750

os: Separate windows from posix. Implement windows support.
path/filepath: Use the same implementation as other platforms
syscall: Add/rework new APIs for Windows

LGTM=alex.brainman
R=golang-codereviews, alex.brainman, gobot, rsc, minux
CC=golang-codereviews
https://golang.org/cl/86160044

10 years agoA+C: snyh (individual CLA)
Shenghou Ma [Thu, 17 Jul 2014 05:35:53 +0000 (01:35 -0400)]
A+C: snyh (individual CLA)

Generated by a+c.

R=gobot
CC=golang-codereviews
https://golang.org/cl/114890043

10 years agoruntime: align gomemeq return value correctly
Keith Randall [Thu, 17 Jul 2014 00:16:12 +0000 (17:16 -0700)]
runtime: align gomemeq return value correctly

Fixes #8378

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/114880043

10 years agoarchive/tar: fix writing of pax headers
Cristian Staretu [Thu, 17 Jul 2014 00:00:29 +0000 (10:00 +1000)]
archive/tar: fix writing of pax headers

"archive/tar: reuse temporary buffer in writeHeader" introduced a
change which was supposed to help lower the number of allocations from
512 bytes for every call to writeHeader. This change broke the writing
of PAX headers.

writeHeader calls writePAXHeader and writePAXHeader calls writeHeader
again. writeHeader will end up writing the PAX header twice.

example broken header:
PaxHeaders.4007/NetLock_Arany_=Class_Gold=_Ftanstvny.crt0000000000000000000000000000007112301216634021512 xustar0000000000000000
PaxHeaders.4007/NetLock_Arany_=Class_Gold=_Ftanstvny.crt0000000000000000000000000000007112301216634021512 xustar0000000000000000

example correct header:
PaxHeaders.4290/NetLock_Arany_=Class_Gold=_Ftanstvny.crt0000000000000000000000000000007112301216634021516 xustar0000000000000000
0100644000000000000000000000270412301216634007250 0ustar0000000000000000

This commit adds a dedicated buffer for pax headers to the Writer
struct. This change increases the size of the struct by 512 bytes, but
allows tar/writer to avoid allocating 512 bytes for all written
headers and it avoids allocating 512 more bytes for pax headers.

LGTM=dsymonds
R=dsymonds, dave, iant
CC=golang-codereviews
https://golang.org/cl/110480043

10 years agosrc, misc: applied gofmt -s -w
Robert Griesemer [Wed, 16 Jul 2014 23:29:51 +0000 (16:29 -0700)]
src, misc: applied gofmt -s -w

Pending CL 113120043.

LGTM=dave
R=golang-codereviews, dave
CC=golang-codereviews
https://golang.org/cl/112290043

10 years agocmd/gc: implement 'for range x {'
Russ Cox [Wed, 16 Jul 2014 23:27:10 +0000 (19:27 -0400)]
cmd/gc: implement 'for range x {'

Fixes #6102.

LGTM=gri
R=ken, r, gri
CC=golang-codereviews
https://golang.org/cl/113120043

10 years agotime: change nsec back to int32
Russ Cox [Wed, 16 Jul 2014 23:26:45 +0000 (19:26 -0400)]
time: change nsec back to int32

The garbage collector and stack scans are good enough now.

Fixes #7446.

LGTM=r
R=r, dvyukov
CC=golang-codereviews, mdempsky, mtj
https://golang.org/cl/112870046

10 years agoliblink: fix precedence bug in pcdata comparison
Russ Cox [Wed, 16 Jul 2014 23:26:36 +0000 (19:26 -0400)]
liblink: fix precedence bug in pcdata comparison

As written, the ! applies before the &1.
This would crash writing out missing pcdata tables
if we ever used non-contiguous IDs in a function.
We don't, but fix anyway.

LGTM=iant, minux
R=minux, iant
CC=golang-codereviews
https://golang.org/cl/117810047

10 years agoruntime: convert map implementation to Go.
Keith Randall [Wed, 16 Jul 2014 21:16:19 +0000 (14:16 -0700)]
runtime: convert map implementation to Go.

It's a bit slower, but not painfully so.  There is still room for
improvement (saving space so we can use nosplit, and removing the
requirement for hash/eq stubs).

benchmark                              old ns/op     new ns/op     delta
BenchmarkMegMap                        23.5          24.2          +2.98%
BenchmarkMegOneMap                     14.9          15.7          +5.37%
BenchmarkMegEqMap                      71668         72234         +0.79%
BenchmarkMegEmptyMap                   4.05          4.93          +21.73%
BenchmarkSmallStrMap                   21.9          22.5          +2.74%
BenchmarkMapStringKeysEight_16         23.1          26.3          +13.85%
BenchmarkMapStringKeysEight_32         21.9          25.0          +14.16%
BenchmarkMapStringKeysEight_64         21.9          25.1          +14.61%
BenchmarkMapStringKeysEight_1M         21.9          25.0          +14.16%
BenchmarkIntMap                        21.8          12.5          -42.66%
BenchmarkRepeatedLookupStrMapKey32     39.3          30.2          -23.16%
BenchmarkRepeatedLookupStrMapKey1M     322353        322675        +0.10%
BenchmarkNewEmptyMap                   129           136           +5.43%
BenchmarkMapIter                       137           107           -21.90%
BenchmarkMapIterEmpty                  7.14          8.71          +21.99%
BenchmarkSameLengthMap                 5.24          6.82          +30.15%
BenchmarkBigKeyMap                     34.5          35.3          +2.32%
BenchmarkBigValMap                     36.1          36.1          +0.00%
BenchmarkSmallKeyMap                   26.9          26.7          -0.74%

LGTM=rsc
R=golang-codereviews, dave, dvyukov, rsc, gobot, khr
CC=golang-codereviews
https://golang.org/cl/99380043

10 years agostrconv: fix handling of BOMs in CanBackquote
Volker Dobler [Wed, 16 Jul 2014 20:06:11 +0000 (13:06 -0700)]
strconv: fix handling of BOMs in CanBackquote

A byte order mark  (BOM) cannot be backquoted.

LGTM=r
R=golang-codereviews, gobot, r
CC=golang-codereviews
https://golang.org/cl/112310043

10 years agoflag: fix typo
Matthew Cottingham [Wed, 16 Jul 2014 19:27:25 +0000 (12:27 -0700)]
flag: fix typo

LGTM=r
R=golang-codereviews, gobot, r
CC=golang-codereviews
https://golang.org/cl/114850043

10 years agocmd/ld: use count, not upper bound, in type of array
Rob Pike [Wed, 16 Jul 2014 18:26:50 +0000 (18:26 +0000)]
cmd/ld: use count, not upper bound, in type of array
DWARF says only one is necessary.
The count is preferable because it admits 0-length arrays.
Update debug/dwarf to handle either form.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/111230044

10 years agocmd/go/doc: Fix example domain
Yasuhiro Matsumoto [Wed, 16 Jul 2014 10:48:57 +0000 (20:48 +1000)]
cmd/go/doc: Fix example domain
code.org exists

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/95500043

10 years agoruntime: start goroutine ids at 1
Dmitriy Vyukov [Wed, 16 Jul 2014 08:19:33 +0000 (12:19 +0400)]
runtime: start goroutine ids at 1

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews, khr
https://golang.org/cl/117810043

10 years agocompress/bzip2: fix panics on malformed input.
Adam Langley [Wed, 16 Jul 2014 01:44:33 +0000 (18:44 -0700)]
compress/bzip2: fix panics on malformed input.

Fixes 8363.

LGTM=bradfitz
R=bradfitz
CC=golang-codereviews
https://golang.org/cl/114810043

10 years agocmd/ld: change DWARF encoding for array lengths
Rob Pike [Tue, 15 Jul 2014 21:18:18 +0000 (21:18 +0000)]
cmd/ld: change DWARF encoding for array lengths
They can be large, so use a varint encoding rather than only one byte.

LGTM=iant, rsc
R=rsc, iant
CC=golang-codereviews
https://golang.org/cl/113180043

10 years agocmd/ld: consistently document flags that expect values
Matthew Dempsky [Tue, 15 Jul 2014 21:05:35 +0000 (17:05 -0400)]
cmd/ld: consistently document flags that expect values

LGTM=minux, rsc
R=golang-codereviews, minux, rsc
CC=golang-codereviews
https://golang.org/cl/113970044

10 years agoobjdump: remove out-of-date comment
Matthew Dempsky [Tue, 15 Jul 2014 13:03:36 +0000 (06:03 -0700)]
objdump: remove out-of-date comment

LGTM=iant
R=rsc, iant
CC=golang-codereviews
https://golang.org/cl/112320043

10 years agoruntime: make a test more robust
Dmitriy Vyukov [Tue, 15 Jul 2014 06:30:12 +0000 (10:30 +0400)]
runtime: make a test more robust
The issue is discovered during testing of a change to runtime.
Even if it is unlikely to happen, the comment can safe an hour
next person who hits it.

LGTM=khr
R=golang-codereviews, khr
CC=golang-codereviews, rlh, rsc
https://golang.org/cl/116790043

10 years agoruntime: zero dangling pointer
Dmitriy Vyukov [Tue, 15 Jul 2014 06:27:36 +0000 (10:27 +0400)]
runtime: zero dangling pointer
I don't see how it can lead to bad things today.
But it's better to kill it before it does.

LGTM=khr
R=golang-codereviews, khr
CC=golang-codereviews, rsc
https://golang.org/cl/111130045

10 years agonet: Don't read beyond end of slice when parsing resolv.conf options.
Jakob Borg [Tue, 15 Jul 2014 04:49:26 +0000 (14:49 +1000)]
net: Don't read beyond end of slice when parsing resolv.conf options.

Fixes #8252.

LGTM=adg
R=ruiu, josharian, adg
CC=golang-codereviews
https://golang.org/cl/102470046

10 years agocmd/go: skip vcs tests on nacl and android
Dave Cheney [Tue, 15 Jul 2014 04:45:59 +0000 (14:45 +1000)]
cmd/go: skip vcs tests on nacl and android

        Fixes build failures on nacl/* and android/* platforms.

LGTM=adg
R=golang-codereviews, adg
CC=golang-codereviews
https://golang.org/cl/113140043

10 years agostrconv: fix CanBackquote for invalid UTF-8
Volker Dobler [Tue, 15 Jul 2014 02:49:26 +0000 (19:49 -0700)]
strconv: fix CanBackquote for invalid UTF-8

Make CanBackquote(invalid UTF-8) return false.

Also add two test which show that CanBackquote reports
true for strings containing a BOM.

Fixes #7572.

LGTM=r
R=golang-codereviews, bradfitz, r
CC=golang-codereviews
https://golang.org/cl/111780045

10 years agogo/ast: fix walk to handle "for range x"
Robert Griesemer [Tue, 15 Jul 2014 02:14:27 +0000 (19:14 -0700)]
go/ast: fix walk to handle "for range x"

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/117790043

10 years agocmd/ld: generate correct upper bound value for array types.
Rob Pike [Tue, 15 Jul 2014 01:38:05 +0000 (01:38 +0000)]
cmd/ld: generate correct upper bound value for array types.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/115820043

10 years agogo get: Support for IBM DevOps Services (hub.jazz.net) git repos
Chris McGee [Tue, 15 Jul 2014 01:27:04 +0000 (11:27 +1000)]
go get: Support for IBM DevOps Services (hub.jazz.net) git repos

LGTM=adg
R=golang-codereviews, adg, minux
CC=golang-codereviews
https://golang.org/cl/106740044

10 years agoA+C: add Chris McGee (individual CLA)
Andrew Gerrand [Tue, 15 Jul 2014 01:25:39 +0000 (11:25 +1000)]
A+C: add Chris McGee (individual CLA)

TBR=dsymonds
R=golang-codereviews
CC=golang-codereviews
https://golang.org/cl/112300043

10 years agoruntime: refactor routines for stopping, running goroutine from m
Russ Cox [Tue, 15 Jul 2014 00:56:37 +0000 (20:56 -0400)]
runtime: refactor routines for stopping, running goroutine from m

This CL adds 'dropg', which is called to drop the association
between m and its current goroutine, and it makes schedule
handle locked goroutines correctly, instead of requiring all
callers of schedule to do that.

The effect is that if you want to take over an m for, say,
garbage collection work while still allowing the current g
to run on some other m, you can do an mcall to a function
that is:

        // dissociate gp
        dropg();
        gp->status = Gwaiting; // for ready

        // put gp on run queue for others to find
        runtime·ready(gp);

        /* ... do other work here ... */

        // done with m, let it run goroutines again
        schedule();

Before this CL, the dropg() body had to be written explicitly,
and the check for lockedg before schedule had to be
written explicitly too, both of which make the code a bit
more fragile than it needs to be.

LGTM=iant
R=dvyukov, iant
CC=golang-codereviews, rlh
https://golang.org/cl/113110043

10 years agogo/*: permit "for range x"
Robert Griesemer [Mon, 14 Jul 2014 23:17:17 +0000 (16:17 -0700)]
go/*: permit "for range x"

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/112970044

10 years agodoc/go1.4.txt: permit for range x
Rob Pike [Mon, 14 Jul 2014 22:45:14 +0000 (15:45 -0700)]
doc/go1.4.txt: permit for range x

CC=golang-codereviews
https://golang.org/cl/110640044

10 years agospec: permit "for range x" (no index variables)
Robert Griesemer [Mon, 14 Jul 2014 22:08:09 +0000 (15:08 -0700)]
spec: permit "for range x" (no index variables)

This is a fully backward-compatible language change.

There are not a lot of cases in the std library, but
there are some. Arguably this makes the syntax a bit
more regular - any trailing index variable that is _
can be left away, and there's some analogy to type
switches where the temporary can be left away.

Implementation-wise the change should be trivial as
it can be done completely syntactically. For instance,
the respective change in go/parser is a dozen lines
(see https://golang.org/cl/112970044 ).

Fixes #6102.

LGTM=iant, r, rsc
R=r, rsc, iant, ken
CC=golang-codereviews
https://golang.org/cl/104680043

10 years agocmd/go: introduce support for $GCCGO env var
Peter Collingbourne [Mon, 14 Jul 2014 13:51:20 +0000 (09:51 -0400)]
cmd/go: introduce support for $GCCGO env var

This variable allows users to select the compiler when using the
gccgo toolchain.

LGTM=rsc
R=rsc, iant, minux, aram
CC=axwalk, golang-codereviews
https://golang.org/cl/106700044

10 years agomake.bat: return exit code to dashboard builder
Alex Brainman [Sat, 12 Jul 2014 05:18:36 +0000 (15:18 +1000)]
make.bat: return exit code to dashboard builder

Fixes #7806.

LGTM=minux
R=golang-codereviews, minux
CC=golang-codereviews
https://golang.org/cl/104690043

10 years agocmd/ld: add go-specific dwarf type information
Russ Cox [Sat, 12 Jul 2014 03:10:00 +0000 (23:10 -0400)]
cmd/ld: add go-specific dwarf type information

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/116720043

10 years agoliblink: fix warnings on Plan 9
David du Colombier [Fri, 11 Jul 2014 20:24:45 +0000 (22:24 +0200)]
liblink: fix warnings on Plan 9

warning: /usr/go/src/liblink/asm5.c:720 set and not used: m
warning: /usr/go/src/liblink/asm5.c:807 set and not used: c

LGTM=minux
R=minux
CC=golang-codereviews
https://golang.org/cl/108570043

10 years agold: change DWARF output for structs
Rob Pike [Fri, 11 Jul 2014 15:16:00 +0000 (15:16 +0000)]
ld: change DWARF output for structs
The debug/dwarf package cannot parse the format generated here,
but the format can be changed so it does.
After this edit, tweaking the expression defining the offset
of a struct field, the dwarf package can parse the tables (again?).

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/105710043

10 years agoimage/png: interlacing support for png.
Dustin Long [Fri, 11 Jul 2014 01:02:02 +0000 (11:02 +1000)]
image/png: interlacing support for png.

Fixes #6293.

Image "testdata/benchRGB-interlace.png" was generated by opening "testdata/benchRGB.png" in the editor Gimp and saving it with interlacing enabled.

Benchmark:
BenchmarkDecodeRGB              500    7014194 ns/op   37.37 MB/s
ok   pkg/image/png 4.657s

BenchmarkDecodeInterlacing      100   10623241 ns/op   24.68 MB/s
ok   pkg/image/png 1.339s

LGTM=nigeltao
R=nigeltao, andybons, matrixik
CC=golang-codereviews
https://golang.org/cl/102130044

10 years agocmd/go: do not fail if libgcc does not exist
Benny Siegert [Thu, 10 Jul 2014 21:35:04 +0000 (14:35 -0700)]
cmd/go: do not fail if libgcc does not exist

(This is a patch from the pkgsrc Go package.)

LGTM=iant
R=golang-codereviews, iant, joerg.sonnenberger, dave
CC=golang-codereviews, joerg
https://golang.org/cl/108340043

10 years agodebug/elf: add (*File).DynamicSymbols, ErrNoSymbols, and tests for (*File).Symbols...
Pietro Gagliardi [Thu, 10 Jul 2014 19:44:40 +0000 (12:44 -0700)]
debug/elf: add (*File).DynamicSymbols, ErrNoSymbols, and tests for (*File).Symbols and (*File).DynamicSymbols, and formalize symbol order.

Added a complement to (*File).Symbols for the dynamic symbol table.
Would be useful, for instance, if seraching for certain shared objects
compatible with certain libraries (for instance, LADSPA requires an
exported symbol "ladspa_descriptor").

Added a variable ErrNoSymbols that canonicalizes a return from
(*File).Symbols and (*File).DyanmicSymbols if the file has no symbols.

Added tests for both (*File).Symbols and (*File).DynamicSymbols;
there was never a test for (*File).Symbols at all. A small C program using
libelf, included in the test data, was used to produce the golden
symbols to compare against.

As part of the requirements for testing, (*File).Symbols and (*File).DynamicSymbols now document the order in which the symbol tables are returned (in the order the symbols appear in the file).

All tests currently pass.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/107530043

10 years agonacltest.bash: set GOROOT before invoking cmd/go
Shenghou Ma [Thu, 10 Jul 2014 19:36:48 +0000 (15:36 -0400)]
nacltest.bash: set GOROOT before invoking cmd/go
The builder builds with GOROOT_FINAL=/usr/local/go set.

TBR=rsc
R=golang-codereviews
CC=golang-codereviews
https://golang.org/cl/112100043

10 years agonacltest.bash: nacl/arm support.
Shenghou Ma [Thu, 10 Jul 2014 19:15:41 +0000 (15:15 -0400)]
nacltest.bash: nacl/arm support.
Also detect GOARCH automatically based on `uname -m`.

LGTM=crawshaw, dave, rsc
R=rsc, iant, crawshaw, dave
CC=golang-codereviews
https://golang.org/cl/111780043

10 years agomisc/nacl: add go_nacl_arm_exec, update README
Shenghou Ma [Thu, 10 Jul 2014 19:15:32 +0000 (15:15 -0400)]
misc/nacl: add go_nacl_arm_exec, update README

LGTM=dave, rsc
R=rsc, iant, dave
CC=golang-codereviews
https://golang.org/cl/109390043

10 years agocmd/dist: always use GOARM=7 for nacl/arm
Shenghou Ma [Thu, 10 Jul 2014 19:15:24 +0000 (15:15 -0400)]
cmd/dist: always use GOARM=7 for nacl/arm

LGTM=dave, rsc
R=rsc, iant, dave
CC=golang-codereviews
https://golang.org/cl/101590044

10 years agocrypto/rc4: disable assembly implementation for nacl/arm.
Shenghou Ma [Thu, 10 Jul 2014 19:15:16 +0000 (15:15 -0400)]
crypto/rc4: disable assembly implementation for nacl/arm.
It uses an unsupported addressing mode.

LGTM=iant, rsc
R=rsc, iant
CC=golang-codereviews
https://golang.org/cl/106370043

10 years agosyscall: nacl/arm support.
Shenghou Ma [Thu, 10 Jul 2014 19:15:06 +0000 (15:15 -0400)]
syscall: nacl/arm support.

LGTM=dave, rsc
R=rsc, iant, dave
CC=golang-codereviews
https://golang.org/cl/101620043

10 years agosync/atomic: nacl/arm support.
Shenghou Ma [Thu, 10 Jul 2014 19:14:58 +0000 (15:14 -0400)]
sync/atomic: nacl/arm support.

LGTM=dave, rsc
R=rsc, iant, dave
CC=golang-codereviews
https://golang.org/cl/110330044

10 years agoruntime: nacl/arm support.
Shenghou Ma [Thu, 10 Jul 2014 19:14:49 +0000 (15:14 -0400)]
runtime: nacl/arm support.

LGTM=rsc
R=rsc, iant, dave
CC=golang-codereviews
https://golang.org/cl/103680046

10 years agocmd/5c, cmd/5g, cmd/5l, liblink: nacl/arm support
Shenghou Ma [Thu, 10 Jul 2014 19:14:37 +0000 (15:14 -0400)]
cmd/5c, cmd/5g, cmd/5l, liblink: nacl/arm support

LGTM=dave, rsc
R=rsc, iant, dave
CC=golang-codereviews
https://golang.org/cl/108360043

10 years agoA+C: add Dustin Long (Markover Inc. DBA Poptip corporate CLA).
Nigel Tao [Thu, 10 Jul 2014 08:08:33 +0000 (18:08 +1000)]
A+C: add Dustin Long (Markover Inc. DBA Poptip corporate CLA).

LGTM=adg
R=adg
CC=dustmop, golang-codereviews
https://golang.org/cl/111000044

10 years agoruntime: align stack before calling windows in usleep2
Alex Brainman [Thu, 10 Jul 2014 04:23:50 +0000 (14:23 +1000)]
runtime: align stack before calling windows in usleep2

Fixes #8174.

LGTM=minux
R=golang-codereviews, minux
CC=golang-codereviews
https://golang.org/cl/102360043

10 years agoruntime: ignore exceptions from foreign threads.
Shenghou Ma [Thu, 10 Jul 2014 03:55:35 +0000 (23:55 -0400)]
runtime: ignore exceptions from foreign threads.
Fixes #8224.

LGTM=alex.brainman, rsc
R=alex.brainman, rsc, dave
CC=golang-codereviews
https://golang.org/cl/104200046

10 years agonet/rpc: use html/template to render html
Josh Bleecher Snyder [Thu, 10 Jul 2014 02:33:45 +0000 (19:33 -0700)]
net/rpc: use html/template to render html

Found using the vet check in CL 106370045.

This is a second attempt at CL 101670044, which omitted the deps_test change.

This adds dependencies to net/rpc:

        encoding
        encoding/base64
        encoding/json
        html
        unicode/utf16

The obvious correctness and security warrants the additional dependencies.

LGTM=rsc
R=r, minux, rsc, adg
CC=golang-codereviews
https://golang.org/cl/110890043

10 years agoA+C: Manuel Mendez (individual CLA)
Andrew Gerrand [Thu, 10 Jul 2014 00:49:59 +0000 (10:49 +1000)]
A+C: Manuel Mendez (individual CLA)

Generated by a+c.

R=gobot
CC=golang-codereviews
https://golang.org/cl/110970047

10 years agodocs: Make consistent use of optional li closing tags.
Robin Eklind [Wed, 9 Jul 2014 21:26:37 +0000 (14:26 -0700)]
docs: Make consistent use of optional li closing tags.

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/105100044

10 years agoandroidtest.bash: missing !
David Crawshaw [Wed, 9 Jul 2014 18:54:11 +0000 (14:54 -0400)]
androidtest.bash: missing !

LGTM=iant
R=bradfitz, iant
CC=golang-codereviews
https://golang.org/cl/112010045

10 years agoos: no /tmp on android
David Crawshaw [Wed, 9 Jul 2014 18:12:30 +0000 (14:12 -0400)]
os: no /tmp on android

LGTM=minux, bradfitz
R=golang-codereviews, minux, bradfitz
CC=golang-codereviews
https://golang.org/cl/104650043

10 years agocmd/go: use $CC to build _cgo_defun.c
Peter Collingbourne [Wed, 9 Jul 2014 17:04:38 +0000 (10:04 -0700)]
cmd/go: use $CC to build _cgo_defun.c

LGTM=dave, iant
R=iant, dave
CC=golang-codereviews
https://golang.org/cl/112000043

10 years agoruntime: grow heap by 64K instead of 128K
Dmitriy Vyukov [Wed, 9 Jul 2014 13:00:54 +0000 (17:00 +0400)]
runtime: grow heap by 64K instead of 128K
When we've switched to 8K pages,
heap started to grow by 128K instead of 64K,
because it was implicitly assuming that pages are 4K.
Fix that and make the code more robust.

LGTM=khr
R=golang-codereviews, dave, khr
CC=golang-codereviews, rsc
https://golang.org/cl/106450044

10 years agoandroidtest.bash, misc/android: build scripts for android
David Crawshaw [Wed, 9 Jul 2014 10:56:49 +0000 (06:56 -0400)]
androidtest.bash, misc/android: build scripts for android

LGTM=minux
R=minux
CC=golang-codereviews
https://golang.org/cl/107640044

10 years agodebug/plan9obj: fix test build
Aram Hăvărneanu [Wed, 9 Jul 2014 10:48:55 +0000 (12:48 +0200)]
debug/plan9obj: fix test build

LGTM=0intro, dave
R=dave, 0intro
CC=golang-codereviews
https://golang.org/cl/106560044

10 years agosyscall: use the nsec system call instead of /dev/bintime on Plan 9
Aram Hăvărneanu [Wed, 9 Jul 2014 10:34:06 +0000 (12:34 +0200)]
syscall: use the nsec system call instead of /dev/bintime on Plan 9

Also remove arch-specific Go files in the Plan 9 syscall package

LGTM=0intro
R=0intro, dave
CC=ality, golang-codereviews, jas, mischief, rsc
https://golang.org/cl/112720043

10 years agoruntime: use the nsec system call instead of /dev/bintime on Plan 9
Aram Hăvărneanu [Wed, 9 Jul 2014 10:33:42 +0000 (12:33 +0200)]
runtime: use the nsec system call instead of /dev/bintime on Plan 9

LGTM=0intro
R=0intro
CC=ality, dave, golang-codereviews, jas, mischief, rsc
https://golang.org/cl/104570043

10 years agodebug/plan9obj, cmd/addr2line: on Plan 9 use a.out header
Aram Hăvărneanu [Wed, 9 Jul 2014 10:33:13 +0000 (12:33 +0200)]
debug/plan9obj, cmd/addr2line: on Plan 9 use a.out header
size instead of abusing text symbol

cmd/addr2line needs to know the virtual address of the start
of the text segment (load address plus header size). For
this, it used the text symbol added by the linker. This is
wrong on amd64. Header size is 40 bytes, not 32 like on 386
and arm. Function alignment is 16 bytes causing text to be
at 0x200030.

debug/plan9obj now exports both the load address and the
header size; cmd/addr2line uses this new information and
doesn't rely on text anymore.

LGTM=0intro
R=0intro, gobot, ality
CC=ality, golang-codereviews, jas, mischief
https://golang.org/cl/106460044

10 years agocmd/objdump: set goarch properly on non-386 Plan 9 systems
Aram Hăvărneanu [Wed, 9 Jul 2014 10:32:49 +0000 (12:32 +0200)]
cmd/objdump: set goarch properly on non-386 Plan 9 systems

LGTM=0intro, r
R=0intro, r
CC=ality, golang-codereviews, jas, mischief
https://golang.org/cl/108420043

10 years agosyscall: remove more NxM assumptions on Plan 9
Aram Hăvărneanu [Wed, 9 Jul 2014 10:32:18 +0000 (12:32 +0200)]
syscall: remove more NxM assumptions on Plan 9

LGTM=0intro, r
R=0intro, r
CC=ality, dave, golang-codereviews, jas, mischief, rsc
https://golang.org/cl/111910043

10 years agoos: fix failing test on Plan 9
Aram Hăvărneanu [Wed, 9 Jul 2014 10:31:20 +0000 (12:31 +0200)]
os: fix failing test on Plan 9

LGTM=0intro, r
R=0intro, r
CC=ality, dave, golang-codereviews, jas, mischief, rsc
https://golang.org/cl/105580044

10 years agosyscall: NetlinkRIB, avoid allocation in loop
Cristian Staretu [Wed, 9 Jul 2014 08:50:38 +0000 (18:50 +1000)]
syscall: NetlinkRIB, avoid allocation in loop

NetlinkRIB is currently allocating a page sized slice of bytes in a
for loop and it's also calling Getpagesize() in the same for loop.

This CL changes NetlinkRIB to preallocate the page sized slice of
bytes before reaching the for loop. This reduces memory allocations
and lowers the number of calls to Getpagesize() to 1 per NetlinkRIB
call.

This CL reduces the allocated memory from 141.5 MB down to 52 MB in
a test.

LGTM=crawshaw, dave
R=dave, dsymonds, crawshaw
CC=bradfitz, dsymonds, golang-codereviews
https://golang.org/cl/110920043

10 years agocmd/go: fix build -o panic when import path pattern matches 0 pkgs
Dmitri Shuralyov [Wed, 9 Jul 2014 03:17:27 +0000 (13:17 +1000)]
cmd/go: fix build -o panic when import path pattern matches 0 pkgs

Fixes #8165.

After this change, the panic is replaced by a message:

        $ go build -o out ...doesntexist
        warning: "...doesntexist" matched no packages
        no packages to build

The motivation to return 1 exit error code is to allow -o flag
to be used to guarantee that the output binary is written to
when exit status is 0. If someone uses an import path pattern
to specify a single package and suddenly that matches no packages,
it's better to return exit code 1 instead of silently doing nothing.
This is consistent with the case when -o flag is given and multiple
packages are matched.
It's also somewhat consistent with the current behavior with the
panic, except that gave return code 2. But it's similar in
that it's also non-zero (indicating failure).
I've changed the language to be similar to output of go test
when an import path pattern matches no packages (it also has a return status of
1):

        $ go test ...doesntexist
        warning: "...doesntexist" matched no packages
        no packages to test

LGTM=adg
R=golang-codereviews, josharian, gobot, adg
CC=golang-codereviews
https://golang.org/cl/107140043

10 years agorun.bash: disable tests that don't (yet) like running off the host
David Crawshaw [Tue, 8 Jul 2014 22:41:07 +0000 (18:41 -0400)]
run.bash: disable tests that don't (yet) like running off the host

LGTM=bradfitz, minux
R=bradfitz, golang-codereviews, minux
CC=golang-codereviews
https://golang.org/cl/110940043

10 years agotest: add test for gccgo comment lexing failure
Ian Lance Taylor [Tue, 8 Jul 2014 21:09:35 +0000 (14:09 -0700)]
test: add test for gccgo comment lexing failure

http://gcc.gnu.org/PR61746

http://code.google.com/p/gofrontend/issues/detail?id=35

LGTM=crawshaw
R=golang-codereviews, crawshaw
CC=golang-codereviews
https://golang.org/cl/111980043