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

22453 Commits

Author SHA1 Message Date
Russ Cox
0c31992eb3 test: add test that variables captured by deferred funcs are current on fault
This came up in private mail.
It works today and I want to make sure it stays working.

Change-Id: I13ebdc2dfadb3c72d7f179be89883137320c05d0
Reviewed-on: https://go-review.googlesource.com/7390
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Rob Pike <r@golang.org>
2015-03-16 23:07:06 +00:00
Rob Pike
5764befa5a text/template: protect against explicit nil in field chains
An explicit nil in an expression like nil.Foo caused a panic
because the evaluator attempted to reflect on the nil.
A typeless nil like this cannot be used to do anything, so
just error out.

Fixes #9426

Change-Id: Icd2c9c7533dda742748bf161eced163991a12f54
Reviewed-on: https://go-review.googlesource.com/7643
Reviewed-by: David Symonds <dsymonds@golang.org>
2015-03-16 22:35:49 +00:00
Shenghou Ma
10a98dd6d9 doc/go_mem.html: correct the channel example
While we're here, also fix two HTML issues.

Fixes #9235.

Change-Id: I6e2f50931c0f387881271484a726ac2308518cf4
Reviewed-on: https://go-review.googlesource.com/7602
Reviewed-by: Rob Pike <r@golang.org>
2015-03-16 21:43:31 +00:00
Josh Bleecher Snyder
e2ca3e6c0f cmd/internal/gc: remove dead code
Change-Id: Id5ce859bd4b6318dc9104f7377ae23d7f0bc30cd
Reviewed-on: https://go-review.googlesource.com/7640
Reviewed-by: Minux Ma <minux@golang.org>
2015-03-16 19:43:12 +00:00
Aram Hăvărneanu
76a2ee3bcd cmd/objdump: disable TestDisasm.* on arm64
ARM64 doesn't have disassembler yet.

Change-Id: I016fa013b5ff50dc49d38ade42351b79be023d80
Reviewed-on: https://go-review.googlesource.com/7149
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-03-16 18:46:52 +00:00
Aram Hăvărneanu
a25e3c03f3 os/signal, hash/crc32: add arm64 build tags
Change-Id: I6ca9caec8ccf12618e56dcf6b83328e7acf8b1ec
Reviewed-on: https://go-review.googlesource.com/7148
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-03-16 18:46:43 +00:00
Aram Hăvărneanu
ddf6d8005d test: fix nosplit test, and disable nilptr3 test on arm64
Change-Id: I5d40e04395de743a8fdcfa8bdc0e580729bc66a3
Reviewed-on: https://go-review.googlesource.com/7147
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-03-16 18:46:35 +00:00
Aram Hăvărneanu
1abd8185b2 reflect: add support for GOARCH=arm64
Change-Id: I033eecff5e5838ba677378ac884bf5f29267e880
Reviewed-on: https://go-review.googlesource.com/7146
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-03-16 18:46:27 +00:00
Aram Hăvărneanu
2a0833da50 sync/atomic: add support for GOARCH=arm64
Change-Id: I11cd4b5e8daf3805af0eaa83b55b20da889702f4
Reviewed-on: https://go-review.googlesource.com/7145
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-03-16 18:46:18 +00:00
Aram Hăvărneanu
f0aef42ea1 math, math/big: add support for GOARCH=arm64
Change-Id: Ief12e1435a40dd2eaddc3f97f63be44c4dd2e050
Reviewed-on: https://go-review.googlesource.com/7144
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-03-16 18:46:10 +00:00
Aram Hăvărneanu
d0d9310df9 syscall: add support for GOARCH=arm64
Change-Id: Ia817e78d9678a365a76fea5e4dbe8f8a5aab0bac
Reviewed-on: https://go-review.googlesource.com/7143
Reviewed-by: Russ Cox <rsc@golang.org>
2015-03-16 18:46:02 +00:00
Aram Hăvărneanu
846ee0465b runtime: add support for linux/arm64
Change-Id: Ibda6a5bedaff57fd161d63fc04ad260931d34413
Reviewed-on: https://go-review.googlesource.com/7142
Reviewed-by: Russ Cox <rsc@golang.org>
2015-03-16 18:45:54 +00:00
Aram Hăvărneanu
5a0c322bce cmd/dist: add support for GOARCH=arm64
Change-Id: I92b4301b64054272d78dd15c16bf6ff592acad26
Reviewed-on: https://go-review.googlesource.com/7141
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-03-16 18:45:45 +00:00
Aram Hăvărneanu
3ab794c8c6 cmd/cgo: add support for GOARCH=arm64
Change-Id: Ia6c3d5e7a32b20e3c45d9485e66b48cd02644280
Reviewed-on: https://go-review.googlesource.com/7140
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-03-16 18:45:35 +00:00
Aram Hăvărneanu
02c1a9d87d cmd/7g: add ARM64 Go compiler, based on 9g
No peep optimizer yet.

