]> Cypherpunks repositories - gostls13.git/log
gostls13.git
10 years agoliblink: use LinkArch.textflag() to get text and dataflag
Shenghou Ma [Wed, 6 Aug 2014 04:24:43 +0000 (00:24 -0400)]
liblink: use LinkArch.textflag() to get text and dataflag
Rather than switch on thechar.

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

10 years agoruntime: remove dead code
Shenghou Ma [Wed, 6 Aug 2014 04:24:31 +0000 (00:24 -0400)]
runtime: remove dead code

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

10 years agoruntime: disable aeshash on NaCl at compile time
Shenghou Ma [Wed, 6 Aug 2014 04:24:11 +0000 (00:24 -0400)]
runtime: disable aeshash on NaCl at compile time

Fixes build for nacl/386.

LGTM=dave
R=khr, bradfitz, dave, dan.kortschak, rsc
CC=golang-codereviews
https://golang.org/cl/121080043

10 years agoliblink: shorter encoding for zeroing register
Rui Ueyama [Wed, 6 Aug 2014 04:10:07 +0000 (21:10 -0700)]
liblink: shorter encoding for zeroing register

Encode MOV $0, %ax as XOR %eax, %eax instead of
XOR %rax, %rax. If an operand register does not
need REX.w bit (i.e. not one of R8-R15), it is
encoded in 2 bytes instead of 3 bytes.

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

10 years agocmd/cgo: fix recursive type mapping
Matthew Dempsky [Wed, 6 Aug 2014 01:16:56 +0000 (18:16 -0700)]
cmd/cgo: fix recursive type mapping

Instead of immediately completing pointer type mappings, add them to
a queue to allow them to be completed later.  This fixes issues caused
by Type() returning arbitrary in-progress type mappings.

Fixes #8368.
Fixes #8441.

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

10 years agocmd/cgo: fix handling of defs_linux.go
Matthew Dempsky [Wed, 6 Aug 2014 01:12:32 +0000 (18:12 -0700)]
cmd/cgo: fix handling of defs_linux.go

Instead of including <sys/types.h> to get size_t, instead include
the ISO C standard <stddef.h> header, which defines fewer additional
types at risk of colliding with the user code.  In particular, this
prevents collisions between <sys/types.h>'s userspace definitions with
the kernel definitions needed by defs_linux.go.

Also, -cdefs mode uses #pragma pack, so we can keep misaligned fields.

Fixes #8477.

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

10 years agonet: separate DNS transport from DNS query-response interaction
Mikio Hara [Wed, 6 Aug 2014 00:58:47 +0000 (09:58 +0900)]
net: separate DNS transport from DNS query-response interaction

Before fixing issue 6579 this CL separates DNS transport from
DNS message interaction to make it easier to add builtin DNS
resolver control logic.

Update #6579

LGTM=alex, kevlar
R=golang-codereviews, alex, gobot, iant, minux, kevlar
CC=golang-codereviews
https://golang.org/cl/101220044

10 years agocmd/cgo: for -godefs, promote first field of anonymous union
Ian Lance Taylor [Wed, 6 Aug 2014 00:10:15 +0000 (17:10 -0700)]
cmd/cgo: for -godefs, promote first field of anonymous union

Update #6677

When a struct contains an anonymous union, use the type and
name of the first field in the union.

This should make the glibc <sys/resource.h> file work; in that
file struct rusage has fields like

__extension__ union
{
        long int ru_maxrss;
        __syscall_slong_t __ru_maxrss_word;
};

in which the field that matters is ru_maxrss and
__ru_maxrss_word just exists to advance to the next field on
systems where the kernel uses long long fields but userspace
expects long fields.

LGTM=mikioh.mikioh
R=golang-codereviews, mikioh.mikioh
CC=golang-codereviews
https://golang.org/cl/106260044

10 years agoruntime: cache one GC workbuf in thread-local storage
Dmitriy Vyukov [Tue, 5 Aug 2014 21:50:37 +0000 (01:50 +0400)]
runtime: cache one GC workbuf in thread-local storage
We call scanblock for lots of small root pieces
e.g. for every stack frame args and locals area.
Every scanblock invocation calls getempty/putempty,
which accesses lock-free stack shared among all worker threads.
One-element local cache allows most scanblock calls
to proceed without accessing the shared stack.

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

10 years agomime/multipart: fix Writer data race test
Rui Ueyama [Tue, 5 Aug 2014 20:43:12 +0000 (13:43 -0700)]
mime/multipart: fix Writer data race test

If the process exits before the spawned goroutine
completes, it'll miss the data race.

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

10 years agodoc/go1.4.txt: document ASN.1 behaviour change.
Adam Langley [Tue, 5 Aug 2014 19:00:14 +0000 (12:00 -0700)]
doc/go1.4.txt: document ASN.1 behaviour change.

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

10 years agomime/multipart: add Writer data race test
Brad Fitzpatrick [Tue, 5 Aug 2014 18:45:24 +0000 (11:45 -0700)]
mime/multipart: add Writer data race test

