]> Cypherpunks repositories - gostls13.git/log
gostls13.git
10 years agocmd/dist, cmd/go: move textdata.h, funcdata.h from pkg/GOOS_GOARCH to pkg/include
Russ Cox [Mon, 2 Mar 2015 15:30:47 +0000 (10:30 -0500)]
cmd/dist, cmd/go: move textdata.h, funcdata.h from pkg/GOOS_GOARCH to pkg/include

There's no point to having them in every GOOS_GOARCH directory,
since they are neither GOOS- nor GOARCH-specific.
(There used to be other headers that were.)

This makes building for additional toolchains easier:
no need to run make.bash at all.

Fixes #10049.

Change-Id: I710ecaafd7a5c8cad85ccd595ea9cb6058f553b3
Reviewed-on: https://go-review.googlesource.com/6471
Reviewed-by: Rob Pike <r@golang.org>
10 years agogo/build: make interaction between file names and +build lines clearer
Russ Cox [Mon, 2 Mar 2015 17:41:23 +0000 (12:41 -0500)]
go/build: make interaction between file names and +build lines clearer

Change-Id: I2cae17d3f0d208c7ed1089bc5cb8f81022fcd36e
Reviewed-on: https://go-review.googlesource.com/6470
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
10 years agocmd/internal/ld, cmd/internal/obj: delete Ctxt.Endian
Russ Cox [Mon, 2 Mar 2015 03:02:13 +0000 (22:02 -0500)]
cmd/internal/ld, cmd/internal/obj: delete Ctxt.Endian

Replaced by Ctxt.ByteOrder, which uses the standard binary.ByteOrder type.

Change-Id: I06cec0674c153a9ad75ff937f7eb934891effd0b
Reviewed-on: https://go-review.googlesource.com/6450
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/go: force default env vars onto tool subprocesses
Russ Cox [Mon, 2 Mar 2015 01:03:49 +0000 (20:03 -0500)]
cmd/go: force default env vars onto tool subprocesses

This avoids needing every invoked tool to have an identical
computation of the build defaults as the go command does.
It makes sure the tools all know what the go command wants.

Change-Id: I484f15982bfb93c86cde8fc9df7f456505270b87
Reviewed-on: https://go-review.googlesource.com/6409
Reviewed-by: Rob Pike <r@golang.org>
10 years agobuild: add bootstrap.bash for bootstrapping new systems
Russ Cox [Mon, 2 Mar 2015 00:44:03 +0000 (19:44 -0500)]
build: add bootstrap.bash for bootstrapping new systems

Change-Id: Ic74830608fe077b4e97e8ce8009017c1e273c672
Reviewed-on: https://go-review.googlesource.com/6408
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/dist: fix default GOOS/GOARCH for cross-compile
Russ Cox [Mon, 2 Mar 2015 00:42:03 +0000 (19:42 -0500)]
cmd/dist: fix default GOOS/GOARCH for cross-compile

Before this CL, if you are on a darwin/amd64 machine and
cross-compile 9g for a linux/ppc64 machine, when you copy
9g over to that kind of machine and run it, you'll find it thinks
the default object target is darwin/amd64. Not useful.
Make the default target linux/ppc64 in this case. More useful.

Change-Id: I62f2e9cb5f60b3077a922b31cd023a9cb7a6cfda
Reviewed-on: https://go-review.googlesource.com/6407
Reviewed-by: Rob Pike <r@golang.org>
10 years agoruntime: change sigset_all and sigset_none into constants on OpenBSD
Matthew Dempsky [Mon, 2 Mar 2015 03:13:50 +0000 (19:13 -0800)]
runtime: change sigset_all and sigset_none into constants on OpenBSD

OpenBSD's sigprocmask system call passes the signal mask by value
rather than reference, so vars are unnecessary.  Additionally,
declaring "var sigset_all = ^sigset_none" means sigset_all won't be
initialized until runtime_init is called, but the first call to
newosproc happens before then.

I've witnessed Go processes on OpenBSD crash from receiving SIGWINCH
on the newly created OS thread before it finished initializing.

Change-Id: I16995e7e466d5e7e50bcaa7d9490173789a0b4cc
Reviewed-on: https://go-review.googlesource.com/6440
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agoruntime: cleanup chan code
Dmitry Vyukov [Sat, 14 Feb 2015 13:42:51 +0000 (16:42 +0300)]
runtime: cleanup chan code

Move type definitions from chan1.go to chan.go and select.go.
Remove underscores from names.
Make c.buf unsafe.Pointer instead of *uint8.

Change-Id: I75cf8385bdb9f79eb5a7f7ad319495abbacbe942
Reviewed-on: https://go-review.googlesource.com/4900
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>

