1
0
mirror of https://github.com/golang/go synced 2024-09-30 19:48:33 -06:00
Commit Graph

21797 Commits

Author SHA1 Message Date
Josh Bleecher Snyder
82a761b656 runtime: speed up eqstring
eqstring does not need to check the length of the strings.
Other architectures were done in a separate commit.

While we're here, add a pointer equality check.

Change-Id: Id2c8616a03a7da7037c1e9ccd56a549fc952bd98
Reviewed-on: https://go-review.googlesource.com/3956
Reviewed-by: Keith Randall <khr@golang.org>
2015-02-06 18:51:14 +00:00
Josh Bleecher Snyder
135ef49fde runtime: speed up eqstring
eqstring does not need to check the length of the strings.

6g

benchmark                              old ns/op     new ns/op     delta
BenchmarkCompareStringEqual            7.03          6.14          -12.66%
BenchmarkCompareStringIdentical        3.36          3.04          -9.52%

5g

benchmark                                 old ns/op     new ns/op     delta
BenchmarkCompareStringEqual               238           232           -2.52%
BenchmarkCompareStringIdentical           90.8          80.7          -11.12%

The equivalent PPC changes are in a separate commit
because I don't have the hardware to test them.

Change-Id: I292874324b9bbd9d24f57a390cfff8b550cdd53c
Reviewed-on: https://go-review.googlesource.com/3955
Reviewed-by: Keith Randall <khr@golang.org>
2015-02-06 18:51:00 +00:00
Robert Griesemer
15594df6b4 math/big: handling of +/-Inf and zero precision, enable zero values
- clarified representation of +/-Inf
- only 0 and Inf values can have 0 precision
- a zero precision value used as result value takes the max precision
  of the arguments (to be fine-tuned for setters)
- the zero precision approach makes Float zero values possible
  (they represent +0)
- more tests

Missing: Filling in the blanks. More tests.

Change-Id: Ibb4f97e12e1f356c3085ce80f3464e97b82ac130
Reviewed-on: https://go-review.googlesource.com/4000
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-02-06 17:21:01 +00:00
Péter Surányi
9b6ccb1323 all: don't refer to code.google.com/p/go{,-wiki}/
Only documentation / comment changes. Update references to
point to golang.org permalinks or go.googlesource.com/go.
References in historical release notes under doc are left as is.

Change-Id: Icfc14e4998723e2c2d48f9877a91c5abef6794ea
Reviewed-on: https://go-review.googlesource.com/4060
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-02-06 14:41:47 +00:00
Shenghou Ma
89669c6504 go1.5.txt: mention the Darwin/ARM port
Change-Id: I40feb9e65615a0f683cfc3f54e0c0cfabcf6a787
Reviewed-on: https://go-review.googlesource.com/4010
Reviewed-by: Minux Ma <minux@golang.org>
2015-02-06 06:09:59 +00:00
Mikio Hara
01fe149271 syscall: gofmt
And the silence of the git-codereview.

Change-Id: If3f7fe2de2ab4c1756f3cef8267199049d468b31
Reviewed-on: https://go-review.googlesource.com/3983
Reviewed-by: Minux Ma <minux@golang.org>
2015-02-06 06:06:20 +00:00
Shenghou Ma
f961a99a35 misc/ios: add README and wrapper script to ease cross-compiling for darwin/arm
Fixes #837.

Change-Id: I2d601504addbd220b304d32d587144d2a702f753
Reviewed-on: https://go-review.googlesource.com/2127
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-06 05:50:10 +00:00
Shenghou Ma
3d1ccf8964 cmd/dist, make.bash: darwin/arm support
cmd/dist: recognize darwin/arm as (host) goos/goarches. also hard
          code GOARM=7 for darwin/arm.
make.bash: don't pass -mmacosx-version-min=10.6 when building for
           darwin/arm.

Change-Id: If0ecd84a5179cd9bb61b801ac1899adc45f12f75
Reviewed-on: https://go-review.googlesource.com/2126
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-02-06 05:49:58 +00:00
Shenghou Ma
5b806e58e2 misc/cgo/test: skip test7978 when using unsupported compilers
On Darwin/ARM, because libSystem doesn't provide functions for
__sync_fetch_and_add, and only clang can inline that function,
skip the test when building with GCC.

