]> Cypherpunks repositories - gostls13.git/log
gostls13.git
10 years agoruntime: add Go symtab implementation
Josh Bleecher Snyder [Fri, 22 Aug 2014 15:41:32 +0000 (08:41 -0700)]
runtime: add Go symtab implementation

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

10 years agopath, path/filepath: remove dead code
Dave Cheney [Fri, 22 Aug 2014 12:21:41 +0000 (22:21 +1000)]
path, path/filepath: remove dead code

Fixes #8503.

Thanks to no.smile.face for the original report.

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

10 years agomisc/nacl: fix build
Dave Cheney [Fri, 22 Aug 2014 08:36:01 +0000 (18:36 +1000)]
misc/nacl: fix build

Add gofmt.go and gofmt_test.go as they are part of the test data set.

See CL 130440043.

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

10 years agosyscall: fix nacl build
Dmitriy Vyukov [Fri, 22 Aug 2014 07:46:10 +0000 (11:46 +0400)]
syscall: fix nacl build
Timer callback does not accept now as first arg anymore.

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

10 years agopath/filepath: make Abs handle paths like c:a.txt properly
Alex Brainman [Fri, 22 Aug 2014 07:14:42 +0000 (17:14 +1000)]
path/filepath: make Abs handle paths like c:a.txt properly

Fixes #8145.

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

10 years agocmd/gofmt: make test files self-describing
Robert Griesemer [Fri, 22 Aug 2014 00:25:13 +0000 (17:25 -0700)]
cmd/gofmt: make test files self-describing

1) Interpret a comment of the form

//gofmt <flags>

in test files to drive the respective
gofmt command. Eliminates the need to
enumerate all test files in the test
harness.

2) Added -update flag to make it easier
to update test cases.

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

10 years agosync: be more explicit in WaitGroup docs
Andrew Gerrand [Thu, 21 Aug 2014 23:53:44 +0000 (09:53 +1000)]
sync: be more explicit in WaitGroup docs

Fixes #8543.

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

10 years agocmd/ld: fix undefined behaviour in pcln.c
Dave Cheney [Thu, 21 Aug 2014 23:10:33 +0000 (09:10 +1000)]
cmd/ld: fix undefined behaviour in pcln.c

Update #8527

Fixes, src/cmd/6l/../ld/pcln.c:93:18: runtime error: left shift of negative value -2

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

10 years agoA+C: Fatih Arslan (individual CLA)
Rob Pike [Thu, 21 Aug 2014 22:44:03 +0000 (15:44 -0700)]
A+C: Fatih Arslan (individual CLA)

Generated by a+c.

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