10 years agonet/http/fcgi: fix test
Dmitry Vyukov [Sun, 1 Mar 2015 13:23:55 +0000 (16:23 +0300)]
net/http/fcgi: fix test

Currently the test fails if run more than once:

$ go test -v -run=TestChildServeCleansUp -cpu=1,1 net/http/fcgi
=== RUN TestChildServeCleansUp
--- PASS: TestChildServeCleansUp (0.00s)
=== RUN TestChildServeCleansUp
fatal error: all goroutines are asleep - deadlock!

The problem is that the writer mutates test input data,
so it is wrong on the second execution.

Change-Id: I4ca54dd2926c6986b2908023ac65e5e65630ed26
Reviewed-on: https://go-review.googlesource.com/6383
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agoruntime: fix traceback of crash before LR is stored
Russ Cox [Mon, 2 Mar 2015 02:29:25 +0000 (21:29 -0500)]
runtime: fix traceback of crash before LR is stored

This fixes runtime's TestBreakpoint on ppc64:
the Breakpoint frame was not showing up in the trace.

It seems like f.frame should be either the frame size
including the saved LR (if any) or the frame size
not including the saved LR.

On ppc64, f.frame is the frame size not including the saved LR.

On arm, f.frame is the frame size not including the saved LR,
except when that's -4, f.frame is 0 instead.

The code here in the runtime expects that f.frame is the frame
size including the saved LR.

Since all three disagree and nothing else uses f.frame anymore,
stop using it here too. Use funcspdelta, which tells us the exact
difference between the FP and SP. If it's zero, LR has not been
saved yet, so the one saved for sigpanic should be recorded.

This fixes TestBreakpoint on both ppc64 and ppc64le.
I don't really understand how it ever worked there.

Change-Id: I2d2c580d5c0252cc8471e828980aeedcab76858d
Reviewed-on: https://go-review.googlesource.com/6430
Reviewed-by: Minux Ma <minux@golang.org>
10 years agocmd/9l: fix ppc64le build
Russ Cox [Mon, 2 Mar 2015 05:16:16 +0000 (00:16 -0500)]
cmd/9l: fix ppc64le build

The conversion accidentally dropped the +4 here.

Change-Id: Ic6181a759565c261bc1b084317f693ae249fd036
Reviewed-on: https://go-review.googlesource.com/6451
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agobuild: update Windows make.bat to use CC_FOR_TARGET.
Hyang-Ah (Hana) Kim [Sun, 1 Mar 2015 15:09:27 +0000 (10:09 -0500)]
build: update Windows make.bat to use CC_FOR_TARGET.

Change-Id: Ie4d8bedb9408372dff64e9a7fd857e1be4ee59e1
Reviewed-on: https://go-review.googlesource.com/6401
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
10 years agodoc/contribute.html rewrite "Set up auth... code review".
Lloyd Dewolf [Wed, 25 Feb 2015 05:33:29 +0000 (21:33 -0800)]
doc/contribute.html rewrite "Set up auth... code review".

- Fixed term in preceding section: submitted -> merged.
- Clear transitions between web sites.
- Clarify "types" of G Accounts.
- Less verbose "Configure Git" instructions. [l10n]
- Google uses the term "sign in".
- Mention .gitcookie file created.

Update "Register with Gerrit".
- Link directly to gerrit /login/ .

HTML
- Removed non-ascii "hidden characters".
- Encoded some & and >.

Change-Id: I0d99102def6b32e09b8e42fa40e20227ad5e7568
Reviewed-on: https://go-review.googlesource.com/5892
Reviewed-by: Andrew Gerrand <adg@golang.org>
10 years agoos: add windows test for Hostname
Alex Brainman [Thu, 26 Feb 2015 03:19:19 +0000 (14:19 +1100)]
os: add windows test for Hostname

Change-Id: I9b38b3a384722cf000eab18b62f73f90bcb56c5c
Reviewed-on: https://go-review.googlesource.com/6070
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agoimage/jpeg: distinguish between FormatError and UnsupportedError when
Nigel Tao [Mon, 2 Mar 2015 00:27:57 +0000 (11:27 +1100)]
image/jpeg: distinguish between FormatError and UnsupportedError when
encountering unknown markers.

Change-Id: Ica86013308d69da2f5b486119235ff693135b2f1
Reviewed-on: https://go-review.googlesource.com/6393
Reviewed-by: David Symonds <dsymonds@golang.org>
Run-TryBot: David Symonds <dsymonds@golang.org>

10 years agocmd/9l: fix bogus C conversion
Russ Cox [Sun, 1 Mar 2015 18:32:49 +0000 (13:32 -0500)]
cmd/9l: fix bogus C conversion

Looks like c2go and gcc disagree about the exact meaning of the
usual arithmetic conversions, in a way that broke 9l's archreloc.
Fix it.

