For expressions where the result type is independent
of the argument types (comparisons, conversions, rhs
of shifts), set the final expression types for those
subtrees early.
This fixes several bugs where incorrect lhs shift
operands where used (say in a comparison), but were
not reported.
Together with the changes listed below this CL fixes
many type-checker bugs.
Also:
- better documented updateExprType
- added larger comment to expr.go explaining
the basic expression checking algorithm
- use latest definition for indices and make
arguments; use the same code to check both
- use the same mechanism for cycle detection
in constant expressions as for variables
(new field Constant.visited)
- more tests for complex and make builtins
- many more and systematic tests for shifts;
moved them into separate testfile
- in the testing code, don't compare the
expected error pattern against itself
(the actual message was always ignored...)
- fix affected error patterns in the test files
- various cleanups along the way
R=adonovan
CC=golang-dev
https://golang.org/cl/7432051
lib9: fix runcmd, removeall, and tempdir functions
cmd/dist: Include run_plan9.c and tempdir_plan9.c
from lib9 for build, and in general consider
file names containing "plan9" for building.
cmd/ld: provide function args for the new functions
from lib9.
R=rsc, rminnich, ality, bradfitz
CC=golang-dev
https://golang.org/cl/7666043
Method calls on interfaces with large stored values
will call the pointer receiver method which may be
a wrapper over a method with value receiver.
This is particularly inefficient for very small bodies.
Inlining the wrapped method body saves a potentially expensive
function call.
benchmark old ns/op new ns/op delta
BenchmarkSortString1K 802295 641387 -20.06%
BenchmarkSortInt1K 359914 238234 -33.81%
BenchmarkSortInt64K 35764226 22803078 -36.24%
Fixes#4707.
R=golang-dev, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/7214044
This includes a simplified resolvePath function and tests for all normal and abnormal path resolution examples described in RFC 3986, sections 5.4.1 and 5.4.2 [1]. Some of those examples failed before (see http://play.golang.org/p/F0ApSaXniv).
Also, parsing a reference "//foo" now works as expected. It was treated as an absolute path with very weird results (see http://play.golang.org/p/089b-_xoNe).
During path resolution, all dot segments are removed as described by the RFC.
A few existing tests had to be changed because they expected the wrong output.
Fixes#4700.
Fixes#4706.
[1] http://tools.ietf.org/html/rfc3986#section-5.4.1
R=rsc, adg, bradfitz
CC=golang-dev
https://golang.org/cl/7203059
"go build" and "go install" were mixing stdout and stderr
from the toolchain, then putting it all on stdout. With this
change, it stays mixed, and is sent to stderr. Because
the toolchain does not create output in a clean compile/install,
sending all output to stderr makese more sense.
Also fix test.bash because of "mktemp: too few X's
in template `testgo'" on Linux.
Fixes#4917.
R=golang-dev, rsc, adg
CC=golang-dev
https://golang.org/cl/7393073
I guess it would be too much to ask for gcc on my machine to give
the same errors as gcc on the builder machines.
R=ken2
CC=golang-dev
https://golang.org/cl/7686044
This brings Mach-O generation more in line with ELF generation.
Having separate sections for the symtab and pclntab mean that we
can find them that way, instead of using the deprecated debug segments.
(And the host linker will keep separate sections for us, but probably
not the debug segments.)
R=ken2
CC=golang-dev
https://golang.org/cl/7688043
Previously it was evaluated once, so re-using the timeout option
repeatedly would always generate the same deadine.
Also switch to doing just one pass over the options, making
the private interface actually useful.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/7608045
myrtle$ go version
go version devel +d533352b414d Sat Mar 09 05:39:15 2013 +0100 netbsd/386
myrtle$ time go test -ldflags -hostobj ../misc/cgo/test
ok _/var/project/GoLang/misc/cgo/test 10.962s
68.63s real 49.60s user 19.06s system
myrtle$ uname -a
NetBSD myrtle.plan9.local 6.0_BETA2 NetBSD 6.0_BETA2 (GENERIC) i386
R=rsc
CC=golang-dev
https://golang.org/cl/7641047
Update #4929
Regenerated from FreeBSD-9.1 for amd64 and 386, FreeBSD-CURRENT for arm.
R=devon.odell, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/7438053
The call to the C function runtime.findnull() requires
that we provide the argument at 0(SP).
R=rsc, rminnich, ality
CC=golang-dev
https://golang.org/cl/7559047
The sticking point on 386 has been the "PC relative" relocations
used to point the garbage collection metadata at the type info.
These aren't in the code segment, and I don't trust that the linker
isn't doing something special that would be okay in code but
not when interpreting the pointers as data (for example, a PLT
jump table would be terrible).
Solve the problem in two steps:
1. Handle "PC relative" relocations within a section internally,
so that the external linker never sees them.
2. Move the gcdata and gcbss tables into the rodata section,
where the type information lives, so that the relocations can
be handled internally.
(To answer the obvious question, we make the gc->type
references relative so that they need not be relocated
individually when generating a shared object file.)
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7629043
For better printing, I recently changed Name to return "<unnamed>" for templates
with empty names, but this causes trouble for the many packages that used "" as
the template name, so restore the old behavior.
It's usually printed as a quoted string anyway, so it should be fine.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/7577044
Otherwise the next goroutine run on the m
can get inadvertently locked if it executes a cgo call
that turns on the internal lock.
While we're here, fix the cgo panic unwind to
decrement m->ncgo like the non-panic unwind does.
Fixes#4971.
R=golang-dev, iant, dvyukov
CC=golang-dev
https://golang.org/cl/7627043
Before this CL, running
cd misc/cgo/test
go test -c
readelf --dyn-syms test.test | grep cgoexp
turned up many UNDEF symbols corresponding to symbols actually
in the binary but marked only cgo_export_static. Only symbols
marked cgo_export_dynamic should be listed in this mode.
And if the symbol is going to be listed, it should be listed with its
actual address instead of UNDEF.
The Linux dynamic linker didn't care about the seemingly missing
symbols, but the BSD one did.
This CL eliminates the symbols from the dyn-syms table.
R=golang-dev
TBR=golang-dev
CC=golang-dev
https://golang.org/cl/7624043
- Introduce MaxAlign constant and use in data layout
and ELF section header.
- Allow up to 16-byte alignment for large objects
(will help Keith's hash changes).
- Emit ELF symbol for .rathole (global /dev/null used by 8c).
- Invoke gcc with -m32/-m64 as appropriate.
- Don't invoke gcc if writing the .o file failed.
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7563045
Now the default startup is that the program begins at _rt0_386_$GOOS,
which behaves as if calling main(argc, argv). Main jumps to _rt0_386.
This makes the _rt0_386 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.
386 analogue of https://golang.org/cl/7525043
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7551045
Implement what Chrome calls socket "late binding". See:
https://insouciant.org/tech/connection-management-in-chromium/
In a nutshell, if our HTTP client needs a TCP connection to a
remote host and there's not an idle one available, rather than
kick off a dial and wait for that specific dial, we instead
kick off a dial and wait for either our own dial to finish, or
any other TCP connection to that same host to become
available.
The implementation looks like a classic "Learning Go
Concurrency" slide.
Chrome's commit and numbers:
http://src.chromium.org/viewvc/chrome?view=rev&revision=36230
R=golang-dev, daniel.morsing, adg
CC=golang-dev
https://golang.org/cl/7587043
Change 231af8ac63aa (CL 7314062) made runtime.enteryscall()
set m->mcache = nil, which means that we can no longer use
syscall.errstr in syscall.Syscall and syscall.Syscall6, since it
requires a new buffer to be allocated for holding the error string.
Instead, we use pre-allocated per-M storage to hold error strings
from syscalls made while in entersyscall mode, and call
runtime.findnull to calculate the lengths.
Fixes#4994.
R=rsc, rminnich, ality, dvyukov, rminnich, r
CC=golang-dev
https://golang.org/cl/7567043
This CL splits multicast listener tests into two; for IPv4 and
for IPv6. It also removes redundant test inputs and makes sure
that assignment of multicast interface to stablize the tests.
Fixes#4059.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7565043
Move pollServer from fd_unix.go to fd_poll_unix.go.
Add pollServerInit(*NetFD) to allow custom initialization.
Add pollServer.Close(*NetFD) to allow custom finalization.
Move setDeadline() to fd_poll_unix.go to allow custom handling of deadlines.
Move newPollServer() to fd_poll_unix.go to allow custom initialization.
No logical code changes.
The next step will be to turn off fd_poll_unix.go for some platform
(I have changes for darwin/linux) and redirect it into runtime. See:
https://golang.org/cl/7569043/diff/2001/src/pkg/net/fd_poll_runtime.go
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7513045
The deadlock episodically occurs on misc/cgo/test/TestCthread.
The problem is that starttheworld() leaves some P's with local work
without M's. Then all active M's enter into syscalls, but reject to
wake another M's due to the following check (both in entersyscallblock() and in retake()):
if(p->runqhead == p->runqtail &&
runtime·atomicload(&runtime·sched.nmspinning) +
runtime·atomicload(&runtime·sched.npidle) > 0)
continue;
R=rsc
CC=golang-dev
https://golang.org/cl/7424054
Still to do: non-linux and non-amd64.
It may work on other ELF-based amd64 systems too, but untested.
"go test -ldflags -hostobj $GOROOT/misc/cgo/test" passes.
Much may yet change, but this seems a reasonable checkpoint.
R=iant
CC=golang-dev
https://golang.org/cl/7369057
Ensure that accept/connect respect deadline,
even if the operation can be executed w/o blocking.
Note this changes external behavior, but it makes
it consistent with read/write.
Factor out deadline check into pollServer.PrepareRead/Write,
in preparation for edge triggered pollServer.
Ensure that pollServer.WaitRead/Write are not called concurrently
by adding rio/wio locks around connect/accept.
R=golang-dev, mikioh.mikioh, bradfitz, iant
CC=golang-dev
https://golang.org/cl/7436048
Some IDS somewhere thinks "Go http package" is a virus.
Make it something else for Go 1.1. Dumb but easy.
R=golang-dev, bradfitz, minux.ma
CC=golang-dev
https://golang.org/cl/7532043
We can enable/disable type checking with a build tag.
Should simplify cutting the go1.1 distribution free of go/types.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7482045
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.
R=golang-dev, devon.odell, minux.ma
CC=golang-dev
https://golang.org/cl/7525043
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.
Please test your HTTP client code before Go 1.1.
Fixes#3672
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7419050
The only check so far is for self-assignments of the form "expr = expr",
but even that found one instance in the standard library.
R=r, adg, mtj, rsc
CC=golang-dev
https://golang.org/cl/7455048
broke arm garbage collector
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
R=rsc
CC=golang-dev
https://golang.org/cl/7301062
»»»
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7493044
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.
Makes TestPassFD work on OpenBSD 5.2.
Fixes#4956.
R=golang-dev, minux.ma, rsc, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/7449046
Implementation closely based on Russ' CL 7440047.
Future work: The error messages could be better
(e.g., instead of "missing return" it might say
"missing return (no default in switch)", etc.).
R=adonovan, rsc
CC=golang-dev
https://golang.org/cl/7437049
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).
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7432048
Use a 17 MB payload instead of a 1 MB payload, since
OS X can apparently buffer up to 16 MB in its pipes.
Fixes#4958 maybe
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7453049
If the constant CollectStats is non-zero and GOGCTRACE=1
the garbage collector will print basic statistics about executed
GC instructions.
R=golang-dev, dvyukov
CC=golang-dev, rsc
https://golang.org/cl/7413049
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.
Fixes#4279.
R=golang-dev, nigeltao
CC=golang-dev
https://golang.org/cl/7421048
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.
R=dsymonds
CC=golang-dev
https://golang.org/cl/7434044