Camlistore uses this pattern to do streaming writes, as do
others I imagine, and it was broken by the lazy boundary
change.

LGTM=dvyukov, ruiu
R=ruiu, dvyukov
CC=golang-codereviews, mathieu.lonjaret
https://golang.org/cl/116690043

10 years agoundo CL 95760043 / b2131d729e52
Brad Fitzpatrick [Tue, 5 Aug 2014 18:36:44 +0000 (11:36 -0700)]
undo CL 95760043 / b2131d729e52

Breaks Camlistore by introducing a datarace. See comments on
https://golang.org/cl/95760043/ for details.

I'll add a new test to lock-in the current behavior in a
subsequent CL.

I don't think Camlistore is particularly unique here: it's doing
the obvious thing to stream a multipart body to a server
using a goroutine feeding the multipart writer.

««« original CL description
mime/multipart: delay reading random source

If a user sets his/her own boundary string with SetBoundary,
we don't need to call randomBoundary at all.

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

LGTM=ruiu
R=ruiu
CC=golang-codereviews, mathieu.lonjaret
https://golang.org/cl/117600043

10 years agocrypto/tls: add ALPN support.
Adam Langley [Tue, 5 Aug 2014 18:36:20 +0000 (11:36 -0700)]
crypto/tls: add ALPN support.

Fixes #6736.

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

10 years agoruntime: remove type.go
Dmitriy Vyukov [Tue, 5 Aug 2014 18:32:24 +0000 (22:32 +0400)]
runtime: remove type.go
We have an autogenerated version in zruntime_defs.
I am not sure what are the consequences as gdb never printed any values for me.
But it looks unnecessary to manually duplicate it.

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

10 years agospec: comma-ok expressions return untyped boolean 2nd result
Robert Griesemer [Tue, 5 Aug 2014 18:31:32 +0000 (11:31 -0700)]
spec: comma-ok expressions return untyped boolean 2nd result

Technically a language change, this cleanup is a completely
backward compatible change that brings the boolean results
of comma-ok expressions in line with the boolean results of
comparisons: they are now all untyped booleans.

The implementation effort should be minimal (less than a
handfull lines of code, depending how well factored the
implementation of comma-ok expressions is).

Fixes #8189.

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

10 years agoA+C: Percy Wegmann (individual CLA)
Adam Langley [Tue, 5 Aug 2014 18:25:47 +0000 (11:25 -0700)]
A+C: Percy Wegmann (individual CLA)

Generated by a+c.

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

10 years agoruntime/race: add tests for maps with big keys/vals
Dmitriy Vyukov [Tue, 5 Aug 2014 14:12:38 +0000 (18:12 +0400)]
runtime/race: add tests for maps with big keys/vals
With the recent GC changes large objects are handled somewhat differently.

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

10 years agoruntime: remove outdated comment
Dmitriy Vyukov [Tue, 5 Aug 2014 13:03:06 +0000 (17:03 +0400)]
runtime: remove outdated comment

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

10 years agoruntime: use memmove rather than memcopy in mgc0.c
Ian Lance Taylor [Tue, 5 Aug 2014 03:40:44 +0000 (20:40 -0700)]
runtime: use memmove rather than memcopy in mgc0.c

For consistency with other code, as that was the only use of
memcopy outside of alg.goc.

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

10 years agosyscall: fix typo in comment
Ian Lance Taylor [Tue, 5 Aug 2014 03:30:26 +0000 (20:30 -0700)]
syscall: fix typo in comment

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

10 years agoruntime: remove unused enum maxround
Ian Lance Taylor [Tue, 5 Aug 2014 03:29:58 +0000 (20:29 -0700)]
runtime: remove unused enum maxround

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

10 years agoruntime: only use a single variable in USED
Ian Lance Taylor [Tue, 5 Aug 2014 03:29:36 +0000 (20:29 -0700)]
runtime: only use a single variable in USED

The gccgo version of USED only accepts a single variable, so
this simplifies merging.

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

10 years agotest: add test for function type in function literal
Ian Lance Taylor [Tue, 5 Aug 2014 02:50:49 +0000 (19:50 -0700)]
test: add test for function type in function literal

The gccgo compiler used to fail this test.  This was the root
cause of http://gcc.gnu.org/PR61308 .  The fix for the gccgo
compiler is https://golang.org/cl/122020043 .

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

10 years agoarchive/zip: accept bogus trailing zeros in extras
Brad Fitzpatrick [Mon, 4 Aug 2014 23:12:55 +0000 (16:12 -0700)]
archive/zip: accept bogus trailing zeros in extras

