]> Cypherpunks repositories - gostls13.git/log
gostls13.git
10 years agocmd/internal/obj/x86: implement -shared computation of TLS base
Michael Hudson-Doyle [Thu, 5 Mar 2015 01:21:42 +0000 (14:21 +1300)]
cmd/internal/obj/x86: implement -shared computation of TLS base

Somehow, terribly embarrassingly, I lost part of the "re-enable
-shared on amd64" patch when rebasing before it got submitted.
This restores it and also fixes the addend to be the necessary -4.

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

10 years agonet: gofmt
Mikio Hara [Sun, 8 Mar 2015 13:44:33 +0000 (22:44 +0900)]
net: gofmt

Change-Id: Ifcf7b96e67b63a08f410a7ba21e8bf4dd20e7d8e
Reviewed-on: https://go-review.googlesource.com/7122
Reviewed-by: Minux Ma <minux@golang.org>
10 years agonet: LookupHost and Resolve{TCP,UDP,IP}Addr should use zone from getaddrinfo
Andrew Pilloud [Fri, 13 Feb 2015 04:24:47 +0000 (20:24 -0800)]
net: LookupHost and Resolve{TCP,UDP,IP}Addr should use zone from getaddrinfo

The unix and windows getaddrinfo calls return a zone with IPv6
addresses. IPv6 link-local addresses returned are only valid on the
given zone. When the zone is dropped, connections to the address
will fail. This patch replaces IP with IPAddr in several internal
resolver functions, and plumbs through the zone.

Change-Id: Ifea891654f586f15b76988464f82e04a42ccff6d
Reviewed-on: https://go-review.googlesource.com/5851
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
10 years agocmd/internal/obj/x86: fix nacl/amd64p32 build
Shenghou Ma [Sat, 7 Mar 2015 06:44:24 +0000 (01:44 -0500)]
cmd/internal/obj/x86: fix nacl/amd64p32 build

some x86 instructions (e.g. PINSRW) might store memory address in Prog.From3,
so we must also rewrite Prog.From3 on nacl.

Change-Id: I2a0da0f692ba321eba17fbc454d68aaafa133515
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/7074
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
10 years agoruntime: add argument sizes for asm functions for bytes, strings
Shenghou Ma [Sat, 7 Mar 2015 05:18:16 +0000 (00:18 -0500)]
runtime: add argument sizes for asm functions for bytes, strings

Also fixed a stack corruption bug for nacl/amd64p32.

Change-Id: I64b821b16999c296a159137d971af3870053c621
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/7073
Reviewed-by: Dave Cheney <dave@cheney.net>
10 years agoFixed wrong arguments to formatting functions
tnt [Fri, 6 Mar 2015 23:48:26 +0000 (00:48 +0100)]
Fixed wrong arguments to formatting functions

Change-Id: I11b4cf00ceeb4441b865e0de3f1674095d1c32d0
Reviewed-on: https://go-review.googlesource.com/7043
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agocmd/internal/gc: more int to bool cleanups
Dave Cheney [Fri, 6 Mar 2015 07:42:58 +0000 (18:42 +1100)]
cmd/internal/gc: more int to bool cleanups

- make paramoutheap return a bool
- convert Node.Assigned to a bool
- convert Node.Captured to a bool
- convert Node.Byval to a bool
- convert Node.Dupok to a bool
- convert Node.Wrapper to a bool
- convert Node.Reslice to a bool

Change-Id: I5b57c019f936c31d53db4db14459fb2b0aa72305
Reviewed-on: https://go-review.googlesource.com/7030
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Dave Cheney <dave@cheney.net>

10 years agotest: add testcase for gccgo-specific issue 10047.
Chris Manghane [Fri, 6 Mar 2015 18:33:07 +0000 (10:33 -0800)]
test: add testcase for gccgo-specific issue 10047.

Change-Id: Ia5115b15a79e1b2b53036646f1ed4b08225b220f
Reviewed-on: https://go-review.googlesource.com/7051
Run-TryBot: Chris Manghane <cmang@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agocmd/internal/ld: change string vars into constants where possible
Matthew Dempsky [Fri, 6 Mar 2015 19:42:53 +0000 (11:42 -0800)]
cmd/internal/ld: change string vars into constants where possible

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

10 years agocmd/internal/ld: remove unused files
Matthew Dempsky [Fri, 6 Mar 2015 04:01:11 +0000 (20:01 -0800)]
cmd/internal/ld: remove unused files

Change-Id: Id27861d5449cc3565bc9e80aad671229598dbeb1
Reviewed-on: https://go-review.googlesource.com/7060
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agocrypto/tls: fix typo in tls handshake error
Joël Stemmer [Fri, 6 Mar 2015 13:59:12 +0000 (14:59 +0100)]
crypto/tls: fix typo in tls handshake error

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

10 years agodoc/go1.5: mention new SWIG requirement: must be 3.0.6 or later.
Ian Lance Taylor [Fri, 6 Mar 2015 17:48:08 +0000 (09:48 -0800)]
doc/go1.5: mention new SWIG requirement: must be 3.0.6 or later.

Change-Id: I18b78677b2ac9a82560d5d787225d4fc46d451d3
Reviewed-on: https://go-review.googlesource.com/7050
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agocmd/go: for gccgo run the located binary rather than using PATH
Ian Lance Taylor [Fri, 9 Jan 2015 21:33:58 +0000 (13:33 -0800)]
cmd/go: for gccgo run the located binary rather than using PATH

Change-Id: I308588db2942e7110a2be22257843931941d92f1
Reviewed-on: https://go-review.googlesource.com/2622
Reviewed-by: Peter Collingbourne <pcc@google.com>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
10 years agomisc/swig/callback: fix test for SWIG -cgo support
Ian Lance Taylor [Fri, 6 Mar 2015 03:58:27 +0000 (19:58 -0800)]
misc/swig/callback: fix test for SWIG -cgo support

The test used to import ../callback.  I forget why that ever worked,
but it probably had something to do with the shared libraries we used
to use with SWIG.  It doesn't work today.

Change-Id: Ib83d6c398aa46bf2fc66320b47b6e6d9897ee0b7
Reviewed-on: https://go-review.googlesource.com/7004
Reviewed-by: David Crawshaw <crawshaw@golang.org>
10 years agocmd/internal/gc: make Addrtaken a bool
Dave Cheney [Thu, 5 Mar 2015 07:20:54 +0000 (18:20 +1100)]
cmd/internal/gc: make Addrtaken a bool

Node.Addrtaken is treated as a bool, so make it a bool.

I'll start to batch these changes if they are simple.

Change-Id: I02a3d1131efc4e12b78b83372c1b50f8b160c194
Reviewed-on: https://go-review.googlesource.com/6911
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agocmd/internal/gc: make Node.Hasbreak a bool
Dave Cheney [Thu, 5 Mar 2015 06:19:54 +0000 (17:19 +1100)]
cmd/internal/gc: make Node.Hasbreak a bool

Node.Hasbreak was treated like a bool, so declare it as bool.

