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.
R=golang-dev
CC=golang-dev
https://golang.org/cl/7440045
The naming in this package is a disaster.
Make it all consistent.
Remove some 'static' from functions that will
be referred to from other files soon.
This CL is purely renames using global search and replace.
Submitting separately so that real changes will not
be drowned out by these renames in future CLs.
TBR=iant
CC=golang-dev
https://golang.org/cl/7416046
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.
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7440044
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.
R=iant
CC=golang-dev
https://golang.org/cl/7433043
This reveals the presence of control and non-printable characters in the
errors returned by the Parse functions. Also add unit tests for NumError.
R=golang-dev, r, rsc
CC=golang-dev
https://golang.org/cl/7393075
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.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7407046
Revision 6a88e1893941 corrupts the argument to
racefuncenter by pushing the data block pointer
to the stack.
Fixes#4885.
R=dvyukov, rsc
CC=golang-dev
https://golang.org/cl/7381053
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