Popular tools both add incorrect trailing zeroes to the zip
extras, and popular tools accept trailing zeros. We seemed to
be the only ones being strict here. Stop being strict. :(

Fixes #8186

LGTM=ruiu, adg, dave
R=adg, ruiu, dave
CC=frohrweck, golang-codereviews
https://golang.org/cl/117550044

10 years agonet: consolidate sockaddrToAddr functions
Mikio Hara [Mon, 4 Aug 2014 21:10:46 +0000 (06:10 +0900)]
net: consolidate sockaddrToAddr functions

This CL removes sockaddrToAddr functions from socket creation
operations to avoid the bug like issue 7183.

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

10 years agoencoding/gob: save a call to userType
Rob Pike [Sun, 3 Aug 2014 22:14:59 +0000 (15:14 -0700)]
encoding/gob: save a call to userType
Avoid some pressure on the global mutex by lifting the call to userType
out of the closure.
TOTH to Matt Harden.

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

10 years agonet: fix Dial comment about IPv6 addresses
Brad Fitzpatrick [Sat, 2 Aug 2014 04:35:03 +0000 (21:35 -0700)]
net: fix Dial comment about IPv6 addresses

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

10 years agocmd/go: use correct link flags if main package contains C++/ObjC files
Peter Collingbourne [Fri, 1 Aug 2014 23:45:33 +0000 (16:45 -0700)]
cmd/go: use correct link flags if main package contains C++/ObjC files

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

10 years agoruntime: move constants from map header to map type
Keith Randall [Fri, 1 Aug 2014 21:38:56 +0000 (14:38 -0700)]
runtime: move constants from map header to map type

A good cleanup anyway, and it makes some room for an additional
field needed for issue 8412.

Update #8412

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

10 years agotest/run: go fmt
David du Colombier [Fri, 1 Aug 2014 20:34:36 +0000 (22:34 +0200)]
test/run: go fmt

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

10 years agoruntime: prevent pointless jmp in amd64 and 386 memmove
Josh Bleecher Snyder [Fri, 1 Aug 2014 13:21:08 +0000 (06:21 -0700)]
runtime: prevent pointless jmp in amd64 and 386 memmove

6a and 8a rearrange memmove such that the fallthrough from move_1or2 to move_0 ends up being a JMP to a RET. Insert an explicit RET to prevent such silliness.

Do the same for memclr as prophylaxis.

benchmark                old ns/op     new ns/op     delta
BenchmarkMemmove1        4.59          4.13          -10.02%
BenchmarkMemmove2        4.58          4.13          -9.83%

LGTM=khr
R=golang-codereviews, dvyukov, minux, ruiu, bradfitz, khr
CC=golang-codereviews
https://golang.org/cl/120930043

10 years agoruntime: implement monotonic clocks on windows
Alex Brainman [Fri, 1 Aug 2014 01:18:11 +0000 (11:18 +1000)]
runtime: implement monotonic clocks on windows

Update #6007.

LGTM=minux, dvyukov
R=golang-codereviews, dvyukov, patrick, aram.h, minux
CC=golang-codereviews
https://golang.org/cl/108700045

10 years agoruntime: missed a file in alg checkin
Keith Randall [Thu, 31 Jul 2014 22:12:53 +0000 (15:12 -0700)]
runtime: missed a file in alg checkin

TBR=dvyukov
CC=golang-codereviews
https://golang.org/cl/122740044

10 years agoruntime: convert hash functions to Go calling convention.
Keith Randall [Thu, 31 Jul 2014 22:07:05 +0000 (15:07 -0700)]
runtime: convert hash functions to Go calling convention.

Create proper closures so hash functions can be called
directly from Go.  Rearrange calling convention so return
value is directly accessible.

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

10 years agostrconv: remove needless cast
Rui Ueyama [Thu, 31 Jul 2014 20:54:42 +0000 (13:54 -0700)]
strconv: remove needless cast

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

10 years agoruntime: move built-in print routines to go.
Keith Randall [Thu, 31 Jul 2014 20:48:48 +0000 (13:48 -0700)]
runtime: move built-in print routines to go.

Fixes #8297

LGTM=bradfitz
R=golang-codereviews, bradfitz, khr, dave, dvyukov
CC=golang-codereviews
https://golang.org/cl/119240043

10 years agoruntime: fix 32 bit build.
Keith Randall [Thu, 31 Jul 2014 20:07:16 +0000 (13:07 -0700)]
runtime: fix 32 bit build.

int(maxMem) is negative on 32 bits.  Need to use
unsigned arithmetic.

TBR=bradfitz
CC=golang-codereviews
https://golang.org/cl/121000045

10 years agoruntime: convert slice operations to Go.
Keith Randall [Thu, 31 Jul 2014 19:43:40 +0000 (12:43 -0700)]
runtime: convert slice operations to Go.

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

10 years agocmd/gc: fix example flag in comment
Josh Bleecher Snyder [Thu, 31 Jul 2014 17:34:51 +0000 (10:34 -0700)]
cmd/gc: fix example flag in comment

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

10 years agoruntime: use right mask to extract type kind
Keith Randall [Thu, 31 Jul 2014 16:32:09 +0000 (09:32 -0700)]
runtime: use right mask to extract type kind

Cleanup from recent malloc changes.

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

10 years agoruntime: get rid of free
Dmitriy Vyukov [Thu, 31 Jul 2014 08:55:40 +0000 (12:55 +0400)]
runtime: get rid of free
Several reasons:
1. Significantly simplifies runtime.
2. This code proved to be buggy.
3. Free is incompatible with bump-the-pointer allocation.
4. We want to write runtime in Go, Go does not have free.
5. Too much code to free env strings on startup.

LGTM=khr
R=golang-codereviews, josharian, tracey.brendan, khr
CC=bradfitz, golang-codereviews, r, rlh, rsc
https://golang.org/cl/116390043

10 years agoimage/jpeg: rename some internal variables.
Nigel Tao [Thu, 31 Jul 2014 07:34:48 +0000 (17:34 +1000)]
image/jpeg: rename some internal variables.

LGTM=dsymonds
R=dsymonds
CC=golang-codereviews
https://golang.org/cl/120980043

10 years agoruntime: cast to uintptr to match %p formatter.
Keith Randall [Thu, 31 Jul 2014 03:24:03 +0000 (20:24 -0700)]
runtime: cast to uintptr to match %p formatter.

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

10 years agoruntime: fix cmallocgc's C prototype
Matthew Dempsky [Thu, 31 Jul 2014 00:08:33 +0000 (17:08 -0700)]
runtime: fix cmallocgc's C prototype

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

10 years agoruntime: fix stack memory test
Keith Randall [Wed, 30 Jul 2014 18:02:40 +0000 (11:02 -0700)]
runtime: fix stack memory test

Stand-alone this test is fine.  Run together with
others, however, the stack used can actually go
negative because other tests are freeing stack
during its execution.

This behavior is new with the new stack allocator.
The old allocator never returned (min-sized) stacks.

This test is fairly poor - it needs to run in
isolation to be accurate.  Maybe we should delete it.

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

10 years agoruntime: fix assembler macro definitions to be consistent in use of center-dot
Rob Pike [Wed, 30 Jul 2014 17:11:44 +0000 (10:11 -0700)]
runtime: fix assembler macro definitions to be consistent in use of center-dot
The DISPATCH and CALLFN macro definitions depend on an inconsistency
between the internal cpp mini-implementation and the language proper in
whether center-dot is an identifier character. The macro depends on it not
being an identifier character, but the resulting code depends on it being one.

Remove the dependence on the inconsistency by placing the center-dot into
the macro invocation rather that the body.

No semantic change. This is just renaming macro arguments.

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

10 years agoruntime: fix freebsd build. Assignment is int32* on 32 bit
Keith Randall [Wed, 30 Jul 2014 16:18:00 +0000 (09:18 -0700)]
runtime: fix freebsd build.  Assignment is int32* on 32 bit
machines and int64* on 64 bit machines.

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

10 years agoruntime: rewrite malloc in Go.
Keith Randall [Wed, 30 Jul 2014 16:01:52 +0000 (09:01 -0700)]
runtime: rewrite malloc in Go.

This change introduces gomallocgc, a Go clone of mallocgc.
Only a few uses have been moved over, so there are still
lots of uses from C. Many of these C uses will be moved
over to Go (e.g. in slice.goc), but probably not all.
What should remain of C's mallocgc is an open question.

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

10 years agomime/multipart: delay reading random source
Rui Ueyama [Wed, 30 Jul 2014 01:24:50 +0000 (18:24 -0700)]
mime/multipart: delay reading random source

If a user sets his/her own boundary string with SetBoundary,
we don't need to call randomBoundary at all.

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

10 years agoundo CL 107280044 / ee11f19bc514
Mikio Hara [Wed, 30 Jul 2014 01:02:16 +0000 (10:02 +0900)]
undo CL 107280044 / ee11f19bc514

preparing for the syscall package freeze.

««« original CL description
syscall: consolidate, simplify socket options for Unix-like systems

Also exposes common socket option functions on Solaris.

Update #7174
Update #7175

LGTM=aram
R=golang-codereviews, aram
CC=golang-codereviews
https://golang.org/cl/107280044
»»»

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

10 years agoundo CL 104290043 / 1d13818e6b3d
Mikio Hara [Wed, 30 Jul 2014 01:01:32 +0000 (10:01 +0900)]
undo CL 104290043 / 1d13818e6b3d

preparing for the syscall package freeze.

««« original CL description
syscall: add source-specific multicast socket options for FreeBSD

Update #8266

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

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

10 years agobufio: fix rot13Reader bug in test
Rui Ueyama [Wed, 30 Jul 2014 00:56:28 +0000 (17:56 -0700)]
bufio: fix rot13Reader bug in test

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

10 years agoundo CL 102610045 / 7244ce3ae9db
Mikio Hara [Wed, 30 Jul 2014 00:47:39 +0000 (09:47 +0900)]
undo CL 102610045 / 7244ce3ae9db

preparing for the syscall package freeze.

««« original CL description
syscall: regenerate z-files for darwin

Updates z-files from 10.7 kernel-based to 10.9 kernel-based.

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

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

10 years agoundo CL 101460043 / 746e175af5d2
Mikio Hara [Wed, 30 Jul 2014 00:25:37 +0000 (09:25 +0900)]
undo CL 101460043 / 746e175af5d2

preparing for the syscall package freeze.

««« original CL description
syscall: add source-specific multicast socket options for Darwin

Update #8266

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

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

10 years agoA+C: fixed doubled entry
Rob Pike [Wed, 30 Jul 2014 00:18:00 +0000 (17:18 -0700)]
A+C: fixed doubled entry
Delete an erroneously doubled name in both files. Once is enough.

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

10 years agofmt: measure width in runes not bytes with %c and %q for ints
Mihai Borobocea [Tue, 29 Jul 2014 23:46:53 +0000 (16:46 -0700)]
fmt: measure width in runes not bytes with %c and %q for ints

This is meant to share my progress on Issue 8275, if it's useful to you. I'm not familiar with the formatter's internals, so this change is likely naive.

Change these calls to measure width in runes not bytes:
fmt.Printf("(%5q)\n", '§')
fmt.Printf("(%3c)\n", '§')

 Fixes #8275.

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

10 years agocmd/gc: don't allow escaping arguments in the runtime package.
Keith Randall [Tue, 29 Jul 2014 21:38:08 +0000 (14:38 -0700)]
cmd/gc: don't allow escaping arguments in the runtime package.

This is a case that was missed in https://golang.org/cl/105280047/

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

10 years agoA+C: Mihai Borobocea (individual CLA)
Rob Pike [Tue, 29 Jul 2014 20:34:47 +0000 (13:34 -0700)]
A+C: Mihai Borobocea (individual CLA)

Generated by a+c.

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

10 years agoruntime: generate type info for chans
Dmitriy Vyukov [Tue, 29 Jul 2014 18:06:47 +0000 (22:06 +0400)]
runtime: generate type info for chans

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

10 years agoruntime: verify hmap type size
Dmitriy Vyukov [Tue, 29 Jul 2014 18:06:20 +0000 (22:06 +0400)]
runtime: verify hmap type size

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

10 years agoruntime: mark global var as NOPTR
Dmitriy Vyukov [Tue, 29 Jul 2014 11:18:01 +0000 (15:18 +0400)]
runtime: mark global var as NOPTR

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

10 years agoruntime: mark global var as NOPTR
Dmitriy Vyukov [Tue, 29 Jul 2014 10:45:07 +0000 (14:45 +0400)]
runtime: mark global var as NOPTR

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

10 years agonet: prevent spurious on-connect events via epoll on linux
Mikio Hara [Tue, 29 Jul 2014 07:48:11 +0000 (16:48 +0900)]
net: prevent spurious on-connect events via epoll on linux

On Linux, adding a socket descriptor to epoll instance before getting
the EINPROGRESS return value from connect system call could be a root
cause of spurious on-connect events.

See golang.org/issue/8276, golang.org/issue/8426 for further information.

All credit to Jason Eggleston <jason@eggnet.com>

Fixes #8276.
Fixes #8426.

LGTM=dvyukov
R=dvyukov, golang-codereviews, adg, dave, iant, alex.brainman
CC=golang-codereviews
https://golang.org/cl/120820043

10 years agocmd/ld: better diagnostics on unaligned symbols
Dmitriy Vyukov [Tue, 29 Jul 2014 07:22:57 +0000 (11:22 +0400)]
cmd/ld: better diagnostics on unaligned symbols
Want to see why builders are failing.
Then decide whether to rollback or fix.

TBR=khr
R=khr
CC=golang-codereviews
https://golang.org/cl/114510043

10 years agoruntime: simpler and faster GC
Dmitriy Vyukov [Tue, 29 Jul 2014 07:01:02 +0000 (11:01 +0400)]
runtime: simpler and faster GC

Implement the design described in:
https://docs.google.com/document/d/1v4Oqa0WwHunqlb8C3ObL_uNQw3DfSY-ztoA-4wWbKcg/pub

Summary of the changes:
GC uses "2-bits per word" pointer type info embed directly into bitmap.
Scanning of stacks/data/heap is unified.
The old spans types go away.
Compiler generates "sparse" 4-bits type info for GC (directly for GC bitmap).
Linker generates "dense" 2-bits type info for data/bss (the same as stacks use).

Summary of results:
-1680 lines of code total (-1000+ in mgc0.c only)
-25% memory consumption
-3-7% binary size
-15% GC pause reduction
-7% run time reduction

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

10 years agoimage/png: use branch-free abs function
Rui Ueyama [Tue, 29 Jul 2014 04:29:14 +0000 (14:29 +1000)]
image/png: use branch-free abs function

benchmark                        old ns/op     new ns/op     delta
BenchmarkPaeth                   5.06          6.02          +18.97%
BenchmarkDecodeGray              1010551       956911        -5.31%
BenchmarkDecodeNRGBAGradient     3877813       3754160       -3.19%
BenchmarkDecodeNRGBAOpaque       3194058       3079094       -3.60%
BenchmarkDecodePaletted          699243        700211        +0.14%
BenchmarkDecodeRGB               2835733       2692120       -5.06%
BenchmarkDecodeInterlacing       3651805       3563124       -2.43%
BenchmarkEncodeGray              4399183       4404113       +0.11%
BenchmarkEncodeNRGBOpaque        13323627      13306485      -0.13%
BenchmarkEncodeNRGBA             15840092      15751188      -0.56%
BenchmarkEncodePaletted          4396622       4404373       +0.18%
BenchmarkEncodeRGBOpaque         13320475      13279189      -0.31%
BenchmarkEncodeRGBA              36898392      36781002      -0.32%

LGTM=nigeltao
R=nigeltao
CC=golang-codereviews
https://golang.org/cl/117290043

10 years agotime: make it clearer that the reference time is the reference time.
Rob Pike [Tue, 29 Jul 2014 00:24:39 +0000 (17:24 -0700)]
time: make it clearer that the reference time is the reference time.
Because the reference time is the reference time but beginners seem
to think otherwise, make it clearer you can't choose the reference time.

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

10 years agocrypto/tls: check curve equation in ECDHE.
Adam Langley [Mon, 28 Jul 2014 22:46:27 +0000 (15:46 -0700)]
crypto/tls: check curve equation in ECDHE.

This change causes a TLS client and server to verify that received
elliptic curve points are on the expected curve. This isn't actually
necessary in the Go TLS stack, but Watson Ladd has convinced me that
it's worthwhile because it's pretty cheap and it removes the
possibility that some change in the future (e.g. tls-unique) will
depend on it without the author checking that precondition.

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

10 years agoencoding/asn1: only omit optional elements matching default value.
Adam Langley [Mon, 28 Jul 2014 21:47:37 +0000 (14:47 -0700)]
encoding/asn1: only omit optional elements matching default value.

ASN.1 elements can be optional, and can have a default value.
Traditionally, Go has omitted elements that are optional and that have
the zero value. I believe that's a bug (see [1]).

This change causes an optional element with a default value to only be
omitted when it has that default value. The previous behaviour of
omitting optional, zero elements with no default is retained because
it's used quite a lot and will break things if changed.

[1] https://groups.google.com/d/msg/Golang-nuts/9Ss6o9CW-Yo/KL_V7hFlyOAJ

Fixes #7780.

R=bradfitz

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

10 years agocrypto/tls: Support ECDSA keys in generate_cert.go
Asim Shankar [Mon, 28 Jul 2014 21:46:34 +0000 (14:46 -0700)]
crypto/tls: Support ECDSA keys in generate_cert.go

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

10 years agonet/http: make ServeContent support dates in If-Range headers
Brad Fitzpatrick [Mon, 28 Jul 2014 06:30:53 +0000 (23:30 -0700)]
net/http: make ServeContent support dates in If-Range headers

Fixes #8367

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

10 years agoliblink: warn about TLS base MRC instruction that does not write into R0.
Shenghou Ma [Sat, 26 Jul 2014 21:46:51 +0000 (17:46 -0400)]
liblink: warn about TLS base MRC instruction that does not write into R0.

While we're here, make it lookup the tlsfallback symbol only once.

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

10 years agocmd/ld: remove duplicated nuxiinit() call.
Shenghou Ma [Sat, 26 Jul 2014 21:45:45 +0000 (17:45 -0400)]
cmd/ld: remove duplicated nuxiinit() call.

It is already called by linknew().

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

10 years agocmd/5g: remove dead code.
Shenghou Ma [Sat, 26 Jul 2014 21:45:24 +0000 (17:45 -0400)]
cmd/5g: remove dead code.

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

10 years agocmd/5l: remove unused noop.c
Shenghou Ma [Sat, 26 Jul 2014 21:44:47 +0000 (17:44 -0400)]
cmd/5l: remove unused noop.c

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

10 years agocmd/5l, cmd/6l, cmd/8l: remove mkenam.
Shenghou Ma [Sat, 26 Jul 2014 21:43:10 +0000 (17:43 -0400)]
cmd/5l, cmd/6l, cmd/8l: remove mkenam.

Unused. cmd/dist will generate enams as liblink/anames[568].c.

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

10 years agoruntime: convert complex128div to go.
Keith Randall [Fri, 25 Jul 2014 22:12:45 +0000 (15:12 -0700)]
runtime: convert complex128div to go.

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

10 years agoinclude/u.h: define _DEFAULT_SOURCE for new glibc
Bobby Powers [Fri, 25 Jul 2014 15:54:09 +0000 (08:54 -0700)]
include/u.h: define _DEFAULT_SOURCE for new glibc

glibc devs have apparently decided _BSD_SOURCE will be
deprecated on Linux, and issue a preprocessor warning if
declaring _BSD_SOURCE without _DEFAULT_SOURCE.

https://sourceware.org/glibc/wiki/Release/2.20

Fixes #8397.

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

10 years agocmd/gc: don't mark select descriptor as EscNone
Bobby Powers [Fri, 25 Jul 2014 07:22:58 +0000 (11:22 +0400)]
cmd/gc: don't mark select descriptor as EscNone

selv is created with temp() which calls tempname, which marks
the new n with EscNever, so there is no need to explicitly set
EscNone on the select descriptor.

Fixes #8396.

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

10 years agosyscall: fix handling of bool return values in mksyscall_windows.go
Alex Brainman [Fri, 25 Jul 2014 05:13:59 +0000 (15:13 +1000)]
syscall: fix handling of bool return values in mksyscall_windows.go

LGTM=chines
R=chines
CC=golang-codereviews
https://golang.org/cl/118160044

10 years agodoc: drop scheme from links that are known to support HTTPS
Andrew Gerrand [Fri, 25 Jul 2014 00:28:39 +0000 (10:28 +1000)]
doc: drop scheme from links that are known to support HTTPS

golang.org now serves HTTPS with a valid cert, so it's reasonable
that users should click through to the HTTPS versions of *.golang.org
and other known sites.

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

10 years agotime: minor typo in doc
Mathieu Lonjaret [Thu, 24 Jul 2014 22:18:41 +0000 (18:18 -0400)]
time: minor typo in doc

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

10 years agoruntime: set sweepgen atomically before updating span state
Keith Randall [Thu, 24 Jul 2014 21:37:34 +0000 (14:37 -0700)]
runtime: set sweepgen atomically before updating span state

Sweepone may be running while a new span is allocating.  It
must not see the state updated while the sweepgen is unset.

Fixes #8399

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

10 years agotest/run: always set goos and goarch
David du Colombier [Thu, 24 Jul 2014 21:18:54 +0000 (23:18 +0200)]
test/run: always set goos and goarch

Following CL 68150047, the goos and goarch
variables are not currently set when the GOOS
and GOARCH environment variables are not set.

This made the content of the build tag to be
ignored in this case.

This CL sets goos and goarch to runtime.GOOS
and runtime.GOARCH when the GOOS and GOARCH
environments variables are not set.

LGTM=aram, bradfitz
R=golang-codereviews, aram, gobot, rsc, dave, bradfitz
CC=golang-codereviews, rsc
https://golang.org/cl/112490043

10 years agonet/http: don't ignore errors in Request.Write
Brad Fitzpatrick [Thu, 24 Jul 2014 01:38:13 +0000 (18:38 -0700)]
net/http: don't ignore errors in Request.Write

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

10 years agomisc/pprof: support web profiles on windows/MinGW
ChaiShushan [Wed, 23 Jul 2014 17:35:04 +0000 (10:35 -0700)]
misc/pprof: support web profiles on windows/MinGW

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

10 years agoruntime: don't lock mheap on user goroutine
Dmitriy Vyukov [Wed, 23 Jul 2014 14:52:25 +0000 (18:52 +0400)]
runtime: don't lock mheap on user goroutine
This is bad for 2 reasons:
1. if the code under lock ever grows stack,
it will deadlock as stack growing acquires mheap lock.
2. It currently deadlocks with SetCPUProfileRate:
scavenger locks mheap, receives prof signal and tries to lock prof lock;
meanwhile SetCPUProfileRate locks prof lock and tries to grow stack
(presumably in runtime.unlock->futexwakeup). Boom.
Let's assume that it
Fixes #8407.

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

10 years agoruntime: fix unexpected return pc for runtime.newstackcall
Dmitriy Vyukov [Wed, 23 Jul 2014 14:51:34 +0000 (18:51 +0400)]
runtime: fix unexpected return pc for runtime.newstackcall
With cl/112640043 TestCgoDeadlockCrash episodically print:
unexpected return pc for runtime.newstackcall
After adding debug output I see the following trace:

runtime: unexpected return pc for runtime.newstackcall called from 0xc208011b00
runtime.throw(0x414da86)
        src/pkg/runtime/panic.c:523 +0x77
runtime.gentraceback(0x40165fc, 0xba440c28, 0x0, 0xc208d15200, 0xc200000000, 0xc208ddfd20, 0x20, 0x0, 0x0, 0x300)
src/pkg/runtime/traceback_x86.c:185 +0xca4
runtime.callers(0x1, 0xc208ddfd20, 0x20)
src/pkg/runtime/traceback_x86.c:438 +0x98
mcommoninit(0xc208ddfc00)
src/pkg/runtime/proc.c:369 +0x5c
runtime.allocm(0xc208052000)
src/pkg/runtime/proc.c:686 +0xa6
newm(0x4017850, 0xc208052000)
src/pkg/runtime/proc.c:933 +0x27
startm(0xc208052000, 0x100000001)
src/pkg/runtime/proc.c:1011 +0xba
wakep()
src/pkg/runtime/proc.c:1071 +0x57
resetspinning()
src/pkg/runtime/proc.c:1297 +0xa1
schedule()
src/pkg/runtime/proc.c:1366 +0x14b
runtime.gosched0(0xc20808e240)
src/pkg/runtime/proc.c:1465 +0x5b
runtime.newstack()
src/pkg/runtime/stack.c:891 +0x44d
runtime: unexpected return pc for runtime.newstackcall called from 0xc208011b00
runtime.newstackcall(0x4000cbd, 0x4000b80)
src/pkg/runtime/asm_amd64.s:278 +0x6f

I suspect that it can happen on any stack split.
So don't unwind g0 stack.
Also, that comment is lying -- we can traceback w/o mcache,
CPU profiler does that.

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

10 years agoliblink: more precise literal word comparison on arm
Russ Cox [Wed, 23 Jul 2014 14:17:59 +0000 (10:17 -0400)]
liblink: more precise literal word comparison on arm

There are fields in the Addr that do not matter for the
purpose of deciding that the same word is already
in the current literal pool. Copy only the fields that
do matter.

This came up when comparing against the Go version
because the way it is invoked doesn't copy a few fields
(like node) that are never directly used by liblink itself.

Also remove a stray print that is not well-defined in
the new liblink. (Cannot use %D outside of %P, because
%D needs the outer Prog*.)

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

10 years agolib9: format %#04x, 0 as 0x0000 not 000000.
Russ Cox [Wed, 23 Jul 2014 14:17:47 +0000 (10:17 -0400)]
lib9: format %#04x, 0 as 0x0000 not 000000.

This matches Go's fmt.Printf instead of ANSI C's dumb rules.
It makes the -S output from C liblink match Go's liblink.

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

10 years agocmd/gc: mark auxiliary symbols as containing no pointers
Dmitriy Vyukov [Wed, 23 Jul 2014 13:36:10 +0000 (17:36 +0400)]
cmd/gc: mark auxiliary symbols as containing no pointers
They do not, but pretend that they do.
The immediate need is that it breaks the new GC because
these are weird symbols as if with pointers but not necessary
pointer aligned.

LGTM=rsc
R=golang-codereviews, dave, josharian, khr, rsc
CC=golang-codereviews, iant, khr, rlh
https://golang.org/cl/116060043

10 years agodoc/go1.4.txt: windows can do symlinks now
Alex Brainman [Wed, 23 Jul 2014 06:36:29 +0000 (16:36 +1000)]
doc/go1.4.txt: windows can do symlinks now

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

10 years agotesting: add Coverage function
Russ Cox [Wed, 23 Jul 2014 02:56:35 +0000 (22:56 -0400)]
testing: add Coverage function

I've found this very useful for generating
good test case lists for -short mode for
the disassemblers.

Fixes #7959.

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

10 years agosyscall: allow for mksyscall_windows.go to be used outside of syscall
Alex Brainman [Wed, 23 Jul 2014 02:36:34 +0000 (12:36 +1000)]
syscall: allow for mksyscall_windows.go to be used outside of syscall

Fixes #8398.

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

10 years agoruntime: rename throwgo to gothrow
Dave Cheney [Tue, 22 Jul 2014 21:08:52 +0000 (07:08 +1000)]
runtime: rename throwgo to gothrow

As pointed out by Elias Naur, the convention for Go runtime functions means this function should be named gothrow.

Discussion: https://golang.org/cl/115860045/#msg6

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

10 years agocmd/ld: mark hostobj sections as containing no pointers
Dmitriy Vyukov [Tue, 22 Jul 2014 08:10:18 +0000 (12:10 +0400)]
cmd/ld: mark hostobj sections as containing no pointers
Currently they are scanned conservatively.
But there is no reason to scan them. C world must not contain
pointers into Go heap. Moreover, we don't have enough information
to emit write barriers nor update pointers there in future.
The immediate need is that it breaks the new GC because
these are weird symbols as if with pointers but not necessary
pointer aligned.

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

10 years agoruntime: make go vet happy
Keith Randall [Tue, 22 Jul 2014 04:35:48 +0000 (21:35 -0700)]
runtime: make go vet happy

CL 117950044 updates vet to fix LEA* issue.

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

10 years agocmd/gc: in the runtime package, don't promote any decls to the heap.
Keith Randall [Tue, 22 Jul 2014 03:56:44 +0000 (20:56 -0700)]
cmd/gc: in the runtime package, don't promote any decls to the heap.

In the runtime, we want to control where allocations happen.
In particular, we don't want the code implementing malloc to
itself trigger a malloc.  This change prevents the compiler
from inserting mallocs on our behalf (due to escaping declarations).

This check does not trigger on the current runtime code.

Note: Composite literals are still allowed.

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

10 years agoruntime: keep build version around in binaries
Keith Randall [Tue, 22 Jul 2014 03:52:11 +0000 (20:52 -0700)]
runtime: keep build version around in binaries

So we can tell from a binary which version of
Go built it.

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