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.
Akshat Kumar [Thu, 28 Feb 2013 05:43:21 +0000 (06:43 +0100)]
net, os, syscall: Plan 9: adjust error handling
syscall: Use NewError for all system errors and introduce
some new errors for compatibility with other packages
and proper error handling in net. Also introduce
Temporary and Timeout methods on ErrorString.
net: Make errors from dial, accept, listen functions follow the
OpError standard and discern whether the underlying
error came from syscall. Since Plan 9 uses a correspondence
between file and network operations, all system error
reporting happens through the underlying file operation.
In Go code, we go through package os for file operations,
so there is another level of indirection in error types.
This change allows us to compare the errors with those in
package syscall, when appropriate.
os: Just use the error string already present in package os,
instead of calling out to package syscall.
Akshat Kumar [Thu, 28 Feb 2013 05:39:02 +0000 (06:39 +0100)]
syscall: Plan 9: keep a consistent environment array
Map order is non-deterministic. Introduce a new
environment string array that tracks the env map.
This allows us to produce identical results for
Environ() upon successive calls, as expected by the
TestConsistentEnviron test in package os.
R=rsc, ality, rminnich, bradfitz, r
CC=golang-dev
https://golang.org/cl/7411047
Tyler Bunnell [Thu, 28 Feb 2013 05:09:48 +0000 (16:09 +1100)]
misc/dist: handle previous installation
The installer package will now detect a previous installation and warn the user
that the previous installation will be deleted. If the user continues, the
installer will delete the previous installation and install the package as
usual.
Volker Dobler [Thu, 28 Feb 2013 00:18:39 +0000 (11:18 +1100)]
exp/cookiejar: add some more tests
New tests added for port handling and IDNA domains.
A new test case contains several redundant
tests but provides a nice documentation of the
implemented rules for domain handling.
Rob Pike [Wed, 27 Feb 2013 23:43:33 +0000 (15:43 -0800)]
cmd/vet: continue past first error
Also delete bogus tests for f.pkg (does the file have a package) since all
files have a package attached. The tests for pkg.types and pkg.values
suffice.
Brad Fitzpatrick [Wed, 27 Feb 2013 23:20:13 +0000 (15:20 -0800)]
net/http: add Transport.CancelRequest
Permits all sorts of custom HTTP timeout policies without
adding a new Transport timeout Duration for each combination
of HTTP phases.
This keeps track internally of which TCP connection a given
Request is on, and lets callers forcefully close the TCP
connection for a given request, without actually getting
the net.Conn directly.
Additionally, a future CL will implement res.Body.Close (Issue
3672) in terms of this.
Alan Donovan [Wed, 27 Feb 2013 21:43:16 +0000 (16:43 -0500)]
exp/ssa: a number of bug fixes.
ssadump:
- permit naming a package (not just *.go files) on command line.
- set BuildSerially flag when setting Log* flags
(Q. should instead the logging functions take a lock?)
Builder:
- fixed bug when calling variadic function with zero '...'-params.
Added regression test.
interp:
- more external functions:
the 'error' interface
bytes.{Equal,IndexByte}
reflect.(Value).{Bool,NumOut,Out}
syscall.{Close,Fstat,Read,Open,Stat,Lstat,Fstat,
Getdents,ParseDirents,Getwd}
- permit comparisons between *Function and *closure.
With this CL, ssadump can now interpret ssadump itself (!),
loading, parsing, typing, SSA-building, and running
println("Hello, World!"). While a fmt-based equivalent still
lacks some external routines, e.g. math/big, I think there are
diminishing returns in expanding the interpreter (and
debugging it is starting to feel like "Inception").
I'm pretty confident this package is now good enough for wider use.
Dmitriy Vyukov [Wed, 27 Feb 2013 19:17:53 +0000 (21:17 +0200)]
runtime: more changes in preparation to the new scheduler
add per-P cache of dead G's
add global runnable queue (not used for now)
add list of idle P's (not used for now)