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.
R=rsc, ality, rminnich, bradfitz
CC=golang-dev
https://golang.org/cl/7398054
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
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.
Fixes#4293.
R=adg
CC=golang-dev
https://golang.org/cl/7427044
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.
R=nigeltao
CC=golang-dev
https://golang.org/cl/7393070
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.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7418043
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.
Update #3362
Update #3672
R=golang-dev, rsc, adg
CC=golang-dev
https://golang.org/cl/7372054
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.
R=gri
CC=golang-dev
https://golang.org/cl/7392053
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)
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7397061
If all locals are optimized away, the type instructions would stay in the instruction stream. Call fixautoused to scrub the output.
Fixes#4915.
R=rsc
CC=golang-dev
https://golang.org/cl/7385055
While submitting CL 7371051 I accidentally reverted much of CL
7395052. This change restores it.
R=gri
TBR=gri
CC=golang-dev
https://golang.org/cl/7364051
The correct semantics of named result parameters and deferred
procedures cannot be implemented with the existing Ret
instruction alone, since the required sequence is:
(1) evaluate return operands and parallel-assign them to
named result parameters
(2) invoke deferred procedures
(3) load named result parameters to form result tuple.
We introduce a new 'rundefers' instruction that explicitly
invokes the deferred procedure calls, and we generate code
that follows the sequence above.
Most functions do not use deferred procedures but this cannot
be known in a single pass. So, we add an optimisation to
eliminate redundant 'rundefers'; it is piggybacked on the
existing pass done for "lifting".
Added tests.
R=gri
CC=golang-dev
https://golang.org/cl/7411043
The current code uses 64-bit pc-relative on 64-bit systems,
but in ELF linkers there is no such thing, so we cannot
express this in a .o file. Change to 32-bit.
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7383055
This CL changes the encoding used for the Go symbol table,
stored in the binary and used at run time. It does not change
any of the semantics or structure: the bits are just packed
a little differently.
The comment at the top of runtime/symtab.c describes the new format.
Compared to the Go 1.0 format, the main changes are:
* Store symbol addresses as full-pointer-sized host-endian values.
(For 6g, this means addresses are 64-bit little-endian.)
* Store other values (frame sizes and so on) varint-encoded.
The second change more than compensates for the first:
for the godoc binary on OS X/amd64, the new symbol table
is 8% smaller than the old symbol table (1,425,668 down from 1,546,276).
This is a required step for allowing the host linker (gcc) to write
the final Go binary, since it will have to fill in the symbol address slots
(so the slots must be host-endian) and on 64-bit systems it may
choose addresses above 4 GB.
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7403054
Actually it already worked since the spec only requires that
the one immediately preceding a for/switch/... be usable as
the target of a break or continue statement.
Added a test.
Also: allocate Function.lblocks on first use.
R=gri
CC=golang-dev
https://golang.org/cl/7365058
And fix test. Pointer to unsafe.Pointer tests nothing important...
Also identify the incorrect type: go/types.Type is a Stringer.
Also fix a couple of incorrect format verbs found by new printf checker,
now that we can run it on more files.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7385051
The previous approach desugared the ast.SelectorExpr
to make implicit field selections explicit. But:
1) it was clunky since it required allocating temporary
syntax trees.
2) it was not thread-safe since it required poking
types into the shared type map for the new ASTs.
3) the desugared syntax had no place to represent the
package lexically enclosing each implicit field
selection, so it was as if they all occurred in the
same package as the explicit field selection.
This meant unexported field names changed meaning.
This CL does what I should have done all along: just
generate the SSA instructions directly from the original
AST and the promoted field information.
Also:
- add logStack util for paired start/end log messages.
Useful for debugging crashes.
R=gri
CC=golang-dev
https://golang.org/cl/7395052
Adjust the exit status string for Plan 9.
Upon allocating >100 file descriptors, Plan 9
raises a warning. Moreover, the Go runtime for
32-bit version of Plan 9 keeps /dev/bintime
open for its implementation of runtime.nanotime().
This change accounts for these things in
TestExtraFiles.
R=rsc, rminnich, ality, bradfitz
CC=golang-dev
https://golang.org/cl/7363056