It's very hard for me to see why the original C code did not say
what c2go interpreted it to say, but apparently it did not.
This is why Go has explicit numerical conversions.

Change-Id: I75bd73afd1fa4ce9a53c887e1bd7d1e26ff43ae4
Reviewed-on: https://go-review.googlesource.com/6405
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agoall: mv 5a old5a and so on
Russ Cox [Sat, 28 Feb 2015 19:24:28 +0000 (14:24 -0500)]
all: mv 5a old5a and so on

This CL will break any uses of 'go tool 5a' etc.
That is intentional.
Code that invokes an assembler directly should be updated to use go tool asm.

We plan to keep the old5a around for bit-for-bit verification during
the release testing phase, but we plan to remove those tools for the
actual release. Renaming the directory now makes sure that lingering
references to 'go tool 5a' will be caught, changed to use asm, and
tested during the release evaluation.

Change-Id: I98748a7ddb34cc7f1b151c2ef421d3656821f5c2
Reviewed-on: https://go-review.googlesource.com/6366
Reviewed-by: Rob Pike <r@golang.org>
10 years agonet: deflake TestPacketConn, increase timeout
Brad Fitzpatrick [Sun, 15 Feb 2015 17:35:18 +0000 (09:35 -0800)]
net: deflake TestPacketConn, increase timeout

Tests sometimes failed with:

ok   mime/internal/quotedprintable      0.606s
ok   mime/multipart                     0.819s
--- FAIL: TestPacketConn (0.10s)
    packetconn_test.go:96: PacketConn.ReadFrom failed: WSARecvFrom udp 127.0.0.1:64156: i/o timeout
FAIL
FAIL    net     3.602s
ok      net/http        4.618s
ok      net/http/cgi    0.576s

Theory: 100 ms is too short. Small timer granularity on Wnidows, or an
allocation in the middle causing a GC sometimes?

In any case, increase it to 500 ms.

Change-Id: I48cc4d600eb168db9f85c0fd05335dd630254c3c
Reviewed-on: https://go-review.googlesource.com/4922
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
10 years agonet: disable TestTCPReadWriteAllocs on dragonfly
Brad Fitzpatrick [Sun, 1 Mar 2015 17:30:15 +0000 (09:30 -0800)]
net: disable TestTCPReadWriteAllocs on dragonfly

Update #8859
Update #10042

Change-Id: Idc7eadb447b73563ce9085e50c2042652442c2d9
Reviewed-on: https://go-review.googlesource.com/6412
Reviewed-by: Minux Ma <minux@golang.org>
10 years agopath/filepath: get tests working on darwin/arm
David Crawshaw [Sun, 1 Mar 2015 03:55:29 +0000 (22:55 -0500)]
path/filepath: get tests working on darwin/arm

Change-Id: Ic44d7837aaec58601e5d9cad8da5b958a809f4a0
Reviewed-on: https://go-review.googlesource.com/6400
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agoruntime: don't use /dev/random on Plan 9
David du Colombier [Sun, 1 Mar 2015 17:08:15 +0000 (18:08 +0100)]
runtime: don't use /dev/random on Plan 9

Plan 9 provides a /dev/random device to return a
stream of random numbers. However, the method used
to generate random numbers on Plan 9 is slow and
reading from /dev/random may block.

We don't want our Go programs to be significantly
slowed down just to slightly improve the distribution
of hash values.

So, we do the same thing as NaCl and rely exclusively
on extendRandom to generate pseudo-random numbers.

Fixes #10028.

Change-Id: I7e11a9b109c22f23608eb09c406b7c3dba31f26a
Reviewed-on: https://go-review.googlesource.com/6386
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agosyscall: fix mount working directory on Plan 9
David du Colombier [Sun, 1 Mar 2015 16:30:47 +0000 (17:30 +0100)]
syscall: fix mount working directory on Plan 9

In CL 6350, Brad fixed the following system calls
to use the program-wide workding directory:

- bind
- chdir
- create
- open
- remove
- stat
- umount
- wstat

However, Russ Cox pointed out that the mount
system call should be fixed as well.

Change-Id: I6139ed11ba449f18c46e95269f4d0e51be7cec48
Reviewed-on: https://go-review.googlesource.com/6385
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agofmt: document existing behavior of nil receivers
Rob Pike [Sun, 1 Mar 2015 16:56:25 +0000 (08:56 -0800)]
fmt: document existing behavior of nil receivers

If a method called by fmt triggers a panic, the output usually says
so. However, there is heretofore undocumented special treatment for
a panic caused by formatting a nil value with an Error or String
method: the output is simply "<nil>". Document that behavior.

