Rémy Oudompheng [Thu, 29 Aug 2013 08:16:09 +0000 (10:16 +0200)]
cmd/gc: fix detection of initialization loop.
The compiler computes initialization order by finding
a spanning tree between a package's global variables.
But it does so by walking both variables and functions
and stops detecting cycles between variables when they
mix with a cycle of mutually recursive functions.
Andrew Gerrand [Thu, 29 Aug 2013 04:41:44 +0000 (14:41 +1000)]
os/exec: return idempotent Closer from StdinPipe
Before this fix, it was always an error to use the Close method on the
io.WriteCloser obtained from Cmd.StdinPipe, as it would race with the
Close performed by Cmd.Wait.
Brad Fitzpatrick [Wed, 28 Aug 2013 18:16:55 +0000 (11:16 -0700)]
time: add more docs on Sleep
Merge the comment from runtime/time.goc ("at least")
and also note that negative is okay and won't crash.
I see people going out of their way to avoid passing
a negative value to Sleep.
The previous wording, though accurate, was hard to parse.
In particular, it was tempting to interpret "the method"
as referring to "the function f" instead of "Do", and
required effort to find the correct antecedent for
"this receiver".
R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/13307043
Shivakumar GN [Tue, 27 Aug 2013 17:35:06 +0000 (10:35 -0700)]
misc/pprof: pprof http used with net/http/pprof not working on windows/amd64
Removed posix assumptions in temporary file generation
Removed curl dependence
Changed opening of svg file
These must now work including symbol resolution.
[1] go tool pprof <prog_name> http://.../debug/pprof/profile
[2] go tool pprof http://.../debug/pprof/profile
Alan Donovan [Tue, 27 Aug 2013 13:47:58 +0000 (09:47 -0400)]
misc/emacs: allow users to customize path of 'go' tool.
Some users have multiple Go development trees and invoke the
'go' tool via a wrapper that sets GOROOT and GOPATH based on
the current directory. Such users should customize go-command
to point to the wrapper script.
Rob Pike [Tue, 27 Aug 2013 03:29:07 +0000 (13:29 +1000)]
text/template: make the escapers for HTML etc. handle pointers correctly
Apply the same rules for argument evaluation and indirection that are
used by the regular evaluator.
Volker Dobler [Mon, 26 Aug 2013 12:41:37 +0000 (07:41 -0500)]
net/http: do not send leading dot in cookie domain attribute
RFC 6265 allows a leading dot in a cookie domain attribute
but is clear (see section 4.1.1) that a Set-Cookie header
should be sent without these dots.
Keith Randall [Sat, 24 Aug 2013 00:28:47 +0000 (17:28 -0700)]
runtime: rename FlagNoPointers to FlagNoScan. Better represents
the use of the flag, especially for objects which actually do have
pointers but we don't want the GC to scan them.
Keith Randall [Sat, 24 Aug 2013 00:28:15 +0000 (17:28 -0700)]
cmd/gc: Reset haspointers computation. When converting from a
slice type to an array type, the haspointer-ness may change.
Before this change, we'd sometimes get types like [1]int marked
as having pointers.
Mikio Hara [Thu, 22 Aug 2013 01:33:06 +0000 (10:33 +0900)]
net: remove redundant argument check from Dial on udp, unix networks
The net package consists of thin three layers like the follwoing;
- Exposed API, that contains net.Dial, net.DialUDP, net.DialUnix
- Socket and network file descriptor, that contains net.netFD and
its methods, helper functions such as dialUDP, dialUnix
- Network pollster, that contains net.pollDesc and its methods
This CL removes redundant argument check which is already done by
API layer.
Dmitriy Vyukov [Wed, 21 Aug 2013 22:17:45 +0000 (02:17 +0400)]
runtime: do not trigger GC on g0
GC acquires worldsema, which is a goroutine-level semaphore
which parks goroutines. g0 can not be parked.
Fixes #6193.
Update the original change but do not read interface types in
the arguments area. Once the arguments area is zeroed as the
locals area is we can safely read interface type values there
too.
Dmitriy Vyukov [Wed, 21 Aug 2013 10:20:28 +0000 (14:20 +0400)]
cmd/5g, cmd/6g, cmd/8g: faster compilation
Replace linked list walk with memset.
This reduces CPU time taken by 'go install -a std' by ~10%.
Before:
real user sys
0m23.561s 0m16.625s 0m5.848s
0m23.766s 0m16.624s 0m5.846s
0m23.742s 0m16.621s 0m5.868s
after:
0m22.714s 0m14.858s 0m6.138s
0m22.644s 0m14.875s 0m6.120s
0m22.604s 0m14.854s 0m6.081s
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13084043
Todd Wang [Wed, 21 Aug 2013 04:41:55 +0000 (14:41 +1000)]
reflect: Fix Convert to add indir bit when the value is actually a
pointer. An example that triggers the bad behavior on a 64bit
machine http://play.golang.org/p/GrNFakAYLN
rv1 := reflect.ValueOf(complex128(0))
rt := rv1.Type()
rv2 := rv1.Convert(rt)
rv3 := reflect.New(rt).Elem()
rv3.Set(rv2)
Running the code fails with the following:
panic: reflect: internal error: storeIword of 16-byte value
I've tested on a 64bit machine and verified this fixes the panic. I
haven't tested on a 32bit machine so I haven't verified the other
cases, but they follow logically.
Rob Pike [Wed, 21 Aug 2013 01:27:27 +0000 (11:27 +1000)]
text/template: implement comparison of basic types
Add eq, lt, etc. to allow one to do simple comparisons.
It's basic types only (booleans, integers, unsigned integers,
floats, complex, string) because that's easy, easy to define,
and covers the great majority of useful cases, while leaving
open the possibility of a more sweeping definition later.
{{if eq .X .Y}}X and Y are equal{{else}}X and Y are unequal{{end}}
Rob Pike [Tue, 20 Aug 2013 22:29:41 +0000 (08:29 +1000)]
archive/tar,zip: implement the os.FileInfo interface correctly.
This is potentially an API-breaking change, but it is an important bug fix.
The CL https://golang.org/cl/7305072/ added stuff to make
the tar file look more like a file system internally, including providing an
implementation of os.FileInfo for the file headers within the archive.
But the code is incorrect because FileInfo.Name is supposed to return
the base name only; this implementation returns the full path. A round
trip test added in the same shows this in action, as the slashes are
preserved as we create a header using the local implementation of
FileInfo.
The CL here changes the behavior of the tar (and zip) FileInfo to honor
the Go spec for that interface. It also clarifies that the FileInfoHeader
function, which takes a FileInfo as an argument, will therefore create
a header with only the base name of the file recorded, and that
subsequent adjustment may be necessary.
There may be code out there that depends on the broken behavior.
We can call out the risk in the release notes.
Rob Pike [Tue, 20 Aug 2013 04:33:03 +0000 (14:33 +1000)]
os: be consistent about File methods with nil receivers
Some crashed, some didn't. Make a nil receiver always
return ErrInvalid rather than crash.
Fixes #5824.
The program in the bug listing is silent now, at least on my Mac.
Dmitriy Vyukov [Mon, 19 Aug 2013 19:06:46 +0000 (23:06 +0400)]
runtime: do not preempt race calls
In the crash stack trace race cgocall() calls endcgo(),
this means that m->racecall is wrong.
Indeed this can happen is a goroutine is rescheduled to another M
during race call.
Disable preemption for race calls.
Fixes #6155.