]> Cypherpunks repositories - gostls13.git/log
gostls13.git
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

10 years agogo/build: add android to the flock
David Crawshaw [Tue, 8 Jul 2014 21:04:18 +0000 (17:04 -0400)]
go/build: add android to the flock

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

10 years agoruntime: skip crash test on android
David Crawshaw [Tue, 8 Jul 2014 18:47:52 +0000 (14:47 -0400)]
runtime: skip crash test on android

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

10 years agoruntime: fix spurious "[string too long]" error
Dmitriy Vyukov [Tue, 8 Jul 2014 18:37:18 +0000 (22:37 +0400)]
runtime: fix spurious "[string too long]" error
Maxstring is not updated in the new string routines,
this makes runtime think that long strings are bogus.
Fixes #8339.

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

10 years agocmd/addr2line: skip test on android
David Crawshaw [Tue, 8 Jul 2014 17:45:31 +0000 (13:45 -0400)]
cmd/addr2line: skip test on android

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

10 years agocmd/pack: skip test on android (no Go tool)
David Crawshaw [Tue, 8 Jul 2014 17:45:06 +0000 (13:45 -0400)]
cmd/pack: skip test on android (no Go tool)

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

10 years agocmd/nm: skip test on android (no Go tool)
David Crawshaw [Tue, 8 Jul 2014 17:44:41 +0000 (13:44 -0400)]
cmd/nm: skip test on android (no Go tool)

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

10 years agoos: adjust tests for android file system
David Crawshaw [Tue, 8 Jul 2014 17:44:06 +0000 (13:44 -0400)]
os: adjust tests for android file system

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

10 years agocmd/objdump: skip test on android (no Go tool)
David Crawshaw [Tue, 8 Jul 2014 17:43:22 +0000 (13:43 -0400)]
cmd/objdump: skip test on android (no Go tool)

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

10 years agocrypto/x509: skip test on android (no Go tool)
David Crawshaw [Tue, 8 Jul 2014 17:43:02 +0000 (13:43 -0400)]
crypto/x509: skip test on android (no Go tool)

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

10 years agonet: no AI_ALL on android
David Crawshaw [Tue, 8 Jul 2014 17:42:14 +0000 (13:42 -0400)]
net: no AI_ALL on android

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

10 years agonet: treat android like linux in tests
David Crawshaw [Tue, 8 Jul 2014 17:41:18 +0000 (13:41 -0400)]
net: treat android like linux in tests

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

10 years agoundo CL 101670044 / 49a6cbd80cf2
Josh Bleecher Snyder [Tue, 8 Jul 2014 00:10:33 +0000 (17:10 -0700)]
undo CL 101670044 / 49a6cbd80cf2

Broke build; missing deps_test change. Will re-send the original with the appropriate fix.

««« original CL description
net/rpc: use html/template to render html

Found using the vet check in CL 106370045.

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

TBR=r
CC=golang-codereviews
https://golang.org/cl/110880044

10 years agonet/rpc: use html/template to render html
Josh Bleecher Snyder [Mon, 7 Jul 2014 23:57:07 +0000 (16:57 -0700)]
net/rpc: use html/template to render html

Found using the vet check in CL 106370045.

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

10 years agocmd/ld: fix off-by-one in DWARF frame tables
Rob Pike [Mon, 7 Jul 2014 23:07:24 +0000 (16:07 -0700)]
cmd/ld: fix off-by-one in DWARF frame tables
The code generating the .debug_frame section emits pairs of "advance PC",
"set SP offset" pseudo-instructions. Before the fix, the PC advance comes
out before the SP setting, which means the emitted offset for a block is
actually the value at the end of the block, which is incorrect for the
block itself.

The easiest way to fix this problem is to emit the SP offset before the
PC advance.

One delicate point: the last instruction to come out is now an
"advance PC", which means that if there are padding intsructions after
the final RET, they will appear to have a non-zero offset. This is odd
but harmless because there is no legal way to have a PC in that range,
or to put it another way, if you get here the SP is certainly screwed up
so getting the wrong (virtual) frame pointer is the least of your worries.

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

10 years agoruntime: export _rt0 for android
David Crawshaw [Mon, 7 Jul 2014 11:35:39 +0000 (07:35 -0400)]
runtime: export _rt0 for android

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

10 years agodoc/contribute.html: capitalize the first letter
Tetsuo Kiso [Mon, 7 Jul 2014 06:31:20 +0000 (16:31 +1000)]
doc/contribute.html: capitalize the first letter

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

