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

25242 Commits

Author SHA1 Message Date
Ian Lance Taylor
5174df9087 runtime, runtime/msan: add msan runtime support
These are the runtime support functions for letting Go code interoperate
with the C/C++ memory sanitizer.  Calls to msanread/msanwrite are now
inserted by the compiler with the -msan option.  Calls to
msanmalloc/msanfree will be from other runtime functions in a subsequent
CL.

Change-Id: I64fb061b38cc6519153face242eccd291c07d1f2
Reviewed-on: https://go-review.googlesource.com/16162
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-10-21 17:50:39 +00:00
Austin Clements
a42f668654 runtime: eliminate unused _GCstw phase
Change-Id: Ie94cd17e1975fdaaa418fa6a7b2d3b164fedc135
Reviewed-on: https://go-review.googlesource.com/16057
Reviewed-by: Rick Hudson <rlh@golang.org>
2015-10-21 16:26:34 +00:00
Austin Clements
28f458ce5b runtime: eliminate unnecessary ragged barrier
The ragged barrier after entering the concurrent mark phase is
vestigial. This used to be the point where we enabled write barriers,
so it was necessary to synchronize all Ps to ensure write barriers
were enabled before any marking occurred. However, we've long since
switched to enabling write barriers during the concurrent scan phase,
so the start-the-world at the beginning of the concurrent scan phase
ensures that all Ps have enabled the write barrier.

Hence, we can eliminate the old "install write barrier" phase.

Fixes #11971.

Change-Id: I8cdcb84b5525cef19927d51ea11ba0a4db991ea8
Reviewed-on: https://go-review.googlesource.com/16044
Reviewed-by: Rick Hudson <rlh@golang.org>
2015-10-21 16:26:25 +00:00
Ian Lance Taylor
0c69f1303f cmd/compile: add -msan option
The -msan option causes the compiler to add instrumentation for the
C/C++ memory sanitizer.  Every memory read/write will be preceded by
a call to msanread/msanwrite.

This CL passes tests but is not usable by itself.  The actual
implementation of msanread/msanwrite in the runtime package, and support
for -msan in the go tool and the linker, and tests, will follow in
subsequent CLs.

Change-Id: I3d517fb3e6e65d9bf9433db070a420fd11f57816
Reviewed-on: https://go-review.googlesource.com/16160
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-10-21 14:58:53 +00:00
Ian Lance Taylor
7b4b96f248 cmd/link: add -msan option
The -msan option causes the linker to link against the runtime/msan
package in order to use the C/C++ memory sanitizer.

This CL passes tests but is not usable by itself.  The actual
runtime/msan package, and support for -msan in the go tool and the
compiler, and tests, are in separate CLs.

Change-Id: I02c097393b98c5b80e40ee3dbc167a8b4d23efe0
Reviewed-on: https://go-review.googlesource.com/16161
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-10-21 14:40:07 +00:00
Konstantin Shaposhnikov
3c1712db0b cmd/vet: fix shadow assignment check with complex rhs
This change fixes shadow assignment check in cases when RHS is not an identifier
or a type assertion.

Fixes #12188

Change-Id: I0940df8d9c237ab8b8d3272eb6895e676c75c115
Reviewed-on: https://go-review.googlesource.com/16038
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-10-21 14:27:49 +00:00
Ian Lance Taylor
9e902f0f3a cmd/compile: generalize racewalk to instrument (naming change)
This is mechanical change that is a step toward reusing the racewalk
pass for a more general instrumentation pass.  The first use will be to
add support for the memory sanitizer.

Change-Id: I75b93b814ac60c1db1660e0b9a9a7d7977d86939
Reviewed-on: https://go-review.googlesource.com/16105
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-10-21 13:55:23 +00:00
Nodir Turakulov
76dcedc920 cmd/go: dedup packages in packagesAndErrors
packagesAndErrors function doesn't dedup packages.
As a result, `go list io ./io` prints io package twice.
Same applies to `go build` and `go test`.

* dedup packages.
* add a test for go list

