]> Cypherpunks repositories - gostls13.git/log
gostls13.git
11 years agoruntime/race: add end-to-end test on windows
Alex Brainman [Thu, 15 Aug 2013 02:13:00 +0000 (12:13 +1000)]
runtime/race: add end-to-end test on windows

whatever "end-to-end" means here

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

11 years agocmd/go: fix bad error message in coverage for package without non-test files
Rob Pike [Thu, 15 Aug 2013 00:36:46 +0000 (10:36 +1000)]
cmd/go: fix bad error message in coverage for package without non-test files
Was checking for nil map; must check for empty map instead.

Fixes #6065

Before:

go test -cover
# testmain
/var/folders/00/013l0000h01000cxqpysvccm0004fc/T/go-build233480051/_/Users/r/issue/_test/_testmain.go:11: imported and not used: "_/Users/r/issue"
FAIL _/Users/r/issue [build failed]

Now:

go test -cover
testing: warning: no tests to run
PASS
coverage: 0.0% of statements
ok   _/Users/r/issue 0.021s

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

11 years agotime: handle GMT possibly with offset
Rob Pike [Thu, 15 Aug 2013 00:10:49 +0000 (10:10 +1000)]
time: handle GMT possibly with offset

Update #3790
Handle time zones like GMT-8.
The more general time zone-matching problem is not yet resolved.

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

11 years agocmd/go: fix detached heads that are remnants of bad git clones.
David Symonds [Wed, 14 Aug 2013 23:44:23 +0000 (09:44 +1000)]
cmd/go: fix detached heads that are remnants of bad git clones.

Fixes #6042.

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

11 years agomisc/emacs: Allow go-coverage to work in existing coverage buffers by reusing previou...
Dominik Honnef [Wed, 14 Aug 2013 23:03:44 +0000 (16:03 -0700)]
misc/emacs: Allow go-coverage to work in existing coverage buffers by reusing previous arguments

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

11 years agoencoding/xml: support generic encoding interfaces
Russ Cox [Wed, 14 Aug 2013 22:52:09 +0000 (18:52 -0400)]
encoding/xml: support generic encoding interfaces

Remove custom support for time.Time.
No new tests: the tests for the time.Time special case
now test the general case.

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

11 years agocmd/go, runtime/cgo: explicitly target ARMv5T
Carl Shapiro [Wed, 14 Aug 2013 22:21:53 +0000 (15:21 -0700)]
cmd/go, runtime/cgo: explicitly target ARMv5T

The baseline architecture had been left to the GCC configured
default which can be more accomodating than the rest of the Go
toolchain.  This prevented instructions used by the 5g compiler,
like BLX, from being used in GCC compiled assembler code.

R=golang-dev, dave, rsc, elias.naur, cshapiro
CC=golang-dev
https://golang.org/cl/12954043

11 years agodoc: update go1.2.txt
Andrew Gerrand [Wed, 14 Aug 2013 22:13:38 +0000 (08:13 +1000)]
doc: update go1.2.txt

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

11 years agodoc: update go1.2.txt
Brad Fitzpatrick [Wed, 14 Aug 2013 21:56:31 +0000 (14:56 -0700)]
doc: update go1.2.txt

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

11 years agonet: simplify dial
Mikio Hara [Wed, 14 Aug 2013 20:53:53 +0000 (05:53 +0900)]
net: simplify dial

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

11 years agocmd/ld: Remove superfluous redundant iself check
Elias Naur [Wed, 14 Aug 2013 20:28:40 +0000 (16:28 -0400)]
cmd/ld: Remove superfluous redundant iself check

        CL 12741044 added an extra iself condition to an if statement that already contained it. Remove it.

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

11 years agoruntime: fix SetBlockProfileRate
Dmitriy Vyukov [Wed, 14 Aug 2013 20:20:36 +0000 (00:20 +0400)]
runtime: fix SetBlockProfileRate
It doughtily misses all possible corner cases.
In particular on machines with <1GHz processors,
SetBlockProfileRate(1) disables profiling.
Fixes #6114.

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

11 years agonet: simplify non-cgo DNS exchange
Mikio Hara [Wed, 14 Aug 2013 20:08:08 +0000 (05:08 +0900)]
net: simplify non-cgo DNS exchange

Also does less buffer allocation in case of TCP fallback.

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

11 years agonet: fix TestTCPLookup
Mikio Hara [Wed, 14 Aug 2013 20:07:35 +0000 (05:07 +0900)]
net: fix TestTCPLookup

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

11 years agodoc: update go1.2.txt
Russ Cox [Wed, 14 Aug 2013 19:37:23 +0000 (15:37 -0400)]
doc: update go1.2.txt

Will submit once I can fill in the CL XXX number.

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

11 years agocmd/5g, cmd/6g, cmd/8g: restore occurrences of R replaced by nil in comments.
Rémy Oudompheng [Wed, 14 Aug 2013 19:24:48 +0000 (21:24 +0200)]
cmd/5g, cmd/6g, cmd/8g: restore occurrences of R replaced by nil in comments.

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