10 years agodebug/elf: fix nil deref in test
Dmitriy Vyukov [Sat, 5 Jul 2014 04:48:46 +0000 (08:48 +0400)]
debug/elf: fix nil deref in test

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

10 years agoimage/gif: fix nil deref in test
Dmitriy Vyukov [Sat, 5 Jul 2014 04:48:04 +0000 (08:48 +0400)]
image/gif: fix nil deref in test

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

10 years agoruntime/cgo: replace fprintf(stderr, ...) with fatalf(...) for linux/android
David Crawshaw [Fri, 4 Jul 2014 01:04:48 +0000 (21:04 -0400)]
runtime/cgo: replace fprintf(stderr, ...) with fatalf(...) for linux/android

Both stdout and stderr are sent to /dev/null in android
apps. Introducing fatalf allows android to implement its
own copy that sends fatal errors to __android_log_print.

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

10 years agodoc/contribute: reorder documented steps to match normal workflow.
Bill Thiede [Thu, 3 Jul 2014 21:42:23 +0000 (17:42 -0400)]
doc/contribute: reorder documented steps to match normal workflow.

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

10 years agoruntime/cgo: revert use of undefined logging function
David Crawshaw [Thu, 3 Jul 2014 20:52:34 +0000 (16:52 -0400)]
runtime/cgo: revert use of undefined logging function

It snuck into cl/106380043. Too many active clients.

LGTM=ruiu
R=golang-codereviews, ruiu
CC=golang-codereviews
https://golang.org/cl/110830045

10 years agocmd/go, cmd/ld, runtime, os/user: TLS emulation for android
David Crawshaw [Thu, 3 Jul 2014 20:14:34 +0000 (16:14 -0400)]
cmd/go, cmd/ld, runtime, os/user: TLS emulation for android

Based on cl/69170045 by Elias Naur.

There are currently several schemes for acquiring a TLS
slot to save the g register. None of them appear to work
for android. The closest are linux and darwin.

Linux uses a linker TLS relocation. This is not supported
by the android linker.

Darwin uses a fixed offset, and calls pthread_key_create
until it gets the slot it wants. As the runtime loads
late in the android process lifecycle, after an
arbitrary number of other libraries, we cannot rely on
any particular slot being available.

So we call pthread_key_create, take the first slot we are
given, and put it in runtime.tlsg, which we turn into a
regular variable in cmd/ld.

Makes android/arm cgo binaries work.

LGTM=minux
R=elias.naur, minux, dave, josharian
CC=golang-codereviews
https://golang.org/cl/106380043

10 years agoruntime: delete unnecessary confusing code
Dmitriy Vyukov [Thu, 3 Jul 2014 18:58:42 +0000 (22:58 +0400)]
runtime: delete unnecessary confusing code
The code in GC that handles gp->gobuf.ctxt is wrong,
because it does not mark the ctxt object itself,
if just queues the ctxt object for scanning.
So the ctxt object can be collected as garbage.
However, Gobuf.ctxt is void*, so it's always marked and
scanned through G.

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

10 years agocrypto/x509: fix format strings in test
Dmitriy Vyukov [Thu, 3 Jul 2014 08:08:24 +0000 (12:08 +0400)]
crypto/x509: fix format strings in test
Currently it says:
--- PASS: TestDecrypt-2 (0.11s)
pem_decrypt_test.go:17: test 0. %!s(x509.PEMCipher=1)
--- PASS: TestEncrypt-2 (0.00s)
pem_decrypt_test.go:42: test 0. %!s(x509.PEMCipher=1)

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

10 years agoruntime: make runtime·usleep and runtime·osyield callable from cgo callback
Aram Hăvărneanu [Thu, 3 Jul 2014 01:36:05 +0000 (11:36 +1000)]
runtime: make runtime·usleep and runtime·osyield callable from cgo callback

runtime·usleep and runtime·osyield fall back to calling an
assembly wrapper for the libc functions in the absence of a m,
so they can be called in cgo callback context.

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

10 years agoarchive/tar: reuse temporary buffer in readHeader
Cristian Staretu [Wed, 2 Jul 2014 23:41:19 +0000 (09:41 +1000)]
archive/tar: reuse temporary buffer in readHeader