Change-Id: I54d4063979b1c9359e5416e12327cb85c4823a0f
Reviewed-on: https://go-review.googlesource.com/16136
Run-TryBot: Andrew Gerrand <adg@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-10-21 06:31:52 +00:00
Aaron Jacobs
d8c6bf916e cmd/compile: remove a stray word in the go:nosplit documentation
Change-Id: I7a85c0ad8aba2d50032c8faa58c83fb327f360cf
Reviewed-on: https://go-review.googlesource.com/16140
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-10-21 04:51:54 +00:00
acanino
b60c8203ea cmd/compile: "invalid variable name x in type switch", where x is a name of a constant
Small fix: looks like a short variable declaration with a type switch
checks to make sure the variable used had valid shape (ONAME, OTYPE, or
ONONAME) and rejects everything else. Then a new variable is declared.
If the symbol contained in the declaration was a named OLITERAL (still a
valid identifier obviously) it would be rejected, even though a new
variable would have been declared.

Fix adds this case to the check.

Added a test case from issue12413.

Fixes #12413

Change-Id: I150dadafa8ee5612c867d58031027f2dca8c6ebc
Reviewed-on: https://go-review.googlesource.com/15760
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-10-21 04:21:16 +00:00
Brad Fitzpatrick
3b000b3eae net/http: update copy of http2
Updates to x/net git revision 9946ad7

Change-Id: I95c03daf382667002a5b22f184bd9b7d18144913
Reviewed-on: https://go-review.googlesource.com/16066
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-10-21 00:28:55 +00:00
Nodir Turakulov
cf59c1f9cc html/template: include itself while cloning
template.Clone() initialized template set incorrectly:
it didn't include itself.

* include itself in template set while cloning
* add a test

Fixes #12996

Change-Id: I932530e4f7f1bbebf833e12b000a5ce052bc9223
Reviewed-on: https://go-review.googlesource.com/16104
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-10-20 23:53:27 +00:00
Brad Fitzpatrick
09eb58893f net/http: return error from Serve if http2.ConfigureServer returns an error
In https://golang.org/cl/15860 http2.ConfigureServer was changed to
return an error if explicit CipherSuites are listed and they're not
compliant with the HTTP/2 spec.

This is the net/http side of the change, to look at the return value
from ConfigureServer and propagate it in Server.Serve.

h2_bundle.go will be updated in a future CL. There are too many other
http2 changes pending to be worth updating it now. Instead,
h2_bundle.go is minimally updated by hand in this CL so at least the
net/http change will compile.

Updates #12895

Change-Id: I4df7a097faff2d235742c2d310c333bd3fd5c08e
Reviewed-on: https://go-review.googlesource.com/16065
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-10-20 23:21:23 +00:00
Matthew Dempsky
d4a7ea1b71 runtime: add stringStructOf helper function
Instead of open-coding conversions from *string to unsafe.Pointer then
to *stringStruct, add a helper function to add some type safety.
Bonus: This caught two **string values being converted to
*stringStruct in heapdump.go.

While here, get rid of the redundant _string type, but add in a
stringStructDWARF type used for generating DWARF debug info.

Change-Id: I8882f8cca66ac45190270f82019a5d85db023bd2
Reviewed-on: https://go-review.googlesource.com/16131
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-10-20 23:13:27 +00:00
Aaron Jacobs
ef986fa3fc runtime: change odd 'print1_write' file names
The '1' part is left over from the C conversion, but no longer makes
sense given that print1.go no longer exists.

Change-Id: Iec171251370d740f234afdbd6fb1a4009fde6696
Reviewed-on: https://go-review.googlesource.com/16036
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-10-20 23:03:06 +00:00
Hyang-Ah Hana Kim
460568b6fd path/filepath: disable symlink tests on android.
Same reason as https://go-review.googlesource.com/#/c/16115/

For golang/go#10807