11 years agoencoding/xml: add, support Marshaler interface
Russ Cox [Wed, 14 Aug 2013 18:58:28 +0000 (14:58 -0400)]
encoding/xml: add, support Marshaler interface

See golang.org/s/go12xml for design.

Repeat of CL 12603044, which was submitted accidentally
and then rolled back.

Fixes #2771.
Fixes #4169.
Fixes #5975.
Fixes #6125.

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

11 years agoencoding/xml: add, support Unmarshaler interface
Russ Cox [Wed, 14 Aug 2013 18:57:45 +0000 (14:57 -0400)]
encoding/xml: add, support Unmarshaler interface

See golang.org/s/go12xml for design.

R=golang-dev, dominik.honnef, dan.kortschak
CC=golang-dev
https://golang.org/cl/12556043

11 years agoencoding/json: support encoding.TextMarshaler, encoding.TextUnmarshaler
Russ Cox [Wed, 14 Aug 2013 18:56:07 +0000 (14:56 -0400)]
encoding/json: support encoding.TextMarshaler, encoding.TextUnmarshaler

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

11 years agoruntime: make SetFinalizer(x, f) accept any f for which f(x) is valid
Russ Cox [Wed, 14 Aug 2013 18:54:31 +0000 (14:54 -0400)]
runtime: make SetFinalizer(x, f) accept any f for which f(x) is valid

Originally the requirement was f(x) where f's argument is
exactly x's type.

CL 11858043 relaxed the requirement in a non-standard
way: f's argument must be exactly x's type or interface{}.

If we're going to relax the requirement, it should be done
in a way consistent with the rest of Go. This CL allows f's
argument to have any type for which x is assignable;
that's the same requirement the compiler would impose
if compiling f(x) directly.

Fixes #5368.

R=dvyukov, bradfitz, pieter
CC=golang-dev
https://golang.org/cl/12895043

11 years agoruntime/cgo: use old-style indirect call on arm
Russ Cox [Wed, 14 Aug 2013 18:54:08 +0000 (14:54 -0400)]
runtime/cgo: use old-style indirect call on arm

TBR=elias.naur
CC=golang-dev
https://golang.org/cl/12943043

11 years agoruntime: fix windows build
Dmitriy Vyukov [Wed, 14 Aug 2013 18:18:49 +0000 (22:18 +0400)]
runtime: fix windows build

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

11 years agoruntime: implement SysUnused on windows
Dmitriy Vyukov [Wed, 14 Aug 2013 17:54:07 +0000 (21:54 +0400)]
runtime: implement SysUnused on windows
Fixes #5584.

R=golang-dev, chaishushan, alex.brainman
CC=golang-dev
https://golang.org/cl/12720043

11 years agonet: make TCPStress test shorter
Dmitriy Vyukov [Wed, 14 Aug 2013 17:53:27 +0000 (21:53 +0400)]
net: make TCPStress test shorter
It timeouts on freebsd builders:
http://build.golang.org/log/3d8169e13bff912bebf6fd3c54b34ad2d29a7221
but there are always runnable goroutines,
which suggests that it's slowly progressing.

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

11 years agoruntime: Fix build on older ARM
Elias Naur [Wed, 14 Aug 2013 17:50:12 +0000 (13:50 -0400)]
runtime: Fix build on older ARM

        The ARM external linking CL used BLX instructions in gcc assembler. Replace with BL to retain support on older ARM processors.

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

11 years agonet: make TestDeadlineRace shorter
Dmitriy Vyukov [Wed, 14 Aug 2013 17:20:11 +0000 (21:20 +0400)]
net: make TestDeadlineRace shorter
1. Do less iterations in short mode
2. Bound number of times SetDeadline is executed

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

11 years agoruntime: Fix netbsd/arm and freebsd/arm build
Elias Naur [Wed, 14 Aug 2013 17:18:32 +0000 (13:18 -0400)]
runtime: Fix netbsd/arm and freebsd/arm build

        The ARM external linking CL left missed changes to sys_freebsd_arm.s and sys_netbsd_arm.s already done to sys_linux_arm.s.

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

11 years agocmd/dist: fix darwin build
Russ Cox [Wed, 14 Aug 2013 16:57:05 +0000 (12:57 -0400)]
cmd/dist: fix darwin build

The TLS block on Darwin is not the same as on ELF.

TBR=elias.naur
CC=golang-dev
https://golang.org/cl/12741044

11 years agocmd/cgo: fix windows build
Elias Naur [Wed, 14 Aug 2013 16:47:06 +0000 (12:47 -0400)]
cmd/cgo: fix windows build

        The shared library changes broke the windows build because __attribute__ ((visibility ("hidden"))) is not supported in windows gcc. This change removes the attribute, as it is only needed when building shared libraries.

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

