Rob Pike [Wed, 6 Mar 2013 20:49:56 +0000 (12:49 -0800)]
cmd/vet: isolate the type checking code into a separate file
We can enable/disable type checking with a build tag.
Should simplify cutting the go1.1 distribution free of go/types.
Russ Cox [Wed, 6 Mar 2013 20:03:04 +0000 (15:03 -0500)]
runtime: change amd64 startup convention
Now the default startup is that the program begins at _rt0_amd64_$GOOS,
which sets DI = argc, SI = argv and jumps to _rt0_amd64.
This makes the _rt0_amd64 entry match the expected semantics for
the standard C "main" function, which we can now provide for use when
linking against a standard C library.
Dominik Honnef [Wed, 6 Mar 2013 19:35:29 +0000 (14:35 -0500)]
misc/emacs: Add compatibility for GNU Emacs 23 and XEmacs >=21.5.32
This CL adds compatibility for GNU Emacs 23 (fixing fontification
issues) and XEmacs >=21.5.32 (fixing a lot of issues). Earlier
versions of XEmacs will not be supported because they do not
support POSIX character classes. Because of that, we also make use
of a lot of functions that were added in 21.5.32.
A known and currently unfixable issue with XEmacs is that go-mode
will not always fontify identifiers that use unicode correctly.
All changes for XEmacs are annotated in the diff.
Note: go--position-bytes is not currently used anywhere, but will
be in a future CL.
Brad Fitzpatrick [Wed, 6 Mar 2013 02:47:27 +0000 (18:47 -0800)]
net/http: close TCP connection on Response.Body.Close
Previously the HTTP client's (*Response).Body.Close would try
to keep reading until EOF, hoping to reuse the keep-alive HTTP
connection, but the EOF might never come, or it might take a
long time. Now we immediately close the TCP connection if we
haven't seen EOF.
This shifts the burden onto clients to read their whole response
bodies if they want the advantage of reusing TCP connections.
In the future maybe we could decide on heuristics to read some
number of bytes for some max amount of time before forcefully
closing, but I'd rather not for now.
Statistically, touching this code makes things regress, so I
wouldn't be surprised if this introduces new bugs, but all the
tests pass, and I think the code is simpler now too. Maybe.
Rob Pike [Tue, 5 Mar 2013 22:13:53 +0000 (14:13 -0800)]
doc/effective_go.html: update slices and maps.
Drop the phrase "reference types", which has caused confusion.
Add a section about 2D arrays, a common newbie question.
traceback_arm fails with a missing pc. It needs CL 7494043.
But that only makes the build break later, this time with
"invalid freelist". Roll back until it can be fixed correctly.
««« original CL description
runtime: restrict stack root scan to locals and arguments
Joel Sing [Tue, 5 Mar 2013 10:40:37 +0000 (21:40 +1100)]
syscall: handle getsockname for unix sockets on openbsd 5.2
On OpenBSD 5.2, calling getsockname on an unbound Unix domain socket
results in a successful syscall, however the AF is unset and the length
is returned as zero. This has been changed to more portable behaviour,
which will be included in the OpenBSD 5.3 release.
For now, work around this by treating a successful getsockname() call
that returns a family of AF_UNSPEC and length of zero as a AF_UNIX
socket.
Dmitriy Vyukov [Tue, 5 Mar 2013 07:40:17 +0000 (09:40 +0200)]
runtime: fix false positive deadlock when using runtime.Goexit
Fixes #4893.
Actually it's fixed by cl/7314062 (improved scheduler),
just submitting the test.
Dmitriy Vyukov [Tue, 5 Mar 2013 07:38:15 +0000 (09:38 +0200)]
runtime: declare addtimer/deltimer in runtime.h
In preparation for integrated network poller
(https://golang.org/cl/7326051),
this is required to handle deadlines.
Robert Griesemer [Mon, 4 Mar 2013 21:55:35 +0000 (13:55 -0800)]
spec: terminating statements for functions
The only functional change is the new section
on terminating statements.
There is a minor syntax rewrite (not change)
of function declarations to make it easier to
refer to the notion of a function from all places
where it is used (function decls, method decls,
and function literals).
Includes some minor fixes/additions of missing links.
Russ Cox [Mon, 4 Mar 2013 16:23:17 +0000 (11:23 -0500)]
cmd/cgo: use explicit flag to emit dynamic linker path
Using -import_runtime_cgo would have worked great except
that it doesn't get passed to the second invocation of cgo,
and that's the one that writes the relevant file.
Fixes ARM build on systems with a different dynamic linker
than the one 5l assumes (like Gentoo).
Volker Dobler [Mon, 4 Mar 2013 03:54:36 +0000 (14:54 +1100)]
image/png: always set up palette during DecodeConfig
The old code would decode the palette only for 8-bit
images during a DecodeConfig.
This CL keeps the behavior for 8-bit images and sets
up the decoded palette also for 1, 2 and 4-bit images.
Andrew Gerrand [Sun, 3 Mar 2013 22:02:45 +0000 (09:02 +1100)]
cmd/godoc: move note argument to godoc.go
Fixes the App Engine version of godoc. The other fix is to duplicate
this code inside appinit.go. I think initHandlers is the right place
to put the strings.Split call, as the notesToShow var is used by
docServer, which is what initHandlers sets up.
Shenghou Ma [Sat, 2 Mar 2013 22:50:17 +0000 (06:50 +0800)]
cmd/dist: support for NetBSD/ARM
1. when executing a unsupported VFP instruction, the NetBSD kernel somehow
doesn't report SIGILL, and instead just spin and spin, we add a alarm(2)
to detect this case (albeit this is a kernel bug).
2. NetBSD/ARM's VFP11 support is not complete, so temporarily disable it.
3. The default gcc shipped with NetBSD-current mis-optimizes our code
at -O2, so lower the optimization level to -O1 on NetBSD/ARM.
Dmitriy Vyukov [Sat, 2 Mar 2013 06:36:06 +0000 (08:36 +0200)]
runtime: move TestGcSys into a separate process
Fixes #4904.
The problem was that when the test runs the heap had grown to ~100MB,
so GC allows it to grow to 200MB, and so the test fails.
Moving the test to a separate process makes it much more isolated and stable.
Carlos Castillo [Sat, 2 Mar 2013 00:48:21 +0000 (16:48 -0800)]
cmd/go: pass -intgosize to SWIG
swig >= 2.0.9 requires the size of int values to be passed via a command line flag. Should swig complain about the -intgosize not being supported, then alert the user to their outdated version of swig.
Robert Griesemer [Sat, 2 Mar 2013 00:45:14 +0000 (16:45 -0800)]
spec: fallthrough may not appear in last clause of a switch
Replacement for CL 7370053 which attempted to make fallthrough's
syntactically a part of switch statements. Because they may be
labeled, fixing that CL completely would require too much spec
surgery.
Fixes #4923.
R=r, iant, rsc, ken
CC=golang-dev
https://golang.org/cl/7416048
Rob Pike [Sat, 2 Mar 2013 00:41:39 +0000 (16:41 -0800)]
runtime: special-case append([]byte, string) for small strings
Also make the crossover point an architecture-dependent constant,
although it's the same everywhere for now.
Rob Pike [Fri, 1 Mar 2013 20:30:09 +0000 (12:30 -0800)]
cmd/vet: use go/printer to pretty-print expressions in printf messages
Fixes #4945.
Most examples in this issue now better, but #10 is incomplete and I'm not
certain how to reproduce it. It actually looks like a go/types problem, since
the type being reported is coming directly from that package.
Please reopen the issue if you disagree.
Dmitriy Vyukov [Fri, 1 Mar 2013 11:49:16 +0000 (13:49 +0200)]
runtime: improved scheduler
Distribute runnable queues, memory cache
and cache of dead G's per processor.
Faster non-blocking syscall enter/exit.
More conservative worker thread blocking/unblocking.
Alex Brainman [Fri, 1 Mar 2013 03:49:23 +0000 (14:49 +1100)]
libmach: many pe handling fixes
- implement windows pread;
- set correct Fhdr.type;
- add ImageBase to all pe "virtual" addresses;
- correct settext parameter order;
- use pclntab/epclntab to find line numbers.
Alan Donovan [Fri, 1 Mar 2013 01:37:25 +0000 (20:37 -0500)]
go/types: fix regression in type checking of RangeStmt.
Now that untyped expressions are done in two phases, the
identity of operand.expr is used as a map key; when reusing
operand values we now must be careful to update the
expr field.