Change-Id: Id0f79dd0b3487f9d1c74a0856727bba5cc342be4
Reviewed-on: https://go-review.googlesource.com/6410
Reviewed-by: David Crawshaw <crawshaw@golang.org>
10 years agoos: darwin/arm working dir moved for tests
David Crawshaw [Sun, 1 Mar 2015 03:35:51 +0000 (22:35 -0500)]
os: darwin/arm working dir moved for tests

The go_darwin_arm_exec script now tells lldb to move the working
directory into <bundle>/src/os on startup.

Change-Id: I0ada4969e9ea374f08c84ab736aab2097ac73dd8
Reviewed-on: https://go-review.googlesource.com/6369
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
10 years agoruntime: TestGdbPython 'print mapvar' should not need unwinding
Jan Kratochvil [Sat, 28 Feb 2015 18:43:50 +0000 (19:43 +0100)]
runtime: TestGdbPython 'print mapvar' should not need unwinding

issue #10017: TestGdbPython 'print mapvar' is reported to fail on ppc64.
issue #10002: TestGdbPython 'print mapvar' is reported to fail on arm hardfloat.

The testcase now uses plain line number in main.  Unwinding issues are
unrelated to the GDB map prettyprinter feature.

Remove arch-specific t.Skip()s from those two issues.

Fixes #10017
Fixes #10002

Change-Id: I9d50ffe2f3eb7bf65dd17c8c76a2677571de68ba
Reviewed-on: https://go-review.googlesource.com/6267
Reviewed-by: Minux Ma <minux@golang.org>
10 years agocmd/pack: skip fork test on darwin/arm
David Crawshaw [Sat, 28 Feb 2015 01:13:51 +0000 (20:13 -0500)]
cmd/pack: skip fork test on darwin/arm

Change-Id: I65b50d2501fe822bc9044a851ac0b3467feadd9f
Reviewed-on: https://go-review.googlesource.com/6330
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agocmd/cc: delete lexbody, macbody
Russ Cox [Sun, 1 Mar 2015 00:52:06 +0000 (19:52 -0500)]
cmd/cc: delete lexbody, macbody

These files were left behind for the C implementation of the assemblers.
They're no longer needed.

This is the last of the cmd/cc directory.

Change-Id: I9231b23c27fead5695000097aeb694824747677d
Reviewed-on: https://go-review.googlesource.com/6367
Reviewed-by: Minux Ma <minux@golang.org>
10 years agoall: delete C libraries and cmd/dist code that builds them
Russ Cox [Sat, 28 Feb 2015 19:00:44 +0000 (14:00 -0500)]
all: delete C libraries and cmd/dist code that builds them

Change-Id: Ic66243674ac1dbf829c7523005e33611cc89ac83
Reviewed-on: https://go-review.googlesource.com/6362
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/5l etc: replace C code with Go code
Russ Cox [Sat, 28 Feb 2015 18:48:09 +0000 (13:48 -0500)]
cmd/5l etc: replace C code with Go code

mv cmd/new5l cmd/5l and so on.

Minimal changes to cmd/dist and cmd/go to keep things building.
More can be deleted in followup CLs.

Change-Id: I1449eca7654ce2580d1f413a56dc4a75f3d4618b
Reviewed-on: https://go-review.googlesource.com/6361
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/go: use Go linker instead of C linker
Russ Cox [Sat, 28 Feb 2015 03:56:29 +0000 (22:56 -0500)]
cmd/go: use Go linker instead of C linker

Change-Id: I783df66d762b52ad3d74340ad5692790cd0ab544
Reviewed-on: https://go-review.googlesource.com/6360
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/dist: build linkers written in Go
Russ Cox [Sat, 28 Feb 2015 03:56:12 +0000 (22:56 -0500)]
cmd/dist: build linkers written in Go

Change-Id: Ia36fa5e617ceacbbca9f30f4e109d94e515b38ef
Reviewed-on: https://go-review.googlesource.com/6336
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
10 years agocmd/new5l etc: convert from C to Go
Russ Cox [Sat, 28 Feb 2015 03:57:28 +0000 (22:57 -0500)]
cmd/new5l etc: convert from C to Go

Using rsc.io/c2go rev fc8cbfa's run.ld script.

Change-Id: I4d4d14fce96f8ce7a934bf8b9701b84fa9cf772d
Reviewed-on: https://go-review.googlesource.com/6335
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/go: install new5l etc to tool dir
Russ Cox [Sat, 28 Feb 2015 03:50:58 +0000 (22:50 -0500)]
cmd/go: install new5l etc to tool dir

Change-Id: I77ab2bed5884b0763147703fd976d462d036336d
Reviewed-on: https://go-review.googlesource.com/6334
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
10 years agocmd/dist: record default GO_EXTLINK_ENABLED in Go
Russ Cox [Sat, 28 Feb 2015 03:50:01 +0000 (22:50 -0500)]
cmd/dist: record default GO_EXTLINK_ENABLED in Go

