]> Cypherpunks repositories - gostls13.git/log
gostls13.git
10 years agoruntime/debug: fix nacl build
Dave Cheney [Thu, 26 Feb 2015 21:06:58 +0000 (08:06 +1100)]
runtime/debug: fix nacl build

Disable the test properly on nacl systems, tested on nacl/amd64p32.

Change-Id: Iffe210be4f9c426bfc47f2dd3a8f0c6b5a398cc3
Reviewed-on: https://go-review.googlesource.com/6093
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agoruntime: disable scavenger on 64k page size kernels
Dave Cheney [Thu, 26 Feb 2015 09:29:58 +0000 (20:29 +1100)]
runtime: disable scavenger on 64k page size kernels

Update #9993

If the physical page size of the machine is larger than the logical
heap size, for example 8k logical, 64k physical, then madvise(2) will
round up the requested amount to a 64k boundary and may discard pages
close to the page being madvised.

This patch disables the scavenger in these situations, which at the moment
is only ppc64 and ppc64le systems. NaCl also uses a 64k page size, but
it's not clear if it is affected by this problem.

Change-Id: Ib897f8d3df5bd915ddc0b510f2fd90a30ef329ca
Reviewed-on: https://go-review.googlesource.com/6091
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
10 years agomime/quotedprintable: create the package
Alexandre Cesaro [Wed, 25 Feb 2015 18:13:43 +0000 (19:13 +0100)]
mime/quotedprintable: create the package

This commit creates the mime/quotedprintable package. It moves and
exports the QP reader of mime/internal/quotedprintable.

The code is almost unchanged to preserve the commit history.

Updates #4943

Change-Id: I4b7b5a2a40a4c84346d42e4cdd2c11a91b28f9e3
Reviewed-on: https://go-review.googlesource.com/5940
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agoliblink: delete unused code
Russ Cox [Wed, 25 Feb 2015 02:40:57 +0000 (21:40 -0500)]
liblink: delete unused code

Liblink is still needed for the linker (for a bit longer) but mostly not.
Delete the unused parts.

Change-Id: Ie63a7c1520dee52b17425b384943cd16262d36e3
Reviewed-on: https://go-review.googlesource.com/6110
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agoruntime: disable TestGdbPython on ppc64
Russ Cox [Thu, 26 Feb 2015 19:30:40 +0000 (14:30 -0500)]
runtime: disable TestGdbPython on ppc64

