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>
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>
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>
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>
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>
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>
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>
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>
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>
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.
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>
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>
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.
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>
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.
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>
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>
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>
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>
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.
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>
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.
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.
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>
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.
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.
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>
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>
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>
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:
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>
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".
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.
Change-Id: Ifc2123f5ceaa6d3f9b31bb5cb6e77a2c8ec23818
Reviewed-on: https://go-review.googlesource.com/6613 Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
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>
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>
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.
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>
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>
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.
David Crawshaw [Mon, 2 Mar 2015 21:01:20 +0000 (16:01 -0500)]
time: zoneinfo support on darwin/arm
A future change will include an NSTimeZone hook so we can determine
the device's current time zone.
Change-Id: Ia4bd6b955e4cb720c518055541b66ff57a4dd303
Reviewed-on: https://go-review.googlesource.com/6511 Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
David Crawshaw [Mon, 2 Mar 2015 21:05:11 +0000 (16:05 -0500)]
misc/ios: more predictable zoneinfo.zip location
See golang.org/cl/6511.
Change-Id: I2145a42877ed6b78400f29c2ef18969870dab5c3
Reviewed-on: https://go-review.googlesource.com/6512 Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>