Change-Id: Ifa5f993cd6ac5e34783c0df41faf772fbce96ae2
Reviewed-on: https://go-review.googlesource.com/7049
Reviewed-by: Russ Cox <rsc@golang.org>
2015-03-16 18:45:26 +00:00
Aram Hăvărneanu
3d1ce27ba5 cmd/7l: add the ARM64 linker
Only internal linking without cgo is supported for now.

Change-Id: I91eb1572c1ccc805db62fc4c29080df98797d51a
Reviewed-on: https://go-review.googlesource.com/7048
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-03-16 18:45:16 +00:00
Aram Hăvărneanu
18d9ddc35c cmd/asm: add support for ARM64
Pre/post-index addressing modes with writeback use .W and .P
instruction suffixes, like on ARM.

Complex addressing modes are not supported yet.

Change-Id: I537a1c3fe5b057c0812662677d0010bc8c468ffb
Reviewed-on: https://go-review.googlesource.com/7047
Reviewed-by: Rob Pike <r@golang.org>
2015-03-16 18:45:08 +00:00
Aram Hăvărneanu
26bbe7ac9b cmd/internal/obj, cmd/internal/obj/arm64: add support for GOARCH=arm64
ARM64 (ARMv8) has 32 general purpose, 64-bit integer registers
(R0-R31), 32 64-bit scalar floating point registers (F0-F31), and
32 128-bit vector registers (unused, V0-V31).

R31 is either the stack pointer (RSP), or the zero register (ZR),
depending on the instruction. Note the distinction between the
hardware stack pointer, RSP, and the virtual stack pointer SP.

The (hardware) stack pointer must be 16-byte aligned at all times;
the RSP register itself must be aligned, offset(RSP) only has to
have natural alignment.

Instructions are fixed-width, and are 32-bit wide. ARM64 supports
ARMv7 too (32-bit ARM), but not in the same process. In general,
there is not much in common between 32-bit ARM and ARM64, it's a
new architecture.

All implementations have floating point instructions.

This change adds a Prog.To3 field analogous to Prog.To. It is used
by exclusive load/store instructions such as STLXR which read from
one register, and write to both a register and a memory address.

	STLXRW	R1, (R0), R3

This will store the word contained in R1 to the memory address
pointed by R0. R3 will be updated with the status result of the
store. It is used to implement atomic operations.

No other changes are made to the portable Prog and Addr structures.

Change-Id: Ie839029aa5265bbad35769d9689eca11e1c48c47
Reviewed-on: https://go-review.googlesource.com/7046
Reviewed-by: Russ Cox <rsc@golang.org>
2015-03-16 18:44:57 +00:00
Aram Hăvărneanu
25e213752b cmd/go: disable verifyAsm for arm64
ARM64 doesn't have the old assembler.

