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
Context.Alignof/Offsetsof/Sizeof now provide means
to customize the type checker for a given platform.
- provide Context.Offsetsof to specify the
offsets of struct fields
- use the correct sizes for ints, uint, uintptrs
in constant computations
- moved all size computations into separate file
(sizes.go)
- fixed a bug with string constant slicing
R=adonovan, axwalk
CC=golang-dev
https://golang.org/cl/7363054
- imported objects don't have position information
- gc exported data contains non-exported objects at
the top-level, guard against them
- better error message when dot-imports conflict
with local declarations
R=adonovan, r
CC=golang-dev
https://golang.org/cl/7379052
pkg/go/doc: move BUG notes from Package.Bugs to the general Package.Notes field.
Removing .Bugs would break existing code so it's left in for now.
R=gri, gri, gary.burd, dsymonds, rsc, kevlar
CC=golang-dev
https://golang.org/cl/7341053
Separates the implementation of nanotime on 64-bit
version of Plan 9 from that on the 32-bit version.
The former uses a syscall.
R=rsc, rminnich, ality
CC=golang-dev
https://golang.org/cl/7379051
Also restores the checking of _test.go files, which disappeared
as a result of the package-at-a-time change.
Fixes#4895.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7399051
Functions for representing network connections as files
and vice versa, on Plan 9.
Representing network connections as files is not so
straight-forward, because a network connection on Plan 9
is represented by a host of files rather than a single
file descriptor (as is the case on UNIX). We use the
type system to distinguish between listeners and
connections, returning the control file in the former
case and the data file in the latter case.
R=rsc, rminnich, ality, akumar, bradfitz
CC=golang-dev
https://golang.org/cl/7235068
Then mark them with a build tag so they're not compiled into the binary.
They are called test_*.go rather than *_test.go because they are not
for go test. Use make test to test the command.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7377052
Composite literals using the &T{} form were incorrectly
exported, leading to weird errors at import time.
Fixes#4879.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7395054
This avoids an allocation when closures are used
as "macros", in Walk idioms, or as argument to defer.
benchmark old ns/op new ns/op delta
BenchmarkSearchWrappers 1171 354 -69.77%
BenchmarkCallClosure 3 3 -12.54%
BenchmarkCallClosure1 119 7 -93.95%
BenchmarkCallClosure2 183 74 -59.18%
BenchmarkCallClosure3 187 75 -59.57%
BenchmarkCallClosure4 187 76 -58.98%
Compared to Go 1:
benchmark old ns/op new ns/op delta
BenchmarkSearchWrappers 3208 354 -88.97%
Fixes#3520.
R=daniel.morsing, bradfitz, minux.ma, dave, rsc
CC=golang-dev
https://golang.org/cl/7397056
Syscalls return `-1' on error and the representation is always
32-bits. The `$-1' literal in 64-bit assembly is always the
64-bit representation. So this change makes sure that we
always do a 32-bit comparison when checking for error.
Also makes sure that in the error case, we return a 64-bit
`-1' from runtime.seek.
Fixes the arithmetic for handling the error-string in
runtime.Syscall6.
R=golang-dev, rminnich, rsc, ality, minux.ma
CC=golang-dev
https://golang.org/cl/7399052
sigprocmask() is process-wide on darwin, so two concurrent
libcgo_sys_thread_start() can result in all signals permanently
blocked, which in particular blocks handling of nil derefs.
Fixes#4833.
R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/7324058
Now that the type information is in TYPE instructions
that are not rewritten by the optimization passes,
we don't have to try to preserve the type information
(no longer) attached to MOV instructions.
R=ken2
CC=golang-dev
https://golang.org/cl/7402054
Now that vet does typechecking, it should use only pkg.gofiles, instead
of pkg.allgofiles. Ignored files should not be checked by vet, because
they wouldn't typecheck.
Fixes#4906.
R=rsc, r
CC=golang-dev
https://golang.org/cl/7401051
The type information is (and for years has been) included
as an extra field in the address chunk of an instruction.
Unfortunately, suppose there is a string at a+24(FP) and
we have an instruction reading its length. It will say:
MOVQ x+32(FP), AX
and the type of *that* argument is int (not slice), because
it is the length being read. This confuses the picture seen
by debuggers and now, worse, by the garbage collector.
Instead of attaching the type information to all uses,
emit an explicit list of TYPE instructions with the information.
The TYPE instructions are no-ops whose only role is to
provide an address to attach type information to.
For example, this function:
func f(x, y, z int) (a, b string) {
return
}
now compiles into:
--- prog list "f" ---
0000 (/Users/rsc/x.go:3) TEXT f+0(SB),$0-56
0001 (/Users/rsc/x.go:3) LOCALS ,
0002 (/Users/rsc/x.go:3) TYPE x+0(FP){int},$8
0003 (/Users/rsc/x.go:3) TYPE y+8(FP){int},$8
0004 (/Users/rsc/x.go:3) TYPE z+16(FP){int},$8
0005 (/Users/rsc/x.go:3) TYPE a+24(FP){string},$16
0006 (/Users/rsc/x.go:3) TYPE b+40(FP){string},$16
0007 (/Users/rsc/x.go:3) MOVQ $0,b+40(FP)
0008 (/Users/rsc/x.go:3) MOVQ $0,b+48(FP)
0009 (/Users/rsc/x.go:3) MOVQ $0,a+24(FP)
0010 (/Users/rsc/x.go:3) MOVQ $0,a+32(FP)
0011 (/Users/rsc/x.go:4) RET ,
The { } show the formerly hidden type information.
The { } syntax is used when printing from within the gc compiler.
It is not accepted by the assemblers.
The same type information is now included on global variables:
0055 (/Users/rsc/x.go:15) GLOBL slice+0(SB){[]string},$24(AL*0)
This more accurate type information fixes a bug in the
garbage collector's precise heap collection.
The linker only cares about globals right now, but having the
local information should make things a little nicer for Carl
in the future.
Fixes#4907.
R=ken2
CC=golang-dev
https://golang.org/cl/7395056
It's accessed without mutex protection
in a different goroutine from the one that
sets it.
Also make sure that Client.Call after Client.Close
will reliably return ErrShutdown, and that clients
see ErrShutdown rather than io.EOF when appropriate.
Suggestions welcome for a way to reliably test
the mutex issue.
R=r, iant
CC=golang-dev
https://golang.org/cl/7338045
Added the command line flag -ex to godoc to print examples in
text output.
Samples from the generated output:
$ godoc -ex strings Index
...
func Index(s, sep string) int
Index returns the index of the first instance of sep in s, or -1 if sep
is not present in s.
Example:
fmt.Println(strings.Index("chicken", "ken"))
fmt.Println(strings.Index("chicken", "dmr"))
// Output:
// 4
// -1
...
$ godoc -ex container/heap
...
package heap
import "container/heap"
Package heap provides heap operations for any type that implements
heap.Interface. A heap is a tree with the property that each node is the
minimum-valued node in its subtree.
Example:
// This example demonstrates an integer heap built using the heap interface.
package heap_test
import (
"container/heap"
"fmt"
...
Example:
// This example demonstrates a priority queue built using the heap interface.
package heap_test
import (
"container/heap"
"fmt"
)
...
Fixes#3587.
R=golang-dev, minux.ma, adg, rsc, gri
CC=golang-dev
https://golang.org/cl/7356043
The heuristics for BitLen of a product of randomly generated primes
are wrong, and the generated candidates never match the required
size for nprimes > 10. This corner case is not expected to be used in
practice.
R=agl
CC=golang-dev
https://golang.org/cl/7397052
Or gcc (-fPIC) will complain:
cmd/dist/unix.c: In function ‘cansse2’
cmd/dist/unix.c:774: error: can't find a register in class ‘BREG’ while reloading ‘asm’
cmd/dist/unix.c:774: error: ‘asm’ operand has impossible constraints
This affects bootstrapping on native Darwin/386 where all code is
compiled with -fPIC.
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7394047
This CL allows to receive network interface arrival and depature
notifications through routing sockets on BSD variants. So far
Darwin doesn't support this feature.
Also does small simplification.
Update #4866.
R=golang-dev, lucio.dere, dave
CC=golang-dev
https://golang.org/cl/7365055
1. Workaround the smart clang diagnostics with -Qunused-arguments:
clang: error: argument unused during compilation: '-XXX'
2. if "clang -print-libgcc-file-name" returns non-absolute path, don't
provide that on linker command line.
3. Fix dwarf.PtrType.Size() in cmd/cgo as clang doesn't generate
DW_AT_byte_size for pointer types.
4. Workaround warnings for -Wno-unneeded-internal-declaration with
-Wno-unknown-warning-option.
5. Add -Wno-unused-function.
6. enable race detector test on darwin with clang
(at least Apple clang version 1.7 (tags/Apple/clang-77) works).
Requires CL 7354043.
Update #4829
This should fix most parts of the problem, but one glitch still remains.
DWARF generated by newer clang doesn't differentiate these
two function types:
void *malloc(size_t);
void *malloc(unsigned long int);
so you might need to do this to make make.bash pass:
sed -i -e 's/C.malloc(C.size_t/C.malloc(C.ulong/' pkg/os/user/lookup_unix.go
R=golang-dev, dave, iant, rsc
CC=golang-dev
https://golang.org/cl/7351044
We need go/types to discriminate the Error method from
the error interface and the Error method of the testing package.
Fixes#4753.
R=golang-dev, bradfitz, gri
CC=golang-dev
https://golang.org/cl/7396054
At least one test (in package runtime) depends
on `go' being in $path. We simply bind GOROOT/bin
before /bin to make sure the latest copy of the
binary is accessible there.
R=rsc, rminnich, ality
CC=golang-dev
https://golang.org/cl/7391047
Plan 9 I/O preserves message boundaries, while Go
library code is written for UNIX-like operating
systems which do not. Avoid doing zero-length
writes in package os.
R=rsc, rminnich, ality, rminnich, r
CC=golang-dev
https://golang.org/cl/7406046
This is a simple refactoring of main.go that will enable the type checker
to be used during vetting.
The change has an unimportant effect on the arguments: it now assumes
that all files named explicitly on the command line belong to the same
package. When run by the go command, this was true already.
Also restore a missing parenthesis from an error message.
R=golang-dev, gri, bradfitz
CC=golang-dev
https://golang.org/cl/7393052
For now, all the callbacks from C use top-level Go functions,
so they use the equivalent C function pointer, and will continue
to do so. But perhaps some day this will be useful for calling
a Go func value (at least if the type is already known).
More importantly, the Windows callback code needs to be able
to use cgocallback_gofunc to call a Go func value.
Should fix the Windows build.
R=ken2
CC=golang-dev
https://golang.org/cl/7388049
We wrap the final '...' argument's type in types.Slice.
Added tests.
Also:
- Function.writeSignature: suppress slice '[]' when printing
variadic arg '...'.
- Eliminate Package.ImportPath field; redundant
w.r.t. Package.Types.Path.
- Use "TODO: (opt|fix)" notation more widely.
- Eliminate many redundant/stale TODOs.
R=gri
CC=golang-dev
https://golang.org/cl/7378057
Change ARM context register to R7, to get out of the way
of the register allocator during the compilation of the
prologue statements (it wants to use R0 as a temporary).
Step 2 of http://golang.org/s/go11func.
R=ken2
CC=golang-dev
https://golang.org/cl/7369048
The new src argument is ignored during linking
(that is, CALL r1, r2 is identical to CALL r2 for linking),
but it serves as a hint to the 5g/6g/8g optimizer
that the src register is live on entry to the called
function and must be preserved.
It is possible to avoid exposing this fact to the rest of
the toolchain, keeping it entirely within 5g/6g/8g,
but I think it will help to be able to look in object files
and assembly listings and linker -a / -W output to
see CALL instructions are "Go func value" calls and
which are "C function pointer" calls.
R=ken2
CC=golang-dev
https://golang.org/cl/7364045
This makes Go's quoted-printable decoder more like other
popular ones, allowing through a bare \r or \n, and also
passes through \r\n which looked like a real bug before.
Fixes#4771
R=minux.ma
CC=golang-dev
https://golang.org/cl/7300092
By appending to the wrong (always empty) list, only the last
anonymous field was being considered for promotion.
Also:
- eliminated "function-local NamedTypes" TODO; nothing to do.
- fixed Function.DumpTo: printing of anon receivers was "( T)",
now "(T)"; extracted writeSignature into own function.
- eliminated blockNames function;
thanks to BasicBlock.String, "%s" of []*BasicBlock is fine.
- extracted buildReferrers into own function.
exp/ssa can now build its own transitive closure.
R=gri
CC=golang-dev
https://golang.org/cl/7384054
runtime: add context argument to gogocall
Too many other things use AX, and at least one
(stack zeroing) cannot be moved onto a different
register. Use the less special DX instead.
Preparation for step 2 of http://golang.org/s/go11func.
Nothing interesting here, just split out so that we can
see it's correct before moving on.
R=ken2
CC=golang-dev
https://golang.org/cl/7395050
- append: nothing to do (nonsemantic change).
- delete: now performs correct conversion (+ test).
- emitCompare: nothing to do.
- emitArith (shifts): nothing to do (+ test).
- "banish untyped types": give up on that.
- real, imag: now do correct conversions.
- added comment to interp.go re zero-size values.
R=gri
CC=golang-dev
https://golang.org/cl/7391046
This significantly speeds up the go tool on
slow file systems (or those with cold caches).
The following numbers were obtained using
an encrypted ext4 file system running on
Linux 3.7.9.
# Before
$ sudo sysctl -w 'vm.drop_caches=3'
$ time go list code.google.com/p/go.net/... | wc -l
9
real 0m16.921s
user 0m0.637s
sys 0m0.317s
# After
$ sudo sysctl -w 'vm.drop_caches=3'
$ time go list code.google.com/p/go.net/... | wc -l
9
real 0m8.175s
user 0m0.220s
sys 0m0.177s
R=rsc, r
CC=golang-dev
https://golang.org/cl/7369044
Revision 5e7fd762f356 has changed the output formatting in a way that
is no longer in line with the format described by the revision
ff0ade0b937b which has introduced this functionality.
When decorating the first line, instead of indenting the whole line,
the current implementation adds indentation right after the "decorate"
part and before the "log" message.
The fix addresses this issue.
R=golang-dev, iant, minux.ma, r, rsc, remyoudompheng
CC=golang-dev
https://golang.org/cl/7304094
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