1
0
mirror of https://github.com/golang/go synced 2024-10-03 06:11:21 -06:00
Commit Graph

17482 Commits

Author SHA1 Message Date
Russ Cox
145b6fb984 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>
2015-03-02 18:36:04 +00:00
Russ Cox
ea7be5170a 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>
2015-03-02 17:52:11 +00:00
Russ Cox
b38fa898c6 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>
2015-03-02 17:52:03 +00:00
Russ Cox
deff22dd88 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>
2015-03-02 17:51:56 +00:00
Russ Cox
86a7c85f83 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>
2015-03-02 17:51:47 +00:00
Matthew Dempsky
5324cf2d45 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>
2015-03-02 08:30:39 +00:00
Dmitry Vyukov
fcc164d783 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>
2015-03-02 08:09:49 +00:00
Dmitry Vyukov
04a3a74456 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>
2015-03-02 06:59:29 +00:00
Russ Cox
dd82d5e728 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>
2015-03-02 05:32:05 +00:00
Russ Cox
e15221acec 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>
2015-03-02 05:17:39 +00:00
Hyang-Ah (Hana) Kim
f1489ac251 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>
2015-03-02 02:20:46 +00:00
Alex Brainman
29a83af5ef os: add windows test for Hostname
Change-Id: I9b38b3a384722cf000eab18b62f73f90bcb56c5c
Reviewed-on: https://go-review.googlesource.com/6070
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-03-02 01:23:27 +00:00
Nigel Tao
a773fae808 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>
2015-03-02 00:53:23 +00:00
Russ Cox
2fb88eceb3 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>
2015-03-02 00:14:48 +00:00
Russ Cox
621d75999f 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>
2015-03-02 00:14:11 +00:00
Brad Fitzpatrick
aedee30870 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>
2015-03-01 22:55:34 +00:00
Brad Fitzpatrick
cf14e0e333 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>
2015-03-01 22:32:22 +00:00
David Crawshaw
5432b4d346 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>
2015-03-01 18:38:21 +00:00
David du Colombier
5c2233f261 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>
2015-03-01 18:33:56 +00:00
David du Colombier
f0bd95b8b9 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>
2015-03-01 18:33:41 +00:00
Rob Pike
3ee9df799f 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>
2015-03-01 18:17:53 +00:00
David Crawshaw
bc674b3d16 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>
2015-03-01 16:09:46 +00:00
Jan Kratochvil
cb37cfa01c 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>
2015-03-01 10:08:49 +00:00
David Crawshaw
e6248c9c99 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>
2015-03-01 01:27:06 +00:00
Russ Cox
184eb0ac9e 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>
2015-03-01 01:07:27 +00:00
Russ Cox
3317e7f19a 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>
2015-03-01 00:40:23 +00:00
Russ Cox
dca5f2e9b3 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>
2015-03-01 00:40:11 +00:00
Russ Cox
100d64b920 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>
2015-03-01 00:39:58 +00:00
Russ Cox
41f5bafc51 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>
2015-03-01 00:39:47 +00:00
Russ Cox
1f9dbb60ef 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>
2015-03-01 00:39:38 +00:00
Russ Cox
30e36983f3 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>
2015-03-01 00:39:26 +00:00
Russ Cox
7934199877 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>
2015-03-01 00:39:15 +00:00
Russ Cox
d7b10060b6 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>
2015-03-01 00:39:04 +00:00
Russ Cox
0aac9bb82d 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>
2015-03-01 00:38:53 +00:00
Russ Cox
4734464a14 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>
2015-03-01 00:19:32 +00:00
Dmitry Vyukov
894024f478 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>
2015-02-28 23:19:57 +00:00
David Crawshaw
2dbee8919c 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>
2015-02-28 22:44:10 +00:00
Nigel Tao
c20323d2bb 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>
2015-02-28 21:43:39 +00:00
Josh Bleecher Snyder
05ca0f3370 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>
2015-02-28 20:44:36 +00:00
Josh Bleecher Snyder
b1c0d8a54b 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>
2015-02-28 20:43:55 +00:00
Rob Pike
0eeb5cf088 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>
2015-02-28 20:10:59 +00:00
Brad Fitzpatrick
bc9748ee6b 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>
2015-02-28 18:17:35 +00:00
David Crawshaw
2adc3bd6ef Revert "os: set TMPDIR on darwin/arm"
This reverts commit 87a0d395c3.

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>
2015-02-28 02:40:03 +00:00
Nigel Tao
66c4031ee9 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>
2015-02-28 01:26:54 +00:00
David Crawshaw
344f424007 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>
2015-02-28 01:07:43 +00:00
David Crawshaw
87a0d395c3 os: set TMPDIR on darwin/arm
Change-Id: Iee25f4b0a31ece0aae79c68aec809e1e4308f865
Reviewed-on: https://go-review.googlesource.com/6311
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-02-28 01:06:42 +00:00
Josh Bleecher Snyder
5f55011aea 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>
2015-02-27 23:36:29 +00:00
Hyang-Ah (Hana) Kim
c2025c4131 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>
2015-02-27 23:31:36 +00:00
Rob Pike
2b417dc3e1 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>
2015-02-27 21:06:25 +00:00
Sebastien Binet
d24e62f2fb 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>
2015-02-27 20:07:53 +00:00
David Crawshaw
90dbd428e5 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>
2015-02-27 19:55:54 +00:00
Austin Clements
da4874cba4 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>
2015-02-27 19:39:57 +00:00
David Crawshaw
b1517c39fb 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>
2015-02-27 19:38:33 +00:00
David Crawshaw
5028f8c98d 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>
2015-02-27 19:38:23 +00:00
David du Colombier
c62b003eba 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>
2015-02-27 16:58:18 +00:00
Matthew Dempsky
d68f52aa43 cmd/internal/gc: restore mkbuiltin
Change-Id: I6cc4061fef9d3c3530406ab3d4811192b7175e89
Reviewed-on: https://go-review.googlesource.com/6233
Reviewed-by: Minux Ma <minux@golang.org>
2015-02-27 09:19:47 +00:00
Rob Pike
daddeb2686 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>
2015-02-27 03:51:33 +00:00
David Crawshaw
95bf77bc68 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>
2015-02-27 01:22:55 +00:00
Dave Cheney
e7a7352e52 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>
2015-02-26 23:30:10 +00:00
David Crawshaw
a3c59779ff 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>
2015-02-26 23:10:18 +00:00
David Crawshaw
b015cf7083 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>
2015-02-26 23:07:27 +00:00
David Crawshaw
d0bcdd3f6a 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>
2015-02-26 23:06:30 +00:00
David Crawshaw
be7090498b 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>
2015-02-26 22:46:39 +00:00
Rob Pike
940f22eea2 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>
2015-02-26 22:03:21 +00:00
David du Colombier
fb75f856df 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>
2015-02-26 21:47:16 +00:00
Dave Cheney
3a3c9d6d66 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>
2015-02-26 21:14:03 +00:00
Dave Cheney
f9cc72ccfe 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>
2015-02-26 20:11:17 +00:00
Alexandre Cesaro
045f9df466 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>
2015-02-26 20:09:28 +00:00
Russ Cox
26438d4d80 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>
2015-02-26 19:44:08 +00:00
Russ Cox
a5eda13d20 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>
2015-02-26 19:43:40 +00:00
Russ Cox
77ccb16eb1 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>
2015-02-26 17:36:00 +00:00
Russ Cox
5d18282695 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>
2015-02-26 17:35:42 +00:00
Russ Cox
f716c5c5bb 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>
2015-02-26 17:35:32 +00:00
Robert Griesemer
79c12958c7 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>
2015-02-26 17:01:16 +00:00
David Crawshaw
e4791066c8 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>
2015-02-26 16:19:46 +00:00
David Crawshaw
1e0e2ffb8d 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>
2015-02-26 15:31:49 +00:00
Joe Shaw
433c1ad140 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>
2015-02-26 15:24:32 +00:00
David Crawshaw
8b1bd75e66 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>
2015-02-26 14:54:55 +00:00
Dmitry Vyukov
f47e581e02 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>
2015-02-26 11:03:07 +00:00
Matthew Dempsky
3c8a89daf3 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>
2015-02-26 08:59:24 +00:00
Nigel Tao
a32dd83253 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>
2015-02-26 02:08:45 +00:00
Josh Bleecher Snyder
9f4c25e223 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>
2015-02-26 01:46:16 +00:00
Josh Bleecher Snyder
1d4bfb3ebb 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>
2015-02-26 00:34:29 +00:00
Robert Griesemer
9c4aade584 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>
2015-02-26 00:15:04 +00:00
Nigel Tao
7d7351395d 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>
2015-02-26 00:14:16 +00:00
Nigel Tao
b351e1decf 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>
2015-02-25 23:56:21 +00:00
Carlos Castillo
59e546633d 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>
2015-02-25 23:16:44 +00:00
Robert Griesemer
ca0be6f849 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>
2015-02-25 23:10:44 +00:00
Robert Griesemer
c20a018d6f 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>
2015-02-25 23:10:14 +00:00
Robert Griesemer
bba8b89aa5 math/big: improve some doc strings
Change-Id: Ie37673d4af2fa7476d67ffb686641611ab6a8e6b
Reviewed-on: https://go-review.googlesource.com/5930
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-02-25 23:09:51 +00:00
David Crawshaw
7e93610b07 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>
2015-02-25 22:34:26 +00:00
David Crawshaw
b54d313205 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>
2015-02-25 22:22:02 +00:00
Dave Cheney
c1216c3a33 runtime: skip failing gdb test on linux/arm
Updates #10002

