1
0
mirror of https://github.com/golang/go synced 2024-10-03 11:11:22 -06:00
Commit Graph

15660 Commits

Author SHA1 Message Date
Marcel van Lohuizen
5afa271ce3 exp/locale/collate: several changes based on comments on CL 7060051
which was submitted earlier.

R=r
CC=golang-dev
https://golang.org/cl/7402048
2013-02-27 11:08:18 +01:00
Matthew Dempsky
f853e9aa4e syscall: Fix FD passing on OpenBSD
Fixes #3349.

R=bradfitz, dave, minux.ma
CC=golang-dev
https://golang.org/cl/7383056
2013-02-27 15:19:23 +11:00
Russ Cox
d21b1922c6 libmach: fix build (set and not used)
TBR=golang-dev
CC=golang-dev
https://golang.org/cl/7401053
2013-02-26 22:51:47 -05:00
Russ Cox
56a06db360 cmd/ld: change GC_CALL to 32-bit relative address
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
2013-02-26 19:42:56 -08:00
Russ Cox
c8dcaeb25d cmd/ld, runtime: adjust symbol table representation
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
2013-02-26 22:38:14 -05:00
Nigel Tao
15cce227c7 exp/cookiejar: add a test for canonicalHost errors.
R=dr.volker.dobler
CC=golang-dev
https://golang.org/cl/7389048
2013-02-27 13:05:57 +11:00
Rob Pike
2c2934eeb5 sort: add an example showing sorting struct by different keys
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/7376058
2013-02-26 17:17:44 -08:00
Brad Fitzpatrick
65fcb39dc7 net/http: fix a bunch of test leaks
And one real leak in TimeoutHandler.

Fixes #4821

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7369056
2013-02-26 17:12:50 -08:00
Robert Griesemer
60066754fd go/types: be more robust in presence of multiple errors
- better documentation of Check
- better handling of (explicit) internal panics
- gotype: don't stop after 1st error

R=adonovan, r
CC=golang-dev
https://golang.org/cl/7406052
2013-02-26 14:33:24 -08:00
Dave Cheney
98d44d140d syscall: fix FD passing on FreeBSD and NetBSD
Fixes #3348.

R=devon.odell, minux.ma, bradfitz, mdempsky
CC=golang-dev
https://golang.org/cl/7406050
2013-02-27 09:13:15 +11:00
Alan Donovan
c8c16cfbb9 exp/ssa: support multiple labels on same statement.
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
2013-02-26 14:07:03 -05:00
Dominik Honnef
b302d68ebc misc/emacs: Greatly improve go-mode for Emacs.
The original go-mode is plagued with odd behaviour, lack of
behaviour typical to modes in Emacs and bugs.

This change rewrites great parts of go-mode (basically only
keeping the gofmt and godoc functions).

Additionally it adds new features such as manipulating package
imports.

For more information please see
https://groups.google.com/group/golang-nuts/browse_frm/thread/3a9d6dae3369c0b5/1efe65e2f7afb190

Fixes #3618.
Fixes #4240.
Fixes #4322.
Fixes #4671.
Fixes #4726.

R=golang-dev, fullung, sameer, cw, arthur, proppy, adonovan, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/7314113
2013-02-26 13:48:32 -05:00
Rob Pike
6c2cbdb142 cmd/vet: fix printf test for unsafe Pointer
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
2013-02-26 10:36:13 -08:00
Alan Donovan
bd92dd6a5f exp/ssa: reimplement logic for field selection.
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
2013-02-26 13:32:22 -05:00
Brad Fitzpatrick
c4c38312e5 A+C: Dominik Honnef (individual CLA)
Generated by addca (mostly, until codereview
blew up)

R=golang-dev
CC=golang-dev
https://golang.org/cl/7386054
2013-02-26 10:27:02 -08:00
Anthony Martin
16eb2c0b7a runtime: fix stack cache typos
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7370050
2013-02-26 09:59:17 -08:00
Anthony Martin
2b39e418be all: clean up C function prototypes
R=minux.ma, rsc, akumar, bradfitz
CC=golang-dev
https://golang.org/cl/7313070
2013-02-26 09:51:33 -08:00
Akshat Kumar
fa625fb39a os/exec: Pass tests on Plan 9
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
2013-02-26 09:40:55 -08:00
Anthony Martin
f08acae76e build: do not set GOBIN on Plan 9
Also, I synced the rc files with changes
that have been made to make.bash, etc.

R=seed, rminnich, r
CC=golang-dev
https://golang.org/cl/7389049
2013-02-26 09:25:46 -08:00
Anthony Martin
c14d255ac5 cmd/go: do not print GCC environment variables on Plan 9
R=seed, rminnich, r, minux.ma
CC=golang-dev
https://golang.org/cl/7397059
2013-02-26 08:34:47 -08:00
Robert Griesemer
a5e42f2611 go/types: fix sizeof computations
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
2013-02-25 22:06:58 -08:00
Robert Griesemer
3f132a8236 go/types: more robust imports
- 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
2013-02-25 20:43:35 -08:00
Robert Griesemer
1caaff6b5a go/types: embedded fields can be predeclared types
R=adonovan, r
CC=golang-dev
https://golang.org/cl/7376055
2013-02-25 20:42:29 -08:00
Cosmos Nicolaou
d6a057c90e cmd/godoc: add support for display Notes parsed by pkg/go/doc
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
2013-02-25 20:34:09 -08:00
Alex Brainman
26498684cb os: use windows ReadConsole to read from console
Fixes #4760.

