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

17467 Commits

Author SHA1 Message Date
Rob Pike
5d987f1513 cmd/asm: implement MCR instruction on ARM
It's an oddball that needs special treatment because it is not really
an opcode, but a variant of MRC.

The String method of Prog still needs updating to print it nicely.

Change-Id: I6005b7f2234ccd3d4ac1f658948e3be97cf1f1c2
Reviewed-on: https://go-review.googlesource.com/7220
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-03-11 17:22:03 +00:00
Dmitry Vyukov
7b0c73aa28 cmd/trace: move goroutine analysis code to internal/trace
This allows to test goroutine analysis code in runtime/pprof tests.
Also fix a nil-deref crash in goroutine analysis code that happens on runtime/pprof tests.

Change-Id: Id7884aa29f7fe4a8d7042482a86fe434e030461e
Reviewed-on: https://go-review.googlesource.com/7301
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-03-11 12:53:24 +00:00
Dmitry Vyukov
9d332a8324 cmd/trace: dump thread id on proc start
Augment ProcStart events with OS thread id.
This helps in scheduler locality analysis.

Change-Id: I93fea75d3072cf68de66110d0b59d07101badcb5
Reviewed-on: https://go-review.googlesource.com/7302
Reviewed-by: Keith Randall <khr@golang.org>
2015-03-11 12:52:41 +00:00
Matthew Dempsky
b2843becab cmd/yacc/testdata/expr: fix handling of negative numbers
Fixes #10129.

Change-Id: I9f56c483726f14b6c1909740549de236d5bf9cfb
Reviewed-on: https://go-review.googlesource.com/7340
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-03-11 04:20:42 +00:00
Dave Cheney
e498181942 cmd/internal/gc: more Node cleanups
More cleanups to gc.Node

- make Node.Local a boolean
- make Type.Local a boolean
- reduce the size of Node.Esc to a uint8

Reducing the size of Node.Esc shaves ~45mb off the RSS compiling cmd/internal/gc on amd64

before:
        Maximum resident set size (kbytes): 659496
after:
        Maximum resident set size (kbytes): 612196

- declare gc.Funcdepth as int32
- declare Node.Funcdepth as int32

In both cases, these were previously machine specific int types. This doesn't result in
any memory saving at the moment due to struct padding.

Change-Id: Iabef8da15e962fe8b79d7fd3d402fb26ce7ec31c
Reviewed-on: https://go-review.googlesource.com/7261
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-03-11 02:58:03 +00:00
Dave Cheney
b353a69509 debug/elf: fix arm build
This change adds the minimum necessary to implement applyRelocations.

For adg, this code uses the switch statement.

Change-Id: I0989daab8d0e36c2a4f6a315ced258b832744616
Reviewed-on: https://go-review.googlesource.com/7266
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-03-11 01:37:57 +00:00
Nigel Tao
782db7fc88 image/jpeg: support chroma hv values other than 0x11.
The testdata was generated by:
convert video-001.png tmp1.tga
cjpeg -quality 100 -sample 2x2,1x2,1x2 tmp1.tga > video-001.221212.jpeg
djpeg -nosmooth -targa video-001.221212.jpeg > tmp2.tga
convert tmp2.tga video-001.221212.png
rm tmp1.tga tmp2.tga

Change-Id: Ica241dfc19b3eb47ade150bf0432373c6006c38a
Reviewed-on: https://go-review.googlesource.com/7264
Reviewed-by: Rob Pike <r@golang.org>
2015-03-11 00:10:09 +00:00
Dave Cheney
532bc5f11c syscall: exec_linux.go: support platforms without SYS_DUP2
Updates #9974

This change is in preparation for merging the arm64 platform.

Arm64 does not support SYS_DUP2 at all, so define a new constant to be
the minimum dup(2) version supported. This constant defaults to SYS_DUP2
on all existing platforms.

Change-Id: If405878105082c7c880f8541c1491970124c9ce4
Reviewed-on: https://go-review.googlesource.com/7123
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-03-10 22:52:09 +00:00
Shenghou Ma
f00c19add5 cmd/7g, cmd/7l, cmd/go: copy 9g/9l to 7g/7l, and build as tools
Kick start the upstreaming of the arm64 port. The only manual
change is cmd/go/pkg.go.