Change-Id: I9253271029440e2b7f2813d3e98a7d2e7a65bfbc
Reviewed-on: https://go-review.googlesource.com/7045
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-03-16 18:44:47 +00:00
Aram Hăvărneanu
272921b5d8 go/build: add GOARCH=arm64
Change-Id: I51db032e3dc2762d94e4000914b30813946250f7
Reviewed-on: https://go-review.googlesource.com/7044
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2015-03-16 18:44:35 +00:00
Aram Hăvărneanu
c23e21e672 .gitignore: ignore ARM64 build products
Change-Id: I56297aac4ee282fd117ec525b88dee4769477111
Reviewed-on: https://go-review.googlesource.com/7560
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2015-03-16 18:44:22 +00:00
Shenghou Ma
dcf1ab3167 doc/go1.5: correct archive/zip change
Change-Id: I7bac7b659b7ff425c6f896c286d0f89f05eff6bd
Reviewed-on: https://go-review.googlesource.com/7601
Reviewed-by: Minux Ma <minux@golang.org>
2015-03-15 21:24:35 +00:00
Joel Sing
6900a421a4 sync/atomic: add support for openbsd/arm
Change-Id: I45383de6d627be35f40e07a9008b6773f5c2b0d0
Reviewed-on: https://go-review.googlesource.com/7613
Reviewed-by: Minux Ma <minux@golang.org>
2015-03-15 09:12:45 +00:00
Joel Sing
6ed6cb4550 cmd/dist: use GOARM=5 for openbsd/arm
OpenBSD/arm only currently supports softfloat, hence make the default GOARM=5.

Change-Id: Ie3e8f457f001b3803d17ad9bc4ab957b2da18c6a
Reviewed-on: https://go-review.googlesource.com/7614
Reviewed-by: Minux Ma <minux@golang.org>
2015-03-15 09:11:56 +00:00
Joel Sing
550149fb04 syscall: add support for openbsd/arm
Change-Id: I9fe15781f52e0d16707a9c021cf800319721a606
Reviewed-on: https://go-review.googlesource.com/4913
Reviewed-by: Minux Ma <minux@golang.org>
2015-03-15 04:07:54 +00:00
Joel Sing
be3133bfda runtime: add support for openbsd/arm
Change-Id: I2bc101aa19172e705ee4de5f3c73a8b4bbf4fa6f
Reviewed-on: https://go-review.googlesource.com/4912
Reviewed-by: Minux Ma <minux@golang.org>
2015-03-15 04:06:26 +00:00
Joel Sing
3e981d9830 doc: note removal of dragonfly/386 port
Change-Id: Ibb7e4f6b95b7a9782a47221cafbe4f20dd77fd38
Reviewed-on: https://go-review.googlesource.com/7583
Reviewed-by: Minux Ma <minux@golang.org>
2015-03-15 04:04:47 +00:00
Shenghou Ma
d7e3d69e1c runtime: skip TestStdcallAndCDeclCallbacks when gcc is missing
Fixes #10167.

Change-Id: Ib6c6b2b5dde47744b69f65482a21964fa3c12090
Reviewed-on: https://go-review.googlesource.com/7600
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2015-03-15 00:37:05 +00:00
Joel Sing
3b1d692093 all: remove dragonfly/386 port
DragonFlyBSD dropped support for i386 in 4.0 and there is no longer a
dragonfly/386 - as such, remove the Go port.

Fixes #8951
Fixes #7580
Fixes #7421

Change-Id: I69022ab2262132e8f97153f14dc8c37c98527008
Reviewed-on: https://go-review.googlesource.com/7543
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Joel Sing <jsing@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-03-14 10:47:19 +00:00
Josh Bleecher Snyder
facd79e4be encoding/binary: cull dead code
Change-Id: I91f9b5280e08e005f5a891aaa249267c211d814b
Reviewed-on: https://go-review.googlesource.com/7592
Reviewed-by: Minux Ma <minux@golang.org>
2015-03-14 02:51:22 +00:00
Ian Lance Taylor
5158147e24 debug/elf: support reading debug info from 32-bit PPC objects
Fixes #10118.

Change-Id: I4a2e6748db609c6eed1d68c824b81c59bd7b875c
Reviewed-on: https://go-review.googlesource.com/7590
Reviewed-by: Minux Ma <minux@golang.org>
2015-03-14 01:31:28 +00:00
Ian Lance Taylor
6e3cf70e68 debug/gosym: fix typo in comment
Change-Id: Ieb13359c5bbe26bbf7baaaa8eb63d5e90bdefdd8
Reviewed-on: https://go-review.googlesource.com/7591
Reviewed-by: Minux Ma <minux@golang.org>
2015-03-14 01:28:30 +00:00
Michael Hudson-Doyle
8c3cc58d0c cmd/internal/ld: remove some dead code
Just little bits and pieces I noticed were unused in passing, and
some more found with https://github.com/opennota/check.