Change-Id: Ied238356dce4da896834bd1412cc21ea56d35e1d
Reviewed-on: https://go-review.googlesource.com/6807
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agocmd/internal/gc: make Node.Readonly a bool
Dave Cheney [Thu, 5 Mar 2015 06:44:02 +0000 (17:44 +1100)]
cmd/internal/gc: make Node.Readonly a bool

Convert Node.Readonly to a bool.

Change-Id: Ide9f6f657f498d70d7b9544a38046325d7c82dc8
Reviewed-on: https://go-review.googlesource.com/6809
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agocmd/internal/gc: remove Node.Builtin
Dave Cheney [Thu, 5 Mar 2015 06:33:19 +0000 (17:33 +1100)]
cmd/internal/gc: remove Node.Builtin

Node.Builtin was occasionally set to 1, but never read.

Change-Id: Ia8a76bccc79b0f211296d50bd419860b13077ba5
Reviewed-on: https://go-review.googlesource.com/6808
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agocmd/go: use new SWIG -cgo option
Ian Lance Taylor [Wed, 4 Mar 2015 23:43:43 +0000 (15:43 -0800)]
cmd/go: use new SWIG -cgo option

This fixes SWIG to work again.  It requires SWIG 3.0.6 or later.
Earlier versions of SWIG will not work because they generate a .c file
to be compiled by [568]c, which no longer exist.  As of SWIG 3.0.6
SWIG supports a -cgo option that tells it to generate files that
import "C" and can be used with the cgo tool.  With luck this will
means that future versions of SWIG will not require changes for future
versions of Go.

Change-Id: Iad7beb196ba9dcd3e3f684196d50e5d51ed98204
Reviewed-on: https://go-review.googlesource.com/6851
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agomath/big: move "bits" operations used for Float tests into separate file
Robert Griesemer [Wed, 4 Mar 2015 22:19:08 +0000 (14:19 -0800)]
math/big: move "bits" operations used for Float tests into separate file

This is a pure code move without any semantic change.

Change-Id: I2c18efc858955d07949b1241e793232f2cf1deb9
Reviewed-on: https://go-review.googlesource.com/6821
Reviewed-by: Alan Donovan <adonovan@google.com>
10 years agoos: do not leave /go_os_test/dir after test
Alex Brainman [Thu, 5 Mar 2015 23:34:59 +0000 (10:34 +1100)]
os: do not leave /go_os_test/dir after test

Change-Id: Idb8e211bf33d2713735f9cdc868a3458ce799c97
Reviewed-on: https://go-review.googlesource.com/6913
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agocmd/internal/gc: use crypto/md5 instead of md5.go
Matthew Dempsky [Fri, 27 Feb 2015 07:05:30 +0000 (16:05 +0900)]
cmd/internal/gc: use crypto/md5 instead of md5.go

Note: for simplicity, this CL changes the identifiers assigned to
gclocals.* objects; e.g., on amd64, gclocals.ABCDEFGHIJKLMNOP is now
gclocals.HGFEDCBAPONMLKJI.  However, since Go requires all packages to
be built with the same toolchain version anyway, this should be a
non-issue.

Similarly, type hashes change somewhat, but don't seem to be exposed
to users in any detectable manner.

Change-Id: Iadb3bce472af9b022b88d52b3c4c5e4113cda330
Reviewed-on: https://go-review.googlesource.com/6232
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
10 years agocmd/internal/obj: remove use of "iota - X"
Russ Cox [Thu, 5 Mar 2015 19:04:12 +0000 (14:04 -0500)]
cmd/internal/obj: remove use of "iota - X"

This was inserted by c2go to turn each enum { ... } into one const ( ... ) block,
but it is fragile and was never intended as a long-term thing.

Change-Id: I8de8e0984b130456da70e4d59891276dfef7ac27
Reviewed-on: https://go-review.googlesource.com/6932
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/5l etc: restore comments lost during C -> Go conversion
Russ Cox [Thu, 5 Mar 2015 18:57:36 +0000 (13:57 -0500)]
cmd/5l etc: restore comments lost during C -> Go conversion

It appears that c2go dropped comments inside struct { ... } and enum { ... }.
Restore them.

Identified missing comments by checking for comments present
in the C code but not the Go code, made a list, and then reapplied
with some mechanical help.

Missing comment finder: http://play.golang.org/p/g6qNUAo1Y0

Change-Id: I323ab45c7ef9d51e28eab3b699eb14bee1eef66b
Reviewed-on: https://go-review.googlesource.com/6899
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/internal/gc: start syntax.go for syntax tree definitions
Russ Cox [Thu, 5 Mar 2015 15:45:56 +0000 (10:45 -0500)]
cmd/internal/gc: start syntax.go for syntax tree definitions

Minor comments added. More to come.

Change-Id: I97511db54d59e1009ef934da38f306a2dc83a6e9
Reviewed-on: https://go-review.googlesource.com/6898
Reviewed-by: Rob Pike <r@golang.org>
10 years agoruntime: start GC background sweep eagerly
Russ Cox [Thu, 5 Mar 2015 21:04:17 +0000 (16:04 -0500)]
runtime: start GC background sweep eagerly

Starting it lazily causes a memory allocation (for the goroutine) during GC.

First use of channels for runtime implementation.

Change-Id: I9cd24dcadbbf0ee5070ee6d0ed7ea415504f316c
Reviewed-on: https://go-review.googlesource.com/6960
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
10 years agocmd/internal/gc: statically initialize function pointers
Matthew Dempsky [Thu, 5 Mar 2015 00:33:28 +0000 (16:33 -0800)]
cmd/internal/gc: statically initialize function pointers

Previously, gc would compile code like

    func foo() { ... }
    var bar = foo

by emitting a static closure to wrap "foo", but then emitting runtime
initialization code to assign the closure to "bar".  This CL changes
gc to instead statically initialize "bar".

Notably, this change shrinks the "go" tool's text segment by ~7.4kB on
linux/amd64 while only increasing the data segment by ~100B:

   text    data     bss     dec     hex filename
7237819  122412  215616 7575847  739927 go.before
7230398  122540  215232 7568170  737b2a go.after

Fixes issue #10081.

Change-Id: If5e26cf46b323393ba6f2199a82a06e9e4baf411
Reviewed-on: https://go-review.googlesource.com/6880
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
10 years agocmd/internal/obj: delete all Pconv, replace with Prog.String
Rob Pike [Thu, 5 Mar 2015 18:39:23 +0000 (10:39 -0800)]
cmd/internal/obj: delete all Pconv, replace with Prog.String

Remove the per-achitecture formatter for Prog and replace it with
a global String method. Clean up and regularize the output. Update
tests affected by the format; some tests are made correct now when
they were broken before (and known to be).

Also, related: Change the encoding of the (R1+R2) syntax on ppc64
to be equivalent to (R1)(R2*1), which means it needs no special
handling.

Delete the now unused STRINGSZ constant.