Change-Id: I0607ad045486f0998c4e21654b59276ca5348069
Reviewed-on: https://go-review.googlesource.com/7075
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
Run-TryBot: Aram Hăvărneanu <aram@mgk.ro>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-03-10 18:52:12 +00:00
Robert Griesemer
d7e043eaf5 go/ast: fixed minor typo in comment
Fixes #10125.

Change-Id: I99032912650cef8e5bf124bda0a60d5899760103
Reviewed-on: https://go-review.googlesource.com/7320
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-03-10 16:40:15 +00:00
Dmitry Vyukov
5471e02338 runtime/pprof: fix trace test
Some of the trace stacks are OS-dependent due to OS-specific code
in net package. Check these stacks only on subset of OSes.

Change-Id: If95e4485839f4120fd6395725374c3a2f8706dfc
Reviewed-on: https://go-review.googlesource.com/7300
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2015-03-10 16:29:25 +00:00
Rick Hudson
d0eab03091 runtime: Adjust when write barriers are active
Even though the world is stopped the GC may do pointer
writes that need to be protected by write barriers.
This means that the write barrier must be on
continuously from the time the mark phase starts and
the mark termination phase ends. Checks were added to
ensure that no allocation happens during a GC.

Hoist the logic that clears pools the start of the GC
so that the memory can be reclaimed during this GC cycle.

Change-Id: I9d1551ac5db9bac7bac0cb5370d5b2b19a9e6a52
Reviewed-on: https://go-review.googlesource.com/6990
Reviewed-by: Austin Clements <austin@google.com>
2015-03-10 15:04:12 +00:00
Dmitry Vyukov
919fd24884 runtime: remove runtime frames from stacks in traces
Stip uninteresting bottom and top frames from trace stacks.
This makes both binary and json trace files smaller,
and also makes stacks shorter and more readable in the viewer.

Change-Id: Ib9c80ccc280504f0e235f867f53f1d2652c41583
Reviewed-on: https://go-review.googlesource.com/5523
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
2015-03-10 14:46:15 +00:00
Austin Clements
fdd49d2be0 debug/dwarf: add unit tests for line table reader
This adds simple ELF test binaries generated by gcc and clang and
compares the line tables returned by the line table reader against
tables based on the output of readelf.

The binaries were generated with
    # gcc --version | head -n1
    gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2
    # gcc -g -o line-gcc.elf line*.c

    # clang --version | head -n1
    Ubuntu clang version 3.4-1ubuntu3 (tags/RELEASE_34/final) (based on LLVM 3.4)
    # clang -g -o line-clang.elf line*.c

Change-Id: Id210fdc1d007ac9719e8f5dc845f2b94eed12234
Reviewed-on: https://go-review.googlesource.com/7070
Reviewed-by: Nigel Tao <nigeltao@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2015-03-10 02:32:48 +00:00
Austin Clements
3393009267 debug/dwarf: add support for line tables
This implements a LineReader for line tables that parallels the
existing Reader for debug entries.

This code is partly based on the debug subrepo's fork of dwarf, but it
is a more complete (and, I believe, correct) implementation of the
spec and exposes a more general API.  While the debug subrepo's
implementation exposed only a PC-to-line function, this version
exposes the line table rows to the caller.  This way the caller can
make its own trade-offs when implementing PC-to-line (or line-to-PC),
such as whether or not to build an index for fast lookup.

Change-Id: Ie157bc817f55e940b6f2e1ae010c5a4e1f29c5c8
Reviewed-on: https://go-review.googlesource.com/6734
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-03-10 02:32:42 +00:00
Austin Clements
0e31b4ed26 debug/dwarf: factor finding unit containing entry offset
This factors out the code for finding which unit contains an offset in
the "info" section.  The new code also replaces linear search with a
binary search.  The line table reader will also need this
functionality.