Change-Id: I199fecdbf8dc2ff9076cf4ea81395275c7f171c3
Reviewed-on: https://go-review.googlesource.com/7033
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-03-14 01:04:25 +00:00
Matthew Dempsky
d6dfb0295b cmd/internal/gc: remove unused fields
Change-Id: I3096a7497955bc475739739ee23be387e9162867
Reviewed-on: https://go-review.googlesource.com/7210
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-03-14 01:03:54 +00:00
Robert Griesemer
23fd374bf2 math/big: wrap Float.Cmp result in struct to prevent wrong use
Float.Cmp used to return a value < 0, 0, or > 0 depending on how
arguments x, y compared against each other. With the possibility
of NaNs, the result was changed into an Accuracy (to include Undef).
Consequently, Float.Cmp results could still be compared for (in-)
equality with 0, but comparing if < 0 or > 0 would provide the
wrong answer w/o any obvious notice by the compiler.

This change wraps Float.Cmp results into a struct and accessors
are used to access the desired result. This prevents incorrect
use.

Change-Id: I34e6a6c1859251ec99b5cf953e82542025ace56f
Reviewed-on: https://go-review.googlesource.com/7526
Reviewed-by: Rob Pike <r@golang.org>
2015-03-14 00:48:53 +00:00
Mikio Hara
b100216441 syscall: add missing Syscall9 for darwin/amd64
Fixes #10068.

Change-Id: I1f12225ee16b0090b87403931c0bc0157f068309
Reviewed-on: https://go-review.googlesource.com/6555
Reviewed-by: Minux Ma <minux@golang.org>
2015-03-14 00:21:11 +00:00
Matthew Dempsky
8b3670ffc6 cmd/internal/gc: remove namebuf variable
namebuf was a global char buffer in the C version of gc, which was
useful for providing common storage for constructing symbol and file
names.  However, now that it's just a global Go string and the string
data is dynamically allocated anyway, it doesn't serve any purpose
except to force extra write barriers everytime it's assigned to.

Also, introduce Lookupf(fmt, args...) as shorthand for
Lookup(fmt.Sprintf(fmt, args...)), which was a very common pattern for
using namebuf.

Passes "go build -toolexec 'toolstash -cmp' -a std".

Notably, this CL shrinks 6g's text section by ~15kB:

$ size toolstash/6g tool/linux_amd64/6g
   text	   data	    bss	    dec	    hex	filename
4600805	 605968	 342988	5549761	 54aec1	toolstash/6g
4585547	 605968	 342956	5534471	 547307	tool/linux_amd64/6g

Change-Id: I98abb44fc7f43a2e2e48425cc9f215cd0be37442
Reviewed-on: https://go-review.googlesource.com/7080
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-03-13 23:35:11 +00:00
Dave Cheney
211df1de12 cmd/7g: fix build breakage
Update cmd/7g to match the other compilers. Fixes build break in rev 6582d1cf8.

Change-Id: I449613cf348254e9de6cc7a6b7737e43ea7d10fe
Reviewed-on: https://go-review.googlesource.com/7580
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-03-13 23:07:00 +00:00
Michael Hudson-Doyle
6582d1cf8b cmd/internal/gc, etc: remove canemitecode of Naddr
The argument is never consulted apart from passing it to recursive
calls.  So delete it.

Change-Id: Ia15eefb6385b3c99ea4def88f564f4e5a94c68ab
Reviewed-on: https://go-review.googlesource.com/7032
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-03-13 22:56:42 +00:00
Ian Lance Taylor
362f7bfa68 test: add test that gccgo failed to compile
Change-Id: I9ea6d4d8a9c1c63de36f2f3871dd5ac9201c0aac
Reviewed-on: https://go-review.googlesource.com/7523
Reviewed-by: Minux Ma <minux@golang.org>
2015-03-13 22:05:23 +00:00
Robert Griesemer
a4bfe64f00 math/big: fix minor documentation issue
Change-Id: Ib42f75c03573cec16801b79a6eb9b1b542028f4f
Reviewed-on: https://go-review.googlesource.com/7524
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-03-13 21:30:11 +00:00
Robert Griesemer
f6580319e4 math/big: fix silly bug in Int64 accessor
Change-Id: If335d45ea1ab6c8aeeb47515f97680e2c1d651f3
Reviewed-on: https://go-review.googlesource.com/7522
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-03-13 20:14:57 +00:00
Nigel Tao
3eb84c8908 image/jpeg: reject bad Tq values in SOF data.
Fixes #10154