A temporary 512 bytes buffer is allocated for every call to
readHeader. This buffer isn't returned to the caller and it could
be reused to lower the number of memory allocations.

This CL improves it by using a pool and zeroing out the buffer before
putting it back into the pool.

benchmark                  old ns/op     new ns/op     delta
BenchmarkListFiles100k     545249903     538832687     -1.18%

benchmark                  old allocs    new allocs    delta
BenchmarkListFiles100k     2105167       2005692       -4.73%

benchmark                  old bytes     new bytes     delta
BenchmarkListFiles100k     105903472     54831527      -48.22%

This improvement is very important if your code has to deal with a lot
of tarballs which contain a lot of files.

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

10 years agoarchive/tar: reuse temporary buffer in writeHeader
Cristian Staretu [Wed, 2 Jul 2014 23:40:53 +0000 (09:40 +1000)]
archive/tar: reuse temporary buffer in writeHeader

A temporary 512 bytes buffer is allocated for every call to
writeHeader. This buffer could be reused the lower the number
of memory allocations.

benchmark                   old ns/op     new ns/op     delta
BenchmarkWriteFiles100k     634622051     583810847     -8.01%

benchmark                   old allocs     new allocs     delta
BenchmarkWriteFiles100k     2701920        2602621        -3.68%

benchmark                   old bytes     new bytes     delta
BenchmarkWriteFiles100k     115383884     64349922      -44.23%

This change is very important if your code has to write a lot of
tarballs with a lot of files.

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

10 years agocrypto/rsa: fix out-of-bound access with short session keys.
Adam Langley [Wed, 2 Jul 2014 22:28:57 +0000 (15:28 -0700)]
crypto/rsa: fix out-of-bound access with short session keys.

Thanks to Cedric Staub for noting that a short session key would lead
to an out-of-bounds access when conditionally copying the too short
buffer over the random session key.

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

10 years agobuild: annotations and modifications for c2go
Russ Cox [Wed, 2 Jul 2014 19:41:29 +0000 (15:41 -0400)]
build: annotations and modifications for c2go

The main changes fall into a few patterns:

1. Replace #define with enum.

2. Add /*c2go */ comment giving effect of #define.
This is necessary for function-like #defines and
non-enum-able #defined constants.
(Not all compilers handle negative or large enums.)

3. Add extra braces in struct initializer.
(c2go does not implement the full rules.)

This is enough to let c2go typecheck the source tree.
There may be more changes once it is doing
other semantic analyses.

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

10 years agocrypto/cipher: fix typo in example comment
Preetam Jinka [Wed, 2 Jul 2014 17:46:54 +0000 (10:46 -0700)]
crypto/cipher: fix typo in example comment

LGTM=josharian
R=golang-codereviews, josharian
CC=golang-codereviews
https://golang.org/cl/110330043

10 years agobufio: Fixed call to Fatal, should be Fatalf.
Timo Truyts [Wed, 2 Jul 2014 14:04:01 +0000 (07:04 -0700)]
bufio: Fixed call to Fatal, should be Fatalf.

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

10 years agoA+C: Timo Truyts (individual CLA)
Brad Fitzpatrick [Wed, 2 Jul 2014 13:45:57 +0000 (06:45 -0700)]
A+C: Timo Truyts (individual CLA)

Generated by a+c.

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

10 years agoA+C: Cristian Staretu (individual CLA)
Brad Fitzpatrick [Wed, 2 Jul 2014 12:24:44 +0000 (05:24 -0700)]
A+C: Cristian Staretu (individual CLA)

Generated by a+c.

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

10 years agoliblink, runtime: preliminary support for plan9/amd64
Aram Hăvărneanu [Wed, 2 Jul 2014 11:04:10 +0000 (21:04 +1000)]
liblink, runtime: preliminary support for plan9/amd64

A TLS slot is reserved by _rt0_.*_plan9 as an automatic and
its address (which is static on Plan 9) is saved in the
global _privates symbol. The startup linkage now is exactly
like that from Plan 9 libc, and the way we access g is
exactly as if we'd have used privalloc(2).

Aside from making the code more standard, this change
drastically simplifies it, both for 386 and for amd64, and
makes the Plan 9 code in liblink common for both 386 and
amd64.

The amd64 runtime code was cleared of nxm assumptions, and
now runs on the standard Plan 9 kernel.

Note handling fixes will follow in a separate CL.

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