Change-Id: Id0c404e9feb963f39a111fc317c9787692516ae1
Reviewed-on: https://go-review.googlesource.com/16116
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-10-20 22:18:43 +00:00
Hyang-Ah Hana Kim
84808a2a90 os: disable symlink tests on android.
Creating symlinks (/data/local/tmp/*) doesn't seem to work
on android-L (tested on nexus5). I cannot find any official
documentation yet but just guess it's a measure for security
attacks using symlinks.

The tests failed with 'permission denied' errors.

For golang/go#10807

Change-Id: I99a9c401c6ecca3c4adc7b21708adaf3dd601279
Reviewed-on: https://go-review.googlesource.com/16115
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-10-20 22:18:23 +00:00
Robert Griesemer
76285213b8 cmd/compile/internal/gc: there are no -0 floating-point constants
Fixes #12577.

Change-Id: Id469cd92f5f9436b0ef948ee1a252ed1842bc7aa
Reviewed-on: https://go-review.googlesource.com/16133
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2015-10-20 22:11:11 +00:00
Matthew Dempsky
ff85f86877 spec: remove "untyped bool" oxymorons
The proper term is "untyped boolean".

Change-Id: Id871164190a03c64a8a8987b1ad5d8653a21d96e
Reviewed-on: https://go-review.googlesource.com/16135
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-10-20 22:08:17 +00:00
Caleb Spare
2bf91afd2b crypto/cipher: fix CTR infinite loop with large block sizes
Additionally, add a test for CTR mode to cover a range of block sizes.

Fixes #12975

Change-Id: I458aac1616228747e62f92f823768d55e874877a
Reviewed-on: https://go-review.googlesource.com/16050
Reviewed-by: Adam Langley <agl@golang.org>
2015-10-20 21:38:36 +00:00
Robert Griesemer
55ecda4ffd spec: clarify numeric conversions where IEEE-754 produces -0.0
The spec defines precise numeric constants which do not overflow.
Consequently, +/-Inf and NaN values were excluded. The case was not
clear for -0.0 but they are mostly of interest to determine the sign
of infinities which don't exist.

That said, the conversion rules explicitly say that T(x) (for a numeric
x and floating-point type T) is the value after rounding per IEEE-754.
The result is constant if x is constant. Rounding per IEEE-754 can
produce a -0.0 which we cannot represent as a constant.

Thus, the spec is inconsistent. Attempt to fix the inconsistency by
adjusting the rounding rule rather than letting -0.0 into the language.

For more details, see the issue below.

Open to discussion.

Fixes #12576.

Change-Id: Ibe3c676372ab16d9229f1f9daaf316f761e074ee
Reviewed-on: https://go-review.googlesource.com/14727
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-10-20 18:16:57 +00:00
Robert Griesemer
27838f3990 cmd/compile/internal/gc: remove atoi function (minor cleanup)
Change-Id: I0ad7836c0e8d70ffdc458e125d97b01e85d8a608
Reviewed-on: https://go-review.googlesource.com/16130
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-10-20 17:55:39 +00:00
Hyang-Ah Hana Kim
30ee5919bd runtime: add syscalls needed for android/amd64 logging.
access, connect, socket.

In Android-L, logging is done by writing the log messages to the logd
process through a unix domain socket.

Also, changed the arg types of those syscall stubs to match linux
programming APIs.

For golang/go#10743

Change-Id: I66368a03316e253561e9e76aadd180c2cd2e48f3
Reviewed-on: https://go-review.googlesource.com/15993
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-10-20 16:56:58 +00:00
Ilya Tocar
7d2c6eb3f5 cmd/internal/obj/x86: align functions with trap instruction
Align functions with 0xCC (INT $3) - breakpoint instruction,
instead of 0x00, which can disassemble into valid instruction.

Change-Id: Ieda191886efc4aacb86f58bea1169fd1b3b57636
Reviewed-on: https://go-review.googlesource.com/16102
Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
Reviewed-by: Gregory Shimansky <gregory.shimansky@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2015-10-20 15:48:49 +00:00
Ian Lance Taylor
77b1fef27e cmd/compile, syscall: use go:norace comment for forkAndExecInChild
Use a go:norace comment rather than having the compiler know the special
name syscall.forkAndExecInChild.

Change-Id: I69bc6aa6fc40feb2148d23f269ff32453696fb28
Reviewed-on: https://go-review.googlesource.com/16097
Reviewed-by: Minux Ma <minux@golang.org>
2015-10-20 14:10:24 +00:00
Aaron Jacobs
3bc0601742 runtime: rename _func.frame to make it clear it's deprecated and unused.
When I saw that it was labelled "legacy", I went looking for users of it
to see how it was still used. But there aren't any. Save the next person
the trouble.

Change-Id: I921dd6c57b60331c9816542272555153ac133c02
Reviewed-on: https://go-review.googlesource.com/16035
Reviewed-by: Dave Cheney <dave@cheney.net>
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-10-20 03:16:09 +00:00
Thorben Krueger
26fe24cbe2 fmt: Add support for capital '%X' format verb for scanning
For printing, the format verb '%X' results in a capitalized
hex-representation of the formatted value. Conversely, using
'%X' in a Scanf function should scan a hex-representation
into the given interface{}. The existing implementation
however only supports '%X' for scanning hex values into
integers; strings or byte slices remain empty. On the other
hand, lower-case '%x' supports strings and byte slices just
fine. This is merely an oversight, which this commit fixes.
(Additional tests also included.)

    Fixes #12940

Change-Id: I178a7f615bae950dfc014ca8c0a038448cf0452a
Reviewed-on: https://go-review.googlesource.com/15689
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-10-20 01:08:54 +00:00
Nodir Turakulov
0bf515c8c4 net/http/httptest: detect Content-Type in ResponseRecorder
* detect Content-Type on ReponseRecorder.Write[String] call
  if header wasn't written yet, Content-Type header is not set and
  Transfer-Encoding is not set.
* fix typos in serve_test.go

Updates #12986

Change-Id: Id2ed8b1994e64657370fed71eb3882d611f76b31
Reviewed-on: https://go-review.googlesource.com/16096
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-10-20 01:01:22 +00:00
Brad Fitzpatrick
d4d1668864 net/http: add Transport.TLSNextProto, ErrSkipAltProtocol
This is the start of wiring up the HTTP/2 Transport. It is still
disabled in this commit.

This change does two main things:

1) Transport.RegisterProtocol now permits registering "http" or
   "https" (they previously paniced), and the semantics of the
   registered RoundTripper have been extended to say that the new
   sentinel error value (ErrSkipAltProtocol, added in this CL) means
   that the Transport's RoundTrip method proceeds as if the alternate
   protocol had not been registered. This gives us a place to register
   an alternate "https" RoundTripper which gets first dibs on using
   HTTP/2 if there's already a cached connection.

2) adds Transport.TLSNextProto, a map keyed by TLS NPN/ALPN protocol
   strings, similar in feel to the existing Server.TLSNextProto map.
   This map is the glue between the HTTP/1 and HTTP/2 clients, since
   we don't know which protocol we're going to speak (and thus which
   Transport type to use) until we've already made the TCP connection.

Updates #6891

Change-Id: I7328c7ff24f52d9fe4899facabf7ecc5dcb989f3
Reviewed-on: https://go-review.googlesource.com/16090
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-10-20 00:30:45 +00:00
Brad Fitzpatrick
a3156aaa12 net/http/httptest: change Server to use http.Server.ConnState for accounting
With this CL, httptest.Server now uses connection-level accounting of
outstanding requests instead of ServeHTTP-level accounting. This is
more robust and results in a non-racy shutdown.

This is much easier now that net/http.Server has the ConnState hook.

Fixes #12789
Fixes #12781

Change-Id: I098cf334a6494316acb66cd07df90766df41764b
Reviewed-on: https://go-review.googlesource.com/15151
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-10-20 00:07:19 +00:00
Ian Lance Taylor
684218e135 cmd/compile: clarify where mkbuiltin.go input files are found
Just a comment change reflecting that the files were moved to the
builtin directory when the compiled was converted from C to Go.

Change-Id: I65e5340c09221684e40174feadfb69f738a9044a
Reviewed-on: https://go-review.googlesource.com/16089
Reviewed-by: Minux Ma <minux@golang.org>
2015-10-19 23:28:34 +00:00
Burcu Dogan
4dc49d23a7 cmd/go: don't override GIT_TERMINAL_PROMPT
This CL keeps disallowing `go get` from falling to the prompt unless
user has set GIT_TERMINAL_PROMPT env variable. If GIT_TERMINAL_PROMPT
is set, go-get will not override its value and will prompt for
username/password in the case of GIT_TERMINAL_PROMPT=1.

Fixes #12706.

Change-Id: Ibd6b1100af6b04fb8114279cdcf608943e7765be
Reviewed-on: https://go-review.googlesource.com/16091
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-10-19 23:05:52 +00:00
Nodir Turakulov
88fa2e0be6 net/http: fix typo in serve_test.go
Change-Id: Iaf33fae7043f21df2dba0bb7e1addb0ff002c508
Reviewed-on: https://go-review.googlesource.com/16088
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-10-19 21:36:09 +00:00
Michael Hudson-Doyle
c5856cfdb6 runtime: tweaks to allow -buildmode=shared to work
Building Go shared libraries requires that all functions that have declarations
without bodies have implementations and vice versa, so remove the
implementation of call16 and add a stub implementation of sigreturn.

Change-Id: I4d5a30c8637a5da7991054e151a536611d5bea46
Reviewed-on: https://go-review.googlesource.com/15966
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-10-19 21:23:36 +00:00
Michael Hudson-Doyle
d66f6c2c86 cmd/link: centralize knowledge of size of fixed part of stack
Shared libraries on ppc64le will require a larger minimum stack frame (because
the ABI mandates that the TOC pointer is available at 24(R1)). Part 2b of
preparing for that is to have all the code in the linker that needs to know
this size of this call a function to find out.

Change-Id: I246363840096db22e44beabbe38b61d60c1f31ad
Reviewed-on: https://go-review.googlesource.com/15675
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-10-19 20:28:16 +00:00
Michael Hudson-Doyle
c23c8d58d6 cmd/compile: allow -shared/-dynlink on ppc64
Only effect is register related: do not allocate R2 or R12, put function
entrypoint in R12 before indirect call.

Change-Id: I9cdd553bab022601c9cb5bb43c9dc0c368c6fb0a
Reviewed-on: https://go-review.googlesource.com/15961
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-10-19 20:27:55 +00:00
David Crawshaw
fd8592859b cmd/cgo: give __uint128_t type [16]uint8
The __uint128_t type appears in darwin/arm header files processed by
cgo -godefs in http://golang.org/cl/16045.

Change-Id: I666194c65dee8ea0ae933d2f02a3abe4581c4697
Reviewed-on: https://go-review.googlesource.com/16046
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-10-19 20:16:03 +00:00
David Crawshaw
996c540be2 net: android no longer supports unix/unixgram
I cannot find any documentation for this, but these tests no longer run
on the device I have since upgrading to Android L. Presumably it still
works for root, but standard Android programs to not have root access.

Change-Id: I001c8fb5ce22f9ff8d7433f881d0dccbf6ab969d
Reviewed-on: https://go-review.googlesource.com/16056
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-10-19 19:27:22 +00:00
Austin Clements
3cd56b4dca runtime: combine gcResetGState and gcResetMarkState
These functions are always called together and perform logically
related state resets, so combine them in to just gcResetMarkState.

Fixes #11427.

Change-Id: I06c17ef65f66186494887a767b3993126955b5fe
Reviewed-on: https://go-review.googlesource.com/16041
Reviewed-by: Rick Hudson <rlh@golang.org>
2015-10-19 18:38:07 +00:00
Austin Clements
b0d5e5c500 runtime: consolidate gcResetGState calls
Currently gcResetGState is called by func gcscan_m for concurrent GC
and directly by func gc for STW GC. Simplify this by consolidating
these two calls in to one call by func gc above where it splits for
concurrent and STW GC.

As a consequence, gcResetGState and gcResetMarkState are always called
together, so the next commit will consolidate these.

Change-Id: Ib62d404c7b32b28f7d3080d26ecf3966cbc4aca0
Reviewed-on: https://go-review.googlesource.com/16040
Reviewed-by: Rick Hudson <rlh@golang.org>
2015-10-19 18:38:00 +00:00
Austin Clements
feb92a8e8c runtime: remove work.partial queue
This work queue is no longer used (there are many reads of
work.partial, but the only write is in putpartial, which is never
called).

Fixes #11922.

Change-Id: I08b76c0c02a0867a9cdcb94783e1f7629d44249a
Reviewed-on: https://go-review.googlesource.com/15892
Reviewed-by: Rick Hudson <rlh@golang.org>
2015-10-19 18:37:54 +00:00
Nodir Turakulov
1da6b2ea19 fmt: clarify reflect.Value printing
fmt docs say:

  If the operand is a reflect.Value, the concrete value it
  holds is printed as if it was the operand.

It implies recursive application of this rule, which is not the case.
Clarify the docs.

Change-Id: I019277c7c6439095bab83e5536aa06403638aa51
Reviewed-on: https://go-review.googlesource.com/15952
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-10-19 18:29:36 +00:00
David Crawshaw
17a256bf22 cmd/go: -buildmode=pie for android/arm
Also make PIE executables the default build mode, as PIE executables
are required as of Android L.

For #10807

Change-Id: I86b7556b9792105cd2531df1b8f3c8f7a8c5d25c
Reviewed-on: https://go-review.googlesource.com/16055
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
2015-10-19 18:02:08 +00:00
David Crawshaw
26205cb3c0 cmd/link: PIE executables for android/arm
For #10807

Change-Id: Ied826d06cb622edf6413b6f2cdcc46987ab0b05a
Reviewed-on: https://go-review.googlesource.com/16054
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-10-19 17:41:39 +00:00
Matthew Dempsky
e538e1b627 go/types: check that typed constant shift expressions are representable
Fixes #12945.

Change-Id: I08b44795fcd7ec59371aea8111f7febead54720b
Reviewed-on: https://go-review.googlesource.com/15900
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-10-19 17:34:51 +00:00
David Crawshaw
e920f7d5c5 cmd/cgo: don't print absolute path in comment
Change-Id: Ib424e14cfaab35d37ebdd084d41151928bfd645e
Reviewed-on: https://go-review.googlesource.com/16051
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
2015-10-19 15:28:32 +00:00
Brad Fitzpatrick
a8645e283b net/http: use the correct error variable in serveFile
It was generating the wrong error message, always defaulting to "500
Internal Server Error", since the err variable used was always nil.

Fixes #12991

Change-Id: I94b0e516409c131ff3b878bcb91e65f0259ff077
Reviewed-on: https://go-review.googlesource.com/16060
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-10-19 15:26:35 +00:00
Aaron Jacobs
5d88323fa6 runtime: remove a redundant nil pointer check.
It appears this was made possible by commit 89f185f; before that, g was
not dereferenced above.

Change-Id: I70bc571d924b36351392fd4c13d681e938cfb573
Reviewed-on: https://go-review.googlesource.com/16033
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-10-19 09:58:15 +00:00
Nodir Turakulov
386fa03609 runtime: merge proc1.go -> proc.go
from proc1.go to proc.go:
* prepend header comment explaining "Goroutine scheduler"
* insert m0 and g0 var defs after the comment
* append the rest

Updates #12952

Change-Id: I35ee9ae3287675cde0c1b6aeaca0a460393f2354
Reviewed-on: https://go-review.googlesource.com/16024
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-10-19 01:11:00 +00:00
Joe Tsai
22dfbbec7f compress/flate: improve inflate speed by reading more bits at a time
The flate library guarantees that the Reader will never read more
bytes than is necessary. This way, the underlying io.Reader will
be left exactly after the last byte of the DEFLATE stream.
Formats like gzip depend on this behavior being true.

As such, inflate conservatively reads the minimum symbol length in
huffSym leading to many individual calls to moreBits. However, if we
take advantage of the fact that every block *must* end with the EOB
symbol, we can choose to read the length of the EOB symbol.
Since the EOB symbol is also the most rare symbol (occuring exactly
once) in a block, we can hypothesize that it is almost as long as
the max symbol length, allowing huffSym to ask for more bits at the
start of every loop. This increases the probabilty that the Huffman
code is decoded on the first iteration of the outer for-loop.

benchmark                              old MB/s     new MB/s     speedup
BenchmarkDecodeDigitsSpeed1e4-4        51.05        54.31        1.06x
BenchmarkDecodeDigitsSpeed1e5-4        58.86        62.24        1.06x
BenchmarkDecodeDigitsSpeed1e6-4        59.63        63.13        1.06x
BenchmarkDecodeDigitsDefault1e4-4      51.94        54.61        1.05x
BenchmarkDecodeDigitsDefault1e5-4      63.70        69.13        1.09x
BenchmarkDecodeDigitsDefault1e6-4      66.08        71.43        1.08x
BenchmarkDecodeDigitsCompress1e4-4     52.25        54.56        1.04x
BenchmarkDecodeDigitsCompress1e5-4     63.34        68.30        1.08x
BenchmarkDecodeDigitsCompress1e6-4     66.84        70.64        1.06x
BenchmarkDecodeTwainSpeed1e4-4         50.74        53.40        1.05x
BenchmarkDecodeTwainSpeed1e5-4         60.77        67.03        1.10x
BenchmarkDecodeTwainSpeed1e6-4         62.08        69.78        1.12x
BenchmarkDecodeTwainDefault1e4-4       53.45        56.40        1.06x
BenchmarkDecodeTwainDefault1e5-4       73.54        79.05        1.07x
BenchmarkDecodeTwainDefault1e6-4       77.68        83.65        1.08x
BenchmarkDecodeTwainCompress1e4-4      53.21        56.15        1.06x
BenchmarkDecodeTwainCompress1e5-4      73.82        77.76        1.05x
BenchmarkDecodeTwainCompress1e6-4      79.23        83.30        1.05x

Change-Id: Ie194925c827988a380b8c2fdd13b13c4faa5d397
Reviewed-on: https://go-review.googlesource.com/15651
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-10-19 00:01:31 +00:00