Matthew Dempsky [Tue, 27 Oct 2015 00:53:22 +0000 (17:53 -0700)]
runtime: eliminate some unnecessary uintptr conversions
arena_{start,used,end} are already uintptr, so no need to convert them
to uintptr, much less to convert them to unsafe.Pointer and then to
uintptr. No binary change to pkg/linux_amd64/runtime.a.
David du Colombier [Sat, 24 Oct 2015 11:28:00 +0000 (13:28 +0200)]
syscall: define common notes on Plan 9
There is no signal list on Plan 9, since notes
are strings. However, some programs expect
signals to be defined in the syscall package.
Hence, we define a list of the most common notes.
Updates #11975.
Change-Id: I852e14fd98777c9595a406e04125be1cbebed0fb
Reviewed-on: https://go-review.googlesource.com/16301 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Matthew Dempsky [Mon, 26 Oct 2015 19:38:47 +0000 (12:38 -0700)]
runtime: fix tiny allocator
When a new tiny block is allocated because we're allocating an object
that won't fit into the current block, mallocgc saves the new block if
it has more space leftover than the old block. However, the logic for
this was subtly broken in golang.org/cl/2814, resulting in never
saving (or consequently reusing) a tiny block.
Change-Id: Ib5f6769451fb82877ddeefe75dfe79ed4a04fd40
Reviewed-on: https://go-review.googlesource.com/16330
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Austin Clements [Fri, 16 Oct 2015 20:52:26 +0000 (16:52 -0400)]
runtime: partition data and BSS root marking
Currently data and BSS root marking are each a single markroot job.
This makes them difficult to load balance, which can draw out mark
termination time if they are large.
Fix this by splitting both in to 256K chunks. While we're putting in
the infrastructure for dynamic roots, we also replace the fixed
sharding of the span roots with sharding in to fixed sizes. In
addition to helping balance root marking, this also paves the way to
parallelizing concurrent scan and to letting assists help with root
marking.
Updates #10345. This fixes the data and BSS aspects of that bug; it
does not partition scanning of large heap objects.
This has negligible effect on either the go1 benchmarks or the garbage
benchmark:
name old time/op new time/op delta
XBenchGarbage-12 4.90ms ± 1% 4.91ms ± 2% ~ (p=0.058 n=17+16)
David Crawshaw [Mon, 26 Oct 2015 15:15:09 +0000 (11:15 -0400)]
androidtest.bash: set GOARM=7
It's the only ARM version we have ever supported on android.
(Not setting it caused some builder timeouts.)
Change-Id: I26061434252ff2a236bb31d95787a1c582d24b3f
Reviewed-on: https://go-review.googlesource.com/16295 Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
David Crawshaw [Tue, 15 Sep 2015 16:22:46 +0000 (12:22 -0400)]
runtime: use a 64kb system stack on arm
I went looking for an arm system whose stacks are by default smaller
than 64KB. In fact the smallest common linux target I could find was
Android, which like iOS uses 1MB stacks.
Fixes #11873
Change-Id: Ieeb66ad095b3da18d47ba21360ea75152a4107c6
Reviewed-on: https://go-review.googlesource.com/14602 Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com> Reviewed-by: Minux Ma <minux@golang.org>
Marcel van Lohuizen [Mon, 31 Aug 2015 20:24:07 +0000 (22:24 +0200)]
cmd/compile/internal/gc: make embedded unexported structs RO
gc will need to be rebuild.
Package that assume f.PkgPath != nil means a field is unexported and
must be ignored must be revised to check for
f.PkgPath != nil && !f.Anonymous,
so that they do try to walk into the embedded fields to look for
exported fields contained within.
Closes #12367, fixes #7363, fixes #11007, and fixes #7247.
Cover some functions that weren't benched before and add InString
variants if the underlying implementation is different.
Note: compare (Valid|RuneCount)InString* to their (Valid|RuneCount)*
counterparts. It shows, somewhat unexpectedly, that ranging over
a string is *much* slower than using calls to DecodeRune.
Results:
In order to avoid a discrepancy in measuring the performance
of core we could leave the names of the string-based measurements
unchanged and suffix the added alternatives with Bytes.
Marcel van Lohuizen [Fri, 28 Aug 2015 07:33:51 +0000 (09:33 +0200)]
reflect: adjust access to unexported embedded structs
This CL changes reflect to allow access to exported fields and
methods in unexported embedded structs for gccgo and after gc
has been adjusted to disallow access to embedded unexported structs.
David Crawshaw [Mon, 19 Oct 2015 20:31:20 +0000 (16:31 -0400)]
cmd/go, cmd/link: -buildmode=pie for linux/amd64
Depends on external linking right now. I have no immediate use for
this, but wanted to check how hard it is to support as android/amd64
is coming and it will require PIE.
Change-Id: I65c6b19159f40db4c79cf312cd0368c2b2527bfd
Reviewed-on: https://go-review.googlesource.com/16072 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Didier Spezia [Fri, 28 Aug 2015 17:36:35 +0000 (17:36 +0000)]
regexp: fix slice bounds out of range panics
Regular expressions involving a (x){0} term are
simplified by removing this term from the
expression, just before the expression is compiled.
The number of subexpressions is evaluated before
the simplification. The number of capture instructions
in the compiled expressions is not necessarily in line
with the number of subexpressions.
When the ReplaceAll(String) methods are used, a number
of capture slots (nmatch) is evaluated as 2*(s+1)
(s being the number of subexpressions).
In some case, it can be higher than the number of capture
instructions evaluated at compile time, resulting in a
panic when the internal slices of regexp.machine
are resized to this value.
Fixed by capping the number of capture slots to the number
of capture instructions.
I must say I do not really see the benefits of setting
nmatch lower than re.prog.NumCap using this 2*(s+1) formula,
so perhaps this can be further simplified.
Robert Griesemer [Fri, 14 Aug 2015 02:05:37 +0000 (19:05 -0700)]
cmd/compile/internal/gc: compact binary export format
The binary import/export format is significantly more
compact than the existing textual format. It should
also be faster to read and write (to be measured).
Use -newexport to enable, for instance:
export GO_GCFLAGS=-newexport; make.bash
The compiler can import packages using both the old
and the new format ("mixed mode").
Missing: export info for inlined functions bodies
(performance issue, does not affect correctness).
Disabled by default until we have inlined function
bodies and confirmation of no regression and equality
of binaries.
Austin Clements [Thu, 13 Aug 2015 03:43:43 +0000 (23:43 -0400)]
runtime: add pcvalue cache to improve stack scan speed
The cost of scanning large stacks is currently dominated by the time
spent looking up and decoding the pcvalue table. However, large stacks
are usually large not because they contain calls to many different
functions, but because they contain many calls to the same, small set
of recursive functions. Hence, walking large stacks tends to make the
same pcvalue queries many times.
Based on this observation, this commit adds a small, very simple, and
fast cache in front of pcvalue lookup. We thread this cache down from
operations that make many pcvalue calls, such as gentraceback, stack
scanning, and stack adjusting.
This simple cache works well because it has minimal overhead when it's
not effective. I also tried a hashed direct-map cache, CLOCK-based
replacement, round-robin replacement, and round-robin with lookups
disabled until there had been at least 16 probes, but none of these
approaches had obvious wins over the random replacement policy in this
commit.
This nearly doubles the overall performance of the deep stack test
program from issue #10898:
name old time/op new time/op delta
Issue10898 16.5s ±12% 9.2s ±12% -44.37% (p=0.008 n=5+5)
It's a very slight win on the garbage benchmark:
name old time/op new time/op delta
XBenchGarbage-12 4.92ms ± 1% 4.89ms ± 1% -0.75% (p=0.000 n=18+19)
It's a wash (but doesn't harm performance) on the go1 benchmarks,
which don't have particularly deep stacks:
In earlier versions of Go, times were only encoded as an ASN.1 UTCTIME and
crypto/tls/generate_cert.go limited times to the maximum UTCTIME value.
Revision 050b60a3 added support for ASN.1 GENERALIZEDTIME, allowing larger
time values to be represented (per RFC 5280).
As a result, when the httptest certificate was regenerated in revision 9b2d84ef, the Not After date changed to Jan 29 16:00:00 2084 GMT. Update
the comment to reflect this.
Change-Id: I1bd66e011f2749f9372b5c7506f52ea34e264ce9
Reviewed-on: https://go-review.googlesource.com/16193 Reviewed-by: Adam Langley <agl@golang.org>
Matthew Dempsky [Thu, 15 Oct 2015 22:59:49 +0000 (15:59 -0700)]
runtime: add mSpanList type to represent lists of mspans
This CL introduces a new mSpanList type to replace the empty mspan
variables that were previously used as list heads.
To be type safe, the previous circular linked list data structure is
now a tail queue instead. One complication of this is
mSpanList_Remove needs to know the list a span is being removed from,
but this appears to be computable in all circumstances.
As a temporary sanity check, mSpanList_Insert and mSpanList_InsertBack
record the list that an mspan has been inserted into so that
mSpanList_Remove can verify that the correct list was specified.
Whereas mspan is 112 bytes on amd64, mSpanList is only 16 bytes. This
shrinks the size of mheap from 50216 bytes to 12584 bytes.
Alex Brainman [Wed, 9 Sep 2015 00:54:25 +0000 (10:54 +1000)]
path/filepath: test EvalSymlinks returns canonical path on windows
When you create C:\A.TXT file on windows, you can open it as c:\a.txt.
EvalSymlinks("c:\a.txt") returns C:\A.TXT. This is all EvalSymlinks
did in the past, but recently symlinks functionality been implemented on
some Windows version (where symlinks are supported). So now EvalSymlinks
handles both: searching for file canonical name and resolving symlinks.
Unfortunately TestEvalSymlinks has not been adjusted properly. The test
tests either canonical paths or symlinks, but not both. This CL separates
canonical paths tests into new TestEvalSymlinksCanonicalNames, so all
functionality is covered. Tests are simplified somewhat too.
Also remove EvalSymlinksAbsWindowsTests - it seems not used anywhere.
Change-Id: Id12e9f1441c1e30f15c523b250469978e4511a84
Reviewed-on: https://go-review.googlesource.com/14412 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Shenghou Ma [Wed, 21 Oct 2015 21:04:49 +0000 (17:04 -0400)]
runtime: fix typos
Change-Id: Iffc25fc80452baf090bf8ef15ab798cfaa120b8e
Reviewed-on: https://go-review.googlesource.com/16154 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Matthew Dempsky [Wed, 21 Oct 2015 19:12:25 +0000 (12:12 -0700)]
runtime: make iface/eface handling more type safe
Change compiler-invoked interface functions to directly take
iface/eface parameters instead of fInterface/interface{} to avoid
needing to always convert.
For the handful of functions that legitimately need to take an
interface{} parameter, add efaceOf to type-safely convert *interface{}
to *eface.
Change-Id: I8928761a12fd3c771394f36adf93d3006a9fcf39
Reviewed-on: https://go-review.googlesource.com/16166
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Ian Lance Taylor [Wed, 21 Oct 2015 20:41:30 +0000 (13:41 -0700)]
doc: go1.6.txt: -msan option for cmd/{go,compile,link}
Change-Id: I8b41de496e4b58214b98267b529f3525ff6d9745
Reviewed-on: https://go-review.googlesource.com/16171 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Ian Lance Taylor [Wed, 21 Oct 2015 19:33:56 +0000 (12:33 -0700)]
cmd/go: add -msan option
The -msan option compiles Go code to use the memory sanitizer. This is
intended for use when linking with C/C++ code compiled with
-fsanitize=memory. When memory blocks are passed back and forth between
C/C++ and Go, code in both languages will agree as to whether the memory
is correctly initialized or not, and will report errors for any use of
uninitialized memory.
Change-Id: I2dbdbd26951eacb7d84063cfc7297f88ffadd70c
Reviewed-on: https://go-review.googlesource.com/16169 Reviewed-by: David Crawshaw <crawshaw@golang.org>
Keith Randall [Wed, 21 Oct 2015 19:32:14 +0000 (12:32 -0700)]
cmd/internal/obj: fix PSRLW opcode
The reg-reg version compiled to PSRAW, not PSRLW (arithmetic
instead of logical shift right).
Fixes #13010.
Change-Id: I69a47bd83c8bbe66c7f8d82442ab45e9bf3b94fb
Reviewed-on: https://go-review.googlesource.com/16168 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Hyang-Ah Hana Kim [Wed, 21 Oct 2015 17:50:06 +0000 (13:50 -0400)]
androidtest.bash: correct the location of compiled packages
For android, gc builds with buildmode=pie by default, and
as a result, the compiled packages are not installed in
the usual pkg/$GOOS_$GOARCH pack. Copy the compiled packages
in pkg/android_$GOARCH_shared into the pkg/android_$GOARCH
in the test device.
Change-Id: I909e4cc7095ac95ef63bdf6ddc4cb2c698f3459e
Reviewed-on: https://go-review.googlesource.com/16151 Reviewed-by: David Crawshaw <crawshaw@golang.org>
Ian Lance Taylor [Wed, 21 Oct 2015 18:04:42 +0000 (11:04 -0700)]
runtime, syscall: add calls to msan functions
Add explicit memory sanitizer instrumentation to the runtime and syscall
packages. The compiler does not instrument the runtime package. It
does instrument the syscall package, but we need to add a couple of
cases that it can't see.
Change-Id: I2d66073f713fe67e33a6720460d2bb8f72f31394
Reviewed-on: https://go-review.googlesource.com/16164 Reviewed-by: David Crawshaw <crawshaw@golang.org>
Hyang-Ah Hana Kim [Tue, 20 Oct 2015 21:42:21 +0000 (17:42 -0400)]
go/build: test code cleanup: remove unnecessary func var
The earlier calls to test(false) in TestDependencies were
removed by https://golang.org/cl/12576
Change-Id: If5c7994172379c2d7f633d2e9c5261e668c754fa
Reviewed-on: https://go-review.googlesource.com/16117 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Hyang-Ah Hana Kim [Tue, 20 Oct 2015 18:48:49 +0000 (14:48 -0400)]
log/syslog: disable unix/unixgram tests on android
unix/unixgram is not available to standard Android programs.
For golang/go#10807
Change-Id: I6062c3a25cffb86e58cbbd12a07dc90ffbf57185
Reviewed-on: https://go-review.googlesource.com/16114 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Ian Lance Taylor [Wed, 21 Oct 2015 16:45:27 +0000 (09:45 -0700)]
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>
Austin Clements [Sun, 18 Oct 2015 15:53:18 +0000 (11:53 -0400)]
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>
Ian Lance Taylor [Wed, 21 Oct 2015 14:04:10 +0000 (07:04 -0700)]
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>
Ian Lance Taylor [Wed, 21 Oct 2015 14:11:01 +0000 (07:11 -0700)]
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>
Konstantin Shaposhnikov [Tue, 20 Oct 2015 16:39:27 +0000 (00:39 +0800)]
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>
Ian Lance Taylor [Tue, 20 Oct 2015 17:00:07 +0000 (10:00 -0700)]
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>
acanino [Sun, 11 Oct 2015 01:35:22 +0000 (21:35 -0400)]
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>
Brad Fitzpatrick [Tue, 20 Oct 2015 22:57:12 +0000 (22:57 +0000)]
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.
Matthew Dempsky [Tue, 20 Oct 2015 07:35:12 +0000 (00:35 -0700)]
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>
Aaron Jacobs [Tue, 20 Oct 2015 22:38:27 +0000 (09:38 +1100)]
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>
Hyang-Ah Hana Kim [Tue, 20 Oct 2015 21:10:04 +0000 (17:10 -0400)]
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.
Robert Griesemer [Fri, 18 Sep 2015 01:10:20 +0000 (18:10 -0700)]
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>
Aaron Jacobs [Tue, 20 Oct 2015 02:15:12 +0000 (13:15 +1100)]
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>
Thorben Krueger [Wed, 14 Oct 2015 19:18:59 +0000 (19:18 +0000)]
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>
Nodir Turakulov [Mon, 19 Oct 2015 21:36:25 +0000 (14:36 -0700)]
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
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.
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.
Burcu Dogan [Mon, 19 Oct 2015 22:27:19 +0000 (15:27 -0700)]
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>
Michael Hudson-Doyle [Mon, 12 Oct 2015 00:20:10 +0000 (13:20 +1300)]
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>
Michael Hudson-Doyle [Sun, 11 Oct 2015 23:19:20 +0000 (12:19 +1300)]
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>
Michael Hudson-Doyle [Wed, 23 Sep 2015 09:02:50 +0000 (21:02 +1200)]
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>
David Crawshaw [Mon, 19 Oct 2015 18:41:38 +0000 (14:41 -0400)]
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>
Austin Clements [Sun, 18 Oct 2015 03:52:49 +0000 (23:52 -0400)]
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>
Nodir Turakulov [Fri, 16 Oct 2015 08:33:28 +0000 (01:33 -0700)]
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>
David Crawshaw [Mon, 19 Oct 2015 16:54:38 +0000 (12:54 -0400)]
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>