10 years agoruntime: properly restore registers in Solaris runtime·sigtramp
Aram Hăvărneanu [Tue, 1 Jul 2014 23:34:06 +0000 (09:34 +1000)]
runtime: properly restore registers in Solaris runtime·sigtramp

We restored registers correctly in the usual case where the thread
is a Go-managed thread and called runtime·sighandler, but we
failed to do so when runtime·sigtramp was called on a cgo-created
thread. In that case, runtime·sigtramp called runtime·badsignal,
a Go function, and did not restore registers after it returned

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

10 years agomisc/nacl, syscall: lazily initialize fs on nacl.
Shenghou Ma [Tue, 1 Jul 2014 22:24:43 +0000 (18:24 -0400)]
misc/nacl, syscall: lazily initialize fs on nacl.
On amd64, the real time is reduced from 176.76s to 140.26s.
On ARM, the real time is reduced from 921.61s to 726.30s.

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

10 years agoall: add GOOS=android
David Crawshaw [Tue, 1 Jul 2014 21:21:50 +0000 (17:21 -0400)]
all: add GOOS=android

As android and linux have significant overlap, and
because build tags are a poor way to represent an
OS target, this CL introduces an exception into
go/build: linux is treated as a synonym for android
when matching files.

http://golang.org/s/go14android
https://groups.google.com/forum/#!topic/golang-dev/P1ATVp1mun0

LGTM=rsc, minux
R=golang-codereviews, mikioh.mikioh, dave, aram, minux, gobot, rsc, aram.h, elias.naur, iant
CC=golang-codereviews, rsc
https://golang.org/cl/105270043

10 years agoencoding/gob: fewer decAlloc calls
Russ Cox [Tue, 1 Jul 2014 18:19:27 +0000 (14:19 -0400)]
encoding/gob: fewer decAlloc calls

Move decAlloc calls a bit higher in the call tree.
Cleans code marginally, improves speed marginally.
The benchmarks are noisy but the median time from
20 consective 1-second runs improves by about 2%.

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

10 years agocmd/gofmt: fix gofmt -s for 3-index slices
Robert Griesemer [Tue, 1 Jul 2014 17:40:27 +0000 (10:40 -0700)]
cmd/gofmt: fix gofmt -s for 3-index slices

3-index slices of the form s[:len(s):len(s)]
cannot be simplified to s[::len(s)].

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

10 years agosrc, misc: applied gofmt -w -s
Robert Griesemer [Tue, 1 Jul 2014 17:28:10 +0000 (10:28 -0700)]
src, misc: applied gofmt -w -s

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

10 years agogofmt/main: Added removal of empty declaration groups.
Simon Whitehead [Tue, 1 Jul 2014 16:32:03 +0000 (09:32 -0700)]
gofmt/main: Added removal of empty declaration groups.

Fixes #7631.

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

10 years agoA+C: Simon Whitehead (individual CLA)
Brad Fitzpatrick [Tue, 1 Jul 2014 16:26:06 +0000 (09:26 -0700)]
A+C: Simon Whitehead (individual CLA)

Generated by a+c.

R=gobot, rsc
CC=golang-codereviews
https://golang.org/cl/106340043

10 years agocodereview: update name of the a+c tool
Brad Fitzpatrick [Tue, 1 Jul 2014 16:25:34 +0000 (09:25 -0700)]
codereview: update name of the a+c tool

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

10 years agodoc/go1.4.txt: delete editor and shell support
Rob Pike [Tue, 1 Jul 2014 16:22:55 +0000 (09:22 -0700)]
doc/go1.4.txt: delete editor and shell support

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

10 years agomisc: delete editor and shell support
Rob Pike [Tue, 1 Jul 2014 16:21:25 +0000 (09:21 -0700)]
misc: delete editor and shell support

We are not the right people to support editor plugins, and the profusion
of editors in this CL demonstrates the unreality of pretending to do so.
People are free to create and advertise their own repos with support.

For discussion: https://groups.google.com/forum/#!topic/golang-dev/SA7fD470FxU

LGTM=rminnich, kamil.kisiel, gri, rsc, dave, josharian, ruiu
R=golang-codereviews, rminnich, kamil.kisiel, gri, rsc, dominik.honnef, dave, josharian, ruiu, ajstarks
CC=golang-codereviews
https://golang.org/cl/105470043

10 years agocmd/8g: don't allocate a register early for cap(CHAN).
Rémy Oudompheng [Tue, 1 Jul 2014 07:20:51 +0000 (09:20 +0200)]
cmd/8g: don't allocate a register early for cap(CHAN).