Today it's only recorded for C, but the Go version of the linker will need it.

Change-Id: I0de56d98e8f3f1b7feb830458c0934af367fd29a
Reviewed-on: https://go-review.googlesource.com/6333
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
10 years agocmd/ld: clean for c2go
Russ Cox [Wed, 25 Feb 2015 03:22:32 +0000 (22:22 -0500)]
cmd/ld: clean for c2go

Change-Id: Iaab2be9a1919f2fa9dbc61a5b7fbf99bcd0712a9
Reviewed-on: https://go-review.googlesource.com/6332
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
10 years agobuild: give windows builders extra time for tests
Russ Cox [Sat, 28 Feb 2015 22:23:32 +0000 (17:23 -0500)]
build: give windows builders extra time for tests

In the tests, the runtime test fails after 2 minutes.
On an unloaded VM it only takes 45 seconds.
I think the difference is all the other build work going on
simultaneously with the running of the runtime test.

Change-Id: I41e95d2e4daea44ceaa8505f81aa7b5bcfa9ec77
Reviewed-on: https://go-review.googlesource.com/6364
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
10 years agonet: disable failing interface tests on dragonfly
Russ Cox [Sun, 1 Mar 2015 00:17:27 +0000 (19:17 -0500)]
net: disable failing interface tests on dragonfly