Change-Id: Id5e9d8f9bbe1e6bcb2f381f0f66cf68aa95277c7
Reviewed-on: https://go-review.googlesource.com/2125
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-02-06 05:49:47 +00:00
Shenghou Ma
a5bff443c7 runtime/cgo: darwin/arm cgo support
Change-Id: I936be12eed95b99d1d20ed16fb785182e1817b33
Reviewed-on: https://go-review.googlesource.com/2124
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-02-06 05:49:35 +00:00
Shenghou Ma
b64dedabea syscall: darwin/arm support
Change-Id: Id6f7fa12084204bc3a200f423c7966ce2a0b63a0
Reviewed-on: https://go-review.googlesource.com/2123
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-02-06 05:49:25 +00:00
Shenghou Ma
a1457cac9c sync/atomic: darwin/arm support
Change-Id: I213a8ab0b8c027a7b73567aeefdca73fd10eae28
Reviewed-on: https://go-review.googlesource.com/2122
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-02-06 05:49:14 +00:00
Shenghou Ma
56e8f8e822 runtime: darwin/arm support
Change-Id: I63110daad2d62ae72ab1f33a40464d76e6205627
Reviewed-on: https://go-review.googlesource.com/2121
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-02-06 05:48:56 +00:00
Shenghou Ma
1083715b7f liblink, cmd/ld, cmd/5l: darwin/arm support
liblink:
 - set dummy value for ctxt->tlsoffset.
cmd/ld:
 - always do external linking when using cgo on darwin/arm,
   as our linker might not generate codesign-compatible binary.
cmd/5l:
 - support generate ARM Mach-O binaries
 - add machoreloc1() that translate our internal relocation to
   macho relocations used by external linking.

Change-Id: Ic5454aeb87009aaf8f1453ec7fe33e6da55d5f06
Reviewed-on: https://go-review.googlesource.com/3273
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-02-06 05:41:15 +00:00
Shenghou Ma
db0d3892e0 lib9: provide alterantive implementation of ldexp and frexp
Libc on Darwin/ARM has a buggy implementation of ldexp and frexp
that could not handle denormal numbers.

Also disable VFP runfast (flush-to-zero) mode so that the gc
compiler can correctly handle denormal constants used in math and
strconv tests.

Change-Id: Ie64220b882f414e0b37f406f38181c3586104d46
Reviewed-on: https://go-review.googlesource.com/2119
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-02-06 05:40:28 +00:00
Shenghou Ma
d738c6b0ca liblink, cmd/ld, runtime: set the type of runtime.tlsg in runtime
In the old code, liblink, cmd/ld and runtime all have code determine
whether runtime.tlsg is an actual variable or a placeholder for TLS
relocation. This change consolidate them into one: the runtime/tls_arm.s
will ultimately determine the type of that variable.

Change-Id: I3b3f80791a1db4c2b7318f81a115972cd2237e43
Reviewed-on: https://go-review.googlesource.com/2118
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-02-06 05:39:51 +00:00
Shenghou Ma
3819907a55 cmd/cgo: detect misuse of generated _cgo_export.h
Fixes #9742.

Change-Id: Ifedf7ff9465bc49534b708d414c8e435ee9ce6cd
Reviewed-on: https://go-review.googlesource.com/3970
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-02-06 05:37:02 +00:00
Rahul Chaudhry
8581d48c15 test: check for build constraints only upto the first blank line
The main issue is that the misc/cgo/{stdio,life} tests are silently
getting skipped when invoked from run.bash.

run.go should ignore any build tags after the first blank line in
source file. It already checks for test actions only upto the first
blank line. Build tags must be specified in the same block.

See http://golang.org/cl/3675 for background.