There is no reason to generate different code for cap and len.

Fixes #8025.
Fixes #8026.

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

10 years agoundo CL 104200047 / 318b04f28372
Keith Randall [Tue, 1 Jul 2014 02:48:08 +0000 (19:48 -0700)]
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

10 years agoruntime: stack allocator, separate from mallocgc
Keith Randall [Tue, 1 Jul 2014 01:59:24 +0000 (18:59 -0700)]
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

10 years agoruntime: update arm comments now register m is gone
David Crawshaw [Mon, 30 Jun 2014 23:10:41 +0000 (19:10 -0400)]
runtime: update arm comments now register m is gone

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

10 years agoencoding/gob: simplify allocation in decode.
Rob Pike [Mon, 30 Jun 2014 22:47:11 +0000 (15:47 -0700)]
encoding/gob: simplify allocation in decode.
The old code's structure needed to track indirections because of the
use of unsafe. That is no longer necessary, so we can remove all
that tracking. The code cleans up considerably but is a little slower.
We may be able to recover that performance drop. I believe the
code quality improvement is worthwhile regardless.

BenchmarkEndToEndPipe           5610          5780          +3.03%
BenchmarkEndToEndByteBuffer     3156          3222          +2.09%

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

10 years agogofmt: remove redundant check in rewriter
Robert Griesemer [Mon, 30 Jun 2014 21:40:12 +0000 (14:40 -0700)]
gofmt: remove redundant check in rewriter

If the actual types of two reflect values are
the same and the values are structs, they must
have the same number of fields.

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

10 years agodoc/go1.4.txt: encoding/gob is now safe
Rob Pike [Mon, 30 Jun 2014 19:28:20 +0000 (12:28 -0700)]
doc/go1.4.txt: encoding/gob is now safe

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

10 years agoencoding/gob: remove unsafe, use reflection.
Rob Pike [Mon, 30 Jun 2014 18:06:47 +0000 (11:06 -0700)]
encoding/gob: remove unsafe, use reflection.
This removes a major unsafe thorn in our side, a perennial obstacle
to clean garbage collection.
Not coincidentally: In cleaning this up, several bugs were found,
including code that reached inside by-value interfaces to create
pointers for pointer-receiver methods. Unsafe code is just as
advertised.

Performance of course suffers, but not too badly. The Pipe number
is more indicative, since it's doing I/O that simulates a network
connection. Plus these are end-to-end, so each end suffers
only half of this pain.

The edit is pretty much a line-by-line conversion, with a few
simplifications and a couple of new tests. There may be more
performance to gain.

BenchmarkEndToEndByteBuffer     2493          3033          +21.66%
BenchmarkEndToEndPipe           4953          5597          +13.00%

Fixes #5159.

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

10 years agotest/fixedbugs: fix typo in comment
Dave Cheney [Sun, 29 Jun 2014 10:34:35 +0000 (20:34 +1000)]
test/fixedbugs: fix typo in comment

Fix copy paste error pointed out by rsc, https://golang.org/cl/107290043/diff/60001/test/fixedbugs/issue8074.go#newcode7

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

10 years agoruntime: fix GC bitmap corruption
Dmitriy Vyukov [Sun, 29 Jun 2014 02:20:46 +0000 (19:20 -0700)]
runtime: fix GC bitmap corruption
Fixes #8299.

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

10 years agostrings: Replacer is safe for concurrent use
Evan Shaw [Sat, 28 Jun 2014 22:53:07 +0000 (15:53 -0700)]
strings: Replacer is safe for concurrent use

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

10 years agocrypto/cipher: Fix typo in example comment
Preetam Jinka [Sat, 28 Jun 2014 17:11:26 +0000 (10:11 -0700)]
crypto/cipher: Fix typo in example comment

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

10 years agoflag: add a little more doc comment to Duration.
David Symonds [Sat, 28 Jun 2014 10:47:06 +0000 (20:47 +1000)]
flag: add a little more doc comment to Duration.

The only text that describes the accepted format is in the package doc,
which is far away from these functions. The other flag types don't need
this explicitness because they are more obvious.

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

10 years agonet/http: add TLS benchmark
Dmitriy Vyukov [Sat, 28 Jun 2014 01:30:09 +0000 (18:30 -0700)]
net/http: add TLS benchmark

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