In general the description should describe what is added or fixed,
not how it was done (the code does this), but in this case the cause
was delete was missing, so the fix is to add it.
Fixes issue 5765.
R=golang-dev, iant, r
CC=golang-dev
https://golang.org/cl/10496043
Dmitriy Vyukov [Mon, 24 Jun 2013 19:51:00 +0000 (23:51 +0400)]
runtime/pprof: disable testing under race detector
until we decide what to do with issues 5659/5736.
Profiling with race detector is not very useful in general,
and now it makes race builders red.
Russ Cox [Mon, 24 Jun 2013 18:49:35 +0000 (14:49 -0400)]
time: avoid garbage collector aliasing bug
Time is a tiny struct, so the compiler copies a Time by
copying each of the three fields.
The layout of a time on amd64 is [ptr int32 gap32 ptr].
Copying a Time onto a location that formerly held a pointer in the
second word changes only the low 32 bits, creating a different
but still plausible pointer. This confuses the garbage collector
when it appears in argument or result frames.
To avoid this problem, declare nsec as uintptr, so that there is
no gap on amd64 anymore, and therefore no partial pointers.
Note that rearranging the fields to put the int32 last still leaves
a gap - [ptr ptr int32 gap32] - because Time must have a total
size that is ptr-width aligned.
Update #5749
This CL is enough to fix the problem, but we should still do
the other actions listed in the initial report. We're not too far
from completely precise collection.
R=golang-dev, dvyukov, r
CC=golang-dev
https://golang.org/cl/10504043
ChaiShushan [Mon, 24 Jun 2013 04:19:00 +0000 (14:19 +1000)]
misc/notepadplus: add missing operator keyword
In general the description should describe what is added or fixed,
not how it was done (the code does this), but in this
case the cause were "/ /= ;" was missing,
so the fix is to add it.
ChaiShushan [Mon, 24 Jun 2013 03:28:10 +0000 (13:28 +1000)]
misc/notepadplus: add missing delete keyword
In general the description should describe what is added or fixed, not how it was done (the code does this), but in this case the cause was delete was missing, so the fix is to add it.
Robert Griesemer [Fri, 21 Jun 2013 23:11:13 +0000 (16:11 -0700)]
spec: fix spec on conversions to match implementations
The existing compilers convert empty strings to empty
but non-nil byte and rune slices. The spec required
a nil byte and rune slice in those cases. That seems
an odd additional requirement. Adjust the spec to
match the reality.
Also, removed over-specification for conversions of
nil []byte and []rune: such nil slices already act
like empty slices and thus don't need extra language.
Added extra examples instead.
Brad Fitzpatrick [Thu, 20 Jun 2013 18:58:24 +0000 (11:58 -0700)]
net/http: fix confusing shadowing in ProxyFromEnvironment
The old code worked, somewhat on accident, but was confusing,
and had a useless assignment to the inner err. It worked
because url.Parse parses just about anything, so the outer err
was always nil, so it always fell through to the bottom return
statement, even without the "err = nil" line.
Instead, just have two return statements, and add a comment.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/10448044
Rob Pike [Thu, 20 Jun 2013 17:27:44 +0000 (10:27 -0700)]
cmd/go: put the coverage information on the summary line.
Output now:
ok crypto/aes 0.060s coverage: 89.8% of statements
ok crypto/des 0.074s coverage: 92.2% of statements
ok crypto/dsa 0.056s coverage: 34.5% of statements
ok crypto/ecdsa 0.058s coverage: 86.8% of statements
ok crypto/elliptic 0.039s coverage: 94.6% of statements
ok crypto/hmac 0.037s coverage: 93.5% of statements
ok crypto/md5 0.031s coverage: 96.2% of statements
ok crypto/rand 0.074s coverage: 9.9% of statements
ok crypto/rc4 0.090s coverage: 66.7% of statements
ok crypto/rsa 0.253s coverage: 83.5% of statements
Adam Langley [Wed, 19 Jun 2013 20:46:53 +0000 (16:46 -0400)]
crypto/tls: change advertised ciphersuite order.
TLS clients send ciphersuites in preference order (most prefereable
first). This change alters the order so that ECDHE comes before plain
RSA, and RC4 comes before AES (because of the Lucky13 attack).
This is unlikely to have much effect: as a server, the code uses the
client's ciphersuite order by default and, as a client, the non-Go
server probably imposes its order.
Rob Pike [Wed, 19 Jun 2013 00:15:26 +0000 (17:15 -0700)]
cmd/go: simplify flags for coverage
The single flag -cover provides the default simplest behavior.
The other flags, -covermode and -coverprofile, provide more
control. The three flags interconnect to work well.
Rob Pike [Tue, 18 Jun 2013 21:18:25 +0000 (14:18 -0700)]
cmd/go: write coverage to file, add percentage statistic
Move the data dumper to the testing package, where it has access
to file I/O.
Print a percentage value at the end of the run.
David Bürgin [Tue, 18 Jun 2013 04:59:50 +0000 (14:59 +1000)]
misc/vim: Added filetype settings for comments.
This basic Vim ftplugin sets the 'comments' and 'commentstring'
settings to sensible values. Future filetype settings for Go
would go in the same file.
The ftplugin was added as misc/vim/ftplugin/go/go.vim, this way
the installation instructions in readme.txt remain valid.
Fixes #5715.
Dmitriy Vyukov [Sat, 15 Jun 2013 12:07:06 +0000 (16:07 +0400)]
runtime: fix race condition between GC and setGCPercent
If first GC runs concurrently with setGCPercent,
it can overwrite gcpercent value with default.
Dmitriy Vyukov [Sat, 15 Jun 2013 12:06:28 +0000 (16:06 +0400)]
runtime: improve scheduler fairness
Currently global runqueue is starved if a group of goroutines
constantly respawn each other (local runqueue never becomes empty).
Fixes #5639.
Dmitriy Vyukov [Sat, 15 Jun 2013 12:02:39 +0000 (16:02 +0400)]
runtime: remove unused moreframesize_minalloc field
It was used to request large stack segment for GC
when it was running not on g0.
Now GC is running on g0 with large stack,
and it is not needed anymore.
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/10242045
Brad Fitzpatrick [Fri, 14 Jun 2013 15:59:43 +0000 (08:59 -0700)]
net: coalesce duplicate in-flight DNS lookups
In Issue 5625, Russ says: "We should at least have a cache of
inflight lookups, so that 100 simultaneous dials of one host
name don't do the work 100x. That's easy and (assume we forget
the answer once they all get it) doesn't pose any consistency
problems. It just merges simultaneous work."
This brings in singleflight (unexported) from Google /
Camlistore, but without its tests. Maybe we should put it
somewhere in the standard library. But not now.
Rémy Oudompheng [Fri, 14 Jun 2013 09:14:45 +0000 (11:14 +0200)]
cmd/gc: instrument arrays properly in race detector.
The previous implementation would only record access to
the address of the array but the memory access to the whole
memory range must be recorded instead.
R=golang-dev, dvyukov, r
CC=golang-dev
https://golang.org/cl/8053044
Rob Pike [Thu, 13 Jun 2013 01:13:34 +0000 (18:13 -0700)]
testing: add -outputdir flag so "go test" controls where the files are written
Obscure misfeature now fixed: When run from "go test", profiles were always
written in the package's source directory. This change puts them in the directory
where "go test" is run.
Also fix a couple of problems causing errors in testing.after to go unreported
unless -v was set.
Dmitriy Vyukov [Wed, 12 Jun 2013 14:46:35 +0000 (18:46 +0400)]
runtime: fix scheduler race condition
In starttheworld() we assume that P's with local work
are situated in the beginning of idle P list.
However, once we start the first M, it can execute all local G's
and steal G's from other P's.
That breaks the assumption above. Thus starttheworld() will fail
to start some P's with local work.
It seems that it can not lead to very bad things, but still
it's wrong and breaks other assumtions
(e.g. we can have a spinning M with local work).
The fix is to collect all P's with local work first,
and only then start them.
The garbage collection routine addframeroots is duplicating
logic in the traceback routine that calls it, sometimes correctly,
sometimes incorrectly, sometimes incompletely.
Pass necessary information to addframeroots instead of
deriving it anew.
Should make addframeroots significantly more robust.
It's certainly smaller.
Also try to standardize on uintptr for saved pc, sp values.
Ian Lance Taylor [Wed, 12 Jun 2013 03:23:21 +0000 (20:23 -0700)]
cmd/gc: save local var list before inlining
This avoids problems with inlining in genwrappers, which
occurs after functions have been compiled. Compiling a
function may cause some unused local vars to be removed from
the list. Since a local var may be unused due to
optimization, it is possible that a removed local var winds up
beingused in the inlined version, in which case hilarity
ensues.
Fixes #5515.
R=golang-dev, khr, dave
CC=golang-dev
https://golang.org/cl/10210043
Russ Cox [Wed, 12 Jun 2013 02:37:07 +0000 (22:37 -0400)]
cmd/gc: turn race detector off for tail-call method wrapper functions
It was off in the old implementation (because there was no high-level
description of the function at all). Maybe some day the race detector
should be fixed to handle the wrapper and then enabled for it, but there's
no reason that has to be today.
Russ Cox [Tue, 11 Jun 2013 20:49:24 +0000 (16:49 -0400)]
runtime: rename _rt0_$GOARCH to _rt0_go
There's no reason to use a different name on each architecture,
and doing so makes it impossible for portable code to refer to
the original Go runtime entry point. Rename it _rt0_go everywhere.
Rob Pike [Tue, 11 Jun 2013 16:35:10 +0000 (09:35 -0700)]
cmd/go: add coverage analysis
This feature is not yet ready for real use. The CL marks a bite-sized
piece that is ready for review. TODOs that remain:
provide control over output
produce output without setting -v
make work on reflect, sync and time packages
(fail now due to link errors caused by inlining)
better documentation
Almost all packages work now, though, if clumsily; try:
go test -v -cover=count encoding/binary
Russ Cox [Tue, 11 Jun 2013 13:41:49 +0000 (09:41 -0400)]
cmd/gc: move genembedtramp into portable code
Requires adding new linker instruction
RET f(SB)
meaning return but then immediately call f.
This is what you'd use to implement a tail call after
fiddling with the arguments, but the compiler only
uses it in genwrapper.
This CL eliminates the copy-and-paste genembedtramp
functions from 5g/8g/6g and makes the code run on ARM
for the first time. It removes a small special case for function
generation, which should help Carl a bit, but at the same time
it does not bother to implement general tail call optimization,
which we do not want anyway.
Gerasimos Dimitriadis [Mon, 10 Jun 2013 22:14:47 +0000 (18:14 -0400)]
asn1: Improved encoding/decoding for OID types
The first identifier in an Object Identifer must be between 0 and 2
inclusive. The range of values that the second one can take depends
on the value of the first one.
The two first identifiers are not necessarily encoded in a single octet,
but in a varint.
Russ Cox [Mon, 10 Jun 2013 20:13:25 +0000 (16:13 -0400)]
cmd/cc: fix lexbody for negative chars
The new code matches the code in cc/lex.c and the #define GETC.
This was causing problems scanning runtime·foo if the leading
· byte was returned by the buffer fill.