Change-Id: Id8abf000119e3335f7250d8ef34aac7811fc9dff
Reviewed-on: https://go-review.googlesource.com/3812
Reviewed-by: Minux Ma <minux@golang.org>
2015-02-06 05:36:26 +00:00
Rahul Chaudhry
d81cc374be test: chdir before running go tool, cleanup afterwards.
issue9355 generated a file a.[568] in test/ directory and left it there.
For tests like these, it is best to chdir to a test specific directory
before generating any temporary files, since the tests are running
in parallel and might otherwise race with each other for the same files.

Change-Id: I58d96256d4d8ee3fda70d81077f19006064a7425
Reviewed-on: https://go-review.googlesource.com/3813
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-02-06 05:16:34 +00:00
Andrew Ekstedt
f5f00be2ec image: fix obsolete reference in PalettedImage doc comment
PalettedColorModel was renamed to color.Palette
over three years ago by https://golang.org/cl/5132048.

Change-Id: I0204ade10eabff45620fda2990fed428c65d871e
Reviewed-on: https://go-review.googlesource.com/3305
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-02-06 04:06:44 +00:00
Nigel Tao
6ea3adc3ba reflect: for struct tags, reject control chars (including tabs) in keys,
and empty keys. Also reject malformed (quoted) values.

See also https://go-review.googlesource.com/3952

Change-Id: Ice6de33b09f9904b28e410a680a90aa6c8c76fed
Reviewed-on: https://go-review.googlesource.com/3953
Reviewed-by: Rob Pike <r@golang.org>
2015-02-06 02:27:27 +00:00
Robert Griesemer
9209d893c8 strconv: fix internal documentation (clarification, typos)
Change-Id: I7514e643a6a81ca715adbf6f8d19d3b2dd43fe6c
Reviewed-on: https://go-review.googlesource.com/3810
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-02-05 22:36:19 +00:00
Robert Griesemer
f083a0e364 math/big: add "smoke test" for big.Float division
Change-Id: Ica419a1215ca33dc1cff1e9e4137f204591e3cee
Reviewed-on: https://go-review.googlesource.com/3942
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-02-05 22:22:28 +00:00
Robert Griesemer
91c0f006fc math/big: more Float conversion tests
Change-Id: Ia30886569141ca2e0321bea6ee1d5c9e0f79d6f9
Reviewed-on: https://go-review.googlesource.com/3941
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-02-05 22:21:01 +00:00
Robert Griesemer
57c1485fd9 math/big: simplified formatting logic
Change-Id: I4329c44b829fcd77e4f1a1d45904f0f8a280a595
Reviewed-on: https://go-review.googlesource.com/3940
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-02-05 22:19:42 +00:00
Erik Aigner
017182258a net/http: Fix typo in MaxBytesReader comment
Change-Id: Ida064ff422d077d508ef94f52fc813daa6277a99
Reviewed-on: https://go-review.googlesource.com/3933
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-02-05 16:38:10 +00:00
Russ Cox
7e3b30aea6 cmd/5a: prepare reglist correctly
This was working when 5a was built on x86 because REG_R0 = 32,
and a 32-bit shift on x86 uses only the low 32 bits of the shift count.

On ARM, the shift clamping is different.

Moving to Go will avoid these differing shift semantics.
I tripped over and fixed this bug in new5a the same way earlier tonight.

Change-Id: Id56aa0bb1830ccf250960f843e0acb8a0409e87d
Reviewed-on: https://go-review.googlesource.com/3961
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-02-05 16:05:13 +00:00
Dmitry Vyukov
08ca401444 expvar: fix build
Change-Id: I6ee7aa76673e51576b5a84c512b22a0f8af5b02f
Reviewed-on: https://go-review.googlesource.com/3966
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2015-02-05 13:53:29 +00:00
Evan Phoenix
fc22fb8f0c expvar: Add benchmarks for perf sensitive operations
These benchmarks are only for functions commonly used in loops. The
other functions are typically used for inspection or setup and thus are
not performance sensitive.

Change-Id: I8d0a0ba2d8234ecacb40fa3aa9077bf93c8fe89c
Reviewed-on: https://go-review.googlesource.com/3680
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2015-02-05 13:32:25 +00:00
Russ Cox
cb4b28e013 Revert "liblink, cmd/5a: fix reglist parsing/printing after changing REG_R0 to 32"
This reverts commit da4abda2a1.