(Issue #10041.)

Change-Id: Ia894ab60ac6b09926c684f99aacca79275cbced4
Reviewed-on: https://go-review.googlesource.com/6365
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agoruntime: fix traceback from goexit1
Dmitry Vyukov [Fri, 20 Feb 2015 17:07:02 +0000 (20:07 +0300)]
runtime: fix traceback from goexit1

We used to not call traceback from goexit1.
But now tracer does it and crashes on amd64p32:

runtime: unexpected return pc for runtime.getg called from 0x108a4240
goroutine 18 [runnable, locked to thread]:
runtime.traceGoEnd()
    src/runtime/trace.go:758 fp=0x10818fe0 sp=0x10818fdc
runtime.goexit1()
    src/runtime/proc1.go:1540 +0x20 fp=0x10818fe8 sp=0x10818fe0
runtime.getg(0x0)
    src/runtime/asm_386.s:2414 fp=0x10818fec sp=0x10818fe8
created by runtime/pprof_test.TestTraceStress
    src/runtime/pprof/trace_test.go:123 +0x500

Return PC from goexit1 points right after goexit (+0x6).
It happens to work most of the time somehow.

This change fixes traceback from goexit1 by adding an additional NOP to goexit.

Fixes #9931

Change-Id: Ied25240a181b0a2d7bc98127b3ed9068e9a1a13e
Reviewed-on: https://go-review.googlesource.com/5460
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agoruntime/cgo: no-op getwd call as test breakpoint
David Crawshaw [Sat, 28 Feb 2015 22:06:06 +0000 (17:06 -0500)]
runtime/cgo: no-op getwd call as test breakpoint

This is to be used by an lldb script inside go_darwin_arm_exec to pause
the execution of tests on iOS so the working directory can be adjusted
into something resembling a GOROOT.

Change-Id: I69ea2d4d871800ae56634b23ffa48583559ddbc6
Reviewed-on: https://go-review.googlesource.com/6363
Reviewed-by: Minux Ma <minux@golang.org>
10 years agoimage/draw: add a fast path for Gray src images.
Nigel Tao [Sat, 28 Feb 2015 04:46:01 +0000 (15:46 +1100)]
image/draw: add a fast path for Gray src images.

Grayscale PNG and JPEG images are not uncommon. We should have a fast path.

Also add a benchmark for the recently added CMYK fast path.

benchmark                    old ns/op     new ns/op     delta
BenchmarkGray                13960348      324152        -97.68%

Change-Id: I72b5838c8c3d1f2d0a4536a848e020e80b10c0f7
Reviewed-on: https://go-review.googlesource.com/6237
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/internal/gc, cmd/internal/obj: remove pointless fmt.Sprintf calls
Josh Bleecher Snyder [Sat, 28 Feb 2015 20:31:32 +0000 (20:31 +0000)]
cmd/internal/gc, cmd/internal/obj: remove pointless fmt.Sprintf calls

This is a follow-up to CL 6265. No behavior changes.
The diff was generated with eg, using template:

package p

import "fmt"

func before(a string) string { return fmt.Sprintf(a) }
func after(a string) string  { return a }

Change-Id: I7b3bebf31be5cd1ae2233da06cb4502a3d73f092
Reviewed-on: https://go-review.googlesource.com/6269
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agonet: disable TestTCPReadWriteAllocs on darwin
Josh Bleecher Snyder [Sat, 28 Feb 2015 20:34:53 +0000 (20:34 +0000)]
net: disable TestTCPReadWriteAllocs on darwin

Having this test fail, as it does reliably for me,
makes working frustrating. Disable it for now,
until we can diagnose the issue.

Update issue #8859.

Change-Id: I9dda30d60793e7a51f48f445c78ccb158068cc25
Reviewed-on: https://go-review.googlesource.com/6381
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agocmd/internal/obj: clean up handling of register list operand on ARM
Rob Pike [Fri, 27 Feb 2015 21:50:26 +0000 (13:50 -0800)]
cmd/internal/obj: clean up handling of register list operand on ARM

ARM operands for MOVM have lists of registers: [R1,R2,R5-R8].
Handle them cleanly.

It was TYPE_CONST with special handling, which meant operand printing
didn't work right and the special handling was ugly. Add a new TYPE_REGLIST
for this case and it all gets cleaner.

Change-Id: I4a64f70fb9765e63cb636619a7a8553611bfe970
Reviewed-on: https://go-review.googlesource.com/6300
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agosyscall: make pwd process-wide on Plan 9
Brad Fitzpatrick [Sat, 28 Feb 2015 03:34:56 +0000 (19:34 -0800)]
syscall: make pwd process-wide on Plan 9

On Plan 9, the pwd is apparently per-thread not per process. That
means different goroutines saw different current directories, even
changing within a goroutine as they were scheduled.

Instead, track the the process-wide pwd protected by a mutex in the
syscall package and set the current goroutine thread's pwd to the
correct once at critical points.

Fixes #9428

Change-Id: I928e90886355be4a95c2be834f5883e2b50fc0cf
Reviewed-on: https://go-review.googlesource.com/6350
Reviewed-by: David du Colombier <0intro@gmail.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

10 years agoRevert "os: set TMPDIR on darwin/arm"
David Crawshaw [Sat, 28 Feb 2015 02:34:08 +0000 (02:34 +0000)]
Revert "os: set TMPDIR on darwin/arm"

This reverts commit 87a0d395c3d454c6efa560c406b5b3d8ad71c8f6.

Looks like introducing file_darwin_arm.go is confusing something in the API checker (probably go/types) into ignoring file.go, so the O_SYNC symbol is being lost.

No actual bug in this CL AFAIK, but I'll fix the other bug later and then roll this forward.

Change-Id: Ic132fb101e4b5f2716f7a0d15872bf35bdf42139
Reviewed-on: https://go-review.googlesource.com/6331
Reviewed-by: David Crawshaw <crawshaw@golang.org>
10 years agoimage/draw: optimize drawFillSrc.
Nigel Tao [Fri, 27 Feb 2015 10:43:53 +0000 (21:43 +1100)]
image/draw: optimize drawFillSrc.

benchmark                    old ns/op     new ns/op     delta
BenchmarkFillSrc             46781         46000         -1.67%

Change-Id: I0ab25d42d5763f1a0fe5a67ee00b83f0aa55f1f6
Reviewed-on: https://go-review.googlesource.com/6235
Reviewed-by: Rob Pike <r@golang.org>
10 years agoos: fix tests on darwin/arm
David Crawshaw [Sat, 28 Feb 2015 00:52:11 +0000 (19:52 -0500)]
os: fix tests on darwin/arm

Tests that fork are skipped. Tests that create files do so in a
temporary directory, as the initial PWD is read-only. And
darwin/arm returns a strange mkdir error when trying to write to /.

Change-Id: I2de661a85524300bbac226693d72142992dc188d
Reviewed-on: https://go-review.googlesource.com/6312
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agoos: set TMPDIR on darwin/arm
David Crawshaw [Sat, 28 Feb 2015 00:54:09 +0000 (19:54 -0500)]
os: set TMPDIR on darwin/arm

Change-Id: Iee25f4b0a31ece0aae79c68aec809e1e4308f865
Reviewed-on: https://go-review.googlesource.com/6311
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agocmd/internal/gc, cmd/internal/obj: clean up string returns
Josh Bleecher Snyder [Fri, 27 Feb 2015 22:44:15 +0000 (22:44 +0000)]
cmd/internal/gc, cmd/internal/obj: clean up string returns

An artifact of the c2go translation was
a handful of instances of code like:

var s string
s += "foo"
return s

This CL converts those to simply 'return "foo"'.

The conversion was done mechanically with the
quick-and-dirty cleanup script at
https://gist.github.com/josharian/1fa4408044c163983e62.

I then manually moved a couple of comments in fmt.go.

toolstash -cmp thinks that there are no functional changes.

Change-Id: Ic0ebdd10f0fb8de0360a1041ce5cd10ae1168be9
Reviewed-on: https://go-review.googlesource.com/6265
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agoos: fix LinkError creation on windows.
Hyang-Ah (Hana) Kim [Fri, 27 Feb 2015 17:34:25 +0000 (12:34 -0500)]
os: fix LinkError creation on windows.

Not only carrying invalid info but also this caused Error to crash with
null pointer exception.

Change-Id: Ibfe63d20eb9b9178ea618e59c74111e9245a6779
Reviewed-on: https://go-review.googlesource.com/6270
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

10 years agocmd/internal/obj: make ppc64's CR subregisters print as CRn rather than Cn
Rob Pike [Fri, 27 Feb 2015 20:36:15 +0000 (12:36 -0800)]
cmd/internal/obj: make ppc64's CR subregisters print as CRn rather than Cn

These 8 registers are windows into the CR register. They are officially CR0
through CR7 and that is what the assembler accepts, but for some reason
they have always printed as C0 through C7. Fix the naming and printing.

Change-Id: I55822c0322c29d3e01a1f2776b3b210ebf9ded21
Reviewed-on: https://go-review.googlesource.com/6290
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agocmd/internal/gc: add missing verb to Yyerror
Sebastien Binet [Fri, 27 Feb 2015 19:42:18 +0000 (20:42 +0100)]
cmd/internal/gc: add missing verb to Yyerror

When a function had no body, Yyerror was called with an extra
argument, leading to extraneous printouts.
Add the missing verb to the Yyerror call and display the name of the
bodiless function.

Fixes #10030

Change-Id: I76d76c4547fb9cad1782cb11f7a5c63065a6e0c5
Reviewed-on: https://go-review.googlesource.com/6263
Reviewed-by: Rob Pike <r@golang.org>
10 years agoruntime/pprof: skip tests that fork on darwin/arm
David Crawshaw [Fri, 27 Feb 2015 13:58:54 +0000 (08:58 -0500)]
runtime/pprof: skip tests that fork on darwin/arm

Change-Id: I9b08b74214e5a41a7e98866a993b038030a4c073
Reviewed-on: https://go-review.googlesource.com/6251
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
10 years agoruntime: trivial clean ups to greyobject
Austin Clements [Fri, 27 Feb 2015 17:41:20 +0000 (12:41 -0500)]
runtime: trivial clean ups to greyobject

Previously, the typeDead check in greyobject was under a separate
!useCheckmark conditional.  Put it with the rest of the !useCheckmark
code.  Also move a comment about atomic update of the marked bit to
where we actually do that update now.

Change-Id: Ief5f16401a25739ad57d959607b8d81ffe0bc211
Reviewed-on: https://go-review.googlesource.com/6271
Reviewed-by: Rick Hudson <rlh@golang.org>
10 years agocrypto/x509: skip tests not made for darwin/arm
David Crawshaw [Fri, 27 Feb 2015 14:08:35 +0000 (09:08 -0500)]
crypto/x509: skip tests not made for darwin/arm

Change-Id: I8b18dc840425b72d7172a35cb0ba004bd156492d
Reviewed-on: https://go-review.googlesource.com/6252
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
10 years agocmd/objdump: skip fork test on darwin/arm
David Crawshaw [Fri, 27 Feb 2015 12:06:34 +0000 (07:06 -0500)]
cmd/objdump: skip fork test on darwin/arm

Change-Id: I1d1eb71014381452d1ef368431cb2556245a35ab
Reviewed-on: https://go-review.googlesource.com/6250
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
10 years agobuild: restore original timeouts in run.rc
David du Colombier [Fri, 27 Feb 2015 16:51:25 +0000 (17:51 +0100)]
build: restore original timeouts in run.rc

The timeouts were increased in CL 2462 and CL 2510
to work around a slowness issue when running Go
programs on a Plan 9 machine on GCE.

Since we figured out this issue, we can restore
the timeouts to their original values.

Updates #10028.

Change-Id: I2e5b91666461715df69df97ea791f3d88d9de4d0
Reviewed-on: https://go-review.googlesource.com/6261
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agocmd/internal/gc: restore mkbuiltin
Matthew Dempsky [Fri, 27 Feb 2015 08:40:34 +0000 (17:40 +0900)]
cmd/internal/gc: restore mkbuiltin

Change-Id: I6cc4061fef9d3c3530406ab3d4811192b7175e89
Reviewed-on: https://go-review.googlesource.com/6233
Reviewed-by: Minux Ma <minux@golang.org>
10 years agocmd/internal/obj: make Rconv a global function
Rob Pike [Fri, 27 Feb 2015 01:09:16 +0000 (17:09 -0800)]
cmd/internal/obj: make Rconv a global function

Clean up the obj API by making Rconv (register pretty printer) a top-level
function. This means that Dconv (operand pretty printer) doesn't need
an Rconv argument.

To do this, we make the register numbers, which are arbitrary inside an
operand (obj.Addr), disjoint sets for each architecture. Each architecture
registers (ha) a piece of the space and then the global Rconv knows which
architecture-specific printer to use.

Clean up all the code that uses Dconv.

Now register numbers are large, so a couple of fields in Addr need to go
from int8 to int16 because they sometimes hold register numbers. Clean
up their uses, which meant regenerating the yacc grammars for the
assemblers. There are changes in this CL triggered by earlier changes
to yacc, which had not been run in this directory.

There is still cleanup to do in Addr, but we're getting closer to that being
easy to do.

Change-Id: I9290ebee013b62f7d24e886743ea5a6b232990ab
Reviewed-on: https://go-review.googlesource.com/6220
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agoruntime: skip tests that need fork on darwin/arm
David Crawshaw [Thu, 26 Feb 2015 23:05:47 +0000 (18:05 -0500)]
runtime: skip tests that need fork on darwin/arm

Change-Id: I1bb0b8b11e8c7686b85657050fd7cf926afe4d29
Reviewed-on: https://go-review.googlesource.com/6200
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
10 years agosyscall: Reimplement linux syscalls in terms of their *at replacements.
Dave Cheney [Wed, 25 Feb 2015 03:52:17 +0000 (14:52 +1100)]
syscall: Reimplement linux syscalls in terms of their *at replacements.

Updates #9974

This proposal tackles the body of syscalls which have been replaced,
and are now deprecated in linux. This is needed for the arm64 port as
arm64 is the first linux architecture to remove the "legacy" forms of
these syscalls.

The *AT variants were added in kernel 2.6.16, so well before our 2.6.23
cutoff (hey, it'll even work on RHEL5).

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

Change-Id: I473a7c9a295d6f776fcdc75dcce06cbe9e3564ee
Reviewed-on: https://go-review.googlesource.com/5837
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agosyscall: exclude Go tool test on darwin/arm
David Crawshaw [Thu, 26 Feb 2015 22:55:11 +0000 (17:55 -0500)]
syscall: exclude Go tool test on darwin/arm

Change-Id: I44c1911beceaedaa35dad71d8be8a814528dce67
Reviewed-on: https://go-review.googlesource.com/6192
Reviewed-by: Minux Ma <minux@golang.org>
10 years agocmd/nm: exclude Go tool test on darwin/arm
David Crawshaw [Thu, 26 Feb 2015 22:49:59 +0000 (17:49 -0500)]
cmd/nm: exclude Go tool test on darwin/arm

Change-Id: I44f1240a766f20de5997faca4f13f96af6da3534
Reviewed-on: https://go-review.googlesource.com/6190
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
10 years agocmd/addr2line: exclude Go tool test on darwin/arm
David Crawshaw [Thu, 26 Feb 2015 22:52:51 +0000 (17:52 -0500)]
cmd/addr2line: exclude Go tool test on darwin/arm

Change-Id: Icee6c88b7eed5fb27f046373ecf53bf64b68c696
Reviewed-on: https://go-review.googlesource.com/6191
Reviewed-by: Minux Ma <minux@golang.org>
10 years agonet/http/cgi: skip exec test on darwin/arm
David Crawshaw [Thu, 26 Feb 2015 22:27:52 +0000 (17:27 -0500)]
net/http/cgi: skip exec test on darwin/arm

Change-Id: I2fc3cf94b465bf9d7ff8d7bf935b45e334b401e3
Reviewed-on: https://go-review.googlesource.com/6180
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
10 years agocmd/internal/obj: implement Dconv for TYPE_INDIR
Rob Pike [Thu, 26 Feb 2015 18:58:48 +0000 (10:58 -0800)]
cmd/internal/obj: implement Dconv for TYPE_INDIR

It was just missing, and apparently always was.

Change-Id: I84c057bb0ec72940201075f3e6078262fe4bce05
Reviewed-on: https://go-review.googlesource.com/6120
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agoruntime: fix memory allocator on Plan 9
David du Colombier [Thu, 26 Feb 2015 21:41:33 +0000 (22:41 +0100)]
runtime: fix memory allocator on Plan 9

Previously, the memory allocator on Plan 9 did
not free memory properly. It was only able to
free the last allocated block.

This change implements a variant of the
Kernighan & Ritchie memory allocator with
coalescing and splitting.

The most notable differences are:

- no header is prefixing the allocated blocks, since
  the size is always specified when calling sysFree,
- the free list is nil-terminated instead of circular.

Fixes #9736.
Fixes #9803.
Fixes #9952.

Change-Id: I00d533714e4144a0012f69820d31cbb0253031a3
Reviewed-on: https://go-review.googlesource.com/5524
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
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>