11 years agodatabase/sql: fix accumulation of bad conns on prepared statements
Matt Joiner [Wed, 14 Aug 2013 16:27:30 +0000 (09:27 -0700)]
database/sql: fix accumulation of bad conns on prepared statements

Fixes an issue where prepared statements that outlive many
connections become expensive to invoke.

Fixes #6081

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

11 years agoA+C: Matt Joiner (individual CLA)
Brad Fitzpatrick [Wed, 14 Aug 2013 16:22:26 +0000 (09:22 -0700)]
A+C: Matt Joiner (individual CLA)

Generated by addca.

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

11 years agoruntime.cmd/ld: Add ARM external linking and implement -shared in terms of external...
Elias Naur [Wed, 14 Aug 2013 15:38:54 +0000 (15:38 +0000)]
runtime.cmd/ld: Add ARM external linking and implement -shared in terms of external linking

This CL is an aggregate of 10271047104990439733044. Descriptions of each follow:

10499043
runtime,cmd/ld: Merge TLS symbols and teach 5l about ARM TLS

This CL prepares for external linking support to ARM.

The pseudo-symbols runtime.g and runtime.m are merged into a single
runtime.tlsgm symbol. When external linking, the offset of a thread local
variable is stored at a memory location instead of being embedded into a offset
of a ldr instruction. With a single runtime.tlsgm symbol for both g and m, only
one such offset is needed.

The larger part of this CL moves TLS code from gcc compiled to internally
compiled. The TLS code now uses the modern MRC instruction, and 5l is taught
about TLS fallbacks in case the instruction is not available or appropriate.

10271047
This CL adds support for -linkmode external to 5l.

For 5l itself, use addrel to allow for D_CALL relocations to be handled by the
host linker. Of the cases listed in rsc's comment in issue 4069, only case 5 and
63 needed an update. One of the TODO: addrel cases was since replaced, and the
rest of the cases are either covered by indirection through addpool (cases with
LTO or LFROM flags) or stubs (case 74). The addpool cases are covered because
addpool emits AWORD instructions, which in turn are handled by case 11.

In the runtime, change the argv argument in the rt0* functions slightly to be a
pointer to the argv list, instead of relying on a particular location of argv.

9733044
The -shared flag to 6l outputs a shared library, implemented in Go
and callable from non-Go programs such as C.

The main part of this CL change the thread local storage model.
Go uses the fastest and least general mode, local exec. TLS data in shared
libraries normally requires at least the local dynamic mode, however, this CL
instead opts for using the initial exec mode. Initial exec mode is faster than
local dynamic mode and can be used in linux since the linker has reserved a
limited amount of TLS space for performance sensitive TLS code.

Initial exec mode requires an extra load from the GOT table to determine the
TLS offset. This penalty will not be paid if ld is not in -shared mode, since
TLS accesses will be reduced to local exec.

The elf sections .init_array and .rela.init_array are added to register the Go
runtime entry with cgo at library load time.

The "hidden" attribute is added to Cgo functions called from Go, since Go
does not generate call through the GOT table, and adding non-GOT relocations for
a global function is not supported by gcc. Cgo symbols don't need to be global
and avoiding the GOT table is also faster.

The changes to 8l are only removes code relevant to the old -shared mode where
internal linking was used.

This CL only address the low level linker work. It can be submitted by itself,
but to be useful, the runtime changes in CL 9738047 is also needed.

Design discussion at
https://groups.google.com/forum/?fromgroups#!topic/golang-nuts/zmjXkGrEx6Q

Fixes #5590.

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

11 years agoruntime: improve block profiler support for channels
Dmitriy Vyukov [Wed, 14 Aug 2013 09:56:01 +0000 (13:56 +0400)]
runtime: improve block profiler support for channels
1. Handle select statements.
2. Handle chan close.
3. Show top frame in debug mode (chansend/chanrecv/selectgo).
Fixes #6049.

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

11 years agosync/atomic: fix new swap on arm linux
Russ Cox [Wed, 14 Aug 2013 04:50:47 +0000 (00:50 -0400)]
sync/atomic: fix new swap on arm linux

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

11 years agocmd/5g: fix temp-merging on ARM
Russ Cox [Wed, 14 Aug 2013 04:34:18 +0000 (00:34 -0400)]
cmd/5g: fix temp-merging on ARM

mkvar was taking care of the "LeftAddr" case,
effectively hiding it from the temp-merging optimization.

Move it into prog.c.

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

11 years agotime: make Time implement encoding interfaces
Russ Cox [Wed, 14 Aug 2013 04:34:00 +0000 (00:34 -0400)]
time: make Time implement encoding interfaces

See golang.org/s/go12encoding for design.

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

11 years agonet: make IP implement encoding.MarshalerText, encoding.UnmarshalerText
Russ Cox [Wed, 14 Aug 2013 04:33:20 +0000 (00:33 -0400)]
net: make IP implement encoding.MarshalerText, encoding.UnmarshalerText

See golang.org/s/go12encoding for design.

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

