Robert Griesemer [Wed, 16 Mar 2011 00:45:16 +0000 (17:45 -0700)]
go/printer: output tuning for gofix
If braces don't have position information for a composite
literal, don't assume alignment of key:value pairs under
the (wrong) assumption that there may be multiple lines.
Rob Pike [Tue, 15 Mar 2011 17:02:44 +0000 (10:02 -0700)]
rpc: add buffering to the encode path.
This reduces the number of writes by 2 (1 client, 1 server) on each round trip.
A simple test shows 24% higher throughput.
Russ Cox [Mon, 14 Mar 2011 17:22:34 +0000 (13:22 -0400)]
gc: include all dependencies in export metadata
This change records more metadata about what
influenced the creation of the object file.
Specifically, if a package imports, say, "fmt" but does not
need to describe any fmt types in its own export data,
that package's object file did not mention the dependency
on "fmt" before. Now it does.
Listing the import is purely informational.
It has no effect on which files are opened or consulted
when importing a package.
Import lines are marked indirect when they are needed
to explain the API but were not imported directly.
For example http imports crypto/tls and exports
a struct with a field of type tls.ConnectionState,
which contains an x509.Certificate. Since http does
not import x509 but needs to explain the x509.Certificate
type in its export data, the import of x509 is marked
as indirect. These import lines were always present;
marking them with the indirect comment makes clear
which were imported directly and which are incidental.
Ian Lance Taylor [Sat, 12 Mar 2011 02:01:28 +0000 (18:01 -0800)]
net: don't loop to drain wakeup pipe.
The loop always makes an extra system call. It only makes a
difference if more than 100 goroutines started waiting for
something to happen on a network file descriptor since the
last time the pipe was drained, which is unlikely since we
will be woken up the first time a goroutine starts waiting.
If we don't drain the pipe this time, we'll be woken up again
right away and can drain again.
Rob Pike [Sat, 12 Mar 2011 00:24:09 +0000 (16:24 -0800)]
gob: use bufio on the decode to avoid a system call on each read.
Add a benchmark.
BenchmarkEndToEndPipe gives 14.3microseconds/op before,
13.1microseconds/op after, or about 76e3 round trips per second
through the kernel.
With a bytes buffer, and therefore no system calls for I/O, the
numbers go to 7.3microseconds/op, or about 137e3 round trips
per second.
Ian Lance Taylor [Wed, 9 Mar 2011 21:15:46 +0000 (13:15 -0800)]
syslog: split Unix domain support from network support.
This is to make it easier to support Solaris syslog. On
Solaris syslog messages are sent via STREAMS using putmsg to
/dev/conslog. The putmsg call uses a a control buffer of type
log_cdtl and a data buffer which is the message, and it is in
general a big mess. This CL just splits out the Unix domain
support so that Solaris can use a different mechanism. I do
not propose to implement the Solaris support today. This
split will make it possible for gccgo to just call the libc
function for now.
Roger Peppe [Wed, 9 Mar 2011 18:01:47 +0000 (10:01 -0800)]
fmt: make ScanState.Token more general.
When writing custom scanners, I found that
Token itself was rarely useful, as I did not always
want to stop at white space. This change makes
it possible to stop at any class of characters
while reusing the buffer within State.
(also fix a bug in Token)
Russ Cox [Wed, 9 Mar 2011 16:18:29 +0000 (11:18 -0500)]
ld: preserve symbol sizes during data layout
Fixes the broken linux/amd64 build.
The symbol table, itself a symbol, was having
its size rounded up to the nearest word boundary.
If the rounding add >7 zero bytes then it confused
the debug/gosym symbol table parser. So you've
got a 1/8 chance to hit the bug on an amd64 system.
Just started in the recent change because I fixed
the rounding to round to word boundary instead
of to 4-byte boundary.
David Anderson [Wed, 9 Mar 2011 13:58:47 +0000 (05:58 -0800)]
syscall: implement Mount and Unmount for linux.
Note that, while the final argument of mount(2) is a void*, in
practice all filesystem implementations treat it as a string
of comma-separated mount options.
Robert Griesemer [Wed, 9 Mar 2011 01:27:44 +0000 (17:27 -0800)]
big: implemented custom Gob(En/De)coder for Int type
- factored implementation of Int.Bytes, Int.SetBytes
and replaced existing code with much simpler cores
- use the shared bytes, setBytes routines for Gob
(en/de)coding
Russ Cox [Tue, 8 Mar 2011 19:14:28 +0000 (14:14 -0500)]
5l, 6l, 8l: omit symbols for type, string, go.string
Much of the bulk of Go binaries is the symbol tables,
which give a name to every C string, Go string,
and reflection type symbol. These names are not worth
much other than seeing what's where in a binary.
This CL deletes all those names from the symbol table,
instead aggregating the symbols into contiguous blocks
and giving them the names "string.*", "go.string.*", and "type.*".
Before:
$ 6nm $(which godoc.old) | sort | grep ' string\.' | tail -10
59eda4 D string."aa87ca22be8b05378eb1c71...
59ee08 D string."b3312fa7e23ee7e4988e056...
59ee6c D string."func(*token.FileSet, st...
59eed0 D string."func(io.Writer, []uint8...
59ef34 D string."func(*tls.Config, *tls....
59ef98 D string."func(*bool, **template....
59effc D string."method(p *printer.print...
59f060 D string."method(S *scanner.Scann...
59f12c D string."func(*struct { begin in...
59f194 D string."method(ka *tls.ecdheRSA...
$
Those names in the "Before" are truncated for the CL.
In the real binary they are the complete string, up to
a certain length, or else a unique identifier.
The same applies to the type and go.string symbols.
Russ Cox [Mon, 7 Mar 2011 20:10:01 +0000 (15:10 -0500)]
gc: unsafe.Pointer is not a pointer
Change unsafe.Pointer to be its own kind of
type, instead of making it equivalent to *any.
The change complicates import and export
but avoids the need to find all the places that
operate on pointers but should not operate on
unsafe.Pointer.
Robert Griesemer [Mon, 7 Mar 2011 19:01:23 +0000 (11:01 -0800)]
go/ast, go/parser: populate identifier scopes at parse time
The parser populates all scopes for a given file (except
type-related scopes for structs, interfaces, and methods
of types) at parse time.
A new parser flag, DeclarationErrors, enables error messages
related to declaration errors (as far as it is possible to
provide them).
The resulting AST has all (non-field, non-method) identifiers
resolved that can be resolved w/o doing imports or parsing
missing package files.
The ast.File node contains the (partially complete)
package scope and a list of unresolved global identifiers.
All type-specific data structures have been removed from the AST.
The existing typechecker is functional but needs to be adjusted
(simplified) accordingly. Utility functions to resolve all
identifiers for a package (after handling imports and parsing
all package files) are missing.
Unrelated changes:
- Rename typechecker/testdata files to that they are not considered
by gofmt.
- Minor cleanups/simplifications.
Parses all .go files in src and misc without declaration errors.
Runs all tests. Changes do not affect gofmt output.