Previously, the func structure contained an inaccurate value for
the args member and a 0 value for the locals member.
This change populates the func structure with args and locals
values computed by the compiler. The number of args was
already available in the ATEXT instruction. The number of
locals is now passed through in the new ALOCALS instruction.
This change also switches the unit of args and locals to be
bytes, just like the frame member, instead of 32-bit words.
R=golang-dev, bradfitz, cshapiro, dave, rsc
CC=golang-dev
https://golang.org/cl/7399045
The interpreter's os.Exit now triggers a special panic rather
than kill the test process. (It's semantically dubious, since
it will run deferred routines.) Interpret now returns its
exit code rather than calling os.Exit.
Also:
- disabled parts of a few $GOROOT/tests via os.Getenv("GOSSAINTERP").
- remove unnecessary 'slots' param to external functions; they
are never closures.
Most of the tests are disabled until go/types supports shifts.
They can be reenabled if you patch this workaround:
https://golang.org/cl/7312068
R=iant, bradfitz
CC=golang-dev, gri
https://golang.org/cl/7313062
Assume people who were going to update to Go 1 have done so.
Those with pre-Go 1 trees remaining will need to update first
to Go 1.0 (using its 'go fix') and then to Go 1.1.
Cuts the cmd/fix test time by 99% (3 seconds to 0.03 seconds).
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7402046
By avoiding the need for self-loops following calls to panic,
we reduce the number of basic blocks considerably.
R=gri
CC=golang-dev, iant
https://golang.org/cl/7403043
Overview: Function.finish() now invokes the "lifting" pass which replaces local allocs and loads and stores to such cells by SSA registers. We use very standard machinery:
(1) we build the dominator tree for the function's control flow graph (CFG) using the "Simple" Lengauer-Tarjan algorithm. (Very "simple" in fact: even simple path compression is not yet implemented.)
In sanity-checking mode, we cross check the dominator tree against an alternative implementation using a simple iterative dataflow algorithm.
This all lives in dom.go, along with some diagnostic printing routines.
(2) we build the dominance frontier for the entire CFG using the Cytron et al algorithm. The DF is represented as a slice of slices, keyed by block index. See buildDomFrontier() in lift.go.
(3) we determine for each Alloc whether it can be lifted: is it only subject to loads and stores? If so, we traverse the iterated dominance frontier (IDF) creating φ-nodes; they are not prepended to the blocks yet.
See liftAlloc() in lift.go.
(4) we perform the SSA renaming algorithm from Cytron et al, replacing all loads to lifted Alloc cells by the value stored by the dominating store operation, and deleting the stores and allocs. See rename() in lift.go.
(5) we eliminate unneeded φ-nodes, then concatenate the remaining ones with the non-deleted instructions of the block into a new slice. We eliminate any lifted allocs from Function.Locals.
To ease reviewing, I have avoided almost all optimisations at this point, though there are many opportunities to explore. These will be easier to understand as follow-up changes.
All the existing tests (pending CL 7313062) pass. (Faster!)
Details:
"NaiveForm" BuilderMode flag suppresses all the new logic.
Exposed as 'ssadump -build=N'.
BasicBlock:
- add .Index field (b.Func[b.Index]==b), simplifying
algorithms such as Kildall-style dataflow with bitvectors.
- rename the Name field to Comment to better reflect its
reduced purpose. It now has a String() method.
- 'dom' field holds dominator tree node; private for now.
- new predIndex method.
- hasPhi is now a method
dom.go:
- domTree: a new struct for a node in a dominator tree.
- buildDomTree builds the dominator tree using the simple
variant Lengauer/Tarjan algorithm with Georgiadis'
bucket optimizations.
- sanityCheckDomTree builds dominance relation using
Kildall-style dataflow and ensures the same result is
obtained.
- printDomTreeDot prints the CFG/DomTree in GraphViz format.
blockopt.go:
- perform a mark/sweep pass to eliminate unreachable
cycles; the previous prune() opt would only eliminate
trivially dead blocks. (Needed for LT algo.)
- using .Index, fuseblocks can now delete fused blocks directly.
- delete prune().
sanity.go: more consistency checks:
- Phi with missing edge value
- local Alloc instructions must appear in Function.Locals.
- BasicBlock.Index, Func consistency
- CFG edges are all intraprocedural.
- detect nils in BasicBlock.Instrs.
- detect Function.Locals with Heap flag set.
- check fn.Blocks is nil if empty.
Also:
- Phi now has Comment field for debugging.
- Fixed bug in Select.Operands()
(took address of temporary copy of field)
- new Literal constructor zeroLiteral().
- algorithms steal private fields Alloc.index,
BasicBlock.gaps to avoid allocating maps.
- We print Function.Locals in DumpTo.
- added profiling support to ssadump.
R=iant, gri
CC=golang-dev
https://golang.org/cl/7229074
mpreinit() is called on the parent thread and with mcache (can allocate memory),
minit() is called on the child thread and can not allocate memory.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7389043
Simplifies the contract for Driver.Stmt.Close in
the process of fixing issue 3865.
Fixes#3865
Update #4459 (maybe fixes it; uninvestigated)
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7363043
Add a new, simple interface for scanning (probably textual) data,
based on a new type called Scanner. It does its own internal buffering,
so should be plausibly efficient even without injecting a bufio.Reader.
The format of the input is defined by a "split function", by default
splitting into lines. Other implemented split functions include single
bytes, single runes, and space-separated words.
Here's the loop to scan stdin as a file of lines:
s := bufio.NewScanner(os.Stdin)
for s.Scan() {
fmt.Printf("%s\n", s.Bytes())
}
if s.Err() != nil {
log.Fatal(s.Err())
}
While we're dealing with spaces, define what space means to strings.Fields.
Fixes#4802.
R=adg, rogpeppe, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/7322088
(Offsetof is a function of Alignof and Sizeof.)
- removed IntSize, PtrSize from Context (set Sizeof instead)
- GcImporter needs a Context now (it needs to have
access to Sizeof/Alignof)
- removed exported Size field from Basic (use Sizeof)
- added Offset to Field
- added Alignment, Size to Struct
R=adonovan
CC=golang-dev
https://golang.org/cl/7357046
The removed code leads to the situation when M executes the same locked G again
and again.
This is https://golang.org/cl/7310096 but with return instead of break
in the nested switch.
Fixes#4820.
R=golang-dev, alex.brainman, rsc
CC=golang-dev
https://golang.org/cl/7304102
On Windows, directory names in PATH can be fully or partially quoted
in double quotes ('"'), but the path names as used by most APIs must
be unquoted. In addition, quoted names can contain the semicolon
(';') character, which is otherwise used as ListSeparator.
This CL changes SplitList in path/filepath and LookPath in os/exec
to only treat unquoted semicolons as separators, and to unquote the
separated elements.
(In addition, fix harmless test bug I introduced for LookPath on Unix.)
Related discussion thread:
https://groups.google.com/d/msg/golang-nuts/PXCr10DsRb4/sawZBM7scYgJ
R=rsc, minux.ma, mccoyst, alex.brainman, iant
CC=golang-dev
https://golang.org/cl/7181047
The data file should be opened when a Conn is first
established, rather than waiting for the first Read or
Write.
Upon Close, we now make sure to try to close both, the
ctl as well as data files and set both to nil, even in
the face of errors, instead of returning early.
The Accept call was not setting the remote address
of the connection properly. Now, we read the correct
file.
Make functions that establish Conn use newTCPConn
or newUDPConn.
R=rsc, rminnich, ality, dave
CC=golang-dev
https://golang.org/cl/7228068
This CL changes nothing to existing API behavior, just sets up
Zone in IPNet and IPAddr structures if possible.
Also does small simplification.
Update #4234.
R=rsc, dave
CC=golang-dev
https://golang.org/cl/7300081
On Linux point-to-point interface an IFA_ADDRESS attribute
represents a peer address. For a correct interface address
we should take an IFA_LOCAL attribute instead.
Fixes#4839.
R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/7352045
This avoids ambiguity and makes the diagnostics closer to
those issued by gc, but it is more verbose since it qualifies
intra-package references.
Without extra context---e.g. a 'from *Package' parameter to
Type.String()---we are forced to err on one side or the other.
Also, cosmetic changes to exp/ssa:
- Remove package-qualification workaround in Function.FullName.
- Always set go/types.Package.Path field to the import path,
since we know the correct path at this point.
- In Function.DumpTo, show variadic '...' and result type info,
and delete now-redundant "# Type: " line.
R=gri
CC=golang-dev
https://golang.org/cl/7325051
Also:
- faster code for example extraction
- simplify handling of command documentation:
all "main" packages are treated as commands
- various minor cleanups along the way
For commands written in Go, any doc.go file containing
documentation must now be part of package main (rather
then package documentation), otherwise the documentation
won't show up in godoc (it will still build, though).
For commands written in C, documentation may still be
in doc.go files defining package documentation, but the
recommended way is to explicitly ignore those files with
a +build ignore constraint to define package main.
Fixes#4806.
R=adg, rsc, dave, bradfitz
CC=golang-dev
https://golang.org/cl/7333046
If a test can be placed in the same package ("internal"), it is placed
there. This facilitates testing of package-private details. Because of
dependency cycles some packages cannot be tested by internal tests.
R=golang-dev, rsc, mikioh.mikioh
CC=golang-dev, r
https://golang.org/cl/7323044
The current implementation would store all cookies received from
any .com domain under "com" in the entries map if a nil public
suffix list is used in constructing the Jar. This is inefficient.
This CL uses the TLD+1 of the domain if the public suffix list
is nil which has two advantages:
- It uses the entries map efficiently.
- It prevents a host foo.com to set cookies for bar.com.
(It may set the cookie, but it won't be returned to bar.com.)
A domain like www.british-library.uk may still set a domain
cookie for .british-library.uk in this case.
The behavior for a non-nil public suffix list is unchanged, cookies
are stored under eTLD+1 in this case.
R=nigeltao
CC=golang-dev
https://golang.org/cl/7312105
* Handle p==nil in signalstack by setting SS_DISABLE flag.
* Make minit only allocate a signal g if there's not one already.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7323072
The routine that adds an automatic to the stack was
adding ptrsize-1 to the size before rounding up.
That addition would only make sense to turn a round down
into a round up. Before a round up, it just wastes a word.
The effect was that a 6c function with one local and
one two-word function call used (8+8)+(16+8) = 40 bytes
instead of 8+16 = 24 bytes.
The wasted space mostly didn't matter, but one place where
it does matter is when trying to stay within the 128-byte
total frame constraint for #pragma textflag 7 functions.
This only affects the C compilers, not the Go compilers.
5c already had correct code, which is now copied to 6c and 8c.
R=ken2
CC=golang-dev
https://golang.org/cl/7303099
Re-enable TestUpdateAndDelete, TestExpiration, TestChromiumDomain and
TestChromiumDeletion on Windows.
Sorting of cookies with same path length and same creation
time is done by an additional seqNum field.
This makes the order in which cookies are returned in Cookies
deterministic, even if the system clock is manipulated or on
systems with a low-resolution clock.
The tests now use a synthetic time: This makes cookie testing
reliable in case of bogus system clocks and speeds up the
expiration tests.
R=nigeltao, alex.brainman, dave
CC=golang-dev
https://golang.org/cl/7323063
Fix the sa_mask member of the sigaction struct - on FreeBSD this is
declared as a sigset_t, which is an array of four unsigned ints.
Replace the current int64 with Sigset from defs_freebsd_GOARCH, which
has the correct definition.
Unbreaks the FreeBSD builds.
R=golang-dev, dave, minux.ma
CC=golang-dev
https://golang.org/cl/7333047
broke windows build
««« original CL description
runtime: ensure forward progress of runtime.Gosched() for locked goroutines
The removed code leads to the situation when M executes the same locked G again and again.
Fixes#4820.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7310096
»»»
TBR=dvyukov
CC=golang-dev
https://golang.org/cl/7343050
This works with at least one version of clang
that existed at one moment in time.
No guarantees about clangs past or future.
To try:
CC=clang all.bash
It does not work with the Xcode clang,
because that clang fails at printing a useful answer
to:
clang -print-libgcc-file-name
The clang that works prints a full path name for
that command, not just "libgcc.a".
Fixes#4713.
R=iant, minux.ma
CC=golang-dev
https://golang.org/cl/7323068
Arguably if this happens the program is buggy anyway,
but letting the panic continue looks better than interrupting it.
Otherwise things like this are possible, and confusing:
$ go run x.go
panic: $ echo $?
0
$
Fixes#3934.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7322083
To make sure that Go code will work when moved to a
system with a case-insensitive file system, like OS X or Windows,
reject any package built from files with names differing
only in case, and also any package built from imported
dependencies with names differing only in case.
Fixes#4773.
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7314104
This is the same logic used in the standard tracebacks.
The caller pc is the pc after the call, so except in the
fake "call" caused by a panic, back up the pc enough
that the lookup will use the previous instruction.
Fixes#4150.
Fixes#4151.
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7317047
Before, the mheap structure was in the bss,
but it's quite large (today, 256 MB, much of
which is never actually paged in), and it makes
Go binaries run afoul of exec-time bss size
limits on some BSD systems.
Fixes#4447.
R=golang-dev, dave, minux.ma, remyoudompheng, iant
CC=golang-dev
https://golang.org/cl/7307122
The removed code leads to the situation when M executes the same locked G again and again.
Fixes#4820.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7310096
Right now it says 'invalid type S' for a struct type S.
Instead, say which type inside the struct is the problem.
Fixes#4825.
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7301102
In addition to the compile failure fixed in signal*.c,
preserving the signal mask led to very strange crashes.
Testing shows that looking for SIG_IGN is all that
matters to get along with nohup, so reintroduce
sigset_zero instead of trying to preserve the signal mask.
TBR=iant
CC=golang-dev
https://golang.org/cl/7323067
There are two ways nohup(1) might be implemented:
it might mask away the signal, or it might set the handler
to SIG_IGN, both of which are inherited across fork+exec.
So two fixes:
* Make sure to preserve the inherited signal mask at
minit instead of clearing it.
* If the SIGHUP handler is SIG_IGN, leave it that way.
Fixes#4491.
R=golang-dev, mikioh.mikioh, iant
CC=golang-dev
https://golang.org/cl/7308102
Subject Alternative Names in X.509 certificates may include IP
addresses. This change adds support for marshaling, unmarshaling and
verifying this form of SAN.
It also causes IP addresses to only be checked against IP SANs,
rather than against hostnames as was previously the case. This
reflects RFC 6125.
Fixes#4658.
R=golang-dev, mikioh.mikioh, bradfitz
CC=golang-dev
https://golang.org/cl/7336046
It is too flaky. Tried to make it more reliable,
but that affects other tests (they run too long),
because we do unusual things here, like attempting
to connect to non-existing address and interrupt.
R=golang-dev, bradfitz, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/7314097
Add support for arbitrary notes of the form // MARKER(userid): comment
in the same vein as BUG(userid): A marker must be two or more upper case [A-Z] letters.
R=gri, rsc, bradfitz, jscrockett01
CC=golang-dev
https://golang.org/cl/7322061
This fixes a regression introduced in changeset 98034d036d03
which added support for producing host object files.
R=rsc, minux.ma
CC=dave, golang-dev
https://golang.org/cl/7307107
- use the new AllErrors flag where appropriate
- unless AllErrors is set, eliminate spurious
errors before they are added to the errors list
(it turns out that reporting spurious errors always
leads to too many uninformative errors after all)
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7323065
The IgnoredGoFiles are already listed in allgofiles,
so they were being run twice. Worse, the ones in
IgnoredGoFiles are not fully qualified paths, so they
weren't being found when executed outside the
package directory.
Fixes#4764.
R=golang-dev, minux.ma, franciscossouza
CC=golang-dev
https://golang.org/cl/7308049
The second attempt at the Unmarshal optimization allowed
panics to get out of the json package. Add test for that bug
and remove the optimization.
Let's stop trying to optimize Unmarshal.
Fixes#4784.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7300108
There wil be a panic if more than ten errors are encountered. ParseFile
will recover and return the ErrorList.
Fixes#3943.
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/7307085
Cleans up godoc and makes it consistent. (some had it, some
didn't)
This still keeps the information there, though, for people
looking at the source directly.
R=golang-dev, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/7324056
Avoids the dot-dot-based algorithm on repeated calls
when the directory hasn't changed.
R=golang-dev, iant, bradfitz
CC=golang-dev
https://golang.org/cl/7340043
This CL provides the implementation of Cookies and
the complete test suite. Several tests have been ported
from the Chromium project as a cross check.
R=nigeltao, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/7311073
No code changes.
This is mainly in preparation to scheduler changes,
oldstack/newstack are not related to scheduling.
R=golang-dev, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/7311085
This is based on rsc's code posted to issue 2585.
Benchmark results are greatly improved:
benchmark old ns/op new ns/op delta
BenchmarkSortString1K 564397 445897 -21.00%
BenchmarkSortInt1K 270889 221249 -18.32%
BenchmarkSortInt64K 26850765 21351967 -20.48%
Eyeballing a sampling of the raw number of comparisons shows a drop
on the order of 20-30% almost everywhere. The test input data that
doesn't match that are some of sawtooth/rand/plateau distributions,
where there is no change in the number of comparisons; that is,
there are no situations where this makes *more* comparisons.
Fixes#2585.
R=iant, rsc
CC=golang-dev
https://golang.org/cl/7306098
Completly the same like the Execer-Interface, just for Queries.
This allows Drivers to execute Queries without preparing them first
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7085056
The test for issue 3590 causes an error to be printed to stderr when run (although the error is obscured during go test std). This is confusing for people who get breakage in the net package as the error is harmless and most likely unrelated to their build breakage.
Given the way the test works, by reaching into the guts of the netFD, I can't see a way to silence the error without adding a bunch of code to support the test, therefore I am suggesting the test be removed before Go 1.1 ships.
R=alex.brainman, mikioh.mikioh, rsc
CC=golang-dev
https://golang.org/cl/7307110
Changed accidentally in 28966b7b2f0c (CopyN using Copy).
Updating docs to be consistent with 29bf5ff5064e (ReadFull & ReadAtLeast)
R=rsc
CC=golang-dev
https://golang.org/cl/7314069
Unexported field and method names that appear in the
export data (as part of some exported type) are fully
qualified with a package id (path). In some cases, a
package with that id was never exported for any other
use (i.e. only the path is of interest).
We must not create a "real" package in those cases
because we don't have a package name. Entering an
unnamed package into the map of imported packages
makes that package accessible for other imports.
Such a subsequent import may find the unnamed
package in the map, and reuse it. That reused and
imported package is then entered into the importing
file scope, still w/o a name. References to that
package cannot resolved after that. Was bug.
R=adonovan
CC=golang-dev
https://golang.org/cl/7307112
Operands returns the SSA values used by an instruction.
Referrers returns the SSA instructions that use a value, for
some values. These will be used for SSA renaming, to follow.
R=iant, gri
CC=golang-dev
https://golang.org/cl/7312090
into separate package. This allows this code to be shared
with the search package without the need for these two to use
the same tables.
Adjusted various files accordingly.
R=rsc
CC=golang-dev
https://golang.org/cl/7213044
The lowering of ast.RangeStmt now has three distinct cases:
1) rangeIter for maps and strings; approximately:
it = range x
for {
k, v, ok = next it
if !ok { break }
...
}
The Range instruction and the interpreter's "iter"
datatype are now restricted to these types.
2) rangeChan for channels; approximately:
for {
k, ok = <-x
if !ok { break }
...
}
3) rangeIndexed for slices, arrays, and *array; approximately:
for k, l = 0, len(x); k < l; k++ {
v = x[k]
...
}
In all cases we now evaluate the side effects of the range expression
exactly once, per comments on http://code.google.com/p/go/issues/detail?id=4644.
However the exact spec wording is still being discussed in
https://golang.org/cl/7307083/. Further (small)
changes may be required once the dust settles.
R=iant
CC=golang-dev
https://golang.org/cl/7303074
Simplify the internal logic for flags controlling what to vet,
by introducing a map of flags that gathers them all together.
This change should simplify the process of adding further flags.
Add a test for untagged struct literals.
Delete a redundant test that was also in the wrong file.
Clean up some ERROR patterns that weren't working.
"make test" passes again.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7305075
This CL provides the rest of the SetCookies code as well as
some test infrastructure which will be used to test also
the Cookies method. This test infrastructure is optimized
for readability and tries to make it easy to review table
driven test cases.
Tests for all the different corner cases of SetCookies
will be provided in a separate CL.
R=nigeltao, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/7306054
Support reading pax archives and applying extended attributes
like long names, subsecond mtime resolutions, etc. Default to
writing pax archives for long file and link names.
Support reading gnu archives using the ././@LongLink extended
header for file name and link target.
Fixes#3300
R=dsymonds, dave, rogpeppe, remyoudompheng, chressie, rsc
CC=golang-dev
https://golang.org/cl/6700047
On Windows, CryptoAPI is finding an alternative validation path. Since
this is a little non-deterministic, this change disables that test
when using system validation.
R=golang-dev
CC=golang-dev
https://golang.org/cl/7313068
By default, crypto/x509 assumes that users wish to validate
certificates for ServerAuth. However, due to historical reasons,
COMODO's intermediates don't specify ServerAuth as an allowed key
usage.
Rather NSS and CryptoAPI both allow these SGC OIDs to be equivalent to
ServerAuth.
R=rsc
CC=golang-dev
https://golang.org/cl/7312070
Add benchmark for request parsing. Fixture data is taken from https://github.com/felixge/node-http-perf
% go version
go version devel +28966b7b2f0c Thu Feb 07 20:26:12 2013 -0800 linux/amd64
% go test -run=nil -bench=ReadRequest -benchtime=10s
PASS
BenchmarkReadRequest 2000000 9900 ns/op 61.71 MB/s 3148 B/op 32 allocs/op
ok net/http 12.180s
R=golang-dev, bradfitz, minux.ma, haimuiba
CC=golang-dev
https://golang.org/cl/7313048
On POSIX, '=' in key is explicitly invalid, and '\x00' in key/value is implicitly invalid.
R=golang-dev, iant, bradfitz
CC=golang-dev
https://golang.org/cl/7311061
With the new scheduler races in the tests are reported during execution of other tests.
The change joins goroutines started during the tests.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7310066
The problem happens when end=0, then end-1 is very big number.
Observed with the new scheduler.
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7307073
It might be non-blocking, but it also might be blocking.
Cannot take the chance, as Accept might block indefinitely
and make it impossible to acquire ForkLock exclusively
(during fork+exec).
Fixes#4737.
R=golang-dev, dave, iant, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/7309050
Before and after:
BenchmarkTrimSpace 20000000 81.3 ns/op
BenchmarkTrimSpace 50000000 58.0 ns/op
(most whitespace trimming is ASCII whitespace)
Same optimization appeared a handful of other places
in this file, but not here.
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/7305063
This is necessary for systems that use select as the pollster,
such as Solaris (supported by gccgo). It corresponds to the
bool returned by AddFD. In general it's not clearly defined
what happens when a descriptor used in a select is closed, and
different systems behave differently. Waking up the select
will cause the right thing to happen: the closed descriptor
will be dropped from the next iteration.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7303056
deferred block. This makes hangs in the waiting code less likely
if a goroutine exits abnormally.
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7306052
This CL is the first of a handful of CLs which will provide
the implementation of cookiejar. It contains several helper
functions and the skeleton of Cookies and SetCookies.
Proper host name handling requires the ToASCII transformation
from package idna which currently lives in the go.net
subrepo. This CL thus contains just a TODO for this issue.
R=nigeltao, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/7287046
Removes limit on maximum number of goroutines ever existed.
code.google.com/p/goexecutor tests now pass successfully.
Also slightly improves performance.
Before: $ time ./flate.test -test.short
real 0m9.314s
After: $ time ./flate.test -test.short
real 0m8.958s
Fixes#4286.
The runtime is built from llvm rev 174312.
R=rsc
CC=golang-dev
https://golang.org/cl/7218044
Closing the inotify file descriptor can take over a second
when running on Ubuntu Precise in an NFS directory, leading to
the test error in issue 3132. Closing the event channel first
lets a client that does not care about the error channel move
on.
Fixes#3132.
R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/7300045
Plan 9 compilers insist this but as we don't have Plan 9
builders, we'd better let gcc check the prototypes.
Inspired by CL 7289050.
R=golang-dev, seed, dave, rsc, lucio.dere
CC=akumar, golang-dev
https://golang.org/cl/7288056
This updates a bad reference to a method name in the example priority queue test.
The error was introduced in the example refactoring in rev. 2ea8f07b2ffe.
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7279045
A new comment directive //go:noescape instructs the compiler
that the following external (no body) func declaration should be
treated as if none of its arguments escape to the heap.
Fixes#4099.
R=golang-dev, dave, minux.ma, daniel.morsing, remyoudompheng, adg, agl, iant
CC=golang-dev
https://golang.org/cl/7289048
If a Handle's Write to a ResponseWriter fails (e.g. via a
net.Conn WriteDeadline via WriteTimeout on the Server), the
Server was blocking forever waiting for reads on that
net.Conn, even after a Write failed.
Instead, once we see a Write fail, close the connection,
since it's then dead to us anyway.
Fixes#4741
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7301043
If the analysis reached a node twice, then the analysis was cut off.
However, if the second arrival is at a lower depth (closer to escaping)
then it is important to repeat the traversal.
The repeating must be cut off at some point to avoid the occasional
infinite recursion. This CL cuts it off as soon as possible while still
passing all tests.
Fixes#4751.
R=ken2
CC=golang-dev, lvd
https://golang.org/cl/7303043
This provides the mechanism to connect SPDY support to the http
package, without pulling SPDY into the standard library.
R=rsc, agl, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/7287045
This CL adds TCPInfo struct to linux/386,arm.
It's already added to linux/amd64.
Note that not sure the reason but cgo godefs w/ latest gcc
translates a flexible array member in structures correctly,
handles it as a non-incomplete, non-opaque type, on Go 1.
This CL reverts such changes by hand for the Go 1 contract.
R=minux.ma, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/7197046
Deadlines should be extended at the beginning of
a request, not at the beginning of a connection.
Fixes#4676
R=golang-dev, fullung, patrick.allen.higgins, adg
CC=golang-dev
https://golang.org/cl/7220076
Was not re-walking the new AND node, so that its ullman
count was wrong, so that the code generator attempted to
store values in registers across the call.
Fixes#4752.
R=ken2
CC=golang-dev
https://golang.org/cl/7288054
In cmd/go's 'go help testflag':
* Rewrite list of flags to drop test. prefix on every name.
* Sort list of flags.
* Add example of using -bench to match all benchmarks.
In testing:
* Remove mention of undefined 'CPU group' concept.
Fixes#4488.
Fixes#4508.
R=adg
CC=golang-dev
https://golang.org/cl/7288053
* Document Parse's zone interpretation.
* Add ParseInLocation (API change).
* Recognize "wrong" time zone names, like daylight savings time in winter.
* Disambiguate time zone names using offset (like winter EST vs summer EST in Sydney).
The final two are backwards-incompatible changes, but I believe
they are both buggy behavior in the Go 1.0 versions; the old results
were more wrong than the new ones.
Fixes#3604.
Fixes#3653.
Fixes#4001.
R=adg
CC=golang-dev
https://golang.org/cl/7288052
This only affects code (with exception of lookupProtocol)
that is only executed on older versions of Windows.
R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/7293043
* Avoid treating CALL fn(SB) as justification for introducing
and tracking a registerized variable for fn(SB).
* Remove USED(n) after declaration and zeroing of n.
It was left over from when the compiler emitted more
aggressive set and not used errors, and it was keeping
the optimizer from removing a redundant zeroing of n
when n was a pointer or integer variable.
Update #597.
R=ken2
CC=golang-dev
https://golang.org/cl/7277048
It accepts all the build flags.
Say that instead of making a copy that will go stale.
Fixes#4742.
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7229081
Those symbols are only allowed during imports;
the parser may expect them but saying that doesn't help users.
Fixes#3434.
R=ken2
CC=golang-dev
https://golang.org/cl/7277045
For consistency with conversions that look like function calls,
conversions that don't look like function calls now allow an
optional trailing comma.
That is, int(x,) has always been syntactically valid.
Now []int(x,) is valid too.
Fixes#4162.
R=ken2
CC=golang-dev
https://golang.org/cl/7288045
This CL also replaces similar loops in other stdlib
package tests with calls to AllocsPerRun.
Fixes#4461.
R=minux.ma, rsc
CC=golang-dev
https://golang.org/cl/7002055
Expressions involving nil, even if they can be evaluated
at compile time, do not count as Go constants and cannot
be used in const initializers.
Fixes#4673.
Fixes#4680.
R=ken2
CC=golang-dev
https://golang.org/cl/7278043
The spec mostly uses the term embedded.
It's too late to change the field name but at least fix the docs.
Fixes#4514.
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/7235080
Impossible for us to check (without sleazily reaching into the
runtime) but at least document it.
Fixes#3800.
R=golang-dev, bradfitz, dave
CC=golang-dev
https://golang.org/cl/7268043
Change the stack unwinding code to compensate for the dynamic
relocation of symbols.
Change the gc instruction GC_CALL to use a relative offset instead of
an absolute address.
R=golang-dev
CC=golang-dev
https://golang.org/cl/7248048
Everybody either gets confused and thinks this is
TrimLeft/TrimRight or does this by hand which gets
repetitive looking.
R=rsc, kevlar
CC=golang-dev
https://golang.org/cl/7239044
* Separate internal and external LockOSThread, for cgo safety.
* Show goroutine that made faulting cgo call.
* Never start a panic due to a signal caused by a cgo call.
Fixes#3774.
Fixes#3775.
Fixes#3797.
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7228081
Cut out temporary cgo file in error message.
Show C.foo instead of _Ctype_foo.
Before:
x.go:20[/var/folders/00/05_b8000h01000cxqpysvccm000n9d/T/go-build242036121/command-line-arguments/_obj/x.cgo1.go:19]: cannot use tv.Usec (type int32) as type _Ctype___darwin_suseconds_t in assignment
After:
x.go:20: cannot use tv.Usec (type int32) as type C.__darwin_suseconds_t in assignment
Fixes#4255.
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7231075
The old version was using go/ast's CommentGroup.Text method,
but that method drops leading blank lines from the result, so that
if the comment looked like one of
//
// syntax error
import "C"
/*
syntax error
*/
import "C"
then the line numbers for the syntax error would be off by the
number of leading blank lines (1 in each of the above cases).
The new text extractor preserves blank lines.
Fixes#4019.
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7232071
The Unix and Plan 9 readfile call breset(b) but Windows was not,
leaving dregs in the buffer.
TBR=golang-dev
CC=golang-dev
https://golang.org/cl/7229069
If runtime's proc.c does not compile, cmd/dist used to show
the compile errors in a sea of acid output, making them impossible
to find. Change the command invocation to write the acid output
to a file, so that the errors are the only thing shown on failure.
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7221082
A step toward a fix for issue 4069.
To allow linking with arbitrary host object files, add a linker mode
that can generate a host object file instead of an executable.
Then the host linker can be invoked to generate the final executable.
This CL adds a new -hostobj flag that instructs the linker to write
a host object file instead of an executable.
That is, this works:
go tool 6g x.go
go tool 6l -hostobj -o x.o x.6
ld -e _rt0_amd64_linux x.o
./a.out
as does:
go tool 8g x.go
go tool 8l -hostld ignored -o x.o x.8
ld -m elf_i386 -e _rt0_386_linux x.o
./a.out
Because 5l was never updated to use the standard relocation scheme,
it will take more work to get this working on ARM.
This is a checkpoint of the basic functionality. It does not work
with cgo yet, and cgo is the main reason for the change.
The command-line interface will likely change too.
The gc linker has other information that needs to be returned to
the caller for use when invoking the host linker besides the single
object file.
R=iant, iant
CC=golang-dev
https://golang.org/cl/7060044
This is a backwards compatible API change that fixes broken code.
In Go 1.0, ReadFull(r, buf) could return either len(buf), nil or len(buf), non-nil.
Most code expects only the former, so do that and document the guarantee.
Code that was correct before is still correct.
Code that was incorrect before, by assuming the guarantee, is now correct too.
The same applies to ReadAtLeast.
Fixes#4544.
R=golang-dev, bradfitz, minux.ma
CC=golang-dev
https://golang.org/cl/7235074
Someone found software that generates negative numbers for the RSA
modulus in an X.509 certificate. Our error messages were very poor in
this case so this change improves that.
Update #4728
Return more helpful errors when RSA parameters are negative or zero.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7228072
* Reject import paths of the form cmd/x/y.
* Reject 'go install' of command outside GOPATH
* Clearer error rejecting 'go install' of package outside GOPATH.
* Name temporary binary for first file in 'go run' list or for test.
* Provide a way to pass -ldflags arguments with spaces.
* Pass all Go files (even +build ignored ones) to go fix, go fmt, go vet.
* Reject 'go run foo_test.go'.
* Silence 'exit 1' prints from 'go tool' invocations.
* Make go test -xxxprofile leave binary behind for analysis.
* Reject ~ in GOPATH except on Windows.
* Get a little less confused by symlinks.
* Document that go test x y z runs three test binaries.
* Fix go test -timeout=0.
* Add -tags flag to 'go list'.
* Use pkg/gccgo_$GOOS_$GOARCH for gccgo output.
Fixes#3389.
Fixes#3500.
Fixes#3503.
Fixes#3760.
Fixes#3941.
Fixes#4007.
Fixes#4032.
Fixes#4074.
Fixes#4127.
Fixes#4140.
Fixes#4311.
Fixes#4568.
Fixes#4576.
Fixes#4702.
R=adg
CC=golang-dev
https://golang.org/cl/7225074
The linker accepts MOVB involving non-byte-addressable
registers, by generating XCHG instructions to AX or BX.
It does not handle the case where nor AX nor BX are available.
See also revision 1470920a2804.
Assembling
TEXT ·Truc(SB),7,$0
MOVB BP, (BX)(AX*1)
RET
gives before:
08048c60 <main.Truc>:
8048c60: 87 dd xchg %ebx,%ebp
8048c62: 88 1c 03 mov %bl,(%ebx,%eax,1)
8048c65: 87 dd xchg %ebx,%ebp
8048c67: c3 ret
and after:
08048c60 <main.Truc>:
8048c60: 87 cd xchg %ecx,%ebp
8048c62: 88 0c 03 mov %cl,(%ebx,%eax,1)
8048c65: 87 cd xchg %ecx,%ebp
8048c67: c3 ret
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7226066
This adds a simple IntHeap example, and modifies the more complex
PriorityQueue example to make use of the index field it maintains.
Fixes#4331.
R=rsc, adg
CC=golang-dev
https://golang.org/cl/7068048
ICU and collate package: ICU requires strings to be in FCD form.
Not all NFC strings are in this form, leading to incorrect results.
Change to NFD instead.
R=rsc
CC=golang-dev
https://golang.org/cl/7201043
Export data was broken after revision 6b602ab487d6
when -l is specified at least 3 times: it makes the compiler
write out func (*T).Method() declarations in export data, which
is not supported.
Also fix the formatting of recover() in export data. It was
not treated like panic() and was rendered as "<node RECOVER>".
R=golang-dev, lvd, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/7067051
Handle return values from recvfrom correctly when the
kernel decides to not return an address.
Fixes#4636.
Fixes#4352.
R=rsc, mikioh.mikioh, dave
CC=golang-dev
https://golang.org/cl/7058062
If os.OpenFile holds ForkLock on files that block opens,
then threads that simultaneously try to do fork-exec will
get hung up (until the open succeeds). Blocked opens are
common enough on Plan 9 that protecting against fd leaks
into fork-execs means not being able to do fork-execs
properly in the general case. Thus, we forgo taking the
lock.
R=rsc, ality
CC=golang-dev
https://golang.org/cl/7235066
An hostport of "[::1]" now results in the same error message
"missing port in address" as the hostport value "127.0.0.1",
so SplitHostPort won't complain about "too many colons
in address" anymore for an IPv6 address missing a port.
Added tests checking the error values.
Fixes#4526.
R=dave, rsc, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/7038045
The JSON unmarshaller failed to allocate an array when there
are no values for the input causing the `[]` unmarshalled
to []interface{} to generate []interface{}(nil) rather than
[]interface{}{}. This wasn't caught in the tests because Decode()
works correctly and because jsonBig never generated zero-sized
arrays. The modification to scanner_test.go quickly triggers
the error:
without the change to decoder.go, but with the change to scanner_test.go:
$ go test
--- FAIL: TestUnmarshalMarshal (0.10 seconds)
decode_test.go:446: Marshal jsonBig
scanner_test.go:206: diverge at 70: «03c1OL6$":null},{"[=» vs «03c1OL6$":[]},{"[=^\»
FAIL
exit status 1
FAIL encoding/json 0.266s
Also added a simple regression to decode_test.go.
R=adg, dave, rsc
CC=golang-dev
https://golang.org/cl/7196050
Binary data in mprof.goc may prevent the garbage collector from freeing
memory blocks. This patch replaces all calls to runtime·mallocgc() with
calls to an allocator private to mprof.goc, thus making the private
memory invisible to the garbage collector. The addrhash variable is
moved outside of the .bss section.
R=golang-dev, dvyukov, rsc, minux.ma
CC=dave, golang-dev, remyoudompheng
https://golang.org/cl/7135063
To allow for stdcall decorated names on Windows, two changes were needed:
1. Change the symbol versioning delimiter '@' in cgo's dynimport output to a '#', and in cmd/ld when it parses dynimports.
2. Remove the "@N" decorator from the first argument of cgo's dynimport output (PE only).
Fixes#4607.
R=minux.ma, adg, rsc
CC=golang-dev
https://golang.org/cl/7047043
Re-assigning the return value of an atomic operation to the same variable being operated is a common mistake:
x = atomic.AddUint64(&x, 1)
Add this check to go vet.
Fixes#4065.
R=dvyukov, golang-dev, remyoudompheng, rsc
CC=golang-dev
https://golang.org/cl/7097048
This change also resolves some issues with note handling: we now make
sure that there is enough room at the bottom of every goroutine to
execute the note handler, and the `exitstatus' is no longer a global
entity, which resolves some race conditions.
R=rminnich, npe, rsc, ality
CC=golang-dev
https://golang.org/cl/6569068
Range access functions are already available in TSan library
but were not yet used.
Time for go test -race -short:
Before:
compress/flate 24.244s
exp/norm >200s
go/printer 78.268s
After:
compress/flate 17.760s
exp/norm 5.537s
go/printer 5.738s
Fixes#4250.
R=dvyukov, golang-dev, fullung
CC=golang-dev
https://golang.org/cl/7229044
Roll back CL making primitive type unmarshal faster,
because it broke the Unmarshal of malformed data.
Add benchmarks for unmarshal of primitive types.
Update #3949.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7228061
We explicitly spill all parameters to the frame during initial
SSA construction. (Later passes will remove spills.)
We now properly handle local Allocs escaping via Captures.
Also: allocate BasicBlock.Succs inline.
R=iant, iant
CC=golang-dev
https://golang.org/cl/7231050
Useful for debugging of runtime bugs.
+ Do not print "stack segment boundary" unless GOTRACEBACK>1.
+ Do not traceback system goroutines unless GOTRACEBACK>1.
R=rsc, minux.ma
CC=golang-dev
https://golang.org/cl/7098050