11 years agoundo CL 12603044 / 2ca230b93195
Russ Cox [Wed, 14 Aug 2013 04:20:55 +0000 (00:20 -0400)]
undo CL 12603044 / 2ca230b93195

fat fingers - did not intend to submit.
depends on the Unmarshaler CL anyway.

««« original CL description
encoding/xml: add, support Marshaler interface

See golang.org/s/go12xml for design.

Fixes #2771.
Fixes #4169.
Fixes #5975.
Fixes #6125.

R=golang-dev, iant, dan.kortschak
CC=golang-dev
https://golang.org/cl/12603044
»»»

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

11 years agoencoding/gob: support new generic interfaces in package encoding
Russ Cox [Wed, 14 Aug 2013 04:18:48 +0000 (00:18 -0400)]
encoding/gob: support new generic interfaces in package encoding

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

11 years agoencoding: new package
Russ Cox [Wed, 14 Aug 2013 04:18:20 +0000 (00:18 -0400)]
encoding: new package

See golang.org/s/go12encoding for design.

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

11 years agoencoding/xml: add, support Marshaler interface
Russ Cox [Wed, 14 Aug 2013 04:17:42 +0000 (00:17 -0400)]
encoding/xml: add, support Marshaler interface

See golang.org/s/go12xml for design.

Fixes #2771.
Fixes #4169.
Fixes #5975.
Fixes #6125.

R=golang-dev, iant, dan.kortschak
CC=golang-dev
https://golang.org/cl/12603044

11 years agomisc/notepadplus: support Calltips
ChaiShushan [Wed, 14 Aug 2013 03:41:36 +0000 (13:41 +1000)]
misc/notepadplus: support Calltips

Fixes #5789.

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

11 years agocmd/go: add -t flag to 'go get' to download test dependencies
Andrew Gerrand [Wed, 14 Aug 2013 01:01:17 +0000 (11:01 +1000)]
cmd/go: add -t flag to 'go get' to download test dependencies

Fixes #5126.

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

11 years agoruntime: fix build on arm
Russ Cox [Tue, 13 Aug 2013 23:37:54 +0000 (19:37 -0400)]
runtime: fix build on arm

Do not use ? :
I cannot say this enough.

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

11 years agoarchive/zip: add File.DataOffset
Brad Fitzpatrick [Tue, 13 Aug 2013 23:29:51 +0000 (16:29 -0700)]
archive/zip: add File.DataOffset

Accessor to find where the bytes of a file start.

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

11 years agonet: make Dial, Listen and ListenPacket return consistent error value
Mikio Hara [Tue, 13 Aug 2013 22:04:39 +0000 (07:04 +0900)]
net: make Dial, Listen and ListenPacket return consistent error value

Update #4856

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

11 years agodatabase/sql: add a disabled broken test
Brad Fitzpatrick [Tue, 13 Aug 2013 21:56:40 +0000 (14:56 -0700)]
database/sql: add a disabled broken test

Update #6081

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

11 years agoarchive/zip: remove an allocation, speed up a test
Brad Fitzpatrick [Tue, 13 Aug 2013 21:48:08 +0000 (14:48 -0700)]
archive/zip: remove an allocation, speed up a test

Update #6138

TestOver65kFiles spends all its time garbage collecting.
Removing the 1.4 MB of allocations per each of the 65k
files brings this from 34 seconds to 0.23 seconds.

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

11 years agoencoding/binary: make Write work like Read
Rob Pike [Tue, 13 Aug 2013 21:03:56 +0000 (07:03 +1000)]
encoding/binary: make Write work like Read
Use the fast path calculation to shorten the code.
No effect on benchmarks.

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

11 years agocmd/go: nicer error diagnosis in go test
Rob Pike [Tue, 13 Aug 2013 21:03:18 +0000 (07:03 +1000)]
cmd/go: nicer error diagnosis in go test
Before,
        go test -bench .
would just dump the long generic "go help" message. Confusing and
unhelpful. Now the message is short and on point and also reminds the
user about the oft-forgotten "go help testflag".

        % go test -bench
        go test: missing argument for flag bench
        run "go help test" or "go help testflag" for more information
        %

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

11 years agonet: fix build fix
Dmitriy Vyukov [Tue, 13 Aug 2013 20:55:18 +0000 (00:55 +0400)]
net: fix build fix
Now builders say:
pkg/net/dnsclient_unix_test.go:10: imported and not used: "runtime"

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

11 years agonet: fix windows build
Dmitriy Vyukov [Tue, 13 Aug 2013 20:44:57 +0000 (00:44 +0400)]
net: fix windows build
Windows builders say:
pkg\net\dnsclient_unix_test.go:24: undefined: dnsConfig
pkg\net\dnsclient_unix_test.go:25: undefined: exchange

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