Change-Id: Ifd09b3dae0af0c7cef5fbbc332c63e78dc90d6b1
Reviewed-on: https://go-review.googlesource.com/3960
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-05 10:23:35 +00:00
Shenghou Ma
98376204e8 cmd/ld: always set timestamp in PE header to 0
Fixes #9756.

Change-Id: If4ee6fe10f8f90294ff9c5e7480371494094b111
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/3740
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2015-02-05 02:45:03 +00:00
Shenghou Ma
da4abda2a1 liblink, cmd/5a: fix reglist parsing/printing after changing REG_R0 to 32
Fixes #9759.

Change-Id: I263f1251b9401371231374551c4f71c70cb6e359
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/3931
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-02-05 02:40:09 +00:00
Rob Pike
706cc13b21 cmd/pack: simplify the testing logic slightly
Followup to https://go-review.googlesource.com/3910

We only need 1000 iteratinons.

Change-Id: Ib63ae53105176abec77bad9609d638aeda7bcd61
Reviewed-on: https://go-review.googlesource.com/3901
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-02-05 00:28:00 +00:00
Robert Griesemer
721d5893d7 math/big: first version of Float %e, %f, %g, %G formatting working
Change-Id: I10efa3bc8bc7f41100feabe17837f805a42d7eb6
Reviewed-on: https://go-review.googlesource.com/3842
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-02-04 21:11:51 +00:00
Robert Griesemer
b8fcae02b0 math/big: fix %b format so it matches strconf %b format for non-zero values
(For zero values the strconv %b format prints the bias-adjusted exponent;
there's no bias in Float.)

Change-Id: I6f4dda9c3a50d02eac375cfe2c927c1540aae865
Reviewed-on: https://go-review.googlesource.com/3841
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-02-04 21:07:37 +00:00
Robert Griesemer
bbd6771621 math/big: implemented decimal rounding for Float-to-string conversion
Change-Id: Id508ca2f6c087861e8c6bc536bc39e54dce09825
Reviewed-on: https://go-review.googlesource.com/3840
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-02-04 21:06:37 +00:00
Hyang-Ah Hana Kim
3a87135754 runtime: support panic/print logging in android-L.
In android-L, logging is done through the logd daemon.
If logd daemon is available, send logging to logd.
Otherwise, fallback to the legacy mechanism (/dev/log files).

This change adds access/socket/connect calls to interact with the logd.

Fixes golang/go#9398.

Change-Id: I3c52b81b451f5862107d7c675f799fc85548486d
Reviewed-on: https://go-review.googlesource.com/3350
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-02-04 21:02:41 +00:00
Josh Bleecher Snyder
11c1227493 go1.5.txt: array generation support in testing/quick
Change-Id: I00f18a8c62a8d63822d7e07fee1ac5f088cc9587
Reviewed-on: https://go-review.googlesource.com/3866
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-02-04 17:33:47 +00:00
Russ Cox
7505cd8b23 Revert "runtime: bound defer pools"
This reverts commit 8059071153.

Conflicts:
	src/runtime/proc1.go (resolved by hand)

Change-Id: Ic62e3e802f0007ff9012b37bc5fd41fcafc153d0
Reviewed-on: https://go-review.googlesource.com/3885
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2015-02-04 17:04:08 +00:00
Russ Cox
1f2d7bf44f liblink: require use of TYPE_ADDR, not TYPE_CONST
Add Addr-checking for all Progs on input to liblink, in liblink/pass.c,
including requiring use of TYPE_ADDR, not TYPE_CONST.
Update compilers and assemblers to satisfy checks.

Change-Id: Idac36b9f6805f0451cb541d2338992ca5eaf3963
Reviewed-on: https://go-review.googlesource.com/3801
Reviewed-by: Austin Clements <austin@google.com>
2015-02-04 16:50:06 +00:00
Chris Kastorff
3e9ed273a2 testing/quick: support generation of array types in Value
Generating array types like [4]int would fail even though the int type
is generatable. Allow generating values of array types when the inner
type is generatable.

Change-Id: I7d71b3c18edb3737e2fec1ddf5e36c9dc8401971
Reviewed-on: https://go-review.googlesource.com/3865
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-02-04 16:17:07 +00:00
Josh Bleecher Snyder
22f337656d cmd/go, make: remove ccflags
cc is no more.

Change-Id: I8d1bc0d2e471cd9357274204c9bc1fa67cbc272d
Reviewed-on: https://go-review.googlesource.com/3833
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-02-04 16:15:00 +00:00
Josh Bleecher Snyder
3fa90ea964 cmd/go: add 9g and 9l to documentation
Change-Id: I274c438ab168278dfbb34ada3ed9a7f7c66b66ef
Reviewed-on: https://go-review.googlesource.com/3834
Reviewed-by: Minux Ma <minux@golang.org>
2015-02-04 16:10:28 +00:00
Mikio Hara
c768a84b38 net: remove the dregs of old built-in poll server
We don't need placeholders for the old built-in poll server any more.

Change-Id: I3a510aec6a30bc2ac97676c400177cdfe557b8dc
Reviewed-on: https://go-review.googlesource.com/3863
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2015-02-04 10:16:38 +00:00
Dmitry Vyukov
d2abbf3ccf runtime: cleanup some left-overs of the C past
Change-Id: I3e280ca7d922f6ab14b2477361327ed076a95779
Reviewed-on: https://go-review.googlesource.com/3743
Reviewed-by: Keith Randall <khr@golang.org>
2015-02-04 09:04:15 +00:00
Mikio Hara
5ab3823c6b net: update TDDO
The issue #8432 has been marked as an issue for golang.org/x/net.

Change-Id: Ia39abd99b685c820ea6169ee6505b16028e7e77f
Reviewed-on: https://go-review.googlesource.com/3836
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-02-04 04:57:32 +00:00
Dmitry Vyukov
8059071153 runtime: bound defer pools
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.

Change-Id: Iadcfb113ccecf912e1b64afc07926f0de9de2248
Reviewed-on: https://go-review.googlesource.com/3741
Reviewed-by: Keith Randall <khr@golang.org>
2015-02-04 04:38:11 +00:00
Dmitry Vyukov
71be013842 cmd/gc: don't copy string in range []byte(str)
Using benchmark from the issue:

benchmark                    old ns/op     new ns/op     delta
BenchmarkRangeStringCast     2162          1152          -46.72%

benchmark                    old allocs     new allocs     delta
BenchmarkRangeStringCast     1              0              -100.00%

Fixes #2204

Change-Id: I92c5edd2adca4a7b6fba00713a581bf49dc59afe
Reviewed-on: https://go-review.googlesource.com/3790
Reviewed-by: Keith Randall <khr@golang.org>
2015-02-04 04:37:21 +00:00
Austin Clements
70321df02f runtime: fix RuntimeGogoBytes on windows/amd64
Before 3c0fee1, runtime.gogo was just long enough to align to 64 bytes
on OSs with short get_tls implementations and 80 bytes on OSs with
longer get_tls implementations (Windows, Solaris, and Plan 9).
3c0fee1 added a few instructions, which pushed it to 80 on most OSs,
including Windows and Plan 9, and 96 on Solaris.

Fixes #9770.

Change-Id: Ie84810657c14ab16dce9f0e0a932955251b0bf33
Reviewed-on: https://go-review.googlesource.com/3850
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2015-02-04 03:34:19 +00:00
Josh Bleecher Snyder
aafb5bcadd go/doc: don't treat _ consts as exported
golang.org/cl/144110044 made _ consts treated
as exported as a small, safe fix for #5397.
It also introduced issue #9615.

golang.org/cl/2091 then fixed the underlying issue,
which was missing type information when the type
was specified only for _.

This cl reverts the original fix.

Fixes #9615.

Change-Id: I4815ad8292bb5bec18beb8c131b48949d9af8876
Reviewed-on: https://go-review.googlesource.com/3832
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-02-04 00:25:54 +00:00