Change-Id: I7f6654d11f80065f3914a3f19353f2f12edfe310
Reviewed-on: https://go-review.googlesource.com/6931
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agostrconv: simplify code for binary exponent float format
Martin Möhrmann [Fri, 13 Feb 2015 14:59:54 +0000 (15:59 +0100)]
strconv: simplify code for binary exponent float format

Use optimized formatBits function to format mantissa and exponent.
Add benchmark for binary exponent float format.

on darwin/386

benchmark                         old ns/op     new ns/op     delta
BenchmarkAppendFloatBinaryExp     520           122           -76.54%

on darwin/amd64

benchmark                         old ns/op     new ns/op     delta
BenchmarkAppendFloatBinaryExp     76.9          84.3          +9.62%

Change-Id: If543552f1960e1655bed3a4130914e5eaa3aac69
Reviewed-on: https://go-review.googlesource.com/5600
Reviewed-by: Robert Griesemer <gri@golang.org>
10 years agoruntime: apply comments from CL 3742
Russ Cox [Thu, 5 Mar 2015 14:52:41 +0000 (09:52 -0500)]
runtime: apply comments from CL 3742

I asked for this in CL 3742 and it was ignored.

Change-Id: I30ad05f87c7d9eccb11df7e19288e3ed2c7e2e3f
Reviewed-on: https://go-review.googlesource.com/6930
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
10 years agocmd/internal/obj/x86: fix nacl/amd64p32
Russ Cox [Thu, 5 Mar 2015 05:43:21 +0000 (00:43 -0500)]
cmd/internal/obj/x86: fix nacl/amd64p32

Change-Id: I815b685e261065bad3416b55feb4fec68974c9a0
Reviewed-on: https://go-review.googlesource.com/6896
Reviewed-by: Rob Pike <r@golang.org>
10 years agoruntime: cleanup
Dmitry Vyukov [Wed, 4 Mar 2015 18:24:58 +0000 (21:24 +0300)]
runtime: cleanup

Cleanup after https://go-review.googlesource.com/3742

Change-Id: Iff3ceffc31b778b1ed0b730696fce6d1b5124447
Reviewed-on: https://go-review.googlesource.com/6761
Reviewed-by: Minux Ma <minux@golang.org>
10 years agocmd/asm: fix (printing of) TEXT flags
Rob Pike [Thu, 5 Mar 2015 05:58:20 +0000 (21:58 -0800)]
cmd/asm: fix (printing of) TEXT flags

With the new unificiation, the flag must be TYPE_CONST to print
properly.

Change-Id: I7cd1c56355724f08cbe9afc6ab7a66904031adc9
Reviewed-on: https://go-review.googlesource.com/6903
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agocmd/internal/obj/x86: fix PINSRD with mem in from3
Russ Cox [Thu, 5 Mar 2015 05:50:38 +0000 (00:50 -0500)]
cmd/internal/obj/x86: fix PINSRD with mem in from3

Change-Id: I3a2b17e218aa05cfb67d7561e0b52a6df766924d
Reviewed-on: https://go-review.googlesource.com/6897
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/internal/obj/x86: add CALL *name(SB)
Russ Cox [Thu, 5 Mar 2015 05:36:09 +0000 (00:36 -0500)]
cmd/internal/obj/x86: add CALL *name(SB)

This was in i386 but not in x86 and was missed during the merge.
Needed for linux/386.

Change-Id: Ia6e495c044f53bcb98f3bb03e20d8f6d35a8f8ff
Reviewed-on: https://go-review.googlesource.com/6902
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/8g, cmd/old8a: stop renaming x86 import to i386
Russ Cox [Thu, 5 Mar 2015 03:58:27 +0000 (22:58 -0500)]
cmd/8g, cmd/old8a: stop renaming x86 import to i386

Change-Id: If2872e73da4daa4ff1912883d30c8fc9754ef552
Reviewed-on: https://go-review.googlesource.com/6894
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/internal/obj/i386: delete
Russ Cox [Thu, 5 Mar 2015 03:56:49 +0000 (22:56 -0500)]
cmd/internal/obj/i386: delete

Now unused.

Change-Id: I0ba27e58721ad66cc3068346d6d31ba0ac37ad64
Reviewed-on: https://go-review.googlesource.com/6893
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
10 years agocmd/internal/gc: simplify some indexing
Russ Cox [Wed, 4 Mar 2015 22:36:50 +0000 (17:36 -0500)]
cmd/internal/gc: simplify some indexing

Change-Id: I7d289c7f250e4db551192d52535a90974685f0b3
Reviewed-on: https://go-review.googlesource.com/6891
Reviewed-by: Minux Ma <minux@golang.org>
10 years agocmd/asm: update to use new encoding for x86 instructions
Rob Pike [Thu, 5 Mar 2015 05:04:11 +0000 (21:04 -0800)]
cmd/asm: update to use new encoding for x86 instructions

Support the old syntax for AX:DX by rewriting into the new form,
AX, DX. Delete now-unnecessary hacks for some special cases.

Change-Id: Icd42697c7617f8a50864ca8b0c69469321a2296e
Reviewed-on: https://go-review.googlesource.com/6901
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agocmd/internal/obj/x86: accept TYPE_MEM in CMPPS 3rd argument
Russ Cox [Thu, 5 Mar 2015 04:54:13 +0000 (23:54 -0500)]
cmd/internal/obj/x86: accept TYPE_MEM in CMPPS 3rd argument