11 years agoruntime: dump scheduler state if GODEBUG=schedtrace is set
Dmitriy Vyukov [Tue, 13 Aug 2013 20:30:55 +0000 (00:30 +0400)]
runtime: dump scheduler state if GODEBUG=schedtrace is set
The schedtrace value sets dump period in milliseconds.
In default mode the trace looks as follows:
SCHED 0ms: gomaxprocs=4 idleprocs=0 threads=3 idlethreads=0 runqueue=0 [1 0 0 0]
SCHED 1001ms: gomaxprocs=4 idleprocs=3 threads=6 idlethreads=3 runqueue=0 [0 0 0 0]
SCHED 2008ms: gomaxprocs=4 idleprocs=1 threads=6 idlethreads=1 runqueue=0 [0 1 0 0]
If GODEBUG=scheddetail=1 is set as well, then the detailed trace is printed:
SCHED 0ms: gomaxprocs=4 idleprocs=0 threads=3 idlethreads=0 runqueue=0 singleproc=0 gcwaiting=1 mlocked=0 nmspinning=0 stopwait=0 sysmonwait=0
  P0: status=3 tick=1 m=0 runqsize=1/128 gfreecnt=0
  P1: status=3 tick=0 m=-1 runqsize=0/128 gfreecnt=0
  P2: status=3 tick=0 m=-1 runqsize=0/128 gfreecnt=0
  P3: status=3 tick=0 m=-1 runqsize=0/128 gfreecnt=0
  M2: p=-1 curg=-1 mallocing=0 throwing=0 gcing=0 locks=1 dying=0 helpgc=0 spinning=0 lockedg=-1
  M1: p=-1 curg=-1 mallocing=0 throwing=0 gcing=0 locks=1 dying=0 helpgc=0 spinning=0 lockedg=-1
  M0: p=0 curg=1 mallocing=0 throwing=0 gcing=0 locks=1 dying=0 helpgc=0 spinning=0 lockedg=1
  G1: status=2() m=0 lockedm=0
  G2: status=1() m=-1 lockedm=-1

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

11 years agosync/atomic: update comment for ARM 64-bit atomics
Russ Cox [Tue, 13 Aug 2013 20:16:05 +0000 (16:16 -0400)]
sync/atomic: update comment for ARM 64-bit atomics

They don't work on older chips, just like the x86-32 64-bit atomics.

Update #6134

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

11 years agoundo CL 12840043 / 3b9f54db72a1
Keith Randall [Tue, 13 Aug 2013 19:59:39 +0000 (12:59 -0700)]
undo CL 12840043 / 3b9f54db72a1

Breaks the build.  Old bucket arrays kept by iterators
still need to be scanned.

««« original CL description
runtime: tell GC not to scan internal hashmap structures.
We'll do it ourselves via hash_gciter, thanks.
Fixes bug 6119.

R=golang-dev, dvyukov, cookieo9, rsc
CC=golang-dev
https://golang.org/cl/12840043
»»»

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

11 years agoruntime: tell GC not to scan internal hashmap structures.
Keith Randall [Tue, 13 Aug 2013 19:36:03 +0000 (12:36 -0700)]
runtime: tell GC not to scan internal hashmap structures.
We'll do it ourselves via hash_gciter, thanks.
Fixes bug 6119.

R=golang-dev, dvyukov, cookieo9, rsc
CC=golang-dev
https://golang.org/cl/12840043

11 years agoundo CL 12787044 / ed695cdf962b
Russ Cox [Tue, 13 Aug 2013 19:33:49 +0000 (23:33 +0400)]
undo CL 12787044 / ed695cdf962b

The NetBSD and OpenBSD failures are apparently real,
not due to the test bug fixed in 100b9fc0c46f.

««« original CL description
runtime/pprof: test netbsd and openbsd again

Maybe these will work now.

R=golang-dev, dvyukov, bradfitz
CC=golang-dev
https://golang.org/cl/12787044
»»»

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

11 years agoruntime: fix LockOSThread
Dmitriy Vyukov [Tue, 13 Aug 2013 18:37:04 +0000 (22:37 +0400)]
runtime: fix LockOSThread
Fixes #6100.

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

11 years agoruntime: more reliable preemption
Dmitriy Vyukov [Tue, 13 Aug 2013 18:14:04 +0000 (22:14 +0400)]
runtime: more reliable preemption
Currently it's possible that a goroutine
that periodically executes non-blocking
cgo/syscalls is never preempted.
This change splits scheduler and syscall
ticks to prevent such situation.

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

11 years agoruntime: do no lose CPU profiling signals
Dmitriy Vyukov [Tue, 13 Aug 2013 18:12:02 +0000 (22:12 +0400)]
runtime: do no lose CPU profiling signals
Currently we lose lots of profiling signals.
Most notably, GC is not accounted at all.
But stack splits, scheduler, syscalls, etc are lost as well.
This creates seriously misleading profile.
With this change all profiling signals are accounted.
Now I see these additional entries that were previously absent:
161  29.7%  29.7%      164  30.3% syscall.Syscall
 12   2.2%  50.9%       12   2.2% scanblock
 11   2.0%  55.0%       11   2.0% markonly
 10   1.8%  58.9%       10   1.8% sweepspan
  2   0.4%  85.8%        2   0.4% runtime.newstack