Change-Id: Ibb8ea9bcf512e7639c57a6f17afbe4495fa329cd
Reviewed-on: https://go-review.googlesource.com/7494
Reviewed-by: Minux Ma <minux@golang.org>
2015-03-13 05:22:55 +00:00
Joel Sing
f076ad893b runtime: remove reference to openbsd kern.rthreads sysctl
The kern.rthreads sysctl has not existed for a long time - there is no way to
disable rthreads and __tfork no longer returns ENOTSUP.

Change-Id: Ia50ff01ac86ea83358e72b8f45f7818aaec1e4b1
Reviewed-on: https://go-review.googlesource.com/7490
Reviewed-by: Minux Ma <minux@golang.org>
2015-03-13 02:51:33 +00:00
Joel Sing
4feee8c659 cmd/5l: make 5l work on openbsd
Change-Id: If58ea50fbf321ae943d0890a40e0552e7bc19709
Reviewed-on: https://go-review.googlesource.com/2080
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-03-13 02:51:12 +00:00
Andrew Gerrand
787a8f1159 doc/go1.5.txt: mention zip.WriterAt
Change-Id: I9f5ca101e0d2fe71cb1ca810cfeeb82c12f5f8e7
Reviewed-on: https://go-review.googlesource.com/7491
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-03-12 22:24:16 +00:00
Andrew Gerrand
1f35bb6466 archive/zip: remove WriterOptions and replace with SetOffset method
Change-Id: I0a8b972c33e80c750ff1d63717177a5a3294a112
Reviewed-on: https://go-review.googlesource.com/7445
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Geert-Johan Riemer <gjr19912@gmail.com>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-03-12 21:32:09 +00:00
Robert Griesemer
8a6eca43df math/big: handle NaNs in Float.Cmp
Also:
- Implemented NewFloat convenience factory function (analogous to
  NewInt and NewRat).
- Implemented convenience accessors for Accuracy values returned
  from Float.Cmp.
- Added test and example.

Change-Id: I985bb4f86e6def222d4b2505417250d29a39c60e
Reviewed-on: https://go-review.googlesource.com/6970
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-03-12 18:56:25 +00:00
Russ Cox
d022266a9a flag: use four spaces before tab, not three
Four spaces is what works well for both 4- and 8-space tab stops.

Screen with fixed-width font and 4-space tab stops:
http://imgur.com/lps5Lbb

Change-Id: I7d2b813d674c3e0a68f79d63bc5d5ec5bd4f87bb
Reviewed-on: https://go-review.googlesource.com/7503
Reviewed-by: Rob Pike <r@golang.org>
2015-03-12 18:43:06 +00:00
Robert Griesemer
363617c7d3 math/big: added (internal) Float.form field for easier case distinctions
This is a fairly significant _internal_ representation change. Instead
of encoding 0, finite, infinite, and NaN values with special mantissa
and exponent values, a new (1 byte) 'form' field is used (without making
the Float struct bigger). The form field permits simpler and faster
case distinctions. As a side benefit, for zero and non-finite floats,
fewer fields need to be set. Also, the exponent range is not the full
int32 range (in the old format, infExp and nanExp were used to represent
Inf and NaN values and tests for those values sometimes didn't test
for the empty mantissa, so the range was reduced by 2 values).

The correspondence between the old and new fields is as follows.
Old representation:

x                 neg      mant         exp
---------------------------------------------------------------
+/-0              sign     empty        0
0 < |x| < +Inf    sign     mantissa     exponent
+/-Inf            sign     empty        infExp
NaN               false    empty        nanExp

New representation (- stands for ignored fields):

x                 neg      mant         exp         form
---------------------------------------------------------------
+/-0              sign     -            -           zero
0 < |x| < +Inf    sign     mantissa     exponent    finite
+/-Inf            sign     -            -           inf
NaN               -        -            -           nan

Client should not be affected by this change.

Change-Id: I7e355894d602ceb23f9ec01da755fe6e0386b101
Reviewed-on: https://go-review.googlesource.com/6870
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-03-12 18:41:45 +00:00