Change-Id: I2076e4fc6719b6f06fd2796cbbc7548ec1876cb3
Reviewed-on: https://go-review.googlesource.com/6733
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-03-10 02:32:37 +00:00
Austin Clements
de1693f984 debug/macho, debug/pe: load DWARF line section and pass to dwarf.New
Change-Id: I1e6c6b3e2984528c0331e17755cc057e7199193e
Reviewed-on: https://go-review.googlesource.com/7071
Reviewed-by: Nigel Tao <nigeltao@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2015-03-10 02:32:31 +00:00
Austin Clements
29ad1ae420 debug/elf: load .debug_line section and pass to dwarf.New
Change-Id: Ia6f9bd77a3d4250339dcb054edc76942864dd358
Reviewed-on: https://go-review.googlesource.com/6781
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-03-10 02:32:25 +00:00
Austin Clements
4ee347b0ad debug/elf: regularize DWARF section loading
Previously, different DWARF sections had relocations applied in very
different ways.  .debug_info was relocated, but only on x86-64 and 386
and using hard-coded relocation section names instead of relocation
links.  .debug_abbrev and .debug_str were never relocated (which is
excusable because they shouldn't need it).  .debug_types sections were
relocated on all architectures and found their relocation section
using a relocation link because section names could be ambiguous.

Simplify all of this so that every DWARF section that has a linked
relocation section gets those relocations applied.

This prepares this code to load .debug_line sections without the need
for yet more ad hoc relocation logic.

Change-Id: Ia00ac8e656b22f22bb31a5f6ef9b0f23cda64d19
Reviewed-on: https://go-review.googlesource.com/6780
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-03-10 02:32:19 +00:00
Nigel Tao
cc009687bc image/jpeg: support RGB JPEG images.
The testdata was generated by:
convert video-001.png tmp1.tga
cjpeg -rgb -sample 2x2,1x1,1x1 tmp1.tga > video-001.rgb.jpeg
djpeg -nosmooth -targa video-001.rgb.jpeg > tmp2.tga
convert tmp2.tga video-001.rgb.png
rm tmp1.tga tmp2.tga

Change-Id: I5da0591b9005c1c75e807311f157d385e0e20a38
Reviewed-on: https://go-review.googlesource.com/6910
Reviewed-by: Rob Pike <r@golang.org>
2015-03-09 23:18:33 +00:00
Dave Cheney
d328756a69 cmd/internal/gc: make Node.Isddd boolean
Convert Node.Isddd to a boolean and simplify usage.

- Node.Isddd converted to bool
- Type.Isddd converted to bool
- mkinlcall converted to take isddd as a bool
- typecheckaste converted to take isddd as a bool
- ascompatte converted to take isddd as a bool

Change-Id: I52586145619c44182bb0c2c5d80a0a3fe3e50a07
Reviewed-on: https://go-review.googlesource.com/7172
Reviewed-by: Keith Randall <khr@golang.org>
2015-03-09 20:56:16 +00:00
David Crawshaw
402f71a839 runtime: do not share underlying envs/argv array
Removes a potential data race between os.Setenv and runtime.GOROOT,
along with a bug where os.Setenv would only sometimes change the
value of runtime.GOROOT.

Change-Id: I7d2a905115c667ea6e73f349f3784a1d3e8f810d
Reviewed-on: https://go-review.googlesource.com/6611
Reviewed-by: Keith Randall <khr@golang.org>
2015-03-09 17:25:23 +00:00
David Crawshaw
ac080fa6d8 net: skip unixgram tests on darwin/arm
Change-Id: I9d2c84237f7b1c4dc2e53adf249b7518dda81a21
Reviewed-on: https://go-review.googlesource.com/7165
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-03-09 15:34:32 +00:00
David Crawshaw
9b8ad3fde2 sync/atomic: skip test on darwin/arm
Updates #7338.

Change-Id: I859a73543352dbdd13ec05efb23a95aecbcc628a
Reviewed-on: https://go-review.googlesource.com/7164
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-03-09 14:10:25 +00:00
Roger Peppe
9f9d66d3b6 encoding/xml: fix default namespace of tags
The struct XMLName sets the default namespace, but
that's not good enough for nested tags, because an
earlier tag can set the implicit parents of a subsequent
tag. This change makes sure that we always explicitly set the
namespace on a tag when possible.

See https://go-review.googlesource.com/#/c/5910/4/src/encoding/xml/marshal_test.go@628
for discussion.

Change-Id: If1afc536471c0be83e5dd80381b598476ea3f44d
Reviewed-on: https://go-review.googlesource.com/6927
Reviewed-by: Nigel Tao <nigeltao@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-03-09 09:10:30 +00:00
Dave Cheney
44e903158f cmd/internal/gc: more Node cleanups
More Node cleanups, these ones touch go.y.

- convert Node.Implicit to bool
- convert Node.Used to bool

Change-Id: I85c7ff9e66cee7122b560adedc995166c874f2f2
Reviewed-on: https://go-review.googlesource.com/7124
Reviewed-by: Keith Randall <khr@golang.org>
2015-03-09 05:01:14 +00:00
Dave Cheney
42c8be4414 go/build: disable cgo by default for freebsd/arm
Updates #10119

Temporarily disable cgo by default to get the freebsd/arm
builder running again.

Change-Id: I4de1f896fcac650184df77c692b102ea6fb73bba
Reviewed-on: https://go-review.googlesource.com/7125
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-03-09 00:42:05 +00:00
Minux Ma
0d0124daa0 Revert "cmd/internal/obj/x86: implement -shared computation of TLS base"
Fix the build.

This reverts commit e73981512f.

Change-Id: I979e138991c06b3295be08212d3ce80b30c2381b
Reviewed-on: https://go-review.googlesource.com/7160
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Minux Ma <minux@golang.org>
2015-03-08 23:25:47 +00:00
Michael Hudson-Doyle
e73981512f 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>
2015-03-08 23:10:18 +00:00
Mikio Hara
bcf43e9565 net: gofmt
Change-Id: Ifcf7b96e67b63a08f410a7ba21e8bf4dd20e7d8e
Reviewed-on: https://go-review.googlesource.com/7122
Reviewed-by: Minux Ma <minux@golang.org>
2015-03-08 22:03:21 +00:00
Andrew Pilloud
f00362b9ec 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>
2015-03-08 09:58:11 +00:00
Shenghou Ma
cbc854a799 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>
2015-03-07 07:09:04 +00:00
Shenghou Ma
3b00197017 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>
2015-03-07 06:02:40 +00:00
tnt
de486b24d1 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>
2015-03-07 02:08:04 +00:00
Dave Cheney
b006d38acc 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>
2015-03-06 23:47:18 +00:00
Matthew Dempsky
665c3da33a 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>
2015-03-06 20:28:36 +00:00
Matthew Dempsky
90e02e8513 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>
2015-03-06 20:06:00 +00:00
Joël Stemmer
1d0a9eb8ab 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>
2015-03-06 18:18:40 +00:00
Ian Lance Taylor
4084b280f5 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>
2015-03-06 17:46:22 +00:00
Dave Cheney
7885de55dc 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>
2015-03-06 07:03:53 +00:00
Dave Cheney
5bf428ef80 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>
2015-03-06 06:53:04 +00:00
Dave Cheney
4a174ee4be 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>
2015-03-06 06:47:25 +00:00
Dave Cheney
4b6337813d 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>
2015-03-06 06:36:26 +00:00
Ian Lance Taylor
ddf958d468 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>
2015-03-06 03:41:32 +00:00
Robert Griesemer
f3d3328988 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>
2015-03-06 01:36:59 +00:00
Alex Brainman
d07e3380b0 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>
2015-03-06 01:35:02 +00:00
Matthew Dempsky
392434e1d0 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>
2015-03-05 22:59:28 +00:00
Russ Cox
ed263f4dd2 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>
2015-03-05 21:54:18 +00:00
Russ Cox
cdb7d7dcc2 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>
2015-03-05 21:49:39 +00:00
Russ Cox
d970bea885 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>
2015-03-05 21:47:44 +00:00
Russ Cox
5789b28525 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>
2015-03-05 21:41:55 +00:00
Matthew Dempsky
632217aae4 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>
2015-03-05 21:35:07 +00:00
Rob Pike
24a43e6a75 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>
2015-03-05 19:18:46 +00:00
Martin Möhrmann
d5b5d6702a 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>
2015-03-05 16:52:41 +00:00
Russ Cox
84f53339be 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>
2015-03-05 15:46:56 +00:00
Russ Cox
12079acaa0 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>
2015-03-05 15:46:46 +00:00
Dmitry Vyukov
6c58d28ca4 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>
2015-03-05 07:45:17 +00:00
Rob Pike
b0d545201e 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>
2015-03-05 06:09:14 +00:00
Russ Cox
29f18f2800 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>
2015-03-05 06:07:06 +00:00
Russ Cox
b66a509992 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>
2015-03-05 06:07:00 +00:00
Russ Cox
8afb3967a3 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>
2015-03-05 06:06:54 +00:00
Russ Cox
818eff0367 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>
2015-03-05 06:06:48 +00:00
Russ Cox
2897d6dea7 cmd/internal/gc: simplify some indexing
Change-Id: I7d289c7f250e4db551192d52535a90974685f0b3
Reviewed-on: https://go-review.googlesource.com/6891
Reviewed-by: Minux Ma <minux@golang.org>
2015-03-05 06:06:42 +00:00
Rob Pike
845c4ff52a 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>
2015-03-05 05:24:58 +00:00
Russ Cox
59584ede73 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>
2015-03-05 04:59:35 +00:00
Russ Cox
a0ac493852 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>
2015-03-05 04:14:00 +00:00
Russ Cox
0bf79b2de8 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>
2015-03-05 04:13:43 +00:00
Russ Cox
383e6b2ce2 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>
2015-03-05 04:13:34 +00:00
Dave Cheney
38a61ff41f 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>
2015-03-05 03:56:12 +00:00
Shenghou Ma
f09887cdce 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>
2015-03-05 03:40:42 +00:00
Russ Cox
43941d85cf 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>
2015-03-05 02:02:39 +00:00
Russ Cox
5a16d6fc34 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>
2015-03-05 02:02:34 +00:00
Russ Cox
494e317fbf 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>
2015-03-05 02:02:27 +00:00
Robert Griesemer
85626a9266 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>
2015-03-05 01:36:45 +00:00
Michael Hudson-Doyle
658a338f78 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>
2015-03-05 01:23:29 +00:00
David Crawshaw
5e49bfec92 net: fix darwin/amd64 build
Accidental semantics change in 4c6364a87d.

Change-Id: I0bbfc441662d79af4dbac6f9fc4e3a485adfb924
Reviewed-on: https://go-review.googlesource.com/6831
Reviewed-by: Minux Ma <minux@golang.org>
2015-03-04 22:56:23 +00:00
Nigel Tao
9b73ecc327 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>
2015-03-04 22:44:28 +00:00
Alex Brainman
d2918cbcaa 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>
2015-03-04 22:38:48 +00:00
David Crawshaw
2587520797 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>
2015-03-04 22:13:06 +00:00
Shenghou Ma
4c6364a87d 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>
2015-03-04 22:12:05 +00:00
Rick Hudson
122384e489 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>
2015-03-04 20:55:55 +00:00
Robert Griesemer
7be32d038a 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>
2015-03-04 18:24:53 +00:00
Robert Griesemer
2a1728d009 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>
2015-03-04 18:24:34 +00:00
Robert Griesemer
0a8a625848 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>
2015-03-04 18:24:15 +00:00
Robert Griesemer
ef0b03137d 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>
2015-03-04 18:23:43 +00:00
Robert Griesemer
d934d10a0b 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>
2015-03-04 18:23:22 +00:00
Robert Griesemer
ea1fafbccd 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>
2015-03-04 18:22:31 +00:00
Robert Griesemer
e053883352 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>
2015-03-04 18:22:01 +00:00
Russ Cox
9feb24f3ed 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>
2015-03-04 17:46:47 +00:00
Matthew Dempsky
81d4072eb0 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>
2015-03-04 17:17:17 +00:00
Russ Cox
3d0397a4f4 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>
2015-03-04 16:35:49 +00:00
Dmitry Vyukov
b759e225f5 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>
2015-03-04 14:29:58 +00:00
Dmitry Vyukov
5ef145c809 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>
2015-03-04 14:14:29 +00:00
Shenghou Ma
60b8908588 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>
2015-03-04 08:32:00 +00:00
Michael Hudson-Doyle
09d9520be9 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>
2015-03-04 01:55:30 +00:00
Brad Fitzpatrick
671472c1c9 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>
2015-03-04 00:25:25 +00:00
Nigel Tao
848e2feac6 image: make Rectangle implement Image.
Change-Id: I01e328fc3644b679bacf2209c3d7ade9d8bffe53
Reviewed-on: https://go-review.googlesource.com/6551
Reviewed-by: Rob Pike <r@golang.org>
2015-03-04 00:03:46 +00:00
Rob Pike
b745ab95af 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>
2015-03-04 00:01:01 +00:00
Rob Pike
f05f273525 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>
2015-03-04 00:00:51 +00:00
Brad Fitzpatrick
d5f690609f 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>
2015-03-03 23:22:11 +00:00