10 years agocmd/gofmt: remove testdata/*.gofmt files
Robert Griesemer [Thu, 21 Aug 2014 21:54:27 +0000 (14:54 -0700)]
cmd/gofmt: remove testdata/*.gofmt files

This files were added accidentally and are
not required for running the tests (they
are produced by failing tests for easier
debugging).

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

10 years agoruntime: give an explicit name to profiling Bucket sub-structs.
Rémy Oudompheng [Thu, 21 Aug 2014 20:34:00 +0000 (22:34 +0200)]
runtime: give an explicit name to profiling Bucket sub-structs.

Fixes compilation of runtime on Solaris where the inner struct
was not called "_4_".

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

10 years agotime: removed from tests now obsolete assumption about Australian tz abbreviations
Alberto Donizetti [Thu, 21 Aug 2014 17:35:43 +0000 (10:35 -0700)]
time: removed from tests now obsolete assumption about Australian tz abbreviations

Australian timezones abbreviation for standard and daylight saving time were recently
changed from EST for both to AEST and AEDT in the icann tz database (see changelog
on www.iana.org/time-zones).

A test in the time package was written to check that the ParseInLocation function
understand that Feb EST and Aug EST are different time zones, even though they are
both called EST. This is no longer the case, and the Date function now returns
AEST or AEDT for australian tz on every Linux system with an up to date tz database
(and this makes the test fail).

Since I wasn't able to find another country that 1) uses daylight saving and 2) has
the same abbreviation for both on tzdata, I changed the test to make sure that
ParseInLocation does not get confused when it parses, in different locations, two
dates with the same abbreviation (this was suggested in the mailing list).

Fixes #8547.

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

10 years agoA+C: Alberto Donizetti (individual CLA)
Brad Fitzpatrick [Thu, 21 Aug 2014 17:34:02 +0000 (10:34 -0700)]
A+C: Alberto Donizetti (individual CLA)

Generated by a+c.

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

10 years agocmd/api: reduce stutter in runtime type stubs
Josh Bleecher Snyder [Thu, 21 Aug 2014 17:16:49 +0000 (10:16 -0700)]
cmd/api: reduce stutter in runtime type stubs

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

10 years agonet/http/httputil: Pass a Logger to ReverseProxy, allowing the user to control logging.
Mark Theunissen [Thu, 21 Aug 2014 17:16:34 +0000 (10:16 -0700)]
net/http/httputil: Pass a Logger to ReverseProxy, allowing the user to control logging.

Fixes #8553.

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

10 years agoA+C: Mark Theunissen (individual CLA)
Brad Fitzpatrick [Thu, 21 Aug 2014 17:15:19 +0000 (10:15 -0700)]
A+C: Mark Theunissen (individual CLA)

Generated by a+c.

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

10 years agoruntime: convert lfstack to Go
Dmitriy Vyukov [Thu, 21 Aug 2014 17:10:45 +0000 (21:10 +0400)]
runtime: convert lfstack to Go
It is called from Go only in tests.

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

10 years agoruntime: remove now arg from timer callback
Dmitriy Vyukov [Thu, 21 Aug 2014 17:10:30 +0000 (21:10 +0400)]
runtime: remove now arg from timer callback
Cleanup before converting to Go.
Fortunately nobody using it, because it is incorrect:
monotonic runtime time instead of claimed real time.

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

10 years agoruntime: convert common scheduler functions to Go
Dmitriy Vyukov [Thu, 21 Aug 2014 16:41:09 +0000 (20:41 +0400)]
runtime: convert common scheduler functions to Go
These are required for chans, semaphores, timers, etc.

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

10 years agonet: fix typo
Mikio Hara [Thu, 21 Aug 2014 08:53:45 +0000 (17:53 +0900)]
net: fix typo

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

10 years agocmd/gc: fix undefined behavior
Dmitriy Vyukov [Thu, 21 Aug 2014 08:34:26 +0000 (12:34 +0400)]
cmd/gc: fix undefined behavior
UndefinedBehaviorSanitizer claims it is UB in C:
src/cmd/gc/racewalk.c:422:37: runtime error: member access within null pointer of type 'Node' (aka 'struct Node')
src/cmd/gc/racewalk.c:423:37: runtime error: member access within null pointer of type 'Node' (aka 'struct Node')

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

10 years agoruntime: init GC later
Dmitriy Vyukov [Thu, 21 Aug 2014 07:55:05 +0000 (11:55 +0400)]
runtime: init GC later
Init GC later as it needs to read GOGC env var.
Fixes #8562.

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

10 years agoruntime: fix deadlock when gctrace
Dmitriy Vyukov [Thu, 21 Aug 2014 07:46:53 +0000 (11:46 +0400)]
runtime: fix deadlock when gctrace
Calling ReadMemStats which does stoptheworld on m0 holding locks
was not a good idea.
Stoptheworld holding locks is a recipe for deadlocks (added check for this).
Stoptheworld on g0 may or may not work (added check for this as well).
As far as I understand scavenger will print incorrect numbers now,
as stack usage is not subtracted from heap. But it's better than deadlocking.

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

10 years agocmd/api: add missing runtime struct
Dmitriy Vyukov [Thu, 21 Aug 2014 07:43:58 +0000 (11:43 +0400)]
cmd/api: add missing runtime struct
Fixes build.

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

10 years agoruntime: convert MemProfile, BlockProfile, ThreadCreateProfile to Go.
Rémy Oudompheng [Thu, 21 Aug 2014 06:07:42 +0000 (08:07 +0200)]
runtime: convert MemProfile, BlockProfile, ThreadCreateProfile to Go.

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

10 years agoruntime: remove unused variable
Josh Bleecher Snyder [Wed, 20 Aug 2014 21:36:28 +0000 (14:36 -0700)]
runtime: remove unused variable

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

10 years agoruntime: convert memclrBytes to Go
Josh Bleecher Snyder [Wed, 20 Aug 2014 21:02:11 +0000 (14:02 -0700)]
runtime: convert memclrBytes to Go

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

10 years agoruntime: add atomicor8 for amd64p32
Dmitriy Vyukov [Wed, 20 Aug 2014 08:58:01 +0000 (12:58 +0400)]
runtime: add atomicor8 for amd64p32

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

10 years agosyscall: replace zsyscall_windows_*.go files with a single file
Alex Brainman [Wed, 20 Aug 2014 03:17:45 +0000 (13:17 +1000)]
syscall: replace zsyscall_windows_*.go files with a single file

zsyscall_windows_386.go and zsyscall_windows_amd64.go contain same bytes

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

10 years agonet/http: fix TimeoutHandler data races; hold lock longer
Brad Fitzpatrick [Wed, 20 Aug 2014 01:45:05 +0000 (18:45 -0700)]
net/http: fix TimeoutHandler data races; hold lock longer

The existing lock needed to be held longer. If a timeout occured
while writing (but after the guarded timeout check), the writes
would clobber a future connection's buffer.

Also remove a harmless warning by making Write also set the
flag that headers were sent (implicitly), so we don't try to
write headers later (a no-op + warning) on timeout after we've
started writing.

Fixes #8414
Fixes #8209

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

10 years agoruntime: fix typo in comment
Josh Bleecher Snyder [Tue, 19 Aug 2014 15:50:35 +0000 (08:50 -0700)]
runtime: fix typo in comment

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

10 years agoruntime: fix TestGcLastTime on windows
Dmitriy Vyukov [Tue, 19 Aug 2014 15:32:27 +0000 (19:32 +0400)]
runtime: fix TestGcLastTime on windows
Intended to fix:
http://build.golang.org/log/d6718ea67541b8c6be2bb14bcbc4e1c4261f67d7

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

10 years agocmd/6a, cmd/8a: document AJxx condition codes
Josh Bleecher Snyder [Tue, 19 Aug 2014 15:07:58 +0000 (08:07 -0700)]
cmd/6a, cmd/8a: document AJxx condition codes

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

10 years agoruntime: make the GC bitmap a byte array
Dmitriy Vyukov [Tue, 19 Aug 2014 13:38:00 +0000 (17:38 +0400)]
runtime: make the GC bitmap a byte array
Half the code in the garbage collector accesses the bitmap
as an array of bytes instead of as an array of uintptrs.
This is tricky to do correctly in a portable fashion,
it breaks on big-endian systems.
Make the bitmap a byte array.
Simplifies markallocated, scanblock and span sweep along the way,
as we don't need to recalculate bitmap position for each word.

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

10 years agoruntime: always pass type to mallocgc when allocating scannable memory
Dmitriy Vyukov [Tue, 19 Aug 2014 11:59:42 +0000 (15:59 +0400)]
runtime: always pass type to mallocgc when allocating scannable memory
We allocate scannable memory w/o type only in few places in runtime.
All these cases are not-performance critical (e.g. G or finq args buffer),
and in long term they all need to go away.
It's not worth it to have special code for this case in mallocgc.
So use special fake "notype" type for such allocations.

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

10 years agoruntime: allow copying of onM frame
Dmitriy Vyukov [Tue, 19 Aug 2014 10:24:03 +0000 (14:24 +0400)]
runtime: allow copying of onM frame
Currently goroutines in onM can't be copied/shrunk
(including the very goroutine that triggers GC).
Special case onM to allow copying.

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

10 years agoruntime: fix MemStats on 32-bits
Dmitriy Vyukov [Tue, 19 Aug 2014 07:53:20 +0000 (11:53 +0400)]
runtime: fix MemStats on 32-bits
Int64's do not fit into uintptr's.

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

10 years agoruntime: convert Gosched to Go
Dmitriy Vyukov [Tue, 19 Aug 2014 07:49:59 +0000 (11:49 +0400)]
runtime: convert Gosched to Go

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

10 years agocmd/gc: fix heap buffer overflow
Dmitriy Vyukov [Tue, 19 Aug 2014 07:49:36 +0000 (11:49 +0400)]
cmd/gc: fix heap buffer overflow
Fixes #8528.

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

10 years agoruntime: improve diagnostics of non-copyable frames
Dmitriy Vyukov [Tue, 19 Aug 2014 07:46:19 +0000 (11:46 +0400)]
runtime: improve diagnostics of non-copyable frames

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

10 years agoruntime: fix memstats
Dmitriy Vyukov [Tue, 19 Aug 2014 07:46:05 +0000 (11:46 +0400)]
runtime: fix memstats
Newly allocated memory is subtracted from inuse, while it was never added to inuse.
Span leftovers are subtracted from both inuse and idle,
while they were never added.
Fixes #8544.
Fixes #8430.

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

10 years agoos: make SameFile handle paths like c:a.txt properly
Alex Brainman [Tue, 19 Aug 2014 04:59:56 +0000 (14:59 +1000)]
os: make SameFile handle paths like c:a.txt properly

Fixes #8490.

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

10 years agoruntime: apply KindMask before comparison
Alex Brainman [Tue, 19 Aug 2014 04:41:52 +0000 (14:41 +1000)]
runtime: apply KindMask before comparison

Fixes windows build.

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

10 years agohtml/template: don't panic on second execution of unescapable template
Andrew Gerrand [Tue, 19 Aug 2014 04:24:14 +0000 (14:24 +1000)]
html/template: don't panic on second execution of unescapable template

Fixes #8431.

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

10 years agonet/http: correct error message for incorrect Body length
Evan Kroske [Tue, 19 Aug 2014 03:40:12 +0000 (20:40 -0700)]
net/http: correct error message for incorrect Body length

Fixes #8140.

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

10 years agoruntime: fix windows/amd64 build after pc-relative 6l change
Russ Cox [Tue, 19 Aug 2014 02:12:51 +0000 (22:12 -0400)]
runtime: fix windows/amd64 build after pc-relative 6l change

TBR=iant
CC=golang-codereviews
https://golang.org/cl/131900043

10 years agoliblink: fix encoding of ASETPC in 6a, 8a
Josh Bleecher Snyder [Tue, 19 Aug 2014 01:14:54 +0000 (18:14 -0700)]
liblink: fix encoding of ASETPC in 6a, 8a

It was incorrectly encoded as ASETLS.

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

10 years agocmd/gc, runtime: refactor interface inlining decision into compiler
Russ Cox [Tue, 19 Aug 2014 01:13:11 +0000 (21:13 -0400)]
cmd/gc, runtime: refactor interface inlining decision into compiler

We need to change the interface value representation for
concurrent garbage collection, so that there is no ambiguity
about whether the data word holds a pointer or scalar.

This CL does NOT make any representation changes.

Instead, it removes representation assumptions from
various pieces of code throughout the tree.
The isdirectiface function in cmd/gc/subr.c is now
the only place that decides that policy.
The policy propagates out from there in the reflect
metadata, as a new flag in the internal kind value.

A follow-up CL will change the representation by
changing the isdirectiface function. If that CL causes
problems, it will be easy to roll back.

Update #8405.

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

10 years agodoc/go1.4: mention pc-relative addressing on amd64
Russ Cox [Tue, 19 Aug 2014 01:07:11 +0000 (21:07 -0400)]
doc/go1.4: mention pc-relative addressing on amd64

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

10 years agoliblink: use pc-relative addressing for all memory references in amd64 code
Russ Cox [Tue, 19 Aug 2014 01:06:56 +0000 (21:06 -0400)]
liblink: use pc-relative addressing for all memory references in amd64 code

LGTM=rminnich, iant
R=golang-codereviews, rminnich, iant
CC=golang-codereviews, r
https://golang.org/cl/125140043

10 years agoruntime: avoid $sym(SB) as constant
Russ Cox [Tue, 19 Aug 2014 01:06:42 +0000 (21:06 -0400)]
runtime: avoid $sym(SB) as constant

The change to pc-relative addressing will make this illegal.

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

10 years agocmd/6g: fix undefined behavior in reg.c
Dave Cheney [Tue, 19 Aug 2014 00:52:50 +0000 (10:52 +1000)]
cmd/6g: fix undefined behavior in reg.c

Update #8527

Fixes, cmd/6g/reg.c:847:24: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'

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

10 years agofmt: print byte stringers correctly
Andrew Gerrand [Mon, 18 Aug 2014 22:52:52 +0000 (08:52 +1000)]
fmt: print byte stringers correctly

type T byte
func (T) String() string { return "X" }

fmt.Sprintf("%s", []T{97, 98, 99, 100}) == "abcd"
fmt.Sprintf("%x", []T{97, 98, 99, 100}) == "61626364"
fmt.Sprintf("%v", []T{97, 98, 99, 100}) == "[X X X X]"

This change makes the last case print correctly.
Before, it would have been "[97 98 99 100]".

Fixes #8360.

LGTM=r
R=r, dan.kortschak
CC=golang-codereviews
https://golang.org/cl/129330043

10 years agobzip2: improve performance
Jeff R. Allen [Mon, 18 Aug 2014 21:41:28 +0000 (14:41 -0700)]
bzip2: improve performance

Improve performance of move-to-front by using cache-friendly
copies instead of doubly-linked list. Simplify so that the
underlying slice is the object. Remove the n=0 special case,
      which was actually slower with the copy approach.

benchmark                 old ns/op     new ns/op     delta
BenchmarkDecodeDigits     26429714      23859699      -9.72%
BenchmarkDecodeTwain      76684510      67591946      -11.86%

benchmark                 old MB/s     new MB/s     speedup
BenchmarkDecodeDigits     1.63         1.81         1.11x
BenchmarkDecodeTwain      1.63         1.85         1.13x

Updates #6754.

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

10 years agoruntime: move panicindex/panicslice to Go.
Keith Randall [Mon, 18 Aug 2014 20:26:28 +0000 (13:26 -0700)]
runtime: move panicindex/panicslice to Go.

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

10 years agounicode: strconv: regexp: Upgrade to Unicode 7.0.0.
Marcel van Lohuizen [Mon, 18 Aug 2014 18:26:10 +0000 (20:26 +0200)]
unicode: strconv: regexp: Upgrade to Unicode 7.0.0.

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

10 years agoruntime: add more cases to GC info test
Dmitriy Vyukov [Mon, 18 Aug 2014 18:21:55 +0000 (22:21 +0400)]
runtime: add more cases to GC info test

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

10 years agointernal/syscall: add support for getrandom on arm
Brad Fitzpatrick [Mon, 18 Aug 2014 18:19:05 +0000 (11:19 -0700)]
internal/syscall: add support for getrandom on arm

Added in linux commit eb6452537b28

LGTM=agl
R=agl
CC=golang-codereviews
https://golang.org/cl/130170043

10 years agoruntime: implement transfer cache
Dmitriy Vyukov [Mon, 18 Aug 2014 12:52:31 +0000 (16:52 +0400)]
runtime: implement transfer cache
Currently we do the following dance after sweeping a span:
1. lock mcentral
2. remove the span from a list
3. unlock mcentral
4. unmark span
5. lock mheap
6. insert the span into heap
7. unlock mheap
8. lock mcentral
9. observe empty list
10. unlock mcentral
11. lock mheap
12. grab the span
13. unlock mheap
14. mark span
15. lock mcentral
16. insert the span into empty list
17. unlock mcentral

This change short-circuits this sequence to nothing,
that is, we just cache and use the span after sweeping.

This gives us functionality similar (even better) to tcmalloc's transfer cache.

benchmark            old ns/op     new ns/op     delta
BenchmarkMalloc8     22.2          19.5          -12.16%
BenchmarkMalloc16    31.0          26.6          -14.19%

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

10 years agoruntime: fix dump of data/bss
Dmitriy Vyukov [Mon, 18 Aug 2014 12:42:24 +0000 (16:42 +0400)]
runtime: fix dump of data/bss
Fixes #8530.

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

10 years agoruntime: don't acquirem on malloc fast path
Dmitriy Vyukov [Mon, 18 Aug 2014 12:33:39 +0000 (16:33 +0400)]
runtime: don't acquirem on malloc fast path
Mallocgc must be atomic wrt GC, but for performance reasons
don't acquirem/releasem on fast path. The code does not have
split stack checks, so it can't be preempted by GC.
Functions like roundup/add are inlined. And onM/racemalloc are nosplit.
Also add debug code that checks these assumptions.

benchmark                     old ns/op     new ns/op     delta
BenchmarkMalloc8              20.5          17.2          -16.10%
BenchmarkMalloc16             29.5          27.0          -8.47%
BenchmarkMallocTypeInfo8      31.5          27.6          -12.38%
BenchmarkMallocTypeInfo16     34.7          30.9          -10.95%

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

10 years agoruntime: mark with non-atomic operations when GOMAXPROCS=1
Dmitriy Vyukov [Sat, 16 Aug 2014 05:07:55 +0000 (09:07 +0400)]
runtime: mark with non-atomic operations when GOMAXPROCS=1
Perf builders show 3-5% GC pause increase with GOMAXPROCS=1 when marking with atomic ops:
http://goperfd.appspot.com/perfdetail?commit=a8a6e765d6a87f7ccb71fd85a60eb5a821151f85&commit0=3b864e02b987171e05e2e9d0840b85b5b6476386&kind=builder&builder=linux-amd64&benchmark=http

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

10 years agocmd/ld: fix operator precedence
Dave Cheney [Sat, 16 Aug 2014 04:10:35 +0000 (14:10 +1000)]
cmd/ld: fix operator precedence

Fixes #8480.

This CL reapplies CL 114420043. This attempt doesn't blow up when encountering hidden symbols.

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

10 years agocmd/ld: fix operator precedence
Shenghou Ma [Sat, 16 Aug 2014 04:04:15 +0000 (14:04 +1000)]
cmd/ld: fix operator precedence

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

10 years agocrypto/x509: SystemRootsError style tweaks, document in Verify
Brad Fitzpatrick [Sat, 16 Aug 2014 00:47:02 +0000 (17:47 -0700)]
crypto/x509: SystemRootsError style tweaks, document in Verify

In retrospect this should've been a variable instead of a type,
but oh well.

LGTM=agl
R=agl
CC=golang-codereviews
https://golang.org/cl/129250044

10 years agocmd/dist: goc2c ignores GOROOT_FINAL
Henning Schmiedehausen [Fri, 15 Aug 2014 22:19:02 +0000 (15:19 -0700)]
cmd/dist: goc2c ignores GOROOT_FINAL

When building golang, the environment variable GOROOT_FINAL can be set
to indicate a different installation location from the build
location. This works fine, except that the goc2c build step embeds
line numbers in the resulting c source files that refer to the build
location, no the install location.

This would not be a big deal, except that in turn the linker uses the
location of runtime/string.goc to embed the gdb script in the
resulting binary and as a net result, the debugger now complains that
the script is outside its load path (it has the install location
configured).

See https://code.google.com/p/go/issues/detail?id=8524 for the full
description.

Fixes #8524.

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

10 years agoA+C: Henning Schmiedehausen (individual CLA)
Ian Lance Taylor [Fri, 15 Aug 2014 22:18:39 +0000 (15:18 -0700)]
A+C: Henning Schmiedehausen (individual CLA)

Generated by a+c.

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

10 years agocmd/go: fix a couple of errors found by "go vet"
Rob Pike [Fri, 15 Aug 2014 19:35:01 +0000 (12:35 -0700)]
cmd/go: fix a couple of errors found by "go vet"

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

10 years agofmt: fix size returned on fast path of ReadRune
Rob Pike [Fri, 15 Aug 2014 18:41:12 +0000 (11:41 -0700)]
fmt: fix size returned on fast path of ReadRune
Fixes #8512.

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

10 years agoruntime: fix getgcmask
Dmitriy Vyukov [Fri, 15 Aug 2014 18:36:12 +0000 (22:36 +0400)]
runtime: fix getgcmask
bv.data is an array of uint32s but the code was using
offsets computed for an array of bytes.
Add a test for stack GC info.
Fixes #8531.

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

10 years agocmd/gc: disallow pointer constants
Matthew Dempsky [Fri, 15 Aug 2014 18:33:31 +0000 (11:33 -0700)]
cmd/gc: disallow pointer constants

Fixes #7760.

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

10 years agomisc/nacl: add debugging instructions
Dmitriy Vyukov [Fri, 15 Aug 2014 16:51:44 +0000 (20:51 +0400)]
misc/nacl: add debugging instructions

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

10 years agonet: fix CNAME resolving on Windows
Egon Elbre [Fri, 15 Aug 2014 06:37:19 +0000 (16:37 +1000)]
net: fix CNAME resolving on Windows

Fixes #8492

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

10 years agodoc: make it point to correct go1.3.1 change history
Mikio Hara [Thu, 14 Aug 2014 23:46:16 +0000 (08:46 +0900)]
doc: make it point to correct go1.3.1 change history

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

10 years agoruntime: mark objects with non-atomic operations
Dmitriy Vyukov [Thu, 14 Aug 2014 17:38:24 +0000 (21:38 +0400)]
runtime: mark objects with non-atomic operations

On the go.benchmarks/garbage benchmark with GOMAXPROCS=16:
                   old ns/op     new ns/op     delta
time               1392254       1353170       -2.81%
cputime            21995751      21373999      -2.83%
gc-pause-one       15044812      13050524      -13.26%
gc-pause-total     213636        185317        -13.26%

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

10 years agocmd/cgo: check for compiler errors in the C preamble
Matthew Dempsky [Thu, 14 Aug 2014 16:21:58 +0000 (09:21 -0700)]
cmd/cgo: check for compiler errors in the C preamble

E.g., here's the new "go build" output:

$ go build misc/cgo/errors/issue8442.go
# command-line-arguments
could not determine kind of name for C.issue8442foo

gcc errors for preamble:
misc/cgo/errors/issue8442.go:11:19: error: unknown type name 'UNDEF'

Fixes #8442.

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

10 years agodoc/go1.4.txt: cmd/go changes, syscall
Rob Pike [Wed, 13 Aug 2014 21:56:58 +0000 (14:56 -0700)]
doc/go1.4.txt: cmd/go changes, syscall

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

10 years agotext/scanner: improve documentation
Robert Griesemer [Wed, 13 Aug 2014 19:53:50 +0000 (12:53 -0700)]
text/scanner: improve documentation

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

10 years agocmd/cgo, debug/dwarf: fix translation of zero-size arrays
Matthew Dempsky [Wed, 13 Aug 2014 18:16:30 +0000 (11:16 -0700)]
cmd/cgo, debug/dwarf: fix translation of zero-size arrays

In cgo, now that recursive calls to typeConv.Type() always work,
we can more robustly calculate the array sizes based on the size
of our element type.

Also, in debug/dwarf, the decision to call zeroType is made
based on a type's usage within a particular struct, but dwarf.Type
values are cached in typeCache, so the modification might affect
uses of the type in other structs.  Current compilers don't appear
to share DWARF type entries for "[]foo" and "[0]foo", but they also
don't consistently share type entries in other cases.  Arguably
modifying the types is an improvement in some cases, but varying
translated types according to compiler whims seems like a bad idea.

Lastly, also in debug/dwarf, zeroType only needs to rewrite the
top-level dimension, and only if the rest of the array size is
non-zero.

Fixes #8428.

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

10 years agoruntime: keep objects in free lists marked as allocated.
Dmitriy Vyukov [Wed, 13 Aug 2014 16:42:55 +0000 (20:42 +0400)]
runtime: keep objects in free lists marked as allocated.
Restore https://golang.org/cl/41040043 after GC rewrite.
Original description:
On the plus side, we don't need to change the bits on malloc and free.
On the downside, we need to mark objects in the free lists during GC.
But the free lists are small at GC time, so it should be a net win.

benchmark             old ns/op     new ns/op     delta
BenchmarkMalloc8      21.9          20.4          -6.85%
BenchmarkMalloc16     31.1          29.6          -4.82%

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

10 years agocmd/dist: Reuse streq whenever possible.
Thiago Fransosi Farina [Wed, 13 Aug 2014 13:47:30 +0000 (06:47 -0700)]
cmd/dist: Reuse streq whenever possible.

Basically this cleanup replaces all the usage usages of strcmp() == 0,
found by the following command line:

$ grep -R strcmp cmd/dist | grep "0"

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

10 years agodoc: remove the "the" in "the the" in the release notes
Andrew Gerrand [Wed, 13 Aug 2014 13:20:39 +0000 (23:20 +1000)]
doc: remove the "the" in "the the" in the release notes

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

10 years agotag go1.3.1
Andrew Gerrand [Wed, 13 Aug 2014 04:54:54 +0000 (14:54 +1000)]
tag go1.3.1

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

10 years agomisc/makerelease: exit with nonzero status code on error
Andrew Gerrand [Wed, 13 Aug 2014 04:00:10 +0000 (14:00 +1000)]
misc/makerelease: exit with nonzero status code on error

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

10 years agoall: copy cmd/ld/textflag.h into pkg/GOOS_GOARCH
Rob Pike [Wed, 13 Aug 2014 00:04:45 +0000 (17:04 -0700)]
all: copy cmd/ld/textflag.h into pkg/GOOS_GOARCH
The file is used by assembly code to define symbols like NOSPLIT.
Having it hidden inside the cmd directory makes it hard to access
outside the standard repository.
Solution: As with a couple of other files used by cgo, copy the
file into the pkg directory and add a -I argument to the assembler
to access it. Thus one can write just
        #include "textflag.h"
in .s files.

The names in runtime are not updated because in the boot sequence the
file has not been copied yet when runtime is built. All other .s files
in the repository are updated.

Changes to doc/asm.html, src/cmd/dist/build.c, and src/cmd/go/build.go
are hand-made. The rest are just the renaming done by a global
substitution. (Yay sam).

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

10 years agocmd/6c, cmd/6g: avoid address-as-constant in amd64 instructions
Russ Cox [Tue, 12 Aug 2014 23:53:11 +0000 (19:53 -0400)]
cmd/6c, cmd/6g: avoid address-as-constant in amd64 instructions

This allows implementing address-of-global
as a pc-relative address instead of as a
32-bit integer constant.

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

10 years agocmd/go: adjust import comment error
Russ Cox [Tue, 12 Aug 2014 23:52:04 +0000 (19:52 -0400)]
cmd/go: adjust import comment error

Fixes #7453.

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

10 years agoruntime: avoid using address as constant in amd64 assembly
Russ Cox [Tue, 12 Aug 2014 23:51:20 +0000 (19:51 -0400)]
runtime: avoid using address as constant in amd64 assembly

This allows changing the addressing mode for constant
global addresses to use pc-relative addressing.

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

10 years agodoc/compat1.html: link to go.sys
Rob Pike [Tue, 12 Aug 2014 22:45:35 +0000 (15:45 -0700)]
doc/compat1.html: link to go.sys
You talked me into it. This and other links should be updated
once the new import paths for the subrepos are established.

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

10 years agosyscall: freeze the package
Rob Pike [Tue, 12 Aug 2014 22:28:45 +0000 (15:28 -0700)]
syscall: freeze the package
Add a clause to the doc comment for the package and a
paragraph in the compatibility document explaining the
situation.

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

10 years agocmd/ld: handle large link base addresses
Russ Cox [Tue, 12 Aug 2014 21:41:16 +0000 (17:41 -0400)]
cmd/ld: handle large link base addresses

codeblk and datblk were truncating their
arguments to int32. Don't do that.

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

10 years agocmd/go, go/build: implement import comment checking
Russ Cox [Tue, 12 Aug 2014 21:41:03 +0000 (17:41 -0400)]
cmd/go, go/build: implement import comment checking

See golang.org/s/go14customimport for design.

Added case to deps_test to allow go/build to import regexp.
Not a new dependency, because go/build already imports go/doc
which imports regexp.

Fixes #7453.

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

10 years agodoc: document go1.3.1
Andrew Gerrand [Tue, 12 Aug 2014 21:39:52 +0000 (07:39 +1000)]
doc: document go1.3.1

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

10 years agocrypto/rand: use getrandom system call on Linux
Brad Fitzpatrick [Tue, 12 Aug 2014 21:35:27 +0000 (14:35 -0700)]
crypto/rand: use getrandom system call on Linux

Adds internal/syscall package.

Fixes #8520

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

10 years agoruntime: remove FlagNoProfile
Dmitriy Vyukov [Tue, 12 Aug 2014 21:03:32 +0000 (01:03 +0400)]
runtime: remove FlagNoProfile
Turns out to be unused as well.

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

10 years agoruntime/pprof: fix data race
Dmitriy Vyukov [Tue, 12 Aug 2014 21:02:01 +0000 (01:02 +0400)]
runtime/pprof: fix data race
It's unclear why we do this broken double-checked locking.
The mutex is not held for the whole duration of CPU profiling.
Fixes #8365.

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

10 years agocmd/cgo: make C function pointers non-assignable
Matthew Dempsky [Tue, 12 Aug 2014 19:55:12 +0000 (12:55 -0700)]
cmd/cgo: make C function pointers non-assignable

Fixes #7757.
Fixes #8488.

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

10 years agodist: Make vaddn private to buf.c
Thiago Fransosi Farina [Tue, 12 Aug 2014 14:49:10 +0000 (07:49 -0700)]
dist: Make vaddn private to buf.c

This function does not have a declaration/prototype in a.h, and it is used only
in buf.c, so it is local to it and thus can be marked as private by adding
'static' to it.

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

10 years agoA+C: Thiago Fransosi Farina (individual CLA)
Ian Lance Taylor [Tue, 12 Aug 2014 14:48:34 +0000 (07:48 -0700)]
A+C: Thiago Fransosi Farina (individual CLA)

Generated by a+c.

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

10 years agorun.bash: run misc/cgo/testgodefs/test.bash
Matthew Dempsky [Tue, 12 Aug 2014 14:13:52 +0000 (07:13 -0700)]
run.bash: run misc/cgo/testgodefs/test.bash

misc/cgo/testgodefs was added by revision d1cf884a594f, but not
add to run.bash.

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