The gdb test added in 1c82e236f5 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>
2015-02-25 22:13:02 +00:00
Keith Randall
35a59f5c99 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>
2015-02-25 21:39:54 +00:00
Keith Randall
7e1b61c718 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>
2015-02-25 21:16:18 +00:00
Keith Randall
6d1ebeb527 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>
2015-02-25 21:07:10 +00:00
Rob Pike
29421cbb5b 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>
2015-02-25 20:59:50 +00:00
Chris Manghane
77d7771a82 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>
2015-02-25 20:04:22 +00:00
David Crawshaw
85d09574fd 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>
2015-02-25 20:02:13 +00:00
Chris Manghane
c7e1453e3d 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>
2015-02-25 19:49:49 +00:00
Chris Manghane
b59dd94f33 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>
2015-02-25 19:27:30 +00:00
Russ Cox
28c6648416 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>
2015-02-25 18:29:42 +00:00
Russ Cox
6eaa095012 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>
2015-02-25 18:29:30 +00:00
Robert Griesemer
88cbe09202 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>
2015-02-25 18:10:42 +00:00
Rob Pike
4100f7d95c 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>
2015-02-25 17:10:37 +00:00
Robert Griesemer
3e9e9b4822 math/big: implemented Float.Rat
Change-Id: If516e12d4b5dfb6f9288437d270569f7e4e2a1cd
Reviewed-on: https://go-review.googlesource.com/5871
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-02-25 16:53:28 +00:00
Rob Pike
df5cfe7c1f 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>
2015-02-25 16:24:32 +00:00
Rob Pike
4241b758af 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>
2015-02-25 16:18:54 +00:00
Austin Clements
07b73ce146 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>
2015-02-25 15:48:57 +00:00
Austin Clements
b3d791c7bb 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>
2015-02-25 15:46:41 +00:00
Austin Clements
37b8597178 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>
2015-02-25 15:46:21 +00:00
Matthew Dempsky
7abdc90fe3 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>
2015-02-25 09:34:58 +00:00
Matthew Dempsky
2fdb728d01 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>
2015-02-25 03:02:28 +00:00
Dave Cheney
c123a80063 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>
2015-02-25 02:45:02 +00:00
Jan Kratochvil
1c82e236f5 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>
2015-02-25 02:36:41 +00:00
Matthew Dempsky
9f926e81c2 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>
2015-02-25 02:30:11 +00:00
Dave Cheney
1fda57ba72 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>
2015-02-25 00:52:03 +00:00
Robert Griesemer
18fd940620 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>
2015-02-25 00:46:27 +00:00
Dave Cheney
9b3ccc082f 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>
2015-02-25 00:19:40 +00:00
Dave Cheney
7ce0261387 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>
2015-02-25 00:15:12 +00:00
Rick Hudson
e31e35a0de 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>
2015-02-25 00:14:42 +00:00
Dave Cheney
42289a4f39 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>
2015-02-24 22:07:00 +00:00
Robert Griesemer
c4b8f9127a 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>
2015-02-24 21:58:00 +00:00
Robert Griesemer
5ce9fde8b6 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>
2015-02-24 21:34:05 +00:00
Robert Griesemer
c651fdc0cf 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>
2015-02-24 21:30:04 +00:00
Rob Pike
aff84b171c 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>
2015-02-24 20:31:30 +00:00
Rob Pike
90590a0cd2 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>
2015-02-24 20:01:21 +00:00
Adam Langley
abf8bbb709 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>
2015-02-24 19:45:52 +00:00
Adam Langley
e7fae68540 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>
2015-02-24 19:45:34 +00:00
Adam Langley
8f8d066bfd 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>
2015-02-24 19:39:36 +00:00
Adam Langley
c2317db2f9 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>
2015-02-24 19:36:52 +00:00
Robert Griesemer
d9859ad404 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>
2015-02-24 17:35:25 +00:00
David Crawshaw
291bf1f03f 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>
2015-02-24 17:28:53 +00:00
Dmitry Vyukov
edcad8639a 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>
2015-02-24 10:53:48 +00:00
Mikio Hara
3dd029aa7e 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>
2015-02-24 08:26:56 +00:00
Adam Langley
7c7126cfeb 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>
2015-02-24 00:46:19 +00:00
Charlie Dorian
ec92af650c 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>
2015-02-23 23:07:01 +00:00
Russ Cox
b986f3e3b5 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
2015-02-23 16:52:29 -05:00
Austin Clements
bceb18e498 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>
2015-02-23 21:49:27 +00:00
Russ Cox
a91c2e0d2d [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>
2015-02-23 21:49:27 +00:00
Russ Cox
382b44eb7c [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>
2015-02-23 21:36:06 +00:00
Robert Griesemer
ce137592c0 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>
2015-02-23 21:23:50 +00:00
Shenghou Ma
f0bbb5c450 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>
2015-02-23 21:05:55 +00:00
Charles Dorian
b48d2a5f25 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>
2015-02-23 21:04:46 +00:00
Russ Cox
3af0d791be [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>
2015-02-23 19:56:40 +00:00
Russ Cox
d10ede5ede [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>
2015-02-23 19:56:31 +00:00
Russ Cox
9c8c0e729d [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>
2015-02-23 19:56:18 +00:00
Rob Pike
9d6ed4af66 [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>
2015-02-23 19:54:39 +00:00
Russ Cox
264c099ba7 [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>
2015-02-23 19:30:08 +00:00
Russ Cox
e8d9c8d163 [dev.cc] all: merge master (6a10f72) into dev.cc
To pick up darwin/arm fix and hopefully fix build.

Change-Id: I06996d0b13b777e476f65405aee031482fc76439
2015-02-23 14:28:54 -05:00
Robert Griesemer
6a10f720f2 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>
2015-02-23 19:20:15 +00:00
Rick Hudson
99482f2f9e 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>
2015-02-23 18:52:43 +00:00
Robert Griesemer
96333a7e48 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>
2015-02-23 18:35:28 +00:00
Robert Griesemer
2b0213d569 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>
2015-02-23 18:09:36 +00:00
Alexandre Cesaro
828129fdbc 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>
2015-02-23 17:46:37 +00:00
David Crawshaw
2f9c9e552d 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>
2015-02-23 17:17:49 +00:00
Russ Cox
c72a21189b [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>
2015-02-23 16:52:33 +00:00
Russ Cox
53d4123fbc [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>
2015-02-23 16:52:11 +00:00
Russ Cox
de50bad121 [dev.cc] all: merge master (48469a2) into dev.cc
Change-Id: I10f7950d173b302151f2a31daebce297b4306ebe
2015-02-23 10:16:29 -05:00
Russ Cox
7cec2157b8 [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>
2015-02-23 15:14:57 +00:00
Russ Cox
096b294f21 [dev.cc] cmd/go: fix expansion of 'std', add 'cmd'
The wildcard 'std' is defined in documentation to be all the packages
in the Go standard library. It has also historically matched commands
in the main repo, but as we implement core commands in Go, that
becomes problematic. We need a wildcard that means just the library,
and since 'std' is already documented to have that definition, make it so.

Add a new wildcard 'cmd' for the commands in the main repo ($GOROOT).
Commands that want both can say 'std cmd' (or 'cmd std') to get the
effect of the old 'std'.

Update make.bash etc to say both std and cmd most of the time.

Exception: in race.bash, do not install race-enabled versions of
the actual commands. This avoids trying to write binaries while
using them, but more importantly it avoids enabling the race
detector and its associated memory overhead for the already
memory-hungry compilers.

Change-Id: I26bb06cb13b636dfbe71a015ee0babeb270a0275
Reviewed-on: https://go-review.googlesource.com/5550
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2015-02-23 15:13:17 +00:00
David du Colombier
48469a2c86 cmd/ld: fix warning on Plan 9
cpp: src/cmd/ld/lib.h:349 No newline at end of file

Change-Id: Id21851963f7778364ba9337da3bacd312443f51f
Reviewed-on: https://go-review.googlesource.com/5520
Reviewed-by: Minux Ma <minux@golang.org>
2015-02-23 07:54:13 +00:00
Matthew Dempsky
57cefa657d runtime: remove unneeded C header files
Change-Id: I239ae86cfebfece607dce39a96d9123cbacbee7d
Reviewed-on: https://go-review.googlesource.com/5562
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
2015-02-23 07:16:06 +00:00
Aaron Jacobs
d5630142fd net/http: Removed some unused constants in request.go.
Change-Id: I05cdf357249166a45105703e9317793aa2088844
Reviewed-on: https://go-review.googlesource.com/5560
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-02-22 23:52:44 +00:00
Jan Kratochvil
02d80b9e93 gdb: fix "gdb.error: No struct named reflect.rtype."
With a trivial Golang-built program loaded in gdb-7.8.90.20150214-7.fc23.x86_64
I get this error:

(gdb) source ./src/runtime/runtime-gdb.py
Loading Go Runtime support.
Traceback (most recent call last):
  File "./src/runtime/runtime-gdb.py", line 230, in <module>
    _rctp_type = gdb.lookup_type("struct reflect.rtype").pointer()
gdb.error: No struct type named reflect.rtype.
(gdb) q

No matter if this struct should or should not be in every Golang-built binary
this change should fix that with no disadvantages.

Change-Id: I0c490d3c9bbe93c65a2183b41bfbdc0c0f405bd1
Reviewed-on: https://go-review.googlesource.com/5521
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-02-22 19:27:07 +00:00
Mark Bucciarelli
4e408e0cc9 Call --> CallSlice in two spots. No logic change, docs only.
Change-Id: I6011e162214db2d65efc1ecdb5ec600ca8e5bfe9
Reviewed-on: https://go-review.googlesource.com/5542
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-02-22 17:22:04 +00:00
Russ Cox
6406acf338 [dev.cc] cmd/asm/internal/asm: fix test on windows
Change-Id: Ia6cf3204d71740bc2b6e26c53ac5206e8a33a180
Reviewed-on: https://go-review.googlesource.com/5540
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-21 17:54:38 +00:00
Russ Cox
c80ff3cb87 [dev.cc] cmd/go: reenable verifyCompiler
Change-Id: Ic7367f2c6e6d4e6b802ce8436022412a1862ca58
Reviewed-on: https://go-review.googlesource.com/5472
Reviewed-by: Rob Pike <r@golang.org>
2015-02-21 14:03:14 +00:00
Russ Cox
f6791da7ad [dev.cc] cmd/new6g etc: reconvert from C
Reconvert using rsc.io/c2go rev 27b3f59.
(Same as last conversion, but C sources have changed
due to merging master into this branch.)

Change-Id: Ib314bb9ac14a726ceb83e2ecf4d1ad2d0b331c38
Reviewed-on: https://go-review.googlesource.com/5471
Reviewed-by: Rob Pike <r@golang.org>
2015-02-21 14:03:04 +00:00
Rob Pike
1996f276d2 [dev.cc] cmd/asm: fix build: broken end to end test
This time for sure.

Change-Id: I77ed6b70d82a6f4ba371afba2f53c8b146ac110f
Reviewed-on: https://go-review.googlesource.com/5530
Reviewed-by: Rob Pike <r@golang.org>
2015-02-21 03:33:09 +00:00
Rob Pike
7ed429d99c [dev.cc] cmd/asm: fix build
Representation in printout of MRC instruction differs between
32- and 64-bit machines. It's just a hex dump. Fix this one day,
but for now just comment out the instruction.

Change-Id: I4709390659e2e0f2d18ff6f8e762f97cdbfb4c16
Reviewed-on: https://go-review.googlesource.com/5424
Reviewed-by: Rob Pike <r@golang.org>
2015-02-21 02:16:37 +00:00
Rob Pike
634049dbe6 [dev.cc] cmd/asm: add end-to-end test
Add trivial golden test that verifies output matches expectation.
The input is based on the old grammar and is intended to cover
the space of the input language.

PPC64 and ARM only for now; others to follow.

Change-Id: Ib5957822bcafd5b9d4c1dea1c03cc6ee1238f7ef
Reviewed-on: https://go-review.googlesource.com/5421
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-21 02:02:23 +00:00
Rob Pike
5d111b898a [dev.cc] cm/asm: fix up arm after cross-check with 5a
As with the previous round for ppc64, this CL fixes a couple of things
that 5a supported but asm did not, both simple.

1) Allow condition code on MRC instruction; this was marked as a TODO.
2) Allow R(n) notation in ARM register shifts.  The code needs a rethink
but the tests we're leading toward will make the rewrite easier to test and
trust.

Change-Id: I5b52ad25d177a74cf07e089dddfeeab21863c424
Reviewed-on: https://go-review.googlesource.com/5422
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-21 01:53:30 +00:00
Russ Cox
c11dadc503 [dev.cc] crypto/md5, crypto/sha1: restore a few SP references
Applying my post-submit comments from CL 5120.
The rewrite there changed the code from writing to the stack
frame to writing below the stack frame.

Change-Id: Ie7e0563c0c1731fede2bcefeaf3c9d88a0cf4063
Reviewed-on: https://go-review.googlesource.com/5470
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-02-20 18:54:29 +00:00
Russ Cox
9c0c050773 [dev.cc] cmd/asm: add ppc64le support
Change-Id: I780ed76c9217d387a73fd7530af2f40948aa1fe4
Reviewed-on: https://go-review.googlesource.com/5452
Reviewed-by: Rob Pike <r@golang.org>
2015-02-20 18:42:54 +00:00
Russ Cox
cf6a77b36d [dev.cc] cmd/go: install cmd/asm as a tool
cmd/dist was doing the right thing, but not cmd/go.

Change-Id: I5412140cfc07e806152915cc49db7f63352d01ca
Reviewed-on: https://go-review.googlesource.com/5451
Reviewed-by: Rob Pike <r@golang.org>
2015-02-20 18:42:49 +00:00
Dmitry Vyukov
edadffa2f3 cmd/trace: add new command
Trace command allows to visualize and analyze traces.
Run as:
$ go tool trace binary trace.file
The commands opens web browser with the main page,
which contains links for trace visualization,
blocking profiler, network IO profiler and per-goroutine
traces.

Also move trace parser from runtime/pprof/trace_parser_test.go
to internal/trace/parser.go, so that it can be shared between
tests and the command.

Change-Id: Ic97ed59ad6e4c7e1dc9eca5e979701a2b4aed7cf
Reviewed-on: https://go-review.googlesource.com/3601
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-02-20 18:31:25 +00:00
David Crawshaw
84e200cbcb [dev.cc] runtime: print to stderr as well as android logd
Restores stack traces in the android/arm builder.

Change-Id: If637aa2ed6f8886126b77cf9cc8a0535ec7c4369
Reviewed-on: https://go-review.googlesource.com/5453
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-02-20 18:30:09 +00:00
Dmitry Vyukov
58125ffe73 runtime/race: update race runtime to rev 229396
Fixes #9720
Fixes #8053
Fixes https://code.google.com/p/thread-sanitizer/issues/detail?id=89

Change-Id: I7d598e53de86586bb9702d8e9276a4d6aece2dfc
Reviewed-on: https://go-review.googlesource.com/4950
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-02-20 18:06:15 +00:00
Dmitry Vyukov
3fc529eabe runtime: adjust program counters in race detector
In most cases we pass return PC to race detector,
and race runtime subtracts one from them.
However, in manual instrumentation in runtime
we pass function start PC to race runtime.
Race runtime can't distinguish these cases
and so it does not subtract one from top PC.
This leads to bogus line numbers in some cases.
Make it consistent and always pass what looks
like a return PC, so that race runtime can
subtract one and still get PC in the same function.

Also delete two unused functions.

Update #8053

Change-Id: I4242dec5e055e460c9a8990eaca1d085ae240ed2
Reviewed-on: https://go-review.googlesource.com/4902
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-02-20 18:04:16 +00:00
Russ Cox
89a091de24 runtime: split gc_m into gcMark and gcSweep
This is a nice split but more importantly it provides a better
way to fit the checkmark phase into the sequencing.

Also factor out common span copying into gcSpanCopy.

Change-Id: Ia058644974e4ed4ac3cf4b017a3446eb2284d053
Reviewed-on: https://go-review.googlesource.com/5333
Reviewed-by: Austin Clements <austin@google.com>
2015-02-20 17:00:39 +00:00
Russ Cox
929597b9e9 runtime: unroll gc_m loop
The loop made more sense when gc_m was not its own function.

Change-Id: I71a7f21d777e69c1924e3b534c507476daa4dfdd
Reviewed-on: https://go-review.googlesource.com/5332
Reviewed-by: Austin Clements <austin@google.com>
2015-02-20 17:00:30 +00:00
Russ Cox
2b655c0b92 runtime: tidy GC driver
Change-Id: I0da26e89ae73272e49e82c6549c774e5bc97f64c
Reviewed-on: https://go-review.googlesource.com/5331
Reviewed-by: Austin Clements <austin@google.com>
2015-02-20 17:00:22 +00:00
Dmitry Vyukov
6e70fddec0 runtime: fix cputicks on x86
See the following issue for context:
https://github.com/golang/go/issues/9729#issuecomment-74648287
In short, RDTSC can produce skewed results without preceding LFENCE/MFENCE.
Information on this matter is very scrappy in the internet.
But this is what linux kernel does (see rdtsc_barrier).
It also fixes the test program on my machine.

Update #9729

Change-Id: I3c1ffbf129fdfdd388bd5b7911b392b319248e68
Reviewed-on: https://go-review.googlesource.com/5033
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-02-20 16:52:13 +00:00
Rob Pike
adff896e4c [dev.cc] cmd/asm: implement FMADD for ppc64
Missed this one instruction in the previous pass.

Change-Id: Ic8cdae4d3bfd626c6bbe0ce49fce28b53db2ad1c
Reviewed-on: https://go-review.googlesource.com/5420
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-20 16:34:15 +00:00
Russ Cox
b4a7806724 [dev.cc] all: merge master (5868ce3) into dev.cc
This time for sure!

Change-Id: I7e7ea24edb7c2f711489e162fb97237a87533089
2015-02-20 10:28:36 -05:00
Russ Cox
d90bbf91d4 [dev.cc] cmd/go: disable verifyCompiler
The merge brought in new C sources without Go updates.

Change-Id: Iad08b58f894173a7b34396275b72db34f3031fe3
Reviewed-on: https://go-review.googlesource.com/5352
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-20 15:26:21 +00:00
Andrew Gerrand
5868ce3519 path/filepath: add example for filepath.Split
Fixes #9928

Change-Id: Iab37051078755a132f211ad48e756422f7c55a39
Reviewed-on: https://go-review.googlesource.com/5416
Reviewed-by: Minux Ma <minux@golang.org>
2015-02-20 07:35:57 +00:00
Mikio Hara
69275eef5e net, syscall: more accurate parsers for routing messages on BSD variants
This changes fixes two issues with regard to handling routing messages
as follows:
- Misparsing on platforms (such as FreeBSD) supporting multiple
  architectures in the same kernel (kern.supported_archs="amd64 i386")
- Misparsing with unimplemented messages such as route, interface
  address state notifications

To fix those issues, this change implements all the required socket
address parsers, adds a processor architecture identifying function to
FreeBSD and tests.

Fixes #9707.
Fixes #8203.

Change-Id: I7ed7b4a0b6f10f54b29edc681a2f35603f2d8d45
Reviewed-on: https://go-review.googlesource.com/4330
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-02-20 04:33:28 +00:00
Ingo Oeser
668762c570 cmd/go: simplify/fix handling private github repos
Before Go 1.4, the traditional way to work with a private Github
repository was to run something similar the following:

```
git config --global url."git@github.com:".insteadOf "https://github.com/"
```

It would allow go get and friends to transparently work as expected,
automatically rewriting https URLs to use SSH for auth. This worked both
when pushing and pulling.

In Go 1.4 this broke, now requiring the use of `go get -f` instead of `go get`
in order to fetch private repositories. This seems neither intended nor
practical, as it requires changing a lot of tooling.

So just use `git config remote.origin.url` instead of `git remote -v` as
this reflects the actual substitution intended in the `insteadOf` config
directive.

Also remove now useless parsing.

Also add a check against supported schemes to avoid errors in later
commands using this URL and expecting such a scheme.

Fixes #9697

Change-Id: I907327f83504302288f913a68f8222a5c2d673ee
Reviewed-on: https://go-review.googlesource.com/3504
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-02-20 03:21:29 +00:00
Rob Pike
5b9429d122 [dev.cc] cmd/asm: bring asm on ppc64 in sync with 9a
I created a .s file that covered every instruction and operand production
in 9a/a.y and made sure that 9a and asm give bit-identical results for it.
I found a few things, including one addressing mode (R1+R2) that was
not present in the source we use. Fixed those

I also found quite a few things where 9a's grammar accepts the instruction
but liblink rejects it. These need to be sorted out, and I will do that separately.
Once that's done, I'll turn my test file into a proper test.

Change-Id: Ib093271b0f7ffd64ffed164ed2a820ebf2420e34
Reviewed-on: https://go-review.googlesource.com/5361
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-20 00:42:09 +00:00
Rob Pike
c21f1d5ef3 [dev.cc] runtime,syscall: quiet some more vet errors
Fix many incorrect FP references and a few other details.

Some errors remain, especially in vlop, but fixing them requires semantics. For another day.

Change-Id: Ib769fb519b465e79fc08d004a51acc5644e8b259
Reviewed-on: https://go-review.googlesource.com/5288
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-20 00:20:54 +00:00
Russ Cox
dc7b54bed2 [dev.cc] cmd/internal/obj, cmd/internal/gc, new6g: reconvert
Reconvert using rsc.io/c2go rev 27b3f59.

Changes to converter:
 - fatal does not return, so no fallthrough after fatal in switch
 - many more function results and variables identified as bool
 - simplification of negated boolean expressions

Change-Id: I3bc67da5e46cb7ee613e230cf7e9533036cc870b
Reviewed-on: https://go-review.googlesource.com/5171
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-02-20 00:17:03 +00:00
Russ Cox
786825c5e8 [dev.cc] cmd/gc: tweak default fatal in ordersafeexpr for c2go
c2go was putting a fallthrough after the fatal call.
Changed c2go to know that fatal doesn't return,
but then there is a missing return at the end of
the translated Go function.
Move code around a little to make C and Go agree.

Change-Id: Icef3d55ccdde0709c02dd0c2b78826f6da33a146
Reviewed-on: https://go-review.googlesource.com/5170
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-02-20 00:16:53 +00:00
Andrew Gerrand
5f84238444 cmd/dist: show friendlier error message when building outside a Git repo
Fixes #9932

Change-Id: I7943470a1784278a5c6e99c3b66c59d4953734ba
Reviewed-on: https://go-review.googlesource.com/5340
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-02-19 22:33:45 +00:00
Russ Cox
5254b7e9ce runtime: do not unmap work.spans until after checkmark phase
This is causing crashes.

Change-Id: I1832f33d114bc29894e491dd2baac45d7ab3a50d
Reviewed-on: https://go-review.googlesource.com/5330
Reviewed-by: Rick Hudson <rlh@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-19 21:33:06 +00:00
Rob Pike
218ff3f9a4 [dev.cc] runtime,syscall: add symbols for FP and SP references in darwin-arm
Maybe fix build.

Change-Id: I99ea76f0e6e472f0e88405bf5d77f72d4b097abd
Reviewed-on: https://go-review.googlesource.com/5287
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-19 21:29:21 +00:00
Rob Pike
caf2bf26f8 [dev.cc] cmd/go: enable verifyAsm for all architectures
Change-Id: Ia1ba28c81e31d149c59a48d5f71628ac0ff14d8e
Reviewed-on: https://go-review.googlesource.com/5283
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-19 21:10:27 +00:00
Rob Pike
f60fb5c5ad [dev.cc] cmd/asm: accept #define A /* nothing */
Was rejected but should be legal.

Change-Id: I0189e3bef6b67c6ba390c75a48a8d9d8f39b7636
Reviewed-on: https://go-review.googlesource.com/5286
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-19 21:06:51 +00:00
Russ Cox
6c4b54f409 runtime: missed change from reorganization CL
That is, I accidentally dropped this change of Austin's
when preparing my CL. I blame Git.

Change-Id: I9dd772c84edefad96c4b16785fdd2dea04a4a0d6
Reviewed-on: https://go-review.googlesource.com/5320
Reviewed-by: Austin Clements <austin@google.com>
2015-02-19 20:46:59 +00:00
Russ Cox
484f801ff4 runtime: reorganize memory code
Move code from malloc1.go, malloc2.go, mem.go, mgc0.go into
appropriate locations.

Factor mgc.go into mgc.go, mgcmark.go, mgcsweep.go, mstats.go.

A lot of this code was in certain files because the right place was in
a C file but it was written in Go, or vice versa. This is one step toward
making things actually well-organized again.

Change-Id: I6741deb88a7cfb1c17ffe0bcca3989e10207968f
Reviewed-on: https://go-review.googlesource.com/5300
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Rick Hudson <rlh@golang.org>
2015-02-19 20:17:01 +00:00
Dmitry Vyukov
d384545a45 cmd/pprof: add -runtime flag
The flag disables stripping of runtime frames in profiles.
This is useful when analyzing runtime itself.

Before:
$ go tool pprof --text --alloc_objects --lines fmt.test /tmp/mprof
      flat  flat%   sum%        cum   cum%
      2768 79.65% 79.65%      32768 79.65%  fmt_test.TestComplexFormatting fmt/fmt_test.go:744
      6554 15.93% 95.58%       6554 15.93%  regexp/syntax.(*compiler).rune regexp/syntax/compile.go:267
      1820  4.42%   100%       1820  4.42%  runtime.malg runtime/proc1.go:1977

After:
$ go tool pprof --text --alloc_objects --lines --runtime fmt.test /tmp/mprof
      flat  flat%   sum%        cum   cum%
     32768 79.65% 79.65%      32768 79.65%  runtime.convT2E runtime/iface.go:139
      6554 15.93% 95.58%       6554 15.93%  runtime.growslice runtime/slice.go:89
      1820  4.42%   100%       1820  4.42%  runtime.malg runtime/proc1.go:1977

Change-Id: If468dfa5c5bbd0809c45a58d912d3115fac009ed
Reviewed-on: https://go-review.googlesource.com/5291
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
2015-02-19 19:46:20 +00:00
Josh Bleecher Snyder
5dbbb77633 runtime: don't test gdb on darwin
Fixes #9927

Change-Id: I2114cc21f7a4772e3d42bcad9642a8a545cd8e16
Reviewed-on: https://go-review.googlesource.com/5285
Reviewed-by: Minux Ma <minux@golang.org>
2015-02-19 17:36:52 +00:00
Austin Clements
c25c371098 runtime: use more natural types in struct workbuf
Until recently, struct workbuf had only lfnode and uintptr fields
before the obj array to make it convenient to compute the size of the
obj array.  It slowly grew more fields until this became inconvenient
enough that it was restructured to make the size computation easy.
Now the size computation doesn't care what the field types are, so
switch to more natural types.

Change-Id: I966140ba7ebb4aeb41d5c66d9d2a3bdc17dd4bcf
Reviewed-on: https://go-review.googlesource.com/5262
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-19 17:00:30 +00:00
Austin Clements
02dcdba7c8 runtime: switch to gcWork abstraction
This converts the garbage collector from directly manipulating work
buffers to using the new gcWork abstraction.

The previous management of work buffers was rather ad hoc.  As a
result, switching to the gcWork abstraction changes many details of
work buffer management.

If greyobject fills a work buffer, it can now pull from work.partial
in addition to work.empty.

Previously, gcDrain started with a partial or empty work buffer and
fetched an empty work buffer if it filled its current buffer (in
greyobject).  Now, gcDrain starts with a full work buffer and fetches
an partial or empty work buffer if it fills its current buffer (in
greyobject).  The original behavior was bad because gcDrain would
immediately drop the empty work buffer returned by greyobject and
fetch a full work buffer, which greyobject was likely to immediately
overflow, fetching another empty work buffer, etc.  The new behavior
isn't great at the start because greyobject is likely to immediately
overflow the full buffer, but the steady-state behavior should be more
stable.  Both before and after this change, gcDrain fetches a full
work buffer if it drains its current buffer.  Basically all of these
choices are bad; the right answer is to use a dual work buffer scheme.

Previously, shade always fetched a work buffer (though usually from
m.currentwbuf), even if the object was already marked.  Now it only
fetches a work buffer if it actually greys an object.

Change-Id: I8b880ed660eb63135236fa5d5678f0c1c041881f
Reviewed-on: https://go-review.googlesource.com/5232
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
2015-02-19 16:59:34 +00:00
Austin Clements
b30d19de59 runtime: introduce higher-level GC work abstraction
This introduces a producer/consumer abstraction for GC work pointers
that internally handles the details of filling, draining, and
shuffling work buffers.

In addition to simplifying the GC code, this should make it easy for
us to change how we use work buffers, including cleaning up how we use
the work.partial queue, reintroducing a FIFO lookahead cache, adding
prefetching, and using dual buffers to avoid flapping.

This commit doesn't change any existing code.  The following commit
will switch the garbage collector from explicit workbuf manipulation
to gcWork.

Change-Id: Ifbfe5fff45bf0362d6d7c3cecb061f0c9874077d
Reviewed-on: https://go-review.googlesource.com/5231
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
2015-02-19 16:59:26 +00:00
Austin Clements
1b205857a4 runtime: drop unused workbufhdr.id field
Change-Id: If7729b3c7df6dc7fcd41f293e2ef2472c769fe8b
Reviewed-on: https://go-review.googlesource.com/5261
Reviewed-by: Rick Hudson <rlh@golang.org>
2015-02-19 15:53:23 +00:00
Rob Pike
e559c5cce2 [dev.cc] cmd/asm: add ppc64
Fairly straightforward. A couple of unusual addressing tricks.
Also added the ability to write R(10) to mean R10. PPC64 uses
this for a couple of large register spaces. It appears for ARM now
as well, since I saw some uses of that before, although I rewrote
them in our source. I could put it in for 386 and amd64 but it's
not worth it.

Change-Id: I3ffd7ffa62d511b95b92c3c75b9f1d621f5393b6
Reviewed-on: https://go-review.googlesource.com/5282
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-19 05:12:20 +00:00
Nigel Tao
270f8447d6 image/jpeg: support 16-bit quantization tables and Extended Sequential
frames.

Fixes #9888.

Change-Id: I60f1d843e72e1b7bc77ab984f149c9ddb5258a06
Reviewed-on: https://go-review.googlesource.com/5251
Reviewed-by: Rob Pike <r@golang.org>
2015-02-19 05:00:43 +00:00
Rob Pike
6acd5a65b2 [dev.cc] runtime: fix FP reference in atomic_ppc64x.s
References to FP must now have a symbol.

Change-Id: I3f06b99cc48cbd4ccd6f23f2e4b0830af40f7f3d
Reviewed-on: https://go-review.googlesource.com/5281
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-19 04:05:41 +00:00
Rob Pike
43a01db9a4 [dev.cc] cmd/9a,new9a: set v=1 on static names
Oversight in 9a: did not set the static bit in the assembler for
symbols with <>.

Change-Id: Id508dcd3ed07733e60395aefa86d0035faab14a9
Reviewed-on: https://go-review.googlesource.com/5280
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-19 04:00:19 +00:00
Austin Clements
1ae124b5ff runtime: make gcDrainN take an int instead of uintptr
Nit.  There's no reason to take a uintptr and doing so just requires
casts in annoying places.

Change-Id: Ifeb9638c6d94eae619c490930cf724cc315680ba
Reviewed-on: https://go-review.googlesource.com/5230
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-19 02:47:45 +00:00
Matthew Dempsky
95ab84a34f runtime: fix accidentally exported OpenBSD constants
Change-Id: I2de63668a1c0152cc329df55c2d6d014e8183158
Reviewed-on: https://go-review.googlesource.com/4943
Reviewed-by: Minux Ma <minux@golang.org>
2015-02-19 01:35:46 +00:00
Aaron Jacobs
9df81f8221 encoding/json: Fixed the comment specifying Marshal behavior for maps.
The comment previously was reversed in sense (it appeared to be
describing unmarshaling). I've fixed that, and added the caveat that map
keys are subject to UTF-8 coercion like other strings.

Change-Id: Id08082aa71401a6e7530a42f979fbb50bd1f4e6a
Reviewed-on: https://go-review.googlesource.com/5221
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-02-18 23:57:36 +00:00
Nigel Tao
84c7a6583a image: change Rectangle.Eq to return true for all empty rectangles, even
if their nominal Min and Max points differ.

This is a behavior change, but arguably a bug fix, as Eq wasn't
previously consistent with In, and the concept of a rectangle being a
set of points. This is demonstrated by the new geom_test.go test.

It does mean that r.Eq(s) no longer implies that Inset'ting both r and s
with a negative inset results in two rectangles that are still Eq, but
that seems acceptable to me.

The previous behavior is still available as "r == s".

Also clarify the image.Rect doc comment when the inputs are
non-canonical.

Also simplify the Point and Rectangle Eq implementations dating from
before Go 1.0, when you couldn't compare structs via the == operator.

Change-Id: Ic39e628db31dc5fe5220f4b444e6d5000eeace5b
Reviewed-on: https://go-review.googlesource.com/5006
Reviewed-by: Rob Pike <r@golang.org>
2015-02-18 23:50:09 +00:00
Alex Sergeyev
eaf8e8cbe5 net/http/cgi: fix REMOTE_ADDR, REMOTE_HOST, add REMOTE_PORT
Env vars were incorrectly copying whole value of http.RemoteAddr
to REMOTE_ADDR and REMOTE_HOST. They contained IP:port pair which
instead should only have IP (RFC 3875, other sources).

Module also was not setting REMOTE_PORT variable which become de-facto
standard for passing TCP client port to CGI scripts (Apache mod_cgi,
IIS, and probably others)

Fixes #9861

Change-Id: Ia73e664c48539e3c7db4997d09d957884e98d8a5
Reviewed-on: https://go-review.googlesource.com/4933
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-02-18 19:56:50 +00:00
Russ Cox
d0c21af7d3 [dev.cc] cmd/9a, cmd/new9a: fix line numbers
Fixed for the other assemblers in CL 2297042 in 2010.

Change-Id: I6cf41c569e884d98d295369e60e550ff8c0884e6
Reviewed-on: https://go-review.googlesource.com/5173
Reviewed-by: Rob Pike <r@golang.org>
2015-02-18 18:49:21 +00:00
Russ Cox
09d7db3bbb [dev.cc] cmd/dist, cmd/go: build new6g etc and verify against 6g
Change-Id: Ide7cff506274ec76d26bdffe7890ca2c28737f2b
Reviewed-on: https://go-review.googlesource.com/4852
Reviewed-by: Rob Pike <r@golang.org>
2015-02-18 15:09:04 +00:00
David Crawshaw
b2c2bc4856 crypto/x509: embed certificates on darwin/arm
Change-Id: Ia6b06f19e5ac424f01a1b90b78b507363b0c4577
Reviewed-on: https://go-review.googlesource.com/5061
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-02-18 14:19:17 +00:00
David du Colombier
2bcfe8b935 cmd/gc: replace NULL by nil
In CL 3964, NULL was used instead of nil.
However, Plan 9 doesn't declare NULL.

Change-Id: Ied3850aca5c8bca5974105129a37d575df33f6ec
Reviewed-on: https://go-review.googlesource.com/5150
Reviewed-by: Minux Ma <minux@golang.org>
2015-02-18 07:49:04 +00:00
Dmitry Vyukov
3a0fbfab57 cmd/gc: generate simpler names for closures
Fixes #8291

There were several complaints about closure names in the issue tracker.
The first problem is that you see names like net/http.func·001
in profiles, traces, etc. And there is no way to figure out what
is that function.
Another issue is non-US-ascii symbols. All programs out there
should accept UTF-8. But unfortunately it is not true in reality.
For example, less does not render middle dot properly.

This change prepends outer function name to closure name and
replaces middle dot with dot. Now names look like:

main.glob.func1
main.glob.func2
main.glob.func2.1
main.init.1
main.init.1.func1
main.init.1.func1.1
main.main.func1
main.main.func1.1

Change-Id: I725726af88f2ad3ced2e3450f0f06bf459fd91c0
Reviewed-on: https://go-review.googlesource.com/3964
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-18 07:09:50 +00:00
Rob Pike
575bdd6753 [dev.cc] cmd/internal/obj/ppc64: set Ctxt when allocating Progs
This will get fixed properly upstream, but this will serve for now.

Change-Id: I25e5210d190bc7a06a5b9f80724e3360d1a6b10c
Reviewed-on: https://go-review.googlesource.com/5121
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-18 05:01:25 +00:00
Rob Pike
345350bf07 [dev.cc] cmd/asm: make 4(SP) illegal except on 386
Require a name to be specified when referencing the pseudo-stack.
If you want a real stack offset, use the hardware stack pointer (e.g.,
R13 on arm), not SP.

Fix affected assembly files.

Change-Id: If3545f187a43cdda4acc892000038ec25901132a
Reviewed-on: https://go-review.googlesource.com/5120
Run-TryBot: Rob Pike <r@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-02-18 03:41:29 +00:00
Russ Cox
c7fa3c625e [dev.cc] cmd/yacc: introduce yyParser to expose parser state
Historically, yacc has supported various kinds of inspections
and manipulations of the parser state, exposed as global variables.
The Go implementation of yacc puts that state (properly) in local
stack variables, so it can only be exposed explicitly.

There is now an explicit parser type, yyParser, returned by a
constructor, yyNewParser.

	type yyParser interface {
		Parse(yyLexer) int
		Lookahead() int
	}

Parse runs a parse. A call to the top-level func Parse
is equivalent to calling yyNewParser().Parse, but constructing
the parser explicitly makes it possible to access additional
parser methods, such as Lookahead.

Lookahead can be called during grammar actions to read
(but not consume) the value of the current lookahead token,
as returned by yylex.Lex. If there is no current lookahead token,
Lookahead returns -1. Invoking Lookahead corresponds to
reading the global variable yychar in a traditional Unix yacc grammar.

To support Lookahead, the internal parsing code now separates
the return value from Lex (yychar) from the reencoding used
by the parsing tables (yytoken). This has the effect that grammars
that read yychar directly in the action (possible since the actions
are in the same function that declares yychar) now correctly see values
from the Lex return value space, not the internal reencoding space.
This can fix bugs in ported grammars not even using SetParse and Lookahead.
(The reencoding was added on Plan 9 for large character sets.
No Plan 9 programs using yacc looked at yychar.)

Other methods may be added to yyParser later as needed.
Obvious candidates include equivalents for the traditional
yyclearin and yyerrok macros.

Change-Id: Iaf7649efcf97e09f44d1f5bc74bb563a11f225de
Reviewed-on: https://go-review.googlesource.com/4850
Reviewed-by: Rob Pike <r@golang.org>
2015-02-18 02:39:48 +00:00
Rob Pike
2633f2aad4 [dev.cc] cmd/asm/internal/asm: add operand parsing tests for 386 and arm
Change-Id: If2aafc4dd3f91650fc7727ea7d534ad7aa627c8c
Reviewed-on: https://go-review.googlesource.com/5090
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-18 01:49:41 +00:00
Russ Cox
8c195bdf12 [dev.cc] cmd/internal/gc, cmd/new6g etc: convert from cmd/gc, cmd/6g etc
First draft of converted Go compiler, using rsc.io/c2go rev 83d795a.

Change-Id: I29f4c7010de07d2ff1947bbca9865879d83c32c3
Reviewed-on: https://go-review.googlesource.com/4851
Reviewed-by: Rob Pike <r@golang.org>
2015-02-17 23:28:51 +00:00
Russ Cox
c11882bc3e [dev.cc] cmd/go: install new6g etc (once they are committed) to tool directory
Change-Id: I2853535ab6c79d14f430c780161e4c35c52d9fb3
Reviewed-on: https://go-review.googlesource.com/4839
Reviewed-by: Rob Pike <r@golang.org>
2015-02-17 23:28:41 +00:00
Russ Cox
2286989912 [dev.cc] cmd/gc, cmd/ld, runtime: minor tweaks for c2go
Change-Id: I3be69a4ebf300ad24b55b5f43fd7ad1f001c762e
Reviewed-on: https://go-review.googlesource.com/4838
Reviewed-by: Rob Pike <r@golang.org>
2015-02-17 23:28:32 +00:00
Russ Cox
535f29c68e [dev.cc] cmd/dist: write default GO386 for cmd/internal/obj
Change-Id: Ida60c30041505c321fbfc48b22b8ff5af1a3f474
Reviewed-on: https://go-review.googlesource.com/4837
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
2015-02-17 23:28:24 +00:00
Rob Pike
aa55bd44b9 [dev.cc] cmd/asm: clean up jumps
Set TYPE_BRANCH for x(PC) in the parser and the assembler has less work to do.
This also makes the operand test handle -4(PC) correctly.

Also add a special test case for AX:DX, which should be fixed in obj really.

Change-Id: If195e3a8cf3454a73508633e9b317d66030da826
Reviewed-on: https://go-review.googlesource.com/5071
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-17 23:17:51 +00:00
Nigel Tao
391805b14b image/draw: add CMYK fast path.
Change-Id: I9582aff7ca141a8aead5692af74b9c708b1700cc
Reviewed-on: https://go-review.googlesource.com/5020
Reviewed-by: Rob Pike <r@golang.org>
2015-02-17 23:17:12 +00:00
Rob Pike
f14020a64e [dev.cc] cmd/asm/internal/asm: add operand parsing test
Generated by reducing all the amd64 operands in the core.
Will add 386 and ARM later; this is a trial balloon.

NOTE: There is at least one anomaly: AX:DX doesn't print correctly in this situation.

Change-Id: I9f327c1890b100e3edb7b1b2a1c01f3e4b798f43
Reviewed-on: https://go-review.googlesource.com/4967
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-17 20:23:52 +00:00
Austin Clements
1ab55a3f04 runtime: fix runtime-gdb_test on arm
Apparently when ARM stops at a GDB breakpoint, it appears to be in
syscall.Syscall.  The "info goroutines" test expected it to be in a
runtime function.  Since this isn't fundamental to the test, simply
tweak the test's regexp to make sure "info goroutines" prints some
running goroutine with an active M, but don't require it to be in any
particular function.

Change-Id: Iba2618b46d3dc49cef62ffb72484b83ea7b0317d
Reviewed-on: https://go-review.googlesource.com/5060
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-02-17 20:10:31 +00:00
Austin Clements
8ed95a942c runtime: rename gcwork.go to mgcwork.go
All of the other memory-related source files start with "m".  Keep up
the tradition.

Change-Id: Idd88fdbf2a1453374fa12109b949b1c4d149a4f8
Reviewed-on: https://go-review.googlesource.com/4853
Reviewed-by: Minux Ma <minux@golang.org>
2015-02-17 18:42:41 +00:00
Austin Clements
98651d6edf runtime: in runtime-gdb.py, use SliceValue wrapper
Rather than reaching in to slices directly in the slice pretty
printer, use the newly introduced SliceValue wrapper.

Change-Id: Ibb25f8c618c2ffb3fe1a8dd044bb9a6a085df5b7
Reviewed-on: https://go-review.googlesource.com/4936
Reviewed-by: Minux Ma <minux@golang.org>
2015-02-17 18:41:10 +00:00
Austin Clements
545686857b runtime: fix GDB "info goroutines" for Go 1.5
"info goroutines" is failing because it hasn't kept up with changes in
the 1.5 runtime.  This fixes three issues preventing "info goroutines"
from working.  allg is no longer a linked list, so switch to using the
allgs slice.  The g struct's 'status' field is now called
'atomicstatus', so rename uses of 'status'.  Finally, this was trying
to parse str(pc) as an int, but str(pc) can return symbolic
information after the raw hex value; fix this by stripping everything
after the first space.

This also adds a test for "info goroutines" to runtime-gdb_test, which
was previously quite skeletal.

Change-Id: I8ad83ee8640891cdd88ecd28dad31ed9b5833b7a
Reviewed-on: https://go-review.googlesource.com/4935
Reviewed-by: Minux Ma <minux@golang.org>
2015-02-17 18:41:01 +00:00
Rob Pike
0f3f2c4110 [dev.cc] runtime/cgo: change PC to R15 in asm_arm.s
R15 is the real register. PC is a pseudo-register that we are making
illegal in this context as part of the grand assembly unification.

Change-Id: Ie0ea38ce7ef4d2cf4fcbe23b851a570fd312ce8d
Reviewed-on: https://go-review.googlesource.com/4966
Reviewed-by: Minux Ma <minux@golang.org>
2015-02-17 18:23:08 +00:00
Rob Pike
09ce5d38d0 [dev.cc] cmd/asm: fix build: handle g in register lists on ARM
Handle the special name of R10 on the ARM - it's g - when it appears
in a register list [R0, g, R3]. Also simplify the pseudo-register parsing
a little.

Should fix the ARM build.

Change-Id: Ifcafc8195dcd3622653b43663ced6e4a144a3e51
Reviewed-on: https://go-review.googlesource.com/4965
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-17 17:23:10 +00:00
Ivan Ukhov
277eddb8f2 math: change Nextafter64 to Nextafter in the description of Nextafter
Change-Id: I3419d6247fbff36aa1ed5451bb3cfb7502c3d07e
Reviewed-on: https://go-review.googlesource.com/5030
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-02-17 14:29:18 +00:00
David Crawshaw
04774336b1 cmd/go: skip stat check when using -toolexec
Change-Id: Idc88b1ee950e33cfe757a27e9a3383d879793af7
Reviewed-on: https://go-review.googlesource.com/4934
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-02-17 12:21:45 +00:00
Alex Brainman
f20826692b syscall: make mksyscall_windows.go to work even when output does not uses unsafe package
Fixes #9900

Change-Id: I5dd401e8d2040e84ccb97c2fe9f5c5a28095b538
Reviewed-on: https://go-review.googlesource.com/5005
Reviewed-by: Minux Ma <minux@golang.org>
2015-02-17 08:31:38 +00:00
Alex Brainman
201b12499c [dev.cc] runtime: remove comma at the end of DIVL instruction (fixes windows build)
Change-Id: Ia47e1e387acd30f30559d766aa6fca18cbb098f9
Reviewed-on: https://go-review.googlesource.com/5010
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-02-17 08:15:13 +00:00
Rob Pike
412ce1f7d6 [dev.cc] cmd/go: enable verifyAsm for asm on ARM
Change-Id: I182ea770110255a5ac1c91cf30dd650696a8f1db
Reviewed-on: https://go-review.googlesource.com/4961
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-17 05:10:18 +00:00
Rob Pike
68bcc13291 [dev.cc] cmd/asm: fix build for x86 architectures
Mishandled the complex addressing mode in masks<>(SB)(CX*8)
as a casualty of the ARM work. Fix by backing all the flows up to
the state where registerIndirect is always called with the input
sitting on the opening paren.

With this, build passes for me with linux-arm, linux-386, and linux-amd64.

Change-Id: I7cae69a6fa9b635c79efd93850bd1e744b22bc79
Reviewed-on: https://go-review.googlesource.com/4964
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-17 04:55:38 +00:00
Yasuhiro Matsumoto
d866cd6817 all: fix typo in doc
Change-Id: I89fdda2914030dfea3183a8b4681dd4b33489729
Reviewed-on: https://go-review.googlesource.com/4996
Reviewed-by: Minux Ma <minux@golang.org>
2015-02-17 04:37:18 +00:00
Rob Pike
188296e5bf [dev.cc] cmd/internal/asm: fix build: was mishandling SP reference on amd64
A consequence of the ARM work overlooked that SP is a real register
on x86, so we need to detect it specially.

This will be done better soon, but this is a fast fix for the build.

Change-Id: Ia30d111c3f42a5f0b5f4eddd4cc4d8b10470c14f
Reviewed-on: https://go-review.googlesource.com/4963
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-17 04:20:19 +00:00
Rob Pike
bf2d611a85 [dev.cc] cmd/internal/obj/arm: delete trailing space from AND instruction
The tools have been fixed to not do this, but verifyAsm depends on this
being fixed.

TBR=rsc

Change-Id: Ia8968cc803b3498dfa2f98188c6ed1cf2e11c66d
Reviewed-on: https://go-review.googlesource.com/4962
Reviewed-by: Rob Pike <r@golang.org>
2015-02-17 03:52:58 +00:00
Nigel Tao
5c8f9e38eb image: fix Rectangle.Overlaps and Rectangle.Union for empty rectangles.
Fixes #9895.

Change-Id: I37d78ced9ff8196e32d299504908a1c41ad4592d
Reviewed-on: https://go-review.googlesource.com/4990
Reviewed-by: Rob Pike <r@golang.org>
2015-02-17 03:40:33 +00:00
Rob Pike
581c309d8f [dev.cc] cmd/internal/obj/arm: add a couple of missing settings of Ctxt
Change-Id: Ic33431cdcc93db300fc2c3467eafdb5340ee4896
Reviewed-on: https://go-review.googlesource.com/4924
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-17 03:37:27 +00:00
Rob Pike
c497349a5b [dev.cc] cmd/asm: support ARM
There are many peculiarites of the ARM architecture that require work:
condition codes, new instructions, new instruction arg counts, and more.

Rewrite the parser to do a cleaner job, flowing left to right through the
sequence of elements of an operand.

Add ARM to arch.
Add ARM-specific details to the arch in a new file, internal/arch/arm.
These are probably better kept away from the "portable" asm. However
there are some pieces, like MRC, that are hard to disentangle. They
can be cleaned up later.

Change-Id: I8c06aedcf61f8a3960a406c094e168182d21b972
Reviewed-on: https://go-review.googlesource.com/4923
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-17 03:37:17 +00:00