(Because that's what the assembly files actually say - no $ on the constant.)

Change-Id: Idb774cdca0e089c4ac24ab665e23290bf7b565bf
Reviewed-on: https://go-review.googlesource.com/6895
Reviewed-by: Rob Pike <r@golang.org>
10 years agoruntime: poison pcln.frame value
Russ Cox [Wed, 4 Mar 2015 21:50:59 +0000 (16:50 -0500)]
runtime: poison pcln.frame value

Nothing uses it, nothing should start using it.
Stop leaving plausible-looking values there.
It would be nice to remove entirely, but that would
require a new version number for the object file format,
in order not to break external readers like debug/gosym.
It's easier to leave and poison.

I came across an old mail thread suggesting we start using it
to speed up tracebacks. I want to make sure that doesn't happen.

(The values there were never quite right, and the number is
fundamentally PC-specific anyway.)

Change-Id: Iaf38e8a6b523cbae30b69c28497c4588ef397519
Reviewed-on: https://go-review.googlesource.com/6890
Reviewed-by: Minux Ma <minux@golang.org>
10 years agocmd/internal/obj/x86: take over i386 duty, clean up PINSRQ, CMPSD
Russ Cox [Wed, 4 Mar 2015 20:46:52 +0000 (15:46 -0500)]
cmd/internal/obj/x86: take over i386 duty, clean up PINSRQ, CMPSD

Make cmd/internal/obj/x86 support 32-bit mode and use
instead of cmd/internal/obj/i386. Delete cmd/internal/obj/i386.

Clean up encoding of PINSRQ, CMPSD to use explicit third arg
instead of jamming it into an unused slot of a different arg.

Also fix bug in old6a, which declared the wrong grammar.
The accepted (and encoded) arguments to CMPSD etc are mem,reg not reg,mem.
Code that did try to use mem,reg before would be rejected by liblink,
so only reg,reg ever worked, so existing code is not affected.
After this change, code can use mem,reg successfully.

The real bug here is that the encoding tables inverted the argument
order, making the comparisons all backward from what they say on the page.
It's too late to swap them, though: people have already written code that
expects the inverted comparisons (like in package math, and likely externally).
The best we can do is make the argument that should and can take a
memory operand accept it.

Bit-for-bit compatibility checked against tree without this CL.

Change-Id: Ife5685bc98c95001f64407f35066b34b4dae11c1
Reviewed-on: https://go-review.googlesource.com/6810
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/internal/obj/x86: prep for next CL
Russ Cox [Thu, 5 Mar 2015 03:24:13 +0000 (22:24 -0500)]
cmd/internal/obj/x86: prep for next CL

Add unused (but initialized) from3 field to ytab, f3t to movtab.
Remove level of indentation in movtab processing.

Change-Id: I8475988f46b541ecaccf8d34608da8bef7d12e24
Reviewed-on: https://go-review.googlesource.com/6892
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/internal/gc: make Node.Needzero a bool
Dave Cheney [Wed, 4 Mar 2015 20:11:40 +0000 (07:11 +1100)]
cmd/internal/gc: make Node.Needzero a bool

Node.Needzero only has two values and acts as a bool, so make it a bool.

Change-Id: Ica46e5ebafbe478017ea52ce6bb335f404059677
Reviewed-on: https://go-review.googlesource.com/6800
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>

10 years agocmd/internal/gc: do not show original expression for constants in export data
Shenghou Ma [Wed, 4 Mar 2015 04:28:00 +0000 (23:28 -0500)]
cmd/internal/gc: do not show original expression for constants in export data

Fixes #10066.

Change-Id: I43c423793dd094989e921e163a06b12181a35719
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/6750
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Chris Manghane <cmang@golang.org>
10 years ago.gitignore: remove obselete entries
Shenghou Ma [Wed, 4 Mar 2015 03:21:04 +0000 (22:21 -0500)]
.gitignore: remove obselete entries

Change-Id: I520a0f2c2d14f744a5d2e8cf93963eec1cf3e9ba
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/6732
Reviewed-by: Andrew Gerrand <adg@golang.org>
10 years agocmd/internal/ld: cache file name construction in linkgetline
Russ Cox [Wed, 4 Mar 2015 03:29:03 +0000 (22:29 -0500)]
cmd/internal/ld: cache file name construction in linkgetline

This avoids repeated allocation and map lookups
when constructing the pcln tables.

For 6g compiling cmd/internal/gc/*.go this saves about 8% wall time.

Change-Id: I6a1a80e278ae2c2a44bd1537015ea7b4e7a4d6ca
Reviewed-on: https://go-review.googlesource.com/6793
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/5g etc: tweak import blocks
Russ Cox [Wed, 4 Mar 2015 03:20:44 +0000 (22:20 -0500)]
cmd/5g etc: tweak import blocks

Remove blank lines and merge lone imports into blocks.

Change-Id: Ib46dad584456909969f1ba3a2c7f5667abf336ae
Reviewed-on: https://go-review.googlesource.com/6792
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/internal: rewrite fmt.Sprintf("%s", x) to x
Russ Cox [Wed, 4 Mar 2015 03:20:16 +0000 (22:20 -0500)]
cmd/internal: rewrite fmt.Sprintf("%s", x) to x

Change-Id: I764933f4928bb9d0d119fbfe44a193ce1449b61e
Reviewed-on: https://go-review.googlesource.com/6791
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
10 years agomath/big: added more comprehensive mul/quo test
Robert Griesemer [Wed, 4 Mar 2015 17:22:44 +0000 (09:22 -0800)]
math/big: added more comprehensive mul/quo test

Change-Id: Ib813eb5960c3310b1c919f25f687560f4f9d63b0
Reviewed-on: https://go-review.googlesource.com/6820
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agocmd/internal/ld, runtime: halve tlsoffset on ELF/intel
Michael Hudson-Doyle [Wed, 4 Mar 2015 03:28:45 +0000 (16:28 +1300)]
cmd/internal/ld, runtime: halve tlsoffset on ELF/intel

For OSes that use elf on intel, 2*Ptrsize bytes are reserved for TLS.
But only one pointer (g) has been stored in the TLS for a while now.
So we can set it to just Ptrsize, which happily matches what happens
when externally linking.

Fixes #9913

Change-Id: Ic816369d3a55a8cdcc23be349b1a1791d53f5f81
Reviewed-on: https://go-review.googlesource.com/6584
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agonet: fix darwin/amd64 build
David Crawshaw [Wed, 4 Mar 2015 22:29:44 +0000 (17:29 -0500)]
net: fix darwin/amd64 build

Accidental semantics change in 4c6364a87d4a.

Change-Id: I0bbfc441662d79af4dbac6f9fc4e3a485adfb924
Reviewed-on: https://go-review.googlesource.com/6831
Reviewed-by: Minux Ma <minux@golang.org>
10 years agoimage/jpeg: check for component uniqueness and total sampling factors.
Nigel Tao [Wed, 4 Mar 2015 06:42:39 +0000 (17:42 +1100)]
image/jpeg: check for component uniqueness and total sampling factors.

Change-Id: I83de9d83708edc8d196bbcfdc7d2ba7ffaff50d2
Reviewed-on: https://go-review.googlesource.com/6586
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/dist: execute misc/cgo/testso again on windows
Alex Brainman [Wed, 4 Mar 2015 05:16:26 +0000 (16:16 +1100)]
cmd/dist: execute misc/cgo/testso again on windows

Fixes #10072

Change-Id: I1f73c8829a89144d49433a36a4e64223c74af954
Reviewed-on: https://go-review.googlesource.com/6585
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

10 years agolog/syslog: avoid unix sockets on darwin/arm
David Crawshaw [Wed, 4 Mar 2015 17:55:04 +0000 (12:55 -0500)]
log/syslog: avoid unix sockets on darwin/arm

Change-Id: Ice4f78e74ec3025a974ffd9ca5e3d28bb3164f40
Reviewed-on: https://go-review.googlesource.com/6794
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: David Crawshaw <crawshaw@golang.org>

10 years agonet: skip unsupported tests (unix and unixgram) on darwin/arm
Shenghou Ma [Thu, 26 Feb 2015 23:25:29 +0000 (18:25 -0500)]
net: skip unsupported tests (unix and unixgram) on darwin/arm

Change-Id: Id1927180ecd18b849727225adea05465d36b3973
Reviewed-on: https://go-review.googlesource.com/6210
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
10 years agoruntime: Remove boundary bit logic.
Rick Hudson [Tue, 3 Mar 2015 21:55:14 +0000 (16:55 -0500)]
runtime: Remove boundary bit logic.

This is an experiment to see if removing the boundary bit logic will
lead to fewer cache misses and improved performance. Instead of using
boundary bits we use the span information to get element size and use
some bit whacking to get the boundary without having to touch the
random heap bits which cause cache misses.

Furthermore once the boundary bit is removed we can either use that
bit for a simpler checkmark routine or we can reduce the number of
bits in the GC bitmap to 2 bits per pointer sized work. For example
the 2 bits at the boundary can be used for marking and pointer/scalar
differentiation. Since we don't need the mark bit except at the
boundary nibble of the object other nibbles can use this bit
as a noscan bit to indicate that there are no more pointers in
the object.

Currently the changed included in this CL slows down the garbage
benchmark. With the boundary bits garbage gives 5.78 and without
(this CL) it gives 5.88 which is a 2% slowdown.

Change-Id: Id68f831ad668176f7dc9f7b57b339e4ebb6dc4c2
Reviewed-on: https://go-review.googlesource.com/6665
Reviewed-by: Austin Clements <austin@google.com>
10 years agomath/big: reenable TestFloatAdd32 (used to fail on 32bit platforms)
Robert Griesemer [Wed, 4 Mar 2015 16:58:03 +0000 (08:58 -0800)]
math/big: reenable TestFloatAdd32 (used to fail on 32bit platforms)

Change-Id: I932c2f1b1d27c437722cd27d2001b085a655c572
Reviewed-on: https://go-review.googlesource.com/6722
Reviewed-by: Alan Donovan <adonovan@google.com>
10 years agomath/big: use stringer for enum String() methods
Robert Griesemer [Tue, 3 Mar 2015 22:17:39 +0000 (14:17 -0800)]
math/big: use stringer for enum String() methods

Change-Id: Ide0615542d67b7d81bf6c56aab550e142a8789f7
Reviewed-on: https://go-review.googlesource.com/6682
Reviewed-by: Alan Donovan <adonovan@google.com>
10 years agomath/big: added Float.Add example, remove warning from Floats
Robert Griesemer [Tue, 3 Mar 2015 21:41:56 +0000 (13:41 -0800)]
math/big: added Float.Add example, remove warning from Floats

Change-Id: If04840c34b0ac5168ce1699eae880f04ae21c84c
Reviewed-on: https://go-review.googlesource.com/6680
Reviewed-by: Alan Donovan <adonovan@google.com>
10 years agomath/big: remove Float.Lsh/Rsh; added shift example
Robert Griesemer [Tue, 3 Mar 2015 20:53:41 +0000 (12:53 -0800)]
math/big: remove Float.Lsh/Rsh; added shift example

Shifts are trivially implemented by combining
Float.MantExp and Float.SetMantExp.

Change-Id: Ia2fb49297d8ea7aa7d64c8b1318dc3dc7c8af2f7
Reviewed-on: https://go-review.googlesource.com/6671
Reviewed-by: Alan Donovan <adonovan@google.com>
10 years agomath/big: introduce Undef Accuracy, use for NaN operands/results
Robert Griesemer [Tue, 3 Mar 2015 19:37:06 +0000 (11:37 -0800)]
math/big: introduce Undef Accuracy, use for NaN operands/results

This change represents Accuracy as a bit pattern rather than
an ordered value; with a new value Undef which is both Below
and Above.

Change-Id: Ibb96294c1417fb3cf2c3cf2374c993b0a4e106b3
Reviewed-on: https://go-review.googlesource.com/6650
Reviewed-by: Alan Donovan <adonovan@google.com>
10 years agomath/big: modified MantExp semantics to enable fast exponent access
Robert Griesemer [Sat, 28 Feb 2015 01:52:12 +0000 (17:52 -0800)]
math/big: modified MantExp semantics to enable fast exponent access

Change-Id: I9a6ebb747d5b9756c214bdeb19f60820602d7a24
Reviewed-on: https://go-review.googlesource.com/6340
Reviewed-by: Alan Donovan <adonovan@google.com>
10 years agomath/big: implement NaN
Robert Griesemer [Mon, 2 Mar 2015 23:36:19 +0000 (15:36 -0800)]
math/big: implement NaN

This change introduces NaNs (for situations like Inf-Inf, etc.).
The implementation is incomplete (the four basic operations produce
a NaN if any of the operands is an Inf or a NaN); and some operations
produce incorrect accuracy for NaN arguments. These are known bugs
which are documented.

Change-Id: Ia88841209e47930681cef19f113e178f92ceeb33
Reviewed-on: https://go-review.googlesource.com/6540
Reviewed-by: Alan Donovan <adonovan@google.com>
10 years agoruntime: use multiply instead of divide in heapBitsForObject
Russ Cox [Wed, 4 Mar 2015 16:34:50 +0000 (11:34 -0500)]
runtime: use multiply instead of divide in heapBitsForObject

These benchmarks show the effect of the combination of this change
and Rick's pending CL 6665. Code with interior pointers is helped
much more than code without, but even code without doesn't suffer
too badly.

benchmark                          old ns/op      new ns/op      delta
BenchmarkBinaryTree17              6989407768     6851728175     -1.97%
BenchmarkFannkuch11                4416250775     4405762558     -0.24%
BenchmarkFmtFprintfEmpty           134            130            -2.99%
BenchmarkFmtFprintfString          491            402            -18.13%
BenchmarkFmtFprintfInt             430            420            -2.33%
BenchmarkFmtFprintfIntInt          748            663            -11.36%
BenchmarkFmtFprintfPrefixedInt     602            534            -11.30%
BenchmarkFmtFprintfFloat           728            699            -3.98%
BenchmarkFmtManyArgs               2528           2507           -0.83%
BenchmarkGobDecode                 17448191       17749756       +1.73%
BenchmarkGobEncode                 14579824       14370183       -1.44%
BenchmarkGzip                      656489990      652669348      -0.58%
BenchmarkGunzip                    141254147      141099278      -0.11%
BenchmarkHTTPClientServer          94111          93738          -0.40%
BenchmarkJSONEncode                36305013       36696440       +1.08%
BenchmarkJSONDecode                124652000      128176454      +2.83%
BenchmarkMandelbrot200             6009333        5997093        -0.20%
BenchmarkGoParse                   7651583        7623494        -0.37%
BenchmarkRegexpMatchEasy0_32       213            213            +0.00%
BenchmarkRegexpMatchEasy0_1K       511            494            -3.33%
BenchmarkRegexpMatchEasy1_32       186            187            +0.54%
BenchmarkRegexpMatchEasy1_1K       1834           1827           -0.38%
BenchmarkRegexpMatchMedium_32      427            412            -3.51%
BenchmarkRegexpMatchMedium_1K      154841         153086         -1.13%
BenchmarkRegexpMatchHard_32        7473           7478           +0.07%
BenchmarkRegexpMatchHard_1K        233587         232272         -0.56%
BenchmarkRevcomp                   918797689      944528032      +2.80%
BenchmarkTemplate                  167665081      167773121      +0.06%
BenchmarkTimeParse                 631            636            +0.79%
BenchmarkTimeFormat                672            666            -0.89%

Change-Id: Ia923de3cdb3993b640fe0a02cbe2c7babc16f32c
Reviewed-on: https://go-review.googlesource.com/6782
Reviewed-by: Rick Hudson <rlh@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
10 years agocmd/internal/gc, runtime: change growslice to use int instead of int64
Matthew Dempsky [Fri, 27 Feb 2015 06:13:05 +0000 (15:13 +0900)]
cmd/internal/gc, runtime: change growslice to use int instead of int64

Gc already calculates n as an int, so converting to int64 to call
growslice doesn't serve any purpose except to emit slightly larger
code on 32-bit platforms.  Passing n as an int shrinks godoc's text
segment by 8kB (9472633 => 9464133) when building for ARM.

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

10 years agocmd/internal/obj/x86: change SHRQ to store second source in From3, not jammed into...
Russ Cox [Tue, 3 Mar 2015 23:47:44 +0000 (18:47 -0500)]
cmd/internal/obj/x86: change SHRQ to store second source in From3, not jammed into From

SHRQ CX, DX:AX is changing to SHRQ CX, AX, DX.
This is the first step: using SHRQ From=CX, From3=AX, To=DX
as the preferred encoding.
Once the assemblers and 6g have been updated,
support for the old encoding can be removed.

Change-Id: Ie603fb8ac25a6df78e42f7ddcae078a7684a7c26
Reviewed-on: https://go-review.googlesource.com/6693
Reviewed-by: Rob Pike <r@golang.org>
10 years agoruntime: bound defer pools (try 2)
Dmitry Vyukov [Thu, 5 Feb 2015 13:35:41 +0000 (13:35 +0000)]
runtime: bound defer pools (try 2)

The unbounded list-based defer pool can grow infinitely.
This can happen if a goroutine routinely allocates a defer;
then blocks on one P; and then unblocked, scheduled and
frees the defer on another P.
The scenario was reported on golang-nuts list.

We've been here several times. Any unbounded local caches
are bad and grow to infinite size. This change introduces
central defer pool; local pools become fixed-size
with the only purpose of amortizing accesses to the
central pool.

Freedefer now executes on system stack to not consume
nosplit stack space.

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

10 years agoruntime: bound sudog cache
Dmitry Vyukov [Mon, 2 Feb 2015 21:33:02 +0000 (00:33 +0300)]
runtime: bound sudog cache

The unbounded list-based sudog cache can grow infinitely.
This can happen if a goroutine is routinely blocked on one P
and then unblocked and scheduled on another P.
The scenario was reported on golang-nuts list.

We've been here several times. Any unbounded local caches
are bad and grow to infinite size. This change introduces
central sudog cache; local caches become fixed-size
with the only purpose of amortizing accesses to the
central cache.

The change required to move sudog cache from mcache to P,
because mcache is not scanned by GC.

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

10 years agocmd/internal/ld: fix symbol visibility for external linking
Shenghou Ma [Wed, 4 Mar 2015 01:45:00 +0000 (20:45 -0500)]
cmd/internal/ld: fix symbol visibility for external linking

The original C code is: (x->type & SHIDDEN) ? 2 : 0, however when
cleaning up the code for c2go, the ternary operator is rewritten in
the exact opposite way.

We need a test for this, and that's being tracked as #10070.

Fixes #10067.

Change-Id: I24a5e021597d8bc44218c6e75bab6446513b76cf
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/6730
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agoliblink, cmd/6l: re-enable -shared on amd64
Michael Hudson-Doyle [Tue, 10 Feb 2015 02:56:32 +0000 (15:56 +1300)]
liblink, cmd/6l: re-enable -shared on amd64

The creation of liblink and subsequent introduction of more explicit
TLS handling broke 6l's (unsupported) -shared flag.  This change adds
-shared flags to cmd/asm and 6g and changes liblink to generate shared-
library compatible instruction sequences when they are passed, and
changes 6l to emit the appropriate ELF relocation.

A proper fix probably also requires go tool changes.

Fixes #9652.

Change-Id: I7b7718fe7305c802ac994f4a5c8de68cfbe6c76b
Reviewed-on: https://go-review.googlesource.com/4321
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

10 years agobuild: don't run a cgo test when cgo is disabled
Brad Fitzpatrick [Tue, 3 Mar 2015 23:50:32 +0000 (15:50 -0800)]
build: don't run a cgo test when cgo is disabled

Fixes the linux-amd64-nocgo builder.

Regression from https://golang.org/cl/6531

Change-Id: Ibffd1ecfee4a888605ed54196f53956ae42e591c
Reviewed-on: https://go-review.googlesource.com/6700
Reviewed-by: Andrew Gerrand <adg@golang.org>
10 years agoimage: make Rectangle implement Image.
Nigel Tao [Tue, 3 Mar 2015 01:59:23 +0000 (12:59 +1100)]
image: make Rectangle implement Image.

Change-Id: I01e328fc3644b679bacf2209c3d7ade9d8bffe53
Reviewed-on: https://go-review.googlesource.com/6551
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/asm: move some machine-dependent code out of the asm directory
Rob Pike [Tue, 3 Mar 2015 20:25:27 +0000 (12:25 -0800)]
cmd/asm: move some machine-dependent code out of the asm directory

cmd/asm/internal/asm no longer imports obj/$GOARCH, only obj itself.

Change-Id: I7c0d107524d833b4a1b6e6a497cca4addadee570
Reviewed-on: https://go-review.googlesource.com/6670
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agocmd/internal/obj: print g for the g register on arm and ppc64
Rob Pike [Tue, 3 Mar 2015 17:14:31 +0000 (09:14 -0800)]
cmd/internal/obj: print g for the g register on arm and ppc64

The name g is an alias for R10 and R30, respectively. Have Rconv
print the alias, for consistency with the input language.

Change-Id: Ic3f40037884a0c8de5089d8c8a8efbcdc38c0d56
Reviewed-on: https://go-review.googlesource.com/6630
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agobuild: convert run.bash, run.bat, and run.rc into a Go program
Brad Fitzpatrick [Tue, 3 Mar 2015 01:07:11 +0000 (17:07 -0800)]
build: convert run.bash, run.bat, and run.rc into a Go program

This will enable test sharding over multiple VMs, to speed trybot answers.

Update #10029

Change-Id: Ie277c6459bc38005e4d6af14d22effeaa0a4667e
Reviewed-on: https://go-review.googlesource.com/6531
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
10 years agonet/http: disable segfaulting test on darwin/arm
David Crawshaw [Tue, 3 Mar 2015 22:59:21 +0000 (17:59 -0500)]
net/http: disable segfaulting test on darwin/arm

Issue #10043

Change-Id: I6ce7f303cd96ac575f7a673dd4a459339382d22e
Reviewed-on: https://go-review.googlesource.com/6692
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agomisc/ios: run lldb commands much more carefully
David Crawshaw [Tue, 3 Mar 2015 22:54:42 +0000 (17:54 -0500)]
misc/ios: run lldb commands much more carefully

We now wait until we see the completed prompt from a command before
proceeding. This seems to cut down on a spurious error I have seen
this afternoon.

Change-Id: Ic0a3481d8c265c3c3b4449ec7ac1c2752b85b0b6
Reviewed-on: https://go-review.googlesource.com/6691
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
10 years agocmd/asm: LOOP is a branch instruction on x86
Rob Pike [Tue, 3 Mar 2015 17:30:07 +0000 (09:30 -0800)]
cmd/asm: LOOP is a branch instruction on x86

Just a missed case in in the handling of branches.

Fixes #10065

Change-Id: I6be054d30bf1f383c12b4c7626abd5f8ae22b22e
Reviewed-on: https://go-review.googlesource.com/6631
Reviewed-by: Minux Ma <minux@golang.org>
10 years agocmd/internal/obj/ppc64: fix ppc64 build
Dave Cheney [Tue, 3 Mar 2015 21:54:16 +0000 (08:54 +1100)]
cmd/internal/obj/ppc64: fix ppc64 build

Apply mask fix from 527b478 to ppc64.

Change-Id: Iac62228f0f04fa8b138e21d82786026158267aaf
Reviewed-on: https://go-review.googlesource.com/6582
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/internal/ld: make ELF constants explicit
Michael Hudson-Doyle [Tue, 3 Mar 2015 21:28:18 +0000 (10:28 +1300)]
cmd/internal/ld: make ELF constants explicit

c2go produced accurate but complex constant definitions like
"ElfSymBindLocal  = 0 + iota - 67" which break when any constants
are added above them in the list. Change them to explicit values
in separate blocks by class. I wrote a little program (using awk)
to dump the values of the constants:

    https://gist.github.com/mwhudson/82f82008279a38ce584e

and confirmed that its output before and after this change is the
same.

Change-Id: Ib4aea4a0d688a16cdcb76af4715d1a97ec0f013c
Reviewed-on: https://go-review.googlesource.com/6581
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agocmd/internal/gc: clean up liveness code
Russ Cox [Tue, 3 Mar 2015 02:25:33 +0000 (21:25 -0500)]
cmd/internal/gc: clean up liveness code

- use Bvec, not *Bvec, and bulk allocate backing store
- use range loops
- put Bvecs in BasicBlock struct instead of indexing into parallel slices

Change-Id: I5cb30f50dccb4d38cc18fae422f7f132c52876be
Reviewed-on: https://go-review.googlesource.com/6602
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/internal/gc: manual goto removal + grind to move var decls
Russ Cox [Tue, 3 Mar 2015 01:34:22 +0000 (20:34 -0500)]
cmd/internal/gc: manual goto removal + grind to move var decls

Also change gc.Naddr to return the Addr instead of filling it in.

Change-Id: I98a86705d23bee49626a12a042a4d51cabe290ea
Reviewed-on: https://go-review.googlesource.com/6601
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/internal/gc: replace hash tables with Go maps
Russ Cox [Mon, 2 Mar 2015 21:21:15 +0000 (16:21 -0500)]
cmd/internal/gc: replace hash tables with Go maps

The C version of the compiler had just one hash table,
indexed by a (name string, pkg *Pkg) pair.
Because we always know the pkg during a lookup,
replace the one table with a per-Pkg map[string]*Sym.
This also lets us do non-allocating []byte key lookups.

This CL *does* change the generated object files.
In the old code, export data and init calls were emitted
in "hash table order". Now they are emitted in the order
in which they were added to the table.

Change-Id: I5a48d5c9add996dc43ad04a905641d901522de0b
Reviewed-on: https://go-review.googlesource.com/6600
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/internal/gc: delete Strlit, Zconv
Russ Cox [Mon, 2 Mar 2015 21:03:26 +0000 (16:03 -0500)]
cmd/internal/gc: delete Strlit, Zconv

Strlit was just a poor excuse for a Go string.
Use a Go string.
In the one case where it was a string-or-nil (Type.Note), use a *string.

Zconv was a poor excuse for %q. Use %q.
The only important part about Zconv's implementation
was that the compiler and linker agreed on the quoting rules.
Now they both use %q instead of having two Zconvs.

This CL *does* change the generated object files, because the
quoted strings end up in symbol names.
For example the string "\r\n" used to be named go.string."\r\n"
and is now go.string."\x0d\n".

Change-Id: I5c0d38e1570ffc495f0db1a20273c9564104a7e8
Reviewed-on: https://go-review.googlesource.com/6519
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/internal/gc: change proginfo to return ProgInfo instead of writing to param
Russ Cox [Mon, 2 Mar 2015 20:22:19 +0000 (15:22 -0500)]
cmd/internal/gc: change proginfo to return ProgInfo instead of writing to param

This avoids the argument appearing to escape
(due to the fact that proginfo is always called
via a function pointer).

Change-Id: Ib9351ba18c80fd89e6a1d4f19dea386d4c657337
Reviewed-on: https://go-review.googlesource.com/6518
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/5g etc: mechanical cleanup
Russ Cox [Mon, 2 Mar 2015 19:22:05 +0000 (14:22 -0500)]
cmd/5g etc: mechanical cleanup

Run rsc.io/grind rev 796d0f2 on C->Go conversions.

This replaces various awkward := initializations with plain var declarations.

Checked bit-for-bit compatibility with toolstash + buildall.

Change-Id: I601101d8177894adb9b0e3fb55dfe0ed4f544716
Reviewed-on: https://go-review.googlesource.com/6517
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agomisc/ios: extra stdout check before run
David Crawshaw [Tue, 3 Mar 2015 19:18:56 +0000 (14:18 -0500)]
misc/ios: extra stdout check before run

On one recent job I saw an unexpected SIGSTOP, which I suspect is
simply the job timeout. But the lack of other diagnostics suggests
lldb just didn't see the "run" command.

-----

process handle SIGHUP  --stop false --pass true --notify false
process handle SIGPIPE --stop false --pass true --notify false
process handle SIGUSR1 --stop false --pass true --notify false
process handle SIGSEGV --stop false --pass true --notify false
process handle SIGBUS  --stop false --pass true --notify false
breakpoint set -n getwd
run
(lldb) NAME        PASS   STOP   NOTIFY
==========  =====  =====  ======
SIGHUP      true   false  false
(lldb) NAME        PASS   STOP   NOTIFY
==========  =====  =====  ======
SIGPIPE     true   false  false
(lldb) NAME        PASS   STOP   NOTIFY
==========  =====  =====  ======
SIGUSR1     true   false  false
(lldb) NAME        PASS   STOP   NOTIFY
==========  =====  =====  ======
SIGSEGV     true   false  false
(lldb) NAME        PASS   STOP   NOTIFY
==========  =====  =====  ======
SIGBUS      true   false  false
(lldb) Breakpoint 1: where = libsystem_c.dylib`getwd, address = 0x2f7f7294
(lldb) Process 23755 stopped
* thread #1: tid = 0x104c02, 0x1febb000 dyld`_dyld_start, stop reason = signal SIGSTOP
    frame #0: 0x1febb000 dyld`_dyld_start
dyld`_dyld_start:
-> 0x1febb000:  mov    r8, sp
   0x1febb004:  sub    sp, sp, #0x10
   0x1febb008:  bic    sp, sp, #0x7
   0x1febb00c:  ldr    r3, [pc, #112]            ; _dyld_start + 132
(lldb) go_darwin_arm_exec: timeout (stage br getwd)
FAIL compress/gzip 359.226s

Change-Id: Ifc2123f5ceaa6d3f9b31bb5cb6e77a2c8ec23818
Reviewed-on: https://go-review.googlesource.com/6613
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
10 years agogo/build: skip GOROOT tests on darwin/arm
David Crawshaw [Tue, 3 Mar 2015 19:55:04 +0000 (14:55 -0500)]
go/build: skip GOROOT tests on darwin/arm

Change-Id: If2d303caae933eec61634152e5d83faaba591315
Reviewed-on: https://go-review.googlesource.com/6660
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
10 years agocmd/internal/obj/arm: fix arm build
Rob Pike [Tue, 3 Mar 2015 18:12:26 +0000 (10:12 -0800)]
cmd/internal/obj/arm: fix arm build

Mishandled the mask for the arm instructions.

TBR=rsc

Change-Id: Idc596097c0fa61dcacdfb4aca5bc6d0b4fd40eeb
Reviewed-on: https://go-review.googlesource.com/6641
Reviewed-by: Rob Pike <r@golang.org>
10 years agoruntime: remove makeStringSlice
David Crawshaw [Tue, 3 Mar 2015 17:25:36 +0000 (12:25 -0500)]
runtime: remove makeStringSlice

Change-Id: I38d716de9d5a9c1b868641262067d0456d52c86d
Reviewed-on: https://go-review.googlesource.com/6612
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agoruntime: Update open/close/read/write to return -1 on error.
Keith Randall [Tue, 3 Mar 2015 04:16:48 +0000 (20:16 -0800)]
runtime: Update open/close/read/write to return -1 on error.

Error detection code copied from syscall, where presumably
we actually do it right.

Note that we throw the errno away.  The runtime doesn't use it.

Fixes #10052

Change-Id: I8de77dda6bf287276b137646c26b84fa61554ec8
Reviewed-on: https://go-review.googlesource.com/6571
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agocmd/internal/obj: switch to one global Aconv
Rob Pike [Tue, 3 Mar 2015 04:17:20 +0000 (20:17 -0800)]
cmd/internal/obj: switch to one global Aconv

Aconv is the pretty-printer for instruction opcodes like AMOVQ.
There was one for each architecture.
Make the space of A names have a different region for each architecture,
much as we did for the registers, so a single global Aconv function can
do the work. Each architecture registers its region as a slice of names
at a given offset.

The global names like CALL and JMP are now defined only once.

The A values are used for indexing tables, so make it easy to do the
indexing by making the offset maskable.

Remove a bunch of now-duplicated architecture-specific code.

Change-Id: Ib15647b7145a1c089e21e36543691a19e146b60e
Reviewed-on: https://go-review.googlesource.com/6620
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

10 years agocmd/internal/ld: fix darwin/386
Russ Cox [Tue, 3 Mar 2015 15:47:15 +0000 (10:47 -0500)]
cmd/internal/ld: fix darwin/386

grind's goto inliner moved a continue and changed its meaning. Oops.

Change-Id: Ifa2d3e1427036a606a069f356cd9b586ef22ec84
Reviewed-on: https://go-review.googlesource.com/6610
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agocmd/internal/ld: minor int to bool cleanup
Brad Fitzpatrick [Mon, 2 Mar 2015 19:31:29 +0000 (11:31 -0800)]
cmd/internal/ld: minor int to bool cleanup

Change-Id: I3078385f5e7c92fbf99af7c4ae8918c86b9f86c9
Reviewed-on: https://go-review.googlesource.com/6500
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

10 years agotime: zoneinfo support for darwin
David Crawshaw [Tue, 3 Mar 2015 12:45:06 +0000 (07:45 -0500)]
time: zoneinfo support for darwin

Roll forward of 54efdc596f7b. Better testing of the build on
darwin/amd64. There is still some variance between cmd/dist
and the Go tool for build tag handling.

Change-Id: I105669ae7f90c8c89b3839c04b182cff46be8dde
Reviewed-on: https://go-review.googlesource.com/6516
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
10 years agoencoding/xml: fix namespaces in a>b tags
Roger Peppe [Wed, 25 Feb 2015 13:42:54 +0000 (13:42 +0000)]
encoding/xml: fix namespaces in a>b tags

Previously, if there was a namespace defined on
a a>b tag, the namespace was ignored when
printing the parent elements. This fixes that,
and also fixes the racy behaviour of printerStack.trim
as discussed in https://go-review.googlesource.com/#/c/4152/10 .

Fixes #9796.

Change-Id: I75f97f67c08bbee151d1e0970f8462dd0f4511ef
Reviewed-on: https://go-review.googlesource.com/5910
Reviewed-by: Nigel Tao <nigeltao@golang.org>
10 years agocmd/{5,6,8,9}g, cmd/internal/gc: use bools for is* and okfor*
Josh Bleecher Snyder [Sun, 1 Mar 2015 07:54:01 +0000 (07:54 +0000)]
cmd/{5,6,8,9}g, cmd/internal/gc: use bools for is* and okfor*

No functional changes.

This diff was generated as follows:

* Manually edit cmd/internal/gc/go.go to update types and group variables.
* Manually edit initialization in cmd/internal/gc/align.go--localized s/1/true.
* Manually fix the handling of sign in cmd/internal/gc/walk.go in func bounded (near line 4000).
* Manually update go.y and regenerate y.go.
* Run gofmt -r many times to do the rest, using https://gist.github.com/josharian/0f61dbb2dff81f938e70.

toolstash -cmp on the stdlib comes back green.

Change-Id: I19766ed551714e51b325133e7138818d117b3a9a
Reviewed-on: https://go-review.googlesource.com/6530
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agocmd/internal/gc: clean up switch code
Josh Bleecher Snyder [Fri, 27 Feb 2015 20:44:45 +0000 (20:44 +0000)]
cmd/internal/gc: clean up switch code

This CL makes the switch walking and typechecking code
more idiomatic and adds documentation.
It also removes all but one global variable.

No functional changes. Confirmed with toolstash -cmp on the stdlib.

Change-Id: Ic3f38acc66e906edd722498839aeb557863639cf
Reviewed-on: https://go-review.googlesource.com/6268
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agosyscall: fix parsing ipv6 address prefix on dragonfly
Mikio Hara [Sun, 1 Mar 2015 14:58:28 +0000 (23:58 +0900)]
syscall: fix parsing ipv6 address prefix on dragonfly

This change fixes a missing case that a routing address contains an
invalid address family label but it holds a valid length of address
structure.

Also makes test robust.

Fixes #10041.

Change-Id: I2480ba273929e859896697382d1a75b01a116b98
Reviewed-on: https://go-review.googlesource.com/6391
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>