It is still impossible to understand what causes stack splits,
but at least it's clear how many time is spent on them.
Update #2197.
Update #5659.

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

11 years agoruntime: fix false deadlock crash
Dmitriy Vyukov [Tue, 13 Aug 2013 18:07:42 +0000 (22:07 +0400)]
runtime: fix false deadlock crash
Fixes #6070.
Update #6055.

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

11 years agosync/atomic: fix ARM nomenclature in comments
Dmitriy Vyukov [Tue, 13 Aug 2013 18:07:21 +0000 (22:07 +0400)]
sync/atomic: fix ARM nomenclature in comments

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

11 years agoio: prevent write to PipeWriter after Close
Rick Arnold [Tue, 13 Aug 2013 18:04:09 +0000 (11:04 -0700)]
io: prevent write to PipeWriter after Close

Return an ErrClosedPipe rather than allowing the write to proceed.

Fixes #5330.

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

11 years agosync/atomic: add Swap to nil deref test
Dmitriy Vyukov [Tue, 13 Aug 2013 17:18:33 +0000 (21:18 +0400)]
sync/atomic: add Swap to nil deref test

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

11 years agosync/atomic: trigger paging fault early on linux/arm
Dmitriy Vyukov [Tue, 13 Aug 2013 17:15:47 +0000 (21:15 +0400)]
sync/atomic: trigger paging fault early on linux/arm
so that we don't need to traceback through __kuser_cmpxchg

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

11 years agonet: implement DNS TCP fallback query if UDP response is truncated
Alex A Skinner [Tue, 13 Aug 2013 16:44:12 +0000 (09:44 -0700)]
net: implement DNS TCP fallback query if UDP response is truncated

Fixes #5686.

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

11 years agocmd/cgo: Add support for C function pointers
Alberto García Hierro [Tue, 13 Aug 2013 16:42:21 +0000 (12:42 -0400)]
cmd/cgo: Add support for C function pointers

* Add a new kind of Name, "fpvar" which stands for function pointer variable
* When walking the AST, find functions used as expressions and create a new Name object for them
* Track functions which are only used in expr contexts, and avoid generating bridge code for them

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

11 years agoruntime/pprof: test netbsd and openbsd again
Russ Cox [Tue, 13 Aug 2013 16:35:37 +0000 (12:35 -0400)]
runtime/pprof: test netbsd and openbsd again

Maybe these will work now.

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

11 years agotest/run: process build tags like go/build
Anthony Martin [Tue, 13 Aug 2013 16:25:41 +0000 (12:25 -0400)]
test/run: process build tags like go/build

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

11 years agoruntime/pprof: fix test
Dmitriy Vyukov [Tue, 13 Aug 2013 16:18:29 +0000 (12:18 -0400)]
runtime/pprof: fix test

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

11 years agoruntime: fix handling of network deadlines
Dmitriy Vyukov [Tue, 13 Aug 2013 15:11:42 +0000 (19:11 +0400)]
runtime: fix handling of network deadlines
Ensure that deadlines affect already issued IO.

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

11 years agodoc: update go1.2.txt
Dmitriy Vyukov [Tue, 13 Aug 2013 13:21:33 +0000 (17:21 +0400)]
doc: update go1.2.txt

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

11 years agosync/atomic: add Swap functions
Dmitriy Vyukov [Tue, 13 Aug 2013 11:26:48 +0000 (15:26 +0400)]
sync/atomic: add Swap functions
Fixes #5722.

R=golang-dev, khr, cshapiro, rsc, r
CC=golang-dev
https://golang.org/cl/12670045

11 years agonet: make deadline helpers join to netFD as its methods
Mikio Hara [Tue, 13 Aug 2013 11:00:58 +0000 (20:00 +0900)]
net: make deadline helpers join to netFD as its methods

Just for readability reasons; to prevent overlooking deadline stuff
across over platforms.

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

11 years agosync: faster Cond
Dmitriy Vyukov [Tue, 13 Aug 2013 10:45:36 +0000 (14:45 +0400)]
sync: faster Cond
The new version does not require any memory allocations and is 30-50% faster.
Also detect and painc if Cond is copied after first.

benchmark            old ns/op    new ns/op    delta
BenchmarkCond1             317          195  -38.49%
BenchmarkCond1-2           875          607  -30.63%
BenchmarkCond1-4          1116          548  -50.90%
BenchmarkCond1-8          1013          613  -39.49%
BenchmarkCond1-16          983          450  -54.22%
BenchmarkCond2             559          352  -37.03%
BenchmarkCond2-2          1916         1378  -28.08%
BenchmarkCond2-4          1518         1322  -12.91%
BenchmarkCond2-8          2313         1291  -44.19%
BenchmarkCond2-16         1885         1078  -42.81%
BenchmarkCond4            1070          614  -42.62%
BenchmarkCond4-2          4899         3047  -37.80%
BenchmarkCond4-4          3813         3006  -21.16%
BenchmarkCond4-8          3605         3045  -15.53%
BenchmarkCond4-16         4148         2637  -36.43%
BenchmarkCond8            2086         1264  -39.41%
BenchmarkCond8-2          9961         6736  -32.38%
BenchmarkCond8-4          8135         7689   -5.48%
BenchmarkCond8-8          9623         7517  -21.89%
BenchmarkCond8-16        11661         8093  -30.60%

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

