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

22503 Commits

Author SHA1 Message Date
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
Chris Manghane
09b49bf18d 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>
2015-03-06 22:29:08 +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
73a73e5065 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>
2015-03-06 17:50:17 +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
Ian Lance Taylor
4f97afcdf2 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>
2015-03-06 15:28:50 +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
Shenghou Ma
1fff4fbebf .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>
2015-03-05 03:40:09 +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