R=golang-dev, minux.ma, bradfitz
CC=golang-dev
https://golang.org/cl/7312053
2013-02-26 14:18:48 +11:00
Akshat Kumar
d2326febd5 syscall, runtime: Plan 9: use nanotime syscall on amd64
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
2013-02-26 01:56:08 +01:00
Nigel Tao
ffa0f83060 exp/cookiejar: implement IDNA/Punycode's toASCII.
R=dr.volker.dobler
CC=golang-dev
https://golang.org/cl/7398049
2013-02-26 11:55:41 +11:00
Rob Pike
78b3ef261d cmd/vet: silence error from type checker unless verbose is set.
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
2013-02-25 16:29:09 -08:00
Akshat Kumar
b461fe660d net: Implement FileListener, FileConn, and File methods for Plan 9
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
2013-02-26 01:26:40 +01:00
Rob Pike
31444a796a cmd/vet: move the tests into separate files
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
2013-02-25 16:25:34 -08:00
Rémy Oudompheng
71b3b46073 cmd/gc: accept cases with same value but different types in switch.
Fixes #4781.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7365056
2013-02-26 00:45:43 +01:00
Rémy Oudompheng
9e66ee4562 cmd/gc: fix corruption in export of &T{} literals.
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
2013-02-26 00:43:31 +01:00
Rémy Oudompheng
9fe60801ae cmd/gc: apply escape analysis results to closures.
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
2013-02-26 00:40:28 +01:00
Shenghou Ma
4692711d7f strconv, fmt: clarify behavior of CanBackquote and "%#q".
Fixes #4858.

R=golang-dev, bradfitz, r, rsc
CC=golang-dev
https://golang.org/cl/7387044
2013-02-26 06:33:59 +08:00
Andrew Gerrand
89cf67eb20 time: handle very large sleep durations
Fixes #4903.

R=golang-dev, daniel.morsing, dave, r
CC=golang-dev
https://golang.org/cl/7388056
2013-02-26 09:23:58 +11:00
Andrew Gerrand
93158bf243 doc: document that weekly.html is only a historical reference
Fixes #4810.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7401050
2013-02-26 09:23:34 +11:00
Shenghou Ma
8cdee79063 libmach, cmd/5a, cmd/5c, cmd/5g, cmd/5l: enable DWARF type info for Linux/ARM
Fixes #3747.

Update #4912
This CL adds gotype into .5 object file.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7376054
2013-02-26 06:15:29 +08:00
Akshat Kumar
b6e322dcf5 syscall: Plan9, amd64: fix syscall error handling in assembly
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
2013-02-25 22:40:14 +01:00
Dmitriy Vyukov
4eb7ba743d runtime/cgo: fix deadlock involving signals on darwin
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
2013-02-25 16:36:29 -05:00
Andrew Gerrand
052d845c5c doc: fix wiki codelab description of template parsing
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7372048
2013-02-26 08:31:47 +11:00
Brad Fitzpatrick
e3ed4cace0 net/http/cgi: make tests compile on plan9
Don't reference the non-portable syscall.Signal(0).

Maybe they'll pass too. Untested. plan9 bit from
Akshat Kumar.

R=golang-dev, akumar
CC=golang-dev
https://golang.org/cl/7370049
2013-02-25 13:27:15 -08:00
Russ Cox
aa3efb28f0 cmd/gc: can stop tracking gotype in regopt
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
2013-02-25 16:11:34 -05:00
Jan Ziak
a656f82071 runtime: precise garbage collection of channels
This changeset adds a mostly-precise garbage collection of channels.
The garbage collection support code in the linker isn't recognizing
channel types yet.

Fixes issue http://stackoverflow.com/questions/14712586/memory-consumption-skyrocket

R=dvyukov, rsc, bradfitz
CC=dave, golang-dev, minux.ma, remyoudompheng
https://golang.org/cl/7307086
2013-02-25 15:58:23 -05:00
Rob Pike
707ab1347f all: fix some vet-found printf errors
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7393059
2013-02-25 12:43:03 -08:00
Shenghou Ma
1a01ffd386 cmd/gc: fix mkbuiltin (gc -A always write all symbols to export section)
Regenerate cmd/gc/builtin.c.
Fixes #4908.

R=rsc
CC=golang-dev
https://golang.org/cl/7383053
2013-02-26 03:14:59 +08:00
Francisco Souza
f5afc7d44f cmd/go: fix vet
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
2013-02-25 10:43:04 -08:00
Russ Cox
f5dce6c853 cmd/5g: fix arm build
R=ken2
CC=golang-dev
https://golang.org/cl/7365057
2013-02-25 12:21:12 -05:00
Russ Cox
1d5dc4fd48 cmd/gc: emit explicit type information for local variables
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
2013-02-25 12:13:47 -05:00
Robert Griesemer
a411b104f0 go/parser: more precise comment
See also CL 7383051 for details.

R=adonovan, bradfitz
CC=golang-dev
https://golang.org/cl/7378063
2013-02-25 08:29:46 -08:00
Roger Peppe
7edd13355f net/rpc: avoid racy use of closing flag.
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
2013-02-25 16:22:00 +00:00