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.
Robert Griesemer [Thu, 28 Feb 2013 23:27:52 +0000 (15:27 -0800)]
go/types: fix type-checking of shift expressions
Completely rethought shift expression type checking.
Instead of attempting to type-check them eagerly, now
delay the checking of untyped constant lhs in non-
constant shifts until the final expression type
becomes clear. Once it is clear, update the respective
expression tree with the final (not untyped) type and
check respective shift lhs' where necessary.
This also cleans up another conundrum: How to report
the type of untyped constants as it changes from
untyped to typed. Now, Context.Expr is only called
for an expresion x once x has received its final
(not untyped) type (for constant initializers, the
final type may still be untyped).
With this CL all remaining std lib packages that
did not typecheck due to shift errors pass now.
TODO: There's a lot of residual stuff that needs
to be cleaned up but with this CL all tests pass
now.
Akshat Kumar [Thu, 28 Feb 2013 22:20:42 +0000 (14:20 -0800)]
os: Plan 9: allocate space for a string in Rename
The Name field of the stat structure is variable length
and the marshalling code in package syscall requires
a buf long enough to contain the Name as well as the
static data. This change makes sure that the buffer in
os.Rename is allocated with the appropriate length.
R=rsc, rminnich, ality, r
CC=golang-dev
https://golang.org/cl/7453044
Russ Cox [Thu, 28 Feb 2013 21:54:23 +0000 (13:54 -0800)]
runtime/cgo: move common symbol overrides into 6c-compiled code
There are some function pointers declared by 6c in
package runtime without initialization and then also
declared in package runtime/cgo with initialization,
so that if runtime/cgo is linked in, the function pointers
are non-nil, and otherwise they are nil. We depend on
this property for implementing non-essential cgo hooks
in package runtime.
The declarations in package runtime are 6c-compiled
and end up in .6 files. The declarations in package runtime/cgo
are gcc-compiled and end up in .o files. Since 6l links the .6
and .o files together, this all works.
However, when we switch to "external linking" mode,
6l will not see the .o files, and it would be up to the host linker
to resolve the two into a single initialized symbol.
Not all host linkers will do this (in particular OS X gcc will not).
To fix this, move the cgo declarations into 6c-compiled code,
so that they end up in .6 files, so that 6l gets them no matter what.
Russ Cox [Thu, 28 Feb 2013 21:21:58 +0000 (16:21 -0500)]
cmd/ld: fix symbol table sorting
runtime: double-check that symbol table is sorted
If the symbol table is unsorted, the binary search in findfunc
will not find its func, which will make stack traces stop early.
When the garbage collector starts using the stack tracer,
that would be a serious problem.
The unsorted symbol addresses came from from two things:
1. The symbols in an ELF object are not necessarily sorted,
so sort them before adding them to the symbol list.
2. The __i686.get_pc_thunk.bx symbol is present in multiple
object files and was having its address adjusted multiple
times, producing an incorrect address in the symbol table.
Russ Cox [Thu, 28 Feb 2013 18:44:29 +0000 (10:44 -0800)]
cmd/cgo: extend implementation comment
This is the plan for how to make host linking work with
the rest of the system.
There are two complications:
1. It is a goal to preserve the property that pure Go programs
(even ones importing "net") can be compiled without needing
gcc, so that a Go toolchain download works out of the box.
This forces the support for two linking modes: with and without
gcc.
2. It is a goal to allow users with old copies of SWIG to continue
to use those copies. This forces the support for "internal only"
packages. Perhaps it is reasonable to require a new SWIG.
I don't know.
John Graham-Cumming [Thu, 28 Feb 2013 17:29:50 +0000 (09:29 -0800)]
net/http: fix handling of HEAD in ReadResponse and (*http.Response).Write
The test suite for ReadResponse was not checking the error return on the io.Copy
on the body. This was masking two errors: the handling of chunked responses to
HEAD requests and the handling of Content-Length > 0 to HEAD.
The former manifested itself as an 'unexpected EOF' when doing the io.Copy
because a chunked reader was assigned but there were no chunks to read. The
latter cause (*http.Response).Write to report an error on HEAD requests
because it saw a Content-Length > 0 and expected a body.
There was also a missing \r\n in one chunked test that meant that the chunked
encoding was malformed. This does not appear to have been intentional.