11 years agoruntime: eliminate excessive notewakeup calls in timers
Dmitriy Vyukov [Tue, 13 Aug 2013 10:14:24 +0000 (14:14 +0400)]
runtime: eliminate excessive notewakeup calls in timers
If the timer goroutine is wakeup by timeout,
other goroutines will still notewakeup because sleeping is still set.

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

11 years agosyscall: disable cpu profiling around fork
Dmitriy Vyukov [Tue, 13 Aug 2013 09:01:30 +0000 (13:01 +0400)]
syscall: disable cpu profiling around fork
Fixes #5517.
Fixes #5659.

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

11 years agoruntime: fix network timers related crash
Dmitriy Vyukov [Tue, 13 Aug 2013 08:55:57 +0000 (12:55 +0400)]
runtime: fix network timers related crash
Fixes #6103.

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

11 years agotag go1.1.2
Andrew Gerrand [Tue, 13 Aug 2013 06:33:59 +0000 (16:33 +1000)]
tag go1.1.2

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

11 years agogo/doc: permit a package synopsis to end with ":\n".
David Symonds [Tue, 13 Aug 2013 06:20:17 +0000 (16:20 +1000)]
go/doc: permit a package synopsis to end with ":\n".

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

11 years agodoc: release notes for go1.1.2
Andrew Gerrand [Tue, 13 Aug 2013 05:08:10 +0000 (15:08 +1000)]
doc: release notes for go1.1.2

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

11 years agocmd/gc: add temporary-merging optimization pass
Russ Cox [Tue, 13 Aug 2013 04:09:31 +0000 (00:09 -0400)]
cmd/gc: add temporary-merging optimization pass

The compilers assume they can generate temporary variables
as needed to preserve the right semantics or simplify code
generation and the back end will still generate good code.
This turns out not to be true. The back ends will only
track the first 128 variables per function and give up
on the remainder. That needs to be fixed too, in a later CL.

This CL merges temporary variables with equal types and
non-overlapping lifetimes using the greedy algorithm in
Poletto and Sarkar, "Linear Scan Register Allocation",
ACM TOPLAS 1999.

The result can be striking in the right functions.

Top 20 frame size changes in a 6g godoc binary by bytes saved:

5464 1984 (-3480, -63.7%) go/build.(*Context).Import
4456 1824 (-2632, -59.1%) go/printer.(*printer).expr1
2560   80 (-2480, -96.9%) time.nextStdChunk
3496 1608 (-1888, -54.0%) go/printer.(*printer).stmt
1896  272 (-1624, -85.7%) net/http.init
2688 1400 (-1288, -47.9%) fmt.(*pp).printReflectValue
2800 1512 (-1288, -46.0%) main.main
3296 2016 (-1280, -38.8%) crypto/tls.(*Conn).clientHandshake
1664  488 (-1176, -70.7%) time.loadZoneZip
1760  608 (-1152, -65.5%) time.parse
4104 3072 (-1032, -25.1%) runtime/pprof.writeHeap
1680  712 ( -968, -57.6%) go/ast.Walk
2488 1560 ( -928, -37.3%) crypto/x509.parseCertificate
1128  392 ( -736, -65.2%) math/big.nat.divLarge
1528  864 ( -664, -43.5%) go/printer.(*printer).fieldList
1360  712 ( -648, -47.6%) regexp/syntax.(*parser).factor
2104 1528 ( -576, -27.4%) encoding/asn1.parseField
1064  504 ( -560, -52.6%) encoding/xml.(*Decoder).text
 584   48 ( -536, -91.8%) html.init
1400  864 ( -536, -38.3%) go/doc.playExample

In the same godoc build, cuts the number of functions with
too many vars from 83 to 32.

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

11 years agodoc/go1.2.txt: bufio.{Writer,Reader}.Reset
Rob Pike [Tue, 13 Aug 2013 03:39:45 +0000 (13:39 +1000)]
doc/go1.2.txt: bufio.{Writer,Reader}.Reset

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

11 years agocmd/api: don't fail API check if there's no network
Brad Fitzpatrick [Tue, 13 Aug 2013 02:18:47 +0000 (19:18 -0700)]
cmd/api: don't fail API check if there's no network

If the hg checkout of go.tools fails, check for Internet
connectivity before failing.

R=golang-dev, shivakumar.gn
CC=golang-dev
https://golang.org/cl/12814043