(issue #10017)

Change-Id: Ia1267dfdb4474247926a998e32d9c6520015757d
Reviewed-on: https://go-review.googlesource.com/6130
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
10 years agocmd/internal/gc: transitive inlining
Russ Cox [Tue, 24 Feb 2015 17:19:01 +0000 (12:19 -0500)]
cmd/internal/gc: transitive inlining

Inlining refuses to inline bodies containing an actual function call, so that
if that call or a child uses runtime.Caller it cannot observe
the inlining.

However, inlining was also refusing to inline bodies that contained
function calls that were themselves inlined away. For example:

func f() int {
return f1()
}

func f1() int {
return f2()
}

func f2() int {
return 2
}

The f2 call in f1 would be inlined, but the f1 call in f would not,
because f1's call to f2 blocked the inlining, despite itself eventually
being inlined away.

Account properly for this kind of transitive inlining and enable.

Also bump the inlining budget a bit, so that the runtime's
heapBits.next is inlined.

This reduces the time for '6g *.go' in html/template by around 12% (!).
(For what it's worth, closing Chrome reduces the time by about 17%.)

Change-Id: If1aa673bf3e583082dcfb5f223e67355c984bfc1
Reviewed-on: https://go-review.googlesource.com/5952
Reviewed-by: Austin Clements <austin@google.com>
10 years agocmd/internal/gc: factor bottom-up visiting out of escape analysis
Russ Cox [Tue, 24 Feb 2015 17:14:29 +0000 (12:14 -0500)]
cmd/internal/gc: factor bottom-up visiting out of escape analysis

Change-Id: Id217fb6d8faf045a1a4fbda43b102ba989a02c17
Reviewed-on: https://go-review.googlesource.com/5951
Reviewed-by: Austin Clements <austin@google.com>
10 years agocmd/internal/gc: restore detail in plain syntax errors
Russ Cox [Tue, 24 Feb 2015 15:21:14 +0000 (10:21 -0500)]
cmd/internal/gc: restore detail in plain syntax errors

Change-Id: Ifc4b25fa57d0c9242968246d2193aa29f6b87700
Reviewed-on: https://go-review.googlesource.com/5950
Reviewed-by: Austin Clements <austin@google.com>
10 years agomath/big: export Float.MinPrec
Robert Griesemer [Wed, 25 Feb 2015 21:23:02 +0000 (13:23 -0800)]
math/big: export Float.MinPrec

MinPrec returns the minimum precision required to represent a Float
without loss of precision. Added test.

Change-Id: I466c8e492dcdd59fae854fc4e71ef9b1add7d817
Reviewed-on: https://go-review.googlesource.com/6010
Reviewed-by: Alan Donovan <adonovan@google.com>
10 years agoos/exec: disable tests on darwin/arm
David Crawshaw [Thu, 26 Feb 2015 14:44:41 +0000 (09:44 -0500)]
os/exec: disable tests on darwin/arm

There is only one process under the iOS sandboxd.

Change-Id: I21b5528366a0248a034801a717f24c60f0733c5f
Reviewed-on: https://go-review.googlesource.com/6101
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agoruntime: skip test on darwin/arm
David Crawshaw [Thu, 26 Feb 2015 15:01:37 +0000 (10:01 -0500)]
runtime: skip test on darwin/arm

Needs the Go tool, which we do not have on iOS. (No Fork.)

Change-Id: Iedf69f5ca81d66515647746546c9b304c8ec10c4
Reviewed-on: https://go-review.googlesource.com/6102
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
10 years agoarchive/zip: fix size value in ZIP64 end central directory record
Joe Shaw [Thu, 12 Feb 2015 22:21:01 +0000 (17:21 -0500)]
archive/zip: fix size value in ZIP64 end central directory record

Section 4.3.14.1 of the ZIP file format
spec (https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT) says,

    The value stored into the "size of zip64 end of central directory
    record" should be the size of the remaining record and should not
    include the leading 12 bytes.

We were previously writing the full size, including the 12 bytes.

Fixes #9857

Change-Id: I7cf1fc8457c5f306717cbcf61e02304ab549781f
Reviewed-on: https://go-review.googlesource.com/4760
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

10 years agogo/build: disable deps test on darwin/arm
David Crawshaw [Thu, 26 Feb 2015 14:21:19 +0000 (09:21 -0500)]
go/build: disable deps test on darwin/arm

Change-Id: Ief78a10c4aaa43f300f34519911ff73b6f510d73
Reviewed-on: https://go-review.googlesource.com/6100
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
10 years agoruntime: do not do futile netpolls
Dmitry Vyukov [Wed, 11 Feb 2015 16:11:32 +0000 (19:11 +0300)]
runtime: do not do futile netpolls

There is no sense in trying to netpoll while there is
already a thread blocked in netpoll. And in most cases
there must be a thread blocked in netpoll, because
the first otherwise idle thread does blocking netpoll.

On some program I see that netpoll called from findrunnable
consumes 3% of time.

Change-Id: I0af1a73d637bffd9770ea50cb9278839716e8816
Reviewed-on: https://go-review.googlesource.com/4553
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>

10 years agoruntime: simplify CPU profiling code
Matthew Dempsky [Wed, 25 Feb 2015 05:41:21 +0000 (14:41 +0900)]
runtime: simplify CPU profiling code

This makes Go's CPU profiling code somewhat more idiomatic; e.g.,
using := instead of forward declaring variables, using "int" for
element counts instead of "uintptr", and slices instead of C-style
pointer+length.  This makes the code easier to read and eliminates a
lot of type conversion clutter.

Additionally, in sigprof we can collect just maxCPUProfStack stack
frames, as cpuprof won't use more than that anyway.

Change-Id: I0235b5ae552191bcbb453b14add6d8c01381bd06
Reviewed-on: https://go-review.googlesource.com/6072
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
10 years agoimage/jpeg: support 4:1:1 and 4:1:0 chroma subsampling.
Nigel Tao [Thu, 26 Feb 2015 00:35:20 +0000 (11:35 +1100)]
image/jpeg: support 4:1:1 and 4:1:0 chroma subsampling.

The test data was generated by:
convert video-001.png tmp.tga
cjpeg -quality 50 -sample 4x2,1x1,1x1 tmp.tga > video-001.q50.410.jpeg
cjpeg -quality 50 -sample 4x1,1x1,1x1 tmp.tga > video-001.q50.411.jpeg
cjpeg -quality 50 -sample 4x2,1x1,1x1 -progressive tmp.tga > video-001.q50.410.progressive.jpeg
cjpeg -quality 50 -sample 4x1,1x1,1x1 -progressive tmp.tga > video-001.q50.411.progressive.jpeg
rm tmp.tga

Change-Id: I5570389c462360f98c3160f3c6963d9466d511de
Reviewed-on: https://go-review.googlesource.com/6041
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/gc: reduce lexer allocs when parsing numeric constants
Josh Bleecher Snyder [Tue, 24 Feb 2015 20:54:57 +0000 (20:54 +0000)]
cmd/gc: reduce lexer allocs when parsing numeric constants

This reduces the number of allocs when
running the rotate.go tests by
about 20%, after applying CL 5700.

Combining

s = "const str"
s += <another string>

generally saves an alloc and might be a candidate for
rsc's grind tool. However, I'm sending this CL now
because this also reuses the result of calling lexbuf.String.

Change-Id: If3a7300b7da9612ab62bb910ee90349dca88dde3
Reviewed-on: https://go-review.googlesource.com/5821
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

10 years agocmd/gc: don't call memequal twice in generated type.eq routines
Josh Bleecher Snyder [Thu, 19 Feb 2015 00:27:48 +0000 (16:27 -0800)]
cmd/gc: don't call memequal twice in generated type.eq routines

The first call is pointless. It appears to simply be a mistake.

benchmark                  old ns/op     new ns/op     delta
BenchmarkComplexAlgMap     90.7          76.1          -16.10%

Change-Id: Id0194c9f09cea8b68f17b2ac751a8e3240e47f19
Reviewed-on: https://go-review.googlesource.com/5284
Reviewed-by: Keith Randall <khr@golang.org>
10 years agomath/big: fix build for 32bit platforms
Robert Griesemer [Wed, 25 Feb 2015 23:45:25 +0000 (15:45 -0800)]
math/big: fix build for 32bit platforms

Change-Id: I9c217e5140294a17e4feb65da5b121ee8d8cadc2
Reviewed-on: https://go-review.googlesource.com/6050
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agoimage: add YCbCrSubsampleRatio411 and YCbCrSubsampleRatio410.
Nigel Tao [Wed, 25 Feb 2015 06:17:01 +0000 (17:17 +1100)]
image: add YCbCrSubsampleRatio411 and YCbCrSubsampleRatio410.

Some real world JPEG images are in 4:1:1 and 4:1:0 formats.

See also http://en.wikipedia.org/wiki/Chroma_subsampling

Change-Id: I2d51a41944f581cf11f4ab975046b1737271842f
Reviewed-on: https://go-review.googlesource.com/5838
Reviewed-by: Rob Pike <r@golang.org>
10 years agoencoding/xml: add more marshalTests tests.
Nigel Tao [Wed, 25 Feb 2015 23:40:15 +0000 (10:40 +1100)]
encoding/xml: add more marshalTests tests.

There are no behavior changes in this CL, only specifying the status
quo. A follow-up CL, https://go-review.googlesource.com/#/c/5910/, will
change marshaling behavior.

Change-Id: Ib3f4d62e8c4758da2f11a6d26b285c10d3b0d98a
Reviewed-on: https://go-review.googlesource.com/6040
Reviewed-by: Andrew Gerrand <adg@golang.org>
10 years agoos: Use GetComputerNameEx to get Hostname on win32
Carlos Castillo [Tue, 24 Feb 2015 10:35:55 +0000 (02:35 -0800)]
os: Use GetComputerNameEx to get Hostname on win32

The existing Hostname function uses the GetComputerName system
function in windows to determine the hostname. It has some downsides:

  - The name is limited to 15 characters.
  - The name returned is for NetBIOS, other OS's return a DNS name

This change adds to the internal/syscall/windows package a
GetComputerNameEx function, and related enum constants. They are used
instead of the syscall.ComputerName function to implement os.Hostname
on windows.

Fixes #9982

Change-Id: Idc8782785eb1eea37e64022bd201699ce9c4b39c
Reviewed-on: https://go-review.googlesource.com/5852
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Carlos Castillo <cookieo9@gmail.com>
Reviewed-by: Yasuhiro MATSUMOTO <mattn.jp@gmail.com>
10 years agomath/big: clean up Float.SetPrec, use shorter internal representation
Robert Griesemer [Wed, 25 Feb 2015 19:53:33 +0000 (11:53 -0800)]
math/big: clean up Float.SetPrec, use shorter internal representation

Change-Id: I9b78085adc12cbd240d0b8b48db6810ddb2aeadd
Reviewed-on: https://go-review.googlesource.com/5991
Reviewed-by: Alan Donovan <adonovan@google.com>
10 years agomath/big: apply a round of go vet
Robert Griesemer [Wed, 25 Feb 2015 18:20:28 +0000 (10:20 -0800)]
math/big: apply a round of go vet

Change-Id: Ie8310acc783659497e50dfe629f06d655b51d647
Reviewed-on: https://go-review.googlesource.com/5990
Reviewed-by: Alan Donovan <adonovan@google.com>
10 years agomath/big: improve some doc strings
Robert Griesemer [Wed, 25 Feb 2015 18:08:17 +0000 (10:08 -0800)]
math/big: improve some doc strings

Change-Id: Ie37673d4af2fa7476d67ffb686641611ab6a8e6b
Reviewed-on: https://go-review.googlesource.com/5930
Reviewed-by: Alan Donovan <adonovan@google.com>
10 years agoruntime/cgo: fix darwin/arm build
David Crawshaw [Wed, 25 Feb 2015 22:30:40 +0000 (17:30 -0500)]
runtime/cgo: fix darwin/arm build

Macro definition ordering.

Change-Id: I0def4702d19a21a68ffa52ea5b7c22578830c578
Reviewed-on: https://go-review.googlesource.com/6030
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
10 years agoruntime/cgo: set the initial working directory
David Crawshaw [Wed, 25 Feb 2015 21:11:53 +0000 (16:11 -0500)]
runtime/cgo: set the initial working directory

Gives tests a way to find the bundle that contains their testdata, and
is generally useful for finding resources.

Change-Id: Idfa03e8543af927c17bc8ec8aadc5014ec82df28
Reviewed-on: https://go-review.googlesource.com/6000
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
10 years agoruntime: skip failing gdb test on linux/arm
Dave Cheney [Wed, 25 Feb 2015 20:48:50 +0000 (07:48 +1100)]
runtime: skip failing gdb test on linux/arm

Updates #10002

The gdb test added in 1c82e236f5ee is failing on most arm systems.

Temporarily disable this test so that we can return to a working arm build.

Change-Id: Iff96ea8d5a99e1ceacf4979e864ff196e5503535
Reviewed-on: https://go-review.googlesource.com/5902
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agoruntime: fix build, divide by constant 0 is a compile-time error
Keith Randall [Wed, 25 Feb 2015 21:38:42 +0000 (13:38 -0800)]
runtime: fix build, divide by constant 0 is a compile-time error

Change-Id: Iee319c9f5375c172fb599da77234c10ccb0fd314
Reviewed-on: https://go-review.googlesource.com/6020
Reviewed-by: Keith Randall <khr@golang.org>
10 years agodoc/install-source.html: fix cd command, already in go dir.
Lloyd Dewolf [Wed, 25 Feb 2015 18:57:45 +0000 (10:57 -0800)]
doc/install-source.html: fix cd command, already in go dir.

Change-Id: I42929abe5cefd84a1daf4f36ee1806c490ce16ec
Reviewed-on: https://go-review.googlesource.com/5960
Reviewed-by: Minux Ma <minux@golang.org>
10 years agoruntime: mark pages we return to kernel as NOHUGEPAGE
Keith Randall [Mon, 23 Feb 2015 21:58:05 +0000 (13:58 -0800)]
runtime: mark pages we return to kernel as NOHUGEPAGE

We return memory to the kernel with madvise(..., DONTNEED).
Also mark returned memory with NOHUGEPAGE to keep the kernel from
merging this memory into a huge page, effectively reallocating it.

Only known to be a problem on linux/{386,amd64,amd64p32} at the moment.
It may come up on other os/arch combinations in the future.

Fixes #8832

Change-Id: Ifffc6627a0296926e3f189a8a9b6e4bdb54c79eb
Reviewed-on: https://go-review.googlesource.com/5660
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
10 years agoruntime: handle holes in the heap
Keith Randall [Tue, 24 Feb 2015 17:25:09 +0000 (09:25 -0800)]
runtime: handle holes in the heap

We need to distinguish pointers to free spans, which indicate bugs in
our pointer analysis, from pointers to never-in-the-heap spans, which
can legitimately arise from sysAlloc/mmap/etc.  This normally isn't a
problem because the heap is contiguous, but in some situations (32
bit, particularly) the heap must grow around an already allocated
region.

The bad pointer test is disabled so this fix doesn't actually do
anything, but it removes one barrier from reenabling it.

Fixes #9872.

Change-Id: I0a92db4d43b642c58d2b40af69c906a8d9777f88
Reviewed-on: https://go-review.googlesource.com/5780
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
10 years agocmd/internal/obj: make Dconv a portable top-level function
Rob Pike [Wed, 25 Feb 2015 17:07:02 +0000 (09:07 -0800)]
cmd/internal/obj: make Dconv a portable top-level function

Each architecture had its own Dconv (operand printer) but the syntax is
close to uniform and the code overlap was considerable. Consolidate these
into a single top-level function. A similar but smaller unification is done
for Mconv ("Name" formatter) as well.

The signature is changed. The flag was unused so drop it. Add a
function argument, Rconv, that must be supplied by the caller.
TODO: A future change will unify Rconv as well and this argument
will go away.

Some formats changed, because of the automatic consistency
created by unification. For instance, 0(R1) always prints as (R1)
now, and foo+0(SB) is just foo(SB). Before, some made these
simplifications and some didn't; now they all do.

Update the asm tests that depend on the format.

Change-Id: I6e3310bc19814c0c784ff0b960a154521acd9532
Reviewed-on: https://go-review.googlesource.com/5920
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agocmd/internal/gc: omit non-explicit capacity in errors with map/chan make
Chris Manghane [Tue, 9 Dec 2014 03:17:37 +0000 (19:17 -0800)]
cmd/internal/gc: omit non-explicit capacity in errors with map/chan make

Fixes #9083.

Change-Id: Ifbdebafb39a73a1dacf7e67171e8e88028d1f10b
Reviewed-on: https://go-review.googlesource.com/1219
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Chris Manghane <cmang@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

10 years agoruntime: fallback to 128M address space on 32bit
David Crawshaw [Tue, 24 Feb 2015 16:11:56 +0000 (11:11 -0500)]
runtime: fallback to 128M address space on 32bit

Available darwin/arm devices sporadically have trouble mapping 256M.

I would really appreciate it if anyone could check my working on
this, and make sure sure there aren't obviously bad consequences I
haven't considered.

Change-Id: Id1a8edae104d974fcf5f9333274f958625467f79
Reviewed-on: https://go-review.googlesource.com/5752
Reviewed-by: Keith Randall <khr@golang.org>
10 years agocmd/internal/gc: do not show computed value in type error
Chris Manghane [Tue, 9 Dec 2014 14:52:17 +0000 (06:52 -0800)]
cmd/internal/gc: do not show computed value in type error

Fixes #9076.

Change-Id: Ib41a452fa9aa9fecf19f65c36d13715923548041
Reviewed-on: https://go-review.googlesource.com/1250
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Chris Manghane <cmang@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

10 years agocmd/internal/gc: method selector should not auto-deref named pointer type
Chris Manghane [Tue, 9 Dec 2014 15:59:24 +0000 (07:59 -0800)]
cmd/internal/gc: method selector should not auto-deref named pointer type

Fixes #9017.

Change-Id: I26cb1e7d6e137ff145773169cfe2d8bd4e1b339c
Reviewed-on: https://go-review.googlesource.com/1252
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Chris Manghane <cmang@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

10 years agocmd/internal/obj: fix index panic on invalid instruction
Russ Cox [Tue, 24 Feb 2015 01:29:08 +0000 (20:29 -0500)]
cmd/internal/obj: fix index panic on invalid instruction

Also introduce actual data structure for table.

Change-Id: I6bbe9aff8a872ae254f3739ae4ca17f7b5c4507a
Reviewed-on: https://go-review.googlesource.com/5701
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/internal/gc: expand DBG macro in lex.go
Russ Cox [Mon, 23 Feb 2015 22:34:49 +0000 (17:34 -0500)]
cmd/internal/gc: expand DBG macro in lex.go

The dummy implementation was causing lots of argument lists
to be prepared and thrown away.

Change-Id: Id0040dec6b0937f3daa8a8d8911fa3280123e863
Reviewed-on: https://go-review.googlesource.com/5700
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
10 years agomath/big: permit passing of an *Int to Float.Int to avoid allocation
Robert Griesemer [Wed, 25 Feb 2015 05:05:12 +0000 (21:05 -0800)]
math/big: permit passing of an *Int to Float.Int to avoid allocation

Change-Id: I50e83248357928e56c94b88a8764de828f4f5c76
Reviewed-on: https://go-review.googlesource.com/5890
Reviewed-by: Alan Donovan <adonovan@google.com>
10 years agocmd/go: make asm the first assembler
Rob Pike [Tue, 24 Feb 2015 22:28:49 +0000 (14:28 -0800)]
cmd/go: make asm the first assembler

verifyAsm is still on, but this CL changes the order to asm then 6a.
Before, it was 6a then asm, but that meant that any bugs in asm
for bad input would be prevented from happening because 6a would
catch them. Now asm gets first crack, as it must.

Also implement the -trimpath flag in asm. It's necessary and trivial.

Change-Id: Ifb2ab870de1aa1b53dec76a78ac697a0d36fa80a
Reviewed-on: https://go-review.googlesource.com/5850
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agomath/big: implemented Float.Rat
Robert Griesemer [Wed, 25 Feb 2015 02:04:40 +0000 (18:04 -0800)]
math/big: implemented Float.Rat

Change-Id: If516e12d4b5dfb6f9288437d270569f7e4e2a1cd
Reviewed-on: https://go-review.googlesource.com/5871
Reviewed-by: Alan Donovan <adonovan@google.com>
10 years agocmd/asm: add end to end test for 386
Rob Pike [Mon, 23 Feb 2015 23:48:09 +0000 (15:48 -0800)]
cmd/asm: add end to end test for 386

Change-Id: I6514f69b979d064b6a3c4b5d0828cc94f485cac2
Reviewed-on: https://go-review.googlesource.com/5694
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agocmd/asm: add a couple of operand parses discovered by end-to-end test
Rob Pike [Mon, 23 Feb 2015 23:45:40 +0000 (15:45 -0800)]
cmd/asm: add a couple of operand parses discovered by end-to-end test

Missing cases for JMP $4 and foo+4(SB):AX. Both are odd but 8a accepts them
and they seem valid.

Change-Id: Ic739f626fcc79ace1eaf646c5dfdd96da59df165
Reviewed-on: https://go-review.googlesource.com/5693
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agoruntime: simplify gcResetGState
Austin Clements [Wed, 25 Feb 2015 03:29:33 +0000 (22:29 -0500)]
runtime: simplify gcResetGState

Since allglock is held in this function, there's no point to
tip-toeing around allgs.  Just use a for-range loop.

Change-Id: I1ee61c7e8cac8b8ebc8107c0c22f739db5db9840
Reviewed-on: https://go-review.googlesource.com/5882
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
10 years agoruntime: consolidate gcworkdone/gcscanvalid clearing loops
Austin Clements [Wed, 25 Feb 2015 03:20:38 +0000 (22:20 -0500)]
runtime: consolidate gcworkdone/gcscanvalid clearing loops

Previously, we had three loops in the garbage collector that all
cleared the per-G GC flags.  Consolidate these into one function.
This one function is designed to work in a concurrent setting.  As a
result, it's slightly more expensive than the loops it replaces during
STW phases, but these happen at most twice per GC.

Change-Id: Id1ec0074fd58865eb0112b8a0547b267802d0df1
Reviewed-on: https://go-review.googlesource.com/5881
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
10 years agoruntime: remove unnecessary gcworkdone resetting loop
Austin Clements [Wed, 25 Feb 2015 03:05:26 +0000 (22:05 -0500)]
runtime: remove unnecessary gcworkdone resetting loop

The loop in gcMark is redundant with the gcworkdone resetting
performed by markroot, which called a few lines later in gcMark.

Change-Id: Ie0a826a614ecfa79e6e6b866e8d1de40ba515856
Reviewed-on: https://go-review.googlesource.com/5880
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
10 years agoruntime: remove gogetcallerpc and gogetcallersp functions
Matthew Dempsky [Wed, 25 Feb 2015 08:28:52 +0000 (17:28 +0900)]
runtime: remove gogetcallerpc and gogetcallersp functions

Package runtime's Go code was converted to directly call getcallerpc
and getcallersp in https://golang.org/cl/138740043, but the assembly
implementations were not removed.

Change-Id: Ib2eaee674d594cbbe799925aae648af782a01c83
Reviewed-on: https://go-review.googlesource.com/5901
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
10 years agoruntime: simplify NetBSD semaphores
Matthew Dempsky [Mon, 23 Feb 2015 08:05:30 +0000 (17:05 +0900)]
runtime: simplify NetBSD semaphores

NetBSD's semaphore implementation is derived from OpenBSD's, but has
subsequently diverged due to cleanups that were only applied to the
latter (https://golang.org/cl/137960043, https://golang.org/cl/5563).
This CL applies analogous cleanups for NetBSD.

Notably, we can also remove the scary NetBSD deadlock warning.
NetBSD's manual pages document that lwp_unpark on a not-yet-parked LWP
will cause that LWP's next lwp_park system call to return immediately,
so there's no race hazard.

Change-Id: Ib06844c420d2496ac289748eba13eb4700bbbbb2
Reviewed-on: https://go-review.googlesource.com/5564
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Joel Sing <jsing@google.com>
10 years agosyscall: generate AT_* constants and regenerate ztypes_linux_*.go
Dave Cheney [Wed, 25 Feb 2015 01:56:44 +0000 (12:56 +1100)]
syscall: generate AT_* constants and regenerate ztypes_linux_*.go

Updates #9974

The *at family of syscalls requires some constants to be defined in the
syscall package for linux. Add the necessary constants and regenerate
the ztypes_linux_*.go files.

Change-Id: I6df343fef7bcacad30d36c7900dbfb621465a4fe
Reviewed-on: https://go-review.googlesource.com/5836
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agogdb: fix map prettyprinter
Jan Kratochvil [Sat, 21 Feb 2015 17:18:33 +0000 (18:18 +0100)]
gdb: fix map prettyprinter

(gdb) p x
Python Exception <class 'gdb.error'> There is no member named b.:
$2 = map[string]string
->
(gdb) p x
$1 = map[string]string = {["shane"] = "hansen"}

Change-Id: I874d02a029f2ac9afc5ab666afb65760ec2c3177
Reviewed-on: https://go-review.googlesource.com/5522
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agoruntime: simplify OpenBSD semaphores
Matthew Dempsky [Mon, 23 Feb 2015 08:05:30 +0000 (17:05 +0900)]
runtime: simplify OpenBSD semaphores

OpenBSD's thrsleep system call includes an "abort" parameter, which
specifies a memory address to be tested after being registered on the
sleep channel (i.e., capable of being woken up by thrwakeup).  By
passing a pointer to waitsemacount for this parameter, we avoid race
conditions without needing a lock.  Instead we just need to use
atomicload, cas, and xadd to mutate the semaphore count.

Change-Id: If9f2ab7cfd682da217f9912783cadea7e72283a8
Reviewed-on: https://go-review.googlesource.com/5563
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Joel Sing <jsing@google.com>
10 years agosyscall: split implementation of Dup2 per linux GOOS
Dave Cheney [Wed, 25 Feb 2015 00:23:04 +0000 (11:23 +1100)]
syscall: split implementation of Dup2 per linux GOOS

Updates #9974

This proposal moves the definition of Dup2 from the generic syscall_linux.go
to the GOOS specific variants. This is in preparation for the arm64 port.

For all existing platforms Dup2 is not affected. When arm64 is added we'll use
either a forwarding method to Dup3 or

//sysnb        Dup2(oldfd int, newfd int) (err error) = SYS_DUP3

Because mksycall.pl does not sort symbols before generating the output file
the diff includes some unavoidable code moves as Dup2 is processed latter in
the run.

Discussion: https://groups.google.com/forum/#!topic/golang-dev/zpeFtN2z5Fc

Change-Id: Icdedf55bb29e749c4230e1ee371bf9d0bd0cfb38
Reviewed-on: https://go-review.googlesource.com/5835
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Dave Cheney <dave@cheney.net>

10 years agodoc/go1.5: mention the change in certificate wildcard handling.
Adam Langley [Wed, 25 Feb 2015 00:06:08 +0000 (16:06 -0800)]
doc/go1.5: mention the change in certificate wildcard handling.

https://go-review.googlesource.com/#/c/5691/ shouldn't affect anyone
because it reflects the RFC and behaviour of modern browsers, but it's
probably worth mentioning.

Change-Id: I8a8eedaac5226b1d8018dc56de6b2d41bd82a642
Reviewed-on: https://go-review.googlesource.com/5862
Reviewed-by: Rob Pike <r@golang.org>
10 years agomath/big: permit passing of (possibly nil) *Float to MantExp to avoid allocation
Robert Griesemer [Wed, 25 Feb 2015 00:42:39 +0000 (16:42 -0800)]
math/big: permit passing of (possibly nil) *Float to MantExp to avoid allocation

Change-Id: Ia92eea833283f8b16fa09d4ca1c9cb3bc0eb18a2
Reviewed-on: https://go-review.googlesource.com/5870
Reviewed-by: Rob Pike <r@golang.org>
10 years agosyscall: split implementation of Pipe/Pipe2 per GOOS
Dave Cheney [Tue, 24 Feb 2015 23:20:13 +0000 (10:20 +1100)]
syscall: split implementation of Pipe/Pipe2 per GOOS

Updates #9974

This proposal moves the definition of Pipe an Pipe2 from the generic
syscall_linux.go to the GOOS specific variants. This is in preparation
for the arm64 port.

For platforms where pipe2(2) is not supported in the minimum 2.6.23 kernel,
amd64 and 386, we retain pipe(2). For all other platforms pipe(2) is removed
and Pipe forwards to pipe2(2).

Because mksycall.pl does not sort symbols before generating the output file
the diff includes some unavoidable code moves as Pipe and Pipe2 are processed
latter in the run.

Discussion: https://groups.google.com/forum/#!topic/golang-dev/zpeFtN2z5Fc

Change-Id: Ie26d6761eeb9760dbaff974ee8bc0d57a9ceaee4
Reviewed-on: https://go-review.googlesource.com/5833
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

10 years agocmd/dist: respect runtime.NumCPU when bootstrapping arm hosts
Dave Cheney [Tue, 24 Feb 2015 23:59:20 +0000 (10:59 +1100)]
cmd/dist: respect runtime.NumCPU when bootstrapping arm hosts

This is a reproposal of CL 2957. This reproposal restricts the
scope of this change to just arm systems.

With respect to rsc's comments on 2957, on all my arm hosts they perform
the build significantly faster with this change in place.

Change-Id: Ie09be1a73d5bb777ec5bca3ba93ba73d5612d141
Reviewed-on: https://go-review.googlesource.com/5834
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agoruntime: reset gcscanvalid and gcworkdone when GODEBUG=gctrace=2
Rick Hudson [Tue, 24 Feb 2015 22:49:55 +0000 (17:49 -0500)]
runtime: reset gcscanvalid and gcworkdone when GODEBUG=gctrace=2

When GODEBUG=gctrace=2 two gcs are preformed. During the first gc
the stack scan sets the g's gcscanvalid and gcworkdone flags to true
indicating that the stacks have to be scanned and do not need to
be rescanned. These need to be reset to false for the second GC so the
stacks are rescanned, otherwise if the only pointer to an object is
on the stack it will not be discovered and the object will be freed.
Typically this will include the object that was just allocated in
the mallocgc call that initiated the GC.

Change-Id: Ic25163f4689905fd810c90abfca777324005c02f
Reviewed-on: https://go-review.googlesource.com/5861
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agosyscall: rebuild zsyscall_linux_*.go
Dave Cheney [Tue, 24 Feb 2015 21:39:07 +0000 (08:39 +1100)]
syscall: rebuild zsyscall_linux_*.go

Rebuild the zsyscall_linux_*.go files in preperation for #9974

The only change is the ppc64/ppc64le files which were not rebuilt when
syscall.use was added.

Change-Id: I804c63731e4900c782025de04ea3585d99688958
Reviewed-on: https://go-review.googlesource.com/5831
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agomath/big: fix test for 32bit platforms (fix build)
Robert Griesemer [Tue, 24 Feb 2015 21:54:42 +0000 (13:54 -0800)]
math/big: fix test for 32bit platforms (fix build)

Change-Id: I73509cd0e0866cfe2b2ae46a26fb4d043dd050c4
Reviewed-on: https://go-review.googlesource.com/5840
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agogo/ast, go/parser: correct End() position for *ast.EmptyStmt
Robert Griesemer [Tue, 24 Feb 2015 07:51:05 +0000 (23:51 -0800)]
go/ast, go/parser: correct End() position for *ast.EmptyStmt

- added a new field ast.EmptyStmt.Implicit to indicate explicit
  or implicit semicolon
- fix ast.EmptyStmt.End() accordingly
- adjusted parser and added test case

Fixes #9979.

Change-Id: I72b0983b3a0cabea085598e1bf6c8df629776b57
Reviewed-on: https://go-review.googlesource.com/5720
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agomath/big: change Float.SetMantExp to always multiply mant by 2**exp
Robert Griesemer [Tue, 24 Feb 2015 19:24:27 +0000 (11:24 -0800)]
math/big: change Float.SetMantExp to always multiply mant by 2**exp

Change-Id: If840e647376a2141f8c17729f7ef251bfff13f5f
Reviewed-on: https://go-review.googlesource.com/5810
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/asm: fix build for new aliases
Rob Pike [Tue, 24 Feb 2015 20:30:39 +0000 (12:30 -0800)]
cmd/asm: fix build for new aliases

Missing leading A on names.

Change-Id: I6f3a66bdd3a21220f45a898f0822930b6a7bfa38
Reviewed-on: https://go-review.googlesource.com/5801
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/asm: add alias for MOVOA=MOVO on amd64
Rob Pike [Tue, 24 Feb 2015 19:00:07 +0000 (11:00 -0800)]
cmd/asm: add alias for MOVOA=MOVO on amd64

The alias should exist for both 386 and amd64.
There were a few others missing as well. Add them.

Change-Id: Ia0c3e71abc79f67a7a66941c0d932a8d5d6e9989
Reviewed-on: https://go-review.googlesource.com/5800
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agocrypto/x509: make behaviour of absolute DNS names match Chromium.
Adam Langley [Mon, 23 Feb 2015 23:32:08 +0000 (15:32 -0800)]
crypto/x509: make behaviour of absolute DNS names match Chromium.

Previously, we didn't handle absolute DNS names in certificates the same
way as Chromium, and we probably shouldn't diverge from major browsers.

Change-Id: I56a3962ad1002f68b5dbd65ae90991b82c2f5629
Reviewed-on: https://go-review.googlesource.com/5692
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agocrypto/x509: allow wildcards only as the first label.
Adam Langley [Mon, 23 Feb 2015 23:11:39 +0000 (15:11 -0800)]
crypto/x509: allow wildcards only as the first label.

RFC 6125 now specifies that wildcards are only allowed for the leftmost
label in a pattern: https://tools.ietf.org/html/rfc6125#section-6.4.3.

This change updates Go to match the behaviour of major browsers in this
respect.

Fixes #9834.

Change-Id: I37c10a35177133624568f2e0cf2767533926b04a
Reviewed-on: https://go-review.googlesource.com/5691
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agocrypto/tls: allow larger initial records.
Adam Langley [Mon, 23 Feb 2015 22:51:40 +0000 (14:51 -0800)]
crypto/tls: allow larger initial records.

Some servers which misunderstood the point of the CertificateRequest
message send huge reply records. These records are large enough that
they were considered “insane” by the TLS code and rejected.

This change removes the sanity test for record lengths. Although the
maxCiphertext test still remains, just above, which (roughly) enforces
the 16KB protocol limit on record sizes:
https://tools.ietf.org/html/rfc5246#section-6.2.1

Fixes #8928.

Change-Id: Idf89a2561b1947325b7ddc2613dc2da638d7d1c9
Reviewed-on: https://go-review.googlesource.com/5690
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agocrypto/x509: don't reject certs with critical policy extensions.
Adam Langley [Mon, 23 Feb 2015 22:27:50 +0000 (14:27 -0800)]
crypto/x509: don't reject certs with critical policy extensions.

There was a missing continue that caused certificates with critical
certificate-policy extensions to be rejected. Additionally, that code
structure in general was prone to exactly that bug so I changed it
around to hopefully be more robust in the future.

Fixes #9964.

Change-Id: I58fc6ef3a84c1bd292a35b8b700f44ef312ec1c1
Reviewed-on: https://go-review.googlesource.com/5670
Reviewed-by: Andrew Gerrand <adg@golang.org>
10 years agomath/big: fix several issues with string->Float conversion
Robert Griesemer [Sat, 14 Feb 2015 01:57:26 +0000 (17:57 -0800)]
math/big: fix several issues with string->Float conversion

Change-Id: I7bf7154e2d8d779fdf7f1d2bb561a06ad174f3b0
Reviewed-on: https://go-review.googlesource.com/4883
Reviewed-by: Alan Donovan <adonovan@google.com>
10 years agocmd/go: limit default darwin/arm parallelism
David Crawshaw [Tue, 24 Feb 2015 16:10:13 +0000 (11:10 -0500)]
cmd/go: limit default darwin/arm parallelism

iOS devices can only run tests serially.

Change-Id: I3f4e7abddf812a186895d9d5138999c8bded698f
Reviewed-on: https://go-review.googlesource.com/5751
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
10 years agosync: add active spinning to Mutex
Dmitry Vyukov [Fri, 20 Feb 2015 08:50:56 +0000 (11:50 +0300)]
sync: add active spinning to Mutex

Currently sync.Mutex is fully cooperative. That is, once contention is discovered,
the goroutine calls into scheduler. This is suboptimal as the resource can become
free soon after (especially if critical sections are short). Server software
usually runs at ~~50% CPU utilization, that is, switching to other goroutines
is not necessary profitable.

This change adds limited active spinning to sync.Mutex if:
1. running on a multicore machine and
2. GOMAXPROCS>1 and
3. there is at least one other running P and
4. local runq is empty.
As opposed to runtime mutex we don't do passive spinning,
because there can be work on global runq on on other Ps.

benchmark                   old ns/op     new ns/op     delta
BenchmarkMutexNoSpin        1271          1272          +0.08%
BenchmarkMutexNoSpin-2      702           683           -2.71%
BenchmarkMutexNoSpin-4      377           372           -1.33%
BenchmarkMutexNoSpin-8      197           190           -3.55%
BenchmarkMutexNoSpin-16     131           122           -6.87%
BenchmarkMutexNoSpin-32     170           164           -3.53%
BenchmarkMutexSpin          4724          4728          +0.08%
BenchmarkMutexSpin-2        2501          2491          -0.40%
BenchmarkMutexSpin-4        1330          1325          -0.38%
BenchmarkMutexSpin-8        684           684           +0.00%
BenchmarkMutexSpin-16       414           372           -10.14%
BenchmarkMutexSpin-32       559           469           -16.10%

BenchmarkMutex                 19.1          19.1          +0.00%
BenchmarkMutex-2               81.6          54.3          -33.46%
BenchmarkMutex-4               143           100           -30.07%
BenchmarkMutex-8               154           156           +1.30%
BenchmarkMutex-16              140           159           +13.57%
BenchmarkMutex-32              141           163           +15.60%
BenchmarkMutexSlack            33.3          31.2          -6.31%
BenchmarkMutexSlack-2          122           97.7          -19.92%
BenchmarkMutexSlack-4          168           158           -5.95%
BenchmarkMutexSlack-8          152           158           +3.95%
BenchmarkMutexSlack-16         140           159           +13.57%
BenchmarkMutexSlack-32         146           162           +10.96%
BenchmarkMutexWork             154           154           +0.00%
BenchmarkMutexWork-2           89.2          89.9          +0.78%
BenchmarkMutexWork-4           139           86.1          -38.06%
BenchmarkMutexWork-8           177           162           -8.47%
BenchmarkMutexWork-16          170           173           +1.76%
BenchmarkMutexWork-32          176           176           +0.00%
BenchmarkMutexWorkSlack        160           160           +0.00%
BenchmarkMutexWorkSlack-2      103           99.1          -3.79%
BenchmarkMutexWorkSlack-4      155           148           -4.52%
BenchmarkMutexWorkSlack-8      176           170           -3.41%
BenchmarkMutexWorkSlack-16     170           173           +1.76%
BenchmarkMutexWorkSlack-32     175           176           +0.57%

"No work" benchmarks are not very interesting (BenchmarkMutex and
BenchmarkMutexSlack), as they are absolutely not realistic.

Fixes #8889

Change-Id: I6f14f42af1fa48f73a776fdd11f0af6dd2bb428b
Reviewed-on: https://go-review.googlesource.com/5430
Reviewed-by: Rick Hudson <rlh@golang.org>
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>

10 years agonet: enable TestTCPReadWriteAllocs in short mode
Mikio Hara [Tue, 24 Feb 2015 05:13:47 +0000 (14:13 +0900)]
net: enable TestTCPReadWriteAllocs in short mode

The change 2096 removed unwanted allocations and a few noises in test
using AllocsPerRun. Now it's safe to enable this canary test on netpoll
hotpaths.

Change-Id: Icdbee813d81c1410a48ea9960d46447042976905
Reviewed-on: https://go-review.googlesource.com/5713
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
10 years agocrypto/rsa: drop the primality check in crypto/rsa.Validate.
Adam Langley [Mon, 23 Feb 2015 21:28:57 +0000 (13:28 -0800)]
crypto/rsa: drop the primality check in crypto/rsa.Validate.

This check is expensive and adversely impacts startup times for some
servers with several, large RSA keys.

It was nice to have, but it's not really going to stop a targetted
attack and was never designed to – hopefully people's private keys
aren't attacker controlled!

Overall I think the feeling is that people would rather have the CPU
time back.

Fixes #6626.

Change-Id: I0143a58c9f22381116d4ca2a3bbba0d28575f3e5
Reviewed-on: https://go-review.googlesource.com/5641
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>

10 years agomath: Dim, Max, Min - allow more bit patterns for NaN
Charlie Dorian [Sun, 22 Feb 2015 21:12:51 +0000 (16:12 -0500)]
math: Dim, Max, Min - allow more bit patterns for NaN

Fixes #9919

Change-Id: Ib443c762f727d4986ca7f8a404362f92b0e91aff
Reviewed-on: https://go-review.googlesource.com/5553
Reviewed-by: Minux Ma <minux@golang.org>
10 years agoall: merge dev.cc (a91c2e0) into master
Russ Cox [Mon, 23 Feb 2015 21:50:05 +0000 (16:50 -0500)]
all: merge dev.cc (a91c2e0) into master

This change deletes the C implementations of
the Go compiler and assembler from the master branch.

The Go implementations are a bit slower right now,
due mainly to garbage generated by taking addresses
of stack variables all over the place (it was C code,
after all). That will be cleaned up (mechanically) over the
next week or so, and things will get faster.

Change-Id: I66b2b3477aec8835f9960d0798f5752dcd98d08f

10 years agoruntime: eliminate unnecessary assumption in heapBitsForObject
Austin Clements [Mon, 23 Feb 2015 19:33:56 +0000 (14:33 -0500)]
runtime: eliminate unnecessary assumption in heapBitsForObject

The slow path of heapBitsForObjects somewhat subtly assumes that the
pointer will not point to the first word of the object and will round
the pointer wrong if this assumption is violated.  This assumption is
safe because the fast path should always take care of this case, but
there's no benefit to making this assumption, it makes the code more
difficult to experiment with than necessary, and it's trivial to
eliminate.

Change-Id: Iedd336f7d529a27d3abeb83e77dfb32a285ea73a
Reviewed-on: https://go-review.googlesource.com/5636
Reviewed-by: Russ Cox <rsc@golang.org>
10 years ago[dev.cc] cmd/internal/obj: set ctxt.Windows != 0 on windows
Russ Cox [Mon, 23 Feb 2015 21:29:00 +0000 (16:29 -0500)]
[dev.cc] cmd/internal/obj: set ctxt.Windows != 0 on windows

May fix windows build.

Change-Id: Ic4e32a4478caf758da6b02bc9126ddacb0fc07e0
Reviewed-on: https://go-review.googlesource.com/5650
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
10 years ago[dev.cc] cmd/5g etc: code cleanup: delay var decls and eliminate dead code
Russ Cox [Mon, 23 Feb 2015 21:07:24 +0000 (16:07 -0500)]
[dev.cc] cmd/5g etc: code cleanup: delay var decls and eliminate dead code

Ran rsc.io/grind rev 6f0e601 on the source files.

The cleanups move var declarations as close to the use
as possible, splitting disjoint uses of the var into separate
variables. They also remove dead code (especially in
func sudoaddable), which helps with the var moving.

There's more cleanup to come, but this alone cuts the
time spent compiling html/template on my 2013 MacBook Pro
from 3.1 seconds to 2.3 seconds.

Change-Id: I4de499f47b1dd47a560c310bbcde6b08d425cfd6
Reviewed-on: https://go-review.googlesource.com/5637
Reviewed-by: Rob Pike <r@golang.org>
10 years agomath/big: fix formatting for 'b' format
Robert Griesemer [Mon, 23 Feb 2015 21:15:10 +0000 (13:15 -0800)]
math/big: fix formatting for 'b' format

Fixes #9939.

Change-Id: I9d60722b648fbc00650115da539a7466c6c86552
Reviewed-on: https://go-review.googlesource.com/5640
Reviewed-by: Alan Donovan <adonovan@google.com>
10 years agoruntime/pprof: make TestBlockProfile more robust
Shenghou Ma [Mon, 23 Feb 2015 08:55:54 +0000 (03:55 -0500)]
runtime/pprof: make TestBlockProfile more robust

It's using debug mode of pprof.writeBlock, so the output actually goes
through text/tabwriter. It is possible that tabwriter expands each tab
into multiple tabs in certain cases.

For example, this output has been observed on the new arm64 port:
10073805 1 @ 0x1088ec 0xd1b8c 0xd0628 0xb68c0 0x867f4
# 0x1088ec sync.(*Cond).Wait+0xfc /home/minux/go.git/src/sync/cond.go:63
# 0xd1b8c runtime/pprof_test.blockCond+0x22c /home/minux/go.git/src/runtime/pprof/pprof_test.go:454
# 0xd0628 runtime/pprof_test.TestBlockProfile+0x1b8 /home/minux/go.git/src/runtime/pprof/pprof_test.go:359
# 0xb68c0 testing.tRunner+0x140 /home/minux/go.git/src/testing/testing.go:447

10069965 1 @ 0x14008 0xd1390 0xd0628 0xb68c0 0x867f4
# 0x14008 runtime.chansend1+0x48 /home/minux/go.git/src/runtime/chan.go:76
# 0xd1390 runtime/pprof_test.blockChanSend+0x100 /home/minux/go.git/src/runtime/pprof/pprof_test.go:396
# 0xd0628 runtime/pprof_test.TestBlockProfile+0x1b8 /home/minux/go.git/src/runtime/pprof/pprof_test.go:359
# 0xb68c0 testing.tRunner+0x140 /home/minux/go.git/src/testing/testing.go:447

10069706 1 @ 0x108e0c 0xd193c 0xd0628 0xb68c0 0x867f4
# 0x108e0c sync.(*Mutex).Lock+0x19c /home/minux/go.git/src/sync/mutex.go:67
# 0xd193c runtime/pprof_test.blockMutex+0xbc /home/minux/go.git/src/runtime/pprof/pprof_test.go:441
# 0xd0628 runtime/pprof_test.TestBlockProfile+0x1b8 /home/minux/go.git/src/runtime/pprof/pprof_test.go:359
# 0xb68c0 testing.tRunner+0x140 /home/minux/go.git/src/testing/testing.go:447

Change-Id: I3bef778c5fe01a894cfdc526fdc5fecb873b8ade
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/5554
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
10 years agomath: faster Cbrt
Charles Dorian [Thu, 19 Feb 2015 01:05:38 +0000 (20:05 -0500)]
math: faster Cbrt

Old 45.3 ns/op, new 19.9 ns/op.

Change-Id: If2a201981dcc259846631ecbc694c401e0a80287
Reviewed-on: https://go-review.googlesource.com/5260
Reviewed-by: Russ Cox <rsc@golang.org>
10 years ago[dev.cc] cmd/6a, cmd/6g etc: replace C implementations with Go implementations
Russ Cox [Mon, 23 Feb 2015 19:20:01 +0000 (14:20 -0500)]
[dev.cc] cmd/6a, cmd/6g etc: replace C implementations with Go implementations

Change-Id: I58e00a39cf63df07813d21453f91e68eef6a413c
Reviewed-on: https://go-review.googlesource.com/5635
Reviewed-by: Rob Pike <r@golang.org>
10 years ago[dev.cc] cmd/dist, cmd/go: stop building C implementations of compilers, assemblers
Russ Cox [Mon, 23 Feb 2015 19:10:08 +0000 (14:10 -0500)]
[dev.cc] cmd/dist, cmd/go: stop building C implementations of compilers, assemblers

Also stop building objwriter, which was only used by them.

Change-Id: Ia2353abd9426026a81a263cb46a72dd39c360ce4
Reviewed-on: https://go-review.googlesource.com/5634
Reviewed-by: Rob Pike <r@golang.org>
10 years ago[dev.cc] cmd/internal/gc: reconvert to pick up bug fixes
Russ Cox [Mon, 23 Feb 2015 19:02:27 +0000 (14:02 -0500)]
[dev.cc] cmd/internal/gc: reconvert to pick up bug fixes

Convert using rsc.io/c2go rev a97ff47.

Notable changes:
- %% in format string now correctly preserved
- reintroduce "signal handler" to hide internal faults
  after errors have been printed

Change-Id: Ic5a94f1c3a8015a9054e21c8969b52d964a36c45
Reviewed-on: https://go-review.googlesource.com/5633
Reviewed-by: Rob Pike <r@golang.org>
10 years ago[dev.cc] test: disable syntax error tests
Russ Cox [Mon, 23 Feb 2015 19:00:51 +0000 (14:00 -0500)]
[dev.cc] test: disable syntax error tests

These don't work with the new compiler, because the
new compiler doesn't have the custom syntax errors
that I built for the old compiler. It will, just not yet.
(Issue #9968.)

Change-Id: I658f7dab2c7f855340a501f9ae4479c097b28cd3
Reviewed-on: https://go-review.googlesource.com/5632
Reviewed-by: Rob Pike <r@golang.org>
10 years ago[dev.cc] cmd/asm: add end to end test for amd64
Rob Pike [Mon, 23 Feb 2015 19:49:36 +0000 (11:49 -0800)]
[dev.cc] cmd/asm: add end to end test for amd64

Change-Id: I40839c2d1c0c105a5ba9aadcb55a13693bf4afa6
Reviewed-on: https://go-review.googlesource.com/5592
Reviewed-by: Russ Cox <rsc@golang.org>
10 years ago[dev.cc] cmd/go: do not install tools while executing them
Russ Cox [Mon, 23 Feb 2015 16:47:48 +0000 (11:47 -0500)]
[dev.cc] cmd/go: do not install tools while executing them

Change-Id: I3417efc203f555a0a6101701f387ead84f9a08d1
Reviewed-on: https://go-review.googlesource.com/5577
Reviewed-by: Rob Pike <r@golang.org>
10 years ago[dev.cc] all: merge master (6a10f72) into dev.cc
Russ Cox [Mon, 23 Feb 2015 19:27:55 +0000 (14:27 -0500)]
[dev.cc] all: merge master (6a10f72) into dev.cc

To pick up darwin/arm fix and hopefully fix build.

Change-Id: I06996d0b13b777e476f65405aee031482fc76439

10 years agomath/big: don't return io.EOF on successful call of ParseFloat
Robert Griesemer [Mon, 23 Feb 2015 18:57:21 +0000 (10:57 -0800)]
math/big: don't return io.EOF on successful call of ParseFloat

Fixes $9938.

Change-Id: Ie8680a875225748abd660fb26b4c25546e7b92d3
Reviewed-on: https://go-review.googlesource.com/5620
Reviewed-by: Alan Donovan <adonovan@google.com>
10 years agoruntime: Add prefetch to allocation code
Rick Hudson [Thu, 19 Feb 2015 23:11:24 +0000 (18:11 -0500)]
runtime: Add prefetch to allocation code

The routine mallocgc retrieves objects from freelists. Prefetch
the object that will be returned in the next call to mallocgc.
Experiments indicate that this produces a 1% improvement when using
prefetchnta and less when using prefetcht0, prefetcht1, or prefetcht2.

Benchmark numbers indicate a 1% improvement over no
prefetch, much less over prefetcht0, prefetcht1, and prefetcht2.
These numbers were for the garbage benchmark with MAXPROCS=4
no prefetch                          >> 5.96 / 5.77 / 5.89
prefetcht0(uintptr(v.ptr().next))    >> 5.88 / 6.17 / 5.84
prefetcht1(uintptr(v.ptr().next))    >> 5.88 / 5.89 / 5.91
prefetcht2(uintptr(v.ptr().next))    >> 5.87 / 6.47 / 5.92
prefetchnta(uintptr(v.ptr().next))   >> 5.72 / 5.84 / 5.85

Change-Id: I54e07172081cccb097d5b5ce8789d74daa055ed9
Reviewed-on: https://go-review.googlesource.com/5350
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Austin Clements <austin@google.com>
10 years agogo/token: document that column positions and file offsets are in bytes
Robert Griesemer [Mon, 23 Feb 2015 18:20:20 +0000 (10:20 -0800)]
go/token: document that column positions and file offsets are in bytes

Fixes #9948.

Change-Id: I7b354fccd5e933eeeb2253a66acec050ebff6e41
Reviewed-on: https://go-review.googlesource.com/5611
Reviewed-by: Alan Donovan <adonovan@google.com>
10 years agomath/big: incorporated feedback from prior TBR reviews
Robert Griesemer [Mon, 23 Feb 2015 18:05:02 +0000 (10:05 -0800)]
math/big: incorporated feedback from prior TBR reviews

Change-Id: Ida847365223ef09b4a3846e240b4bb6919cb0fe9
Reviewed-on: https://go-review.googlesource.com/5610
Reviewed-by: Alan Donovan <adonovan@google.com>
10 years agonet/mail: move RFC 2047 code to internal/mime
Alexandre Cesaro [Tue, 23 Dec 2014 19:29:13 +0000 (20:29 +0100)]
net/mail: move RFC 2047 code to internal/mime

The code concerning quoted-printable encoding (RFC 2045) and its
variant for MIME headers (RFC 2047) is currently spread in
mime/multipart and net/mail. It is also not exported.

This commit is the second step to fix that issue. It moves the
RFC 2047 encoding and decoding functions from net/mail to
internal/mime. The exported API is unchanged.

Updates #4943

Change-Id: I5f58aa58e74bbe4ec91b2e9b8c81921338053b00
Reviewed-on: https://go-review.googlesource.com/2101
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agocmd/go: link cgo into tests on darwin/arm
David Crawshaw [Fri, 20 Feb 2015 16:05:36 +0000 (11:05 -0500)]
cmd/go: link cgo into tests on darwin/arm

We currently have only one supported darwin/arm device, a locked iOS
machine. It requires cgo binaries.

Change-Id: If36a152e6a743e4a58ea3470e62cccb742630a5d
Reviewed-on: https://go-review.googlesource.com/5443
Reviewed-by: Russ Cox <rsc@golang.org>
10 years ago[dev.cc] misc/nacl: add testdata for cmd/internal/rsc.io/x86/x86asm
Russ Cox [Mon, 23 Feb 2015 15:29:25 +0000 (10:29 -0500)]
[dev.cc] misc/nacl: add testdata for cmd/internal/rsc.io/x86/x86asm

Should fix nacl build on dev.cc.

Change-Id: I166a03b5f6903bd8bbce65af4e5f2899807bb6cc
Reviewed-on: https://go-review.googlesource.com/5575
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>

10 years ago[dev.cc] runtime, syscall: add names to FP offsets in freebsd, netbsd arm assembly
Russ Cox [Mon, 23 Feb 2015 15:56:10 +0000 (10:56 -0500)]
[dev.cc] runtime, syscall: add names to FP offsets in freebsd, netbsd arm assembly

Makes them compatible with the new asm.
Applied mechanically from vet diagnostics.

Manual edits: the names for arguments in time·now(SB) in runtime/sys_*_arm.s.

Change-Id: Ib295390d9509d306afc67714e3f50dc832256625
Reviewed-on: https://go-review.googlesource.com/5576
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
10 years ago[dev.cc] cmd/new6g, etc: reconvert to add profiling
Russ Cox [Mon, 23 Feb 2015 15:22:26 +0000 (10:22 -0500)]
[dev.cc] cmd/new6g, etc: reconvert to add profiling

Converted from rsc.io/c2go rev a9bc7f2.
Adds profiling support.

Change-Id: Ie04f86b71e0713c7294416c77d349e0d93798403
Reviewed-on: https://go-review.googlesource.com/5574
Reviewed-by: Rob Pike <r@golang.org>
10 years ago[dev.cc] all: merge master (48469a2) into dev.cc
Russ Cox [Mon, 23 Feb 2015 15:15:35 +0000 (10:15 -0500)]
[dev.cc] all: merge master (48469a2) into dev.cc

Change-Id: I10f7950d173b302151f2a31daebce297b4306ebe

10 years ago[dev.cc] cmd/go: fix expansion of cmd
Russ Cox [Sun, 22 Feb 2015 18:17:43 +0000 (13:17 -0500)]
[dev.cc] cmd/go: fix expansion of cmd

This was supposed to be in the previous CL, but I forgot to 'git rw' it down.

Change-Id: Ia5e14ca2c7640f08abbbed1a777a6cf04d71d0e7
Reviewed-on: https://go-review.googlesource.com/5570
Reviewed-by: Russ Cox <rsc@golang.org>
10 years ago[dev.cc] doc/go1.5: mention cmd/go meaning of std change
Russ Cox [Sun, 22 Feb 2015 17:48:16 +0000 (12:48 -0500)]
[dev.cc] doc/go1.5: mention cmd/go meaning of std change

Change-Id: I259e88f019b6818c57caaa1ec236b7c2e2ae1382
Reviewed-on: https://go-review.googlesource.com/5551
Reviewed-by: Rob Pike <r@golang.org>