The error was caused by a call to implements() even when
the type switch variable was not an interface.
Fixes#3786.
R=golang-dev, r
CC=golang-dev, remy
https://golang.org/cl/6354102
The previous implementation used to have a O(n) recursion
depth for unbalanced inputs. A test is added to check that a
reasonable amount of bytes is allocated in this case.
Fixes#3807.
R=golang-dev, dsymonds, gri
CC=golang-dev, remy
https://golang.org/cl/6345075
Also adds a new test for GOMAXPROCS=16 explicitly, which now passes
reliably in a stress loop like:
$ go test -c
$ (while ./http.test -test.v -test.run=Concurrency; do echo pass; done ) 2>&1 | tee foo; less foo
(It used to fail very quickly and reliably on at least Linux/amd64)
Fixes#3793
R=golang-dev, adg, r
CC=golang-dev
https://golang.org/cl/6347061
OpenSSL requires that RSA signatures be exactly the same byte-length
as the modulus. Currently it'll reject ~1/256 of our signatures: those
that end up a byte shorter.
Fixes#3796.
R=golang-dev, edsrzf, r
CC=golang-dev
https://golang.org/cl/6352093
Previously, strings that didn't have an explicit ASN.1 string type
were taken to be ASN.1 PrintableStrings. This resulted in an error if
a unrepresentable charactor was included.
For compatibility reasons, I'm too afraid to switch the default string
type to UTF8String, but this patch causes untyped strings to become
UTF8Strings if they contain a charactor that's not valid in a
PrintableString.
Fixes#3791.
R=golang-dev, bradfitz, r, r
CC=golang-dev
https://golang.org/cl/6348074
Entrust have issued a root certificate that's not marked as valid for
signing certificates.
This results in Go programs failing to validate certificates that
chain up to this root (i.e. gateway.push.apple.com:2195).
Although this is clearly a mistake on Entrust's part, it seems that we
will have to bodge around it.
R=golang-dev, dave, r
CC=golang-dev
https://golang.org/cl/6346064
Ran 'double.pl' on the pkg tree to identify doubled words.
One change to an error string return in x509; the rest are in comments.
Thanks to Matt Jibson for the idea.
R=golang-dev, bsiegert
CC=golang-dev
https://golang.org/cl/6344089
Made the following changes:
- Export errprintf() from all three OS-specific modules
- Added errprintf() to a.h
- Moved errprintf() in windows.c under xprintf(), since they are so similar
- Replaced all instances of xprintf() with errprintf() where a vflag check is done
Fixes#3788.
R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/6346056
Move panic/defer/recover-related stuff from proc.c/runtime.c to a new file panic.c.
No semantic changes.
proc.c is 1800+ LOC and is a bit difficult to work with.
R=golang-dev, dave, r
CC=golang-dev
https://golang.org/cl/6343071
The use of math.Pow for mere squaring can be extremely
slow on soft-float ARM. Even on systems with hardware
floating-point, a speedup in test duration is observed.
On amd64
Before: ok math/rand 2.009s
After: ok math/rand 0.340s
Fixes#3740.
R=dave, golang-dev, r, r
CC=golang-dev
https://golang.org/cl/6348061
The previous version was not handling an off_t (64 bit)
parameter on 32 bit i386 systems. This patch splits sendfile
into two implementations in their respective arch-specific files.
Tested on FreeBSD amd64 and i386.
R=bradfitz
CC=golang-dev
https://golang.org/cl/6356048
1. Rename 'g' and 'm' local vars to 'gp' and 'mp' (convention already used in some functions)
'g' and 'm' are global vars that mean current goroutine and current machine,
when they are shadowed by local vars, it's confusing, no ability to debug log both, etc.
2. White-space shuffling.
No semantic changes.
In preparation to bigger changes.
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/6355061
There may be further savings if convT2I can avoid the function call
if the cache is good and T is uintptr-shaped, a la convT2E, but that
will be a follow-up CL.
src/pkg/runtime:
benchmark old ns/op new ns/op delta
BenchmarkConvT2ISmall 43 15 -64.01%
BenchmarkConvT2IUintptr 45 14 -67.48%
BenchmarkConvT2ILarge 130 101 -22.31%
test/bench/go1:
benchmark old ns/op new ns/op delta
BenchmarkBinaryTree17 8588997000 8499058000 -1.05%
BenchmarkFannkuch11 5300392000 5358093000 +1.09%
BenchmarkGobDecode 30295580 31040190 +2.46%
BenchmarkGobEncode 18102070 17675650 -2.36%
BenchmarkGzip 774191400 771591400 -0.34%
BenchmarkGunzip 245915100 247464100 +0.63%
BenchmarkJSONEncode 123577000 121423050 -1.74%
BenchmarkJSONDecode 451969800 596256200 +31.92%
BenchmarkMandelbrot200 10060050 10072880 +0.13%
BenchmarkParse 10989840 11037710 +0.44%
BenchmarkRevcomp 1782666000 1716864000 -3.69%
BenchmarkTemplate 798286600 723234400 -9.40%
R=rsc, bradfitz, go.peter.90, daniel.morsing, dave, uriel
CC=golang-dev
https://golang.org/cl/6337058
The switch at the beginning of the function already ensures n > 1,
so testing for n < 2 is redundant.
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/6350051
Occasionally I see:
--- FAIL: TestAllocations-15 (0.00 seconds)
all_test.go:1575: 6 mallocs after 100 iterations
Tested:
$ go test -cpu=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 reflect
R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/6354063
Generating env.bat using dist env -wp > env.bat failed silently
if case of an error, because the message was redirected to env.bat.
Verbose messages still go to stdout, causing problems, but that's
a seperate change.
Made errprintf() identical to xprintf(), except for the output handle.
Yes, it's duplicate code, but most of the function is unpacking
the argument list and preparing it for WriteFile(), which has to be
done anyway.
R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/6343047
Number represents the actual JSON text,
preserving the precision and
formatting of the original input.
R=rsc, iant
CC=golang-dev
https://golang.org/cl/6202068
go/build section "Build Constraints", first paragraph said:
"... they must be appear near the top of the file ..."
fixed to:
"... they must appear near the top of the file ..."
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6329060
Removes an incorrect code comment and some superfluous variables.
The comment I removed says that struct fields which implement
Unmarshaler must be pointers, even if they're in an addressable
struct. That's not the case, and there's already a test in decode_test.go
that demonstrates as much.
Encoding/json has quite a few assignments of reflect.Values to extra
variables – things like "iv := v" when there's no need to make a copy. I
think these are left over from a previous version of the reflect API. If they
aren't wanted, I wouldn't mind going through the package and getting
rid of the rest of them.
R=rsc
CC=golang-dev
https://golang.org/cl/6318047
This is a new, not yet committed API.
- Changed NewCommentMap to be independent of
*File nodes and more symmetric with the
Filter and Comments methods.
- Implemented Update method for use in
AST modifications.
- Implemented String method for debugging
R=rsc
CC=golang-dev
https://golang.org/cl/6303086
A few performance improvements, but without the stack sorting
change to avoid allocating, which is instead waiting on better
escape analysis.
R=rsc
CC=golang-dev
https://golang.org/cl/6265047
The issue seems to not be triggered right now,
but I've seen the deadlock after some other legal
modifications to runtime.
So I think we are safer this way.
R=rsc, r
CC=golang-dev
https://golang.org/cl/6339051
This can only happen if the hash function we're using is getting
far more than it's fair share of collisions, but that has happened
to us repeatedly as we've expanded the allowed use cases for
hash tables (issue 1544, issue 2609, issue 2630, issue 2883, issue 3695).
Maybe this will help the next time we try something new.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6306083
pkg/math/all_test.go tests Atan (and therefore Asin and Acos) to a
relative accuracy of 4e-16, but the test vector misses values where
the old algorithm was in error by more than that. For example:
x newError oldError
0.414215746 1.41e-16 -4.24e-16
0.414216076 1.41e-16 -4.24e-16
0.414217632 1.41e-16 -4.24e-16
0.414218770 1.41e-16 -4.24e-16
0.414225466 0 -5.65e-16
0.414226244 1.41e-16 -4.24e-16
0.414228756 0 -5.65e-16
0.414235089 0 -5.65e-16
0.414237070 0 -5.65e-16
R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/6302093
Several of my students were confused by trying to use both the error
return and a reply return, so I figured it was worth explicitly clarifying
that returning an error overrides the reply.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6327051
Flame motivated me to get around to adding extended key usage support
so that code signing certificates can't be used for TLS server
authentication and vice versa.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6304065
if we were to use sizeof(sa.sa_mask) instead of 8 as the last argument
to rt_sigaction, we would have already fixed this bug, so also updated
Linux/386 and Linux/amd64 files to use that; also test the return value
of rt_sigaction.
R=dave, rsc
CC=golang-dev
https://golang.org/cl/6297087
If the server replies with an HTTP response before we're done
writing our body (for instance "401 Unauthorized" response), we
were previously ignoring that, since we returned our write
error ("broken pipe", etc) before ever reading the response.
Now we read and write at the same time.
Fixes#3595
R=rsc, adg
CC=golang-dev
https://golang.org/cl/6238043
Also, fixes one violation found during testing where both
response and error could be non-nil when a CheckRedirect test
failed. This is arguably a minor API (behavior, not
signature) change, but it wasn't documented either way and was
inconsistent & non-Go like. Any code depending on the old
behavior was wrong anyway.
R=adg, rsc
CC=golang-dev
https://golang.org/cl/6307088
A comment to that effect was introduced
with rev d332f4b9cef5 but the respective
code wasn't deleted.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6304086
Fixes a situation where a nested bad type would still
permit the outer type to install a working engine, leading
to inconsistent behavior.
Fixes#3273.
R=bsiegert, rsc
CC=golang-dev
https://golang.org/cl/6294067
A comment map associates comments with AST nodes
and permits correct updating of the AST's comment
list when the AST is manipulated.
R=rsc
CC=golang-dev
https://golang.org/cl/6281044
This slipped in with the implementation of Getpid in CL 5909043.
I'd exclude that CL entirely but it is tangled up in the Win32finddata changes.
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/6297065
Preserve old API by using correct struct in system call
and then copying the results, as we did for SetsockoptLinger.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6307065
This new error is the only API change in the current draft of
Go 1.0.2 CLs. I'd like to include the CL that introduced it,
because it replaces a mysterious 'internal error' with a
useful error message, but I don't want any API changes,
so unexport the error constant for now. It can be
re-exported for Go 1.1.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6294055
Fixes#3708.
The fix to allow 5{c,g,l} to compile under clang 3.1 broke cross
compilation on darwin using the Apple default compiler on 10.7.3.
This failure was introduced in 9b455eb64690.
This has been tested by cross compiling on darwin/amd64 to linux/arm using
* gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)
* clang version 3.1 (branches/release_31)
As well as on linux/arm using
* gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
* Ubuntu clang version 3.0-6ubuntu3 (tags/RELEASE_30/final) (based on LLVM 3.0)
* Debian clang version 3.1-4 (branches/release_31) (based on LLVM 3.1)
R=consalus, rsc
CC=golang-dev
https://golang.org/cl/6307058
The type declarations were being generated using
a range over a map, which meant that successive
runs produced different orders. This will make sure
successive runs produce the same files.
Fixes#3707.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6300062
If there are mutually recursive functions, there is a cycle in
the dependency graph, so the order is actually dependency order
among the strongly connected components: mutually recursive
functions get put into the same batch and analyzed together.
(Until now the entire package was put in one batch.)
The non-recursive case (single function, maybe with some
closures inside) will be able to be more precise about inputs
that escape only back to outputs, but that is not implemented yet.
R=ken2
CC=golang-dev, lvd
https://golang.org/cl/6304050
CL 4313064 fixed its test case but did not address a
general enough problem:
type T1 struct { F *T2 }
type T2 T1
type T3 T2
could still end up copying the definition of T1 for T2
before T1 was done being evaluated, or T3 before T2
was done.
In order to propagate the updates correctly,
record a copy of an incomplete type for re-execution
once the type is completed. Roll back CL 4313064.
Fixes#3709.
R=ken2
CC=golang-dev, lstoakes
https://golang.org/cl/6301059
This is part 1 of a 2 part changelist. Part 2 contains the mechanical
change to parse.go to compare atoms (ints) instead of strings.
The overall effect of the two changes are:
benchmark old ns/op new ns/op delta
BenchmarkParser 4462274 4058254 -9.05%
BenchmarkRawLevelTokenizer 913202 912917 -0.03%
BenchmarkLowLevelTokenizer 1268626 1267836 -0.06%
BenchmarkHighLevelTokenizer 1947305 1968944 +1.11%
R=rsc
CC=andybalholm, golang-dev, r
https://golang.org/cl/6305053
The reordering speedup in CL 6245068 changed the semantics
of %#v by delaying the clearing of some flags. Restore the old
semantics and add a test.
Fixes#3706.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6302048
CL 6250075 removed AI_MASK mask on all BSD variants,
however FreeBSD's AI_MASK does not include AI_V4MAPPED
and AI_ALL, and its libc is strict about the ai_flags.
This will fix the FreeBSD builder.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6305054
On netbsd/386, tv_sec is a 64-bit integer for both timeval and timespec.
Fix the time handling code so that it works correctly.
R=golang-dev, rsc, m4dh4tt3r
CC=golang-dev
https://golang.org/cl/6256056
Thanks to Dave Cheney for the magic words "comm page".
benchmark old ns/op new ns/op delta
BenchmarkNow 197 33 -83.05%
This should make profiling a little better on OS X.
The raw time saved is unlikely to matter: what likely matters
more is that it seems like OS X sends profiling signals on the
way out of system calls more often than it should; avoiding
the system call should increase the accuracy of cpu profiles.
The 386 version would be similar but needs to do different
math for CPU speeds less than 1 GHz. (Apparently Apple has
never shipped a 64-bit CPU with such a slow clock.)
R=golang-dev, bradfitz, dave, minux.ma, r
CC=golang-dev
https://golang.org/cl/6275056
amd64 was done in CL 6275056.
We don't attempt to handle machines with clock speeds
less than 1 GHz. Those will fall back to the system call.
benchmark old ns/op new ns/op delta
BenchmarkNow 364 38 -89.53%
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6307045
Using an int64 for a block size doesn't make
sense on 32bit platforms but extracts a performance
penalty dealing with double word quantities on Arm.
linux/arm
benchmark old ns/op new ns/op delta
BenchmarkGobDecode 155401600 144589300 -6.96%
BenchmarkGobEncode 72772220 62460940 -14.17%
BenchmarkGzip 5822632 2604797 -55.26%
BenchmarkGunzip 326321 151721 -53.51%
benchmark old MB/s new MB/s speedup
BenchmarkGobDecode 4.94 5.31 1.07x
BenchmarkGobEncode 10.55 12.29 1.16x
R=golang-dev, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/6272047
The original implementation of closures created the
underlying top-level function during walk, which is fairly
late in the compilation process and caused ordering-based
complications due to earlier stages that had to be repeated
any number of times.
Create the underlying function during typecheck, much
earlier, so that later stages can be run just once.
The result is a simpler compilation sequence.
R=ken2
CC=golang-dev
https://golang.org/cl/6279049
although the comment says it uses libc's getenv, without NOPLAN9DEFINES
it actually uses p9getenv which strdups.
R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6285046
The recent shuffle in parsing formats exposed probably unintentional
behavior in time.Parse, namely that it was mostly ignoring ".99999"
in the format, producing the following behavior:
fmt.Println(time.Parse("03:04:05.999 MST", "12:00:00.888 PDT")) // error (.888 unexpected)
fmt.Println(time.Parse("03:04:05.999", "12:00:00")) // error (input too short)
fmt.Println(time.Parse("03:04:05.999 MST", "12:00:00 PDT")) // ok (extra bytes on input make it ok)
http://play.golang.org/p/ESJ1UYXzq2
API CHANGE:
This CL makes all three examples valid: ".999" can match an
empty string or else a fractional second with at most nine digits.
Fixes#3701.
R=r, r
CC=golang-dev
https://golang.org/cl/6267045
An attempt to profit from CL 6176043 (fix to superpolinomial
runtime of karatsuba multiplication) and determine a better
karatsuba threshold. The result indicates that 32 is still
a reasonable value. Left the threshold as is (== 32), but
made some minor changes to the calibrate code which are
worthwhile saving (use of existing benchmarking code for
better results, better use of package time).
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6260062