11 years agocmd/6l: fix printing of frame size in TEXT instruction
Russ Cox [Tue, 13 Aug 2013 02:04:24 +0000 (22:04 -0400)]
cmd/6l: fix printing of frame size in TEXT instruction

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

11 years agocmd/gc: move flow graph into portable opt
Russ Cox [Tue, 13 Aug 2013 02:02:10 +0000 (22:02 -0400)]
cmd/gc: move flow graph into portable opt

Now there's only one copy of the flow graph construction
and dominator computation, and different optimizations
can attach different annotations to the instructions.

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

11 years agogo/build: change the wording of NoGoError and comment it better
Rob Pike [Tue, 13 Aug 2013 01:32:32 +0000 (11:32 +1000)]
go/build: change the wording of NoGoError and comment it better
Out of context, it can be very confusing because there can be lots of Go
files in the directory, but the error message says there aren't.

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

11 years agotext/template: Make function call builtin handle nil errors correctly
Elias Naur [Tue, 13 Aug 2013 01:11:05 +0000 (11:11 +1000)]
text/template: Make function call builtin handle nil errors correctly

The call builtin unconditionally tries to convert a second return value from a function to the error type. This fails in case nil is returned, effectively making call useless for functions returning two values.

This CL adds a nil check for the second return value, and adds a test.

Note that for regular function and method calls the nil error case is handled correctly and is verified by a test.

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

11 years agocmd/6g, cmd/8g: proginfo carry fixes
Russ Cox [Tue, 13 Aug 2013 01:02:55 +0000 (21:02 -0400)]
cmd/6g, cmd/8g: proginfo carry fixes

Bugs pointed out by cshapiro in CL 12637051.

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

11 years agocmd/gc: support for "portable" optimization logic
Russ Cox [Mon, 12 Aug 2013 23:14:02 +0000 (19:14 -0400)]
cmd/gc: support for "portable" optimization logic

Code in gc/popt.c is compiled as part of 5g, 6g, and 8g,
meaning it can use arch-specific headers but there's
just one copy of the code.

This is the same arrangement we use for the portable
code generation logic in gc/pgen.c.

Move fixjmp and noreturn there to get the ball rolling.

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

11 years agonet/http: do not send malformed cookie domain attribute
Volker Dobler [Mon, 12 Aug 2013 22:14:34 +0000 (15:14 -0700)]
net/http: do not send malformed cookie domain attribute

Malformed domain attributes are not sent in a Set-Cookie header.
Instead the domain attribute is dropped which turns the cookie
into a host-only cookie. This is much safer than dropping characters
from domain attribute.

Domain attributes with a leading dot '.' are still allowed, even
if discouraged by RFC 6265 section 4.1.1.

Fixes #6013

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

11 years agoruntime: change textflags from numbers to symbols
Keith Randall [Mon, 12 Aug 2013 20:47:18 +0000 (13:47 -0700)]
runtime: change textflags from numbers to symbols

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

11 years agoruntime/race: add end-to-end test
Dmitriy Vyukov [Mon, 12 Aug 2013 18:04:10 +0000 (22:04 +0400)]
runtime/race: add end-to-end test
Fixes #5933.

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

11 years agoruntime: remove unused m->racepc
Dmitriy Vyukov [Mon, 12 Aug 2013 17:48:19 +0000 (21:48 +0400)]
runtime: remove unused m->racepc
The original plan was to collect allocation stacks
for all memory blocks. But it was never implemented
and it's not in near plans and it's unclear how to do it at all.

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

11 years agosync/atomic: specify argsize for asm routines
Dmitriy Vyukov [Mon, 12 Aug 2013 17:46:33 +0000 (21:46 +0400)]
sync/atomic: specify argsize for asm routines
Fixes #6098.

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

11 years agocmd/5g: factor out prog information
Russ Cox [Mon, 12 Aug 2013 17:42:23 +0000 (13:42 -0400)]
cmd/5g: factor out prog information

Like CL 12637051, but for 5g instead of 6g.

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

11 years agocmd/5l: fix encoding of new MOVB, MOVH instructions
Russ Cox [Mon, 12 Aug 2013 17:42:04 +0000 (13:42 -0400)]
cmd/5l: fix encoding of new MOVB, MOVH instructions

They are just like MOVW and should be setting only
two register fields, not three.

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

11 years agoruntime: fix ARM assembly formatting
Dmitriy Vyukov [Mon, 12 Aug 2013 17:36:33 +0000 (21:36 +0400)]
runtime: fix ARM assembly formatting

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

11 years agoall: change textflags from numbers to symbols.
Keith Randall [Mon, 12 Aug 2013 17:25:36 +0000 (10:25 -0700)]
all: change textflags from numbers to symbols.

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

11 years agomath: convert textflags from numbers to symbols
Keith Randall [Mon, 12 Aug 2013 17:25:18 +0000 (10:25 -0700)]
math: convert textflags from numbers to symbols

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