It runs all tests correctly and saves significant time by avoiding the shell script.
However, this is just the code for the command, for review.
A separate CL will move this into the real gotest, which will take some dancing.
R=rsc, peterGo, bsiegert, albert.strasheim, rog, niemeyer, r2
CC=golang-dev
https://golang.org/cl/4281073
This changeset makes it possible for crypto/x509 to parse
certificates that include the 'Extended Key Usage' extension
with the critical bit set.
R=agl1
CC=golang-dev
https://golang.org/cl/4277075
* Adds support for GENERAL STRING
* Adds support for APPLICATION tagged values.
* Add UnmarshalWithParams to set parameters for the top-level
structure
R=golang-dev, rsc1, r
CC=golang-dev
https://golang.org/cl/4291075
Refactored bind/connect from sock.go into netFD.connect(), as
a consequence newFD() doesn't accept laddr/raddr anymore, and
expects an (optional) call to netFD.connect() followed by a
call to netFD.setAddr().
Windows code is updated, but still uses blocking connect,
since otherwise it needs support for ConnectEx syscall.
R=brainman, rsc
CC=golang-dev
https://golang.org/cl/4303060
Drop laddr argument from Dial.
Drop cname return from LookupHost.
Add LookupIP, LookupCNAME, ParseCIDR, IP.Equal.
Export SplitHostPort, JoinHostPort.
Add AAAA (IPv6) support to host lookups.
Preparations for implementing some of the
lookups using cgo.
ParseCIDR and IP.Equal are logically new in this CL
but accidentally snuck into an earlier CL about unused
labels that was in the same client.
In crypto/tls, drop laddr from Dial to match net.
R=golang-dev, dsymonds, adg, rh
CC=golang-dev
https://golang.org/cl/4244055
With gccgo some operating systems require using select rather
than epoll or kevent. Using select means that we have to wake
up the polling thread each time we add a new file descriptor.
This implements that in the generic code rather than adding
another wakeup channel, even though nothing in the current net
package uses the capability.
R=rsc, iant2
CC=golang-dev
https://golang.org/cl/4284069
NewPackage creates an ast.Package node from
a set of package files and resolves unresolved
identifiers.
Also:
- Changed semantics of Scope.Insert: If an
object is inserted w/o errors, the result
is nil (before it was obj).
- Fixed an identifier resolution bug in the
parser: map keys must not be resolved.
gotype runs through several go/* packages
and successfully resolves all (non-field/method)
identifiers.
R=rog, rsc
CC=golang-dev
https://golang.org/cl/4298044
in gdb, 'info goroutines' and 'goroutine <n> <cmd> were crashing
because the 'g' and 'm' structures had changed a bit.
R=rsc
CC=golang-dev
https://golang.org/cl/4289077
On darwin amd64 it was impossible to create more that ~132 threads. While
investigating I noticed that go consumes almost 1TB of virtual memory per
OS thread and the reason for such a small limit of OS thread was because
process was running out of virtual memory. While looking at bsdthread_create
I noticed that on amd64 it wasn't using PTHREAD_START_CUSTOM.
If you look at http://fxr.watson.org/fxr/source/bsd/kern/pthread_synch.c?v=xnu-1228
you will see that in that case darwin will use stack pointer as stack size,
allocating huge amounts of memory for stack. This change fixes the issue
and allows for creation of up to 2560 OS threads (which appears to be some
Mac OS X limit) with relatively small virtual memory consumption.
R=rsc
CC=golang-dev
https://golang.org/cl/4289075
New make target "testshort" runs "gotest -test.short" and is invoked
by run.bash, which is invoked by all.bash.
Use -test.short to make one package (crypto ecdsa) run much faster.
More changes to come.
Once this is in, I will update the long-running tests to use the new flag.
R=rsc
CC=golang-dev
https://golang.org/cl/4317043
Fixes#1641.
Actually it side steps the real issue, which is that the
setitimer(2) implementation on OS X is not useful for
profiling of multi-threaded programs. I filed the below
using the Apple Bug Reporter.
/*
Filed as Apple Bug Report #9177434.
This program creates a new pthread that loops, wasting cpu time.
In the main pthread, it sleeps on a condition that will never come true.
Before doing so it sets up an interval timer using ITIMER_PROF.
The handler prints a message saying which thread it is running on.
POSIX does not specify which thread should receive the signal, but
in order to be useful in a user-mode self-profiler like pprof or gprof
http://code.google.com/p/google-perftoolshttp://www.delorie.com/gnu/docs/binutils/gprof_25.html
it is important that the thread that receives the signal is the one
whose execution caused the timer to expire.
Linux and FreeBSD handle this by sending the signal to the process's
queue but delivering it to the current thread if possible:
http://lxr.linux.no/linux+v2.6.38/kernel/signal.c#L802
807 /*
808 * Now find a thread we can wake up to take the signal off the queue.
809 *
810 * If the main thread wants the signal, it gets first crack.
811 * Probably the least surprising to the average bear.
812 * /
http://fxr.watson.org/fxr/source/kern/kern_sig.c?v=FREEBSD8;im=bigexcerpts#L1907
1914 /*
1915 * Check if current thread can handle the signal without
1916 * switching context to another thread.
1917 * /
On those operating systems, this program prints:
$ ./a.out
signal on cpu-chewing looper thread
signal on cpu-chewing looper thread
signal on cpu-chewing looper thread
signal on cpu-chewing looper thread
signal on cpu-chewing looper thread
signal on cpu-chewing looper thread
signal on cpu-chewing looper thread
signal on cpu-chewing looper thread
signal on cpu-chewing looper thread
signal on cpu-chewing looper thread
$
The OS X kernel does not have any such preference. Its get_signalthread
does not prefer current_thread(), in contrast to the other two systems,
so the signal gets delivered to the first thread in the list that is able to
handle it, which ends up being the main thread in this experiment.
http://fxr.watson.org/fxr/source/bsd/kern/kern_sig.c?v=xnu-1456.1.26;im=excerpts#L1666
$ ./a.out
signal on sleeping main thread
signal on sleeping main thread
signal on sleeping main thread
signal on sleeping main thread
signal on sleeping main thread
signal on sleeping main thread
signal on sleeping main thread
signal on sleeping main thread
signal on sleeping main thread
signal on sleeping main thread
$
The fix is to make get_signalthread use the same heuristic as
Linux and FreeBSD, namely to use current_thread() if possible
before scanning the process thread list.
*/
#include <sys/time.h>
#include <sys/signal.h>
#include <pthread.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
static void handler(int);
static void* looper(void*);
static pthread_t pmain, ploop;
int
main(void)
{
struct itimerval it;
struct sigaction sa;
pthread_cond_t cond;
pthread_mutex_t mu;
memset(&sa, 0, sizeof sa);
sa.sa_handler = handler;
sa.sa_flags = SA_RESTART;
memset(&sa.sa_mask, 0xff, sizeof sa.sa_mask);
sigaction(SIGPROF, &sa, 0);
pmain = pthread_self();
pthread_create(&ploop, 0, looper, 0);
memset(&it, 0, sizeof it);
it.it_interval.tv_usec = 10000;
it.it_value = it.it_interval;
setitimer(ITIMER_PROF, &it, 0);
pthread_mutex_init(&mu, 0);
pthread_mutex_lock(&mu);
pthread_cond_init(&cond, 0);
for(;;)
pthread_cond_wait(&cond, &mu);
return 0;
}
static void
handler(int sig)
{
static int nsig;
pthread_t p;
p = pthread_self();
if(p == pmain)
printf("signal on sleeping main thread\n");
else if(p == ploop)
printf("signal on cpu-chewing looper thread\n");
else
printf("signal on %p\n", (void*)p);
if(++nsig >= 10)
exit(0);
}
static void*
looper(void *v)
{
for(;;);
}
R=r
CC=golang-dev
https://golang.org/cl/4273113
Also fix comment.
The only caller of chanrecv initializes the value to false, so
this patch makes no difference at present. But it seems like
the right thing to do.
R=rsc
CC=golang-dev
https://golang.org/cl/4312053
Correctly distinguish between lhs and rhs identifiers
and resolve/declare them accordingly.
Collect field and method names in respective scopes
(will be available after some minor AST API changes).
Also collect imports since it's useful to have that
list directly w/o having to re-traverse the AST
(will also be available after some minor AST API changes).
No external API changes in this CL.
R=rsc, rog
CC=golang-dev
https://golang.org/cl/4271061
The top level bytes.Buffer is always there and can be re-used.
Rpc goes from 83 to 79 mallocs per round trip.
R=rsc
CC=golang-dev
https://golang.org/cl/4271062
- StartProcess will work with relative (to attr.Dir, not
current directory) executable filenames
- StartProcess will only work if executable filename points
to the real file, it will not search for executable in the
$PATH list and others (see CreateProcess manual for details)
- StartProcess argv strings can contain any characters
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4306041
This patch adds a connection cache and keep-alive
support to Transport, which is used by the
HTTP client.
It's also structured such that it's easy to add
HTTP pipelining in the future.
R=rsc, petar-m, bradfitzwork, r
CC=golang-dev
https://golang.org/cl/4272045
Revert changes to printer.Config. Pass in the
nodeSizes map trough an internal helper function.
R=golang-dev, rsc1
CC=golang-dev
https://golang.org/cl/4309042
Use memoization to avoid repeated recomputation of nested
node sizes. Speeds up testdata/slow.input by several orders
of magnitude.
- added respective test case
- added timeout to test code
- deleted some unrelated unused code
Fixes#1628.
R=rsc, r
CC=golang-dev
https://golang.org/cl/4274075
This change had already been made in revision 7371, but
was then undone with changes in revision 7606.
R=golang-dev, rsc1
CC=golang-dev
https://golang.org/cl/4239064
These timeouts are breaking tests in very slow
systems every once in a while. I've noticed
problems when compiling the Ubuntu packages for
arm, specifically.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4291058
Also in the common case avoid unnecessary buffering in
the channel.
Removes 13 allocations per round trip. Now at 86, down from
144 a week ago.
R=rsc, bradfitzgo, r2, rsc1
CC=golang-dev
https://golang.org/cl/4277060
The scanner returns slices into the original source
for token values. If those slices are making it into
the AST and from there into other long-living data
structures (e.g. godoc search), references to the
original source are kept around involuntarily.
For the current godoc and source tree, this change reduces
memory consumption after indexing and before GC by ~92MB
or almost 30%, and by ~10MB after GC (or about 6%).
R=rsc
CC=golang-dev
https://golang.org/cl/4273072
In conjunction with the non-blocking system call CL, this
gives about an 8% performance improvement on a client/server
test running on my local machine.
R=rsc, iant2
CC=golang-dev
https://golang.org/cl/4272057
- just an oversight; we were reallocating a buffer.
- use unsafe to avoid allocating storage for a string twice.
R=rsc
CC=golang-dev
https://golang.org/cl/4290056
Permit system calls to be designated as non-blocking, meaning
that we simply call them without involving the scheduler.
This change by itself is mostly performance neutral. In
combination with a following change to the net package there
is a performance advantage.
R=rsc, dfc, r2, iant2, rsc1
CC=golang-dev
https://golang.org/cl/4278055
- use enc.err and dec.err instead of return values in deferred error catcher
- replace io.WriteString with buffer.WriteString
now at:
mallocs per encode of type Bench: 7
mallocs per decode of type Bench: 8
R=rsc
CC=golang-dev
https://golang.org/cl/4277057
This just returns a ClientConn suitable for writing
proxy requests. To be used in Transport.
R=rsc, petar-m
CC=golang-dev
https://golang.org/cl/4290052
The -test.run and -test.bench flags were compilng the regexp for ever test
function, which was mucking up memory profiles. Add a simple wrapper
to save the compiled state so that the regexp is compiled only once for
each flag.
R=rsc
CC=golang-dev
https://golang.org/cl/4274063
Dependency on bufio crept in during last CL; this breaks the cycle.
Also add a missing '-' to the documentation.
R=rsc
CC=golang-dev
https://golang.org/cl/4274061
There is some disagreement about how to deal with hash values larger
than the curve order size. We choose to follow OpenSSL's lead here.
R=bradfitzgo, r
CC=golang-dev
https://golang.org/cl/4273059
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.
R=rsc
CC=golang-dev
https://golang.org/cl/4297043
On my mac:
mallocs per rpc round trip: 144
rpc.BenchmarkEndToEnd 10000 228244 ns/op
Room for improvement.
R=rsc
CC=golang-dev
https://golang.org/cl/4274058
Swapping the goroutines lets them reuse the
communication completion on v instead of
needing a second channel (done).
R=gri
CC=golang-dev
https://golang.org/cl/4287045
This reduces the number of writes by 2 (1 client, 1 server) on each round trip.
A simple test shows 24% higher throughput.
R=rsc
CC=golang-dev
https://golang.org/cl/4279057
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.
R=ken2
CC=golang-dev
https://golang.org/cl/4295048
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.
R=rsc
CC=golang-dev
https://golang.org/cl/4275042
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.
R=rsc
CC=golang-dev
https://golang.org/cl/4279045
Transport.Do -> RoundTripper.RoundTrip
This makes way for a subsequent CL to export the
currently private RoundTripper implementation
as struct Transport.
R=rsc, r
CC=golang-dev
https://golang.org/cl/4286043
Functionality was only present for
debuggging and now is available in
gocheck where is makes more sense.
R=rsc
CC=golang-dev
https://golang.org/cl/4239078
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.
R=r, rsc
CC=golang-dev
https://golang.org/cl/4261061
The Flush functionality wasn't removed, but now you have
to test if your ResponseWriter is also a Flusher:
func ServeHTTP(rw http.ResponseWriter, req *http.Request) {
if f, ok := rw.(http.Flusher); ok {
f.Flush()
}
}
R=rsc, bradfitzwork
CC=gburd, golang-dev
https://golang.org/cl/4239077
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)
R=r, r2
CC=golang-dev
https://golang.org/cl/4243055
Caller code needs to change:
rw.SetHeader("Content-Type", "text/plain")
to:
rw.Header().Set("Content-Type", "text/plain")
This now permits returning multiple headers
with the same name using Add:
rw.Header().Add("Set-Cookie", "..")
rw.Header().Add("Set-Cookie", "..")
This patch also fixes serialization of headers, removing newline characters.
Fixes#488Fixes#914
R=rsc
CC=gburd, golang-dev
https://golang.org/cl/4239076
Trivial fix to '// n' comments against etype enum in go.h, as these have
got out of sync.
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4240097
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.
R=r
CC=golang-dev
https://golang.org/cl/4241056
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.
R=bradfitzgo, bradfitzwork
CC=golang-dev
https://golang.org/cl/4247070
The published interface is the simple version of the syscall,
allowing all reboot functions except for the esoteric
LINUX_REBOOT_CMD_RESTART2.
R=golang-dev, bradfitzgo, bradfitzwork
CC=golang-dev
https://golang.org/cl/4256060
- 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
Fixes#1496.
R=r, eds
CC=golang-dev
https://golang.org/cl/4249063
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...
$
After:
$ 6nm $(which godoc) | sort | grep ' string\.' | tail -10
5e6a30 D string.*
$
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.
Removing the names cuts godoc by more than half:
-rwxr-xr-x 1 rsc rsc 9153405 2011-03-07 23:19 godoc.old
-rwxr-xr-x 1 rsc rsc 4290071 2011-03-07 23:19 godoc
For what it's worth, only 80% of what's left gets loaded
into memory; the other 20% is dwarf debugging information
only ever accessed by gdb:
-rwxr-xr-x 1 rsc rsc 3397787 2011-03-07 23:19 godoc.nodwarf
R=r, cw
CC=golang-dev
https://golang.org/cl/4245072
The http/cgi package now supports both being
a CGI host or being a CGI child process.
R=rsc, adg, bradfitzwork
CC=golang-dev
https://golang.org/cl/4245070
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.
Fixes#1566. (a different way)
Fixes#1582.
R=ken2
CC=golang-dev
https://golang.org/cl/4264050
Was only breaking on some dashboard builds because
not all run the network tests.
R=bradfitzgo, bradfitzwork
CC=golang-dev
https://golang.org/cl/4240086
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.
R=rsc
CC=golang-dev
https://golang.org/cl/4244049
As a data point, this enables goinstall to handle the standard
syscall package almost unchanged (there's one file with the _bsd
extension, and a .c file which isn't supposed to be compiled in).
R=rsc
CC=golang-dev
https://golang.org/cl/4259057
In June 2010 I accidentally checked in pending
changes to package rpc in a compiler CL:
https://golang.org/cl/1736041
I backed them out by hand in a followup CL:
https://golang.org/cl/1736042
That followup CL missed the lines being deleted
in this CL, spotted by Petar.
hg diff -r 5678:5683 src/cmd/prof/gopprof \
src/pkg/image/png/reader.go \
src/pkg/rpc/client.go \
src/pkg/rpc/jsonrpc/all_test.go \
src/pkg/rpc/jsonrpc/server.go \
src/pkg/rpc/server.go \
test/arm-pass.txt
confirms that these lines in server.go are the
only ones that were missed by the original followup.
Fixes#1583.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4266046
This enables goinstall to handle .go and .c files (for cgo)
which are named after the following patterns:
name_$(GOOS).*
name_$(GOARCH).*
name_$(GOOS)_$(GOARCH).*
Files with those names are only included if the $(GOOS) and
$(GOARCH) match the current system.
R=rsc
CC=golang-dev
https://golang.org/cl/4172055
* Change use of m->g0 stack (aka scheduler stack).
* Provide runtime.mcall(f) to invoke f() on m->g0 stack.
* Replace scheduler loop entry with runtime.mcall(schedule).
Runtime.mcall eliminates the need for fake scheduler states that
exist just to run a bit of code on the m->g0 stack
(Grecovery, Gstackalloc).
The elimination of the scheduler as a loop that stops and
starts using gosave and gogo fixes a bad interaction with the
way cgo uses the m->g0 stack. Cgo runs external (gcc-compiled)
C functions on that stack, and then when calling back into Go,
it sets m->g0->sched.sp below the added call frames, so that
other uses of m->g0's stack will not interfere with those frames.
Unfortunately, gogo (longjmp) back to the scheduler loop at
this point would end up running scheduler with the lower
sp, which no longer points at a valid stack frame for
a call to scheduler. If scheduler then wrote any function call
arguments or local variables to where it expected the stack
frame to be, it would overwrite other data on the stack.
I realized this possibility while debugging a problem with
calling complex Go code in a Go -> C -> Go cgo callback.
This wasn't the bug I was looking for, it turns out, but I believe
it is a real bug nonetheless. Switching to runtime.mcall, which
only adds new frames to the stack and never jumps into
functions running in existing ones, fixes this bug.
* Move cgo-related code out of proc.c into cgocall.c.
* Add very large comment describing cgo call sequences.
* Simpilify, regularize cgo function implementations and names.
* Add test suite as misc/cgo/test.
Now the Go -> C path calls cgocall, which calls asmcgocall,
and the C -> Go path calls cgocallback, which calls cgocallbackg.
The shuffling, which affects mainly the callback case, moves
most of the callback implementation to cgocallback running
on the m->curg stack (not the m->g0 scheduler stack) and
only while accounted for with $GOMAXPROCS (between calls
to exitsyscall and entersyscall).
The previous callback code did not block in startcgocallback's
approximation to exitsyscall, so if, say, the garbage collector
were running, it would still barge in and start doing things
like call malloc. Similarly endcgocallback's approximation of
entersyscall did not call matchmg to kick off new OS threads
when necessary, which caused the bug in issue 1560.
Fixes#1560.
R=iant
CC=golang-dev
https://golang.org/cl/4253054
The Hijack functionality wasn't removed, but now you have
to test if your ResponseWriter is also a Hijacker:
func ServeHTTP(rw http.ResponseWriter, req *http.Request) {
if hj, ok := rw.(http.Hijacker); ok {
hj.Hijack(..)
}
}
R=rsc
CC=golang-dev
https://golang.org/cl/4245064
The recursive algorithm used to parse types in cgo
has a bug related to building the C type representation.
As an example, when the recursion starts at a type *T,
the C type representation won't be known until type T
itself is parsed. But then, it is possible that type T
references the type **T internally. The latter
representation is built based on the one of *T, which
started the recursion, so it won't attempt to parse it
again, and will instead use the current representation
value for *T, which is still empty at this point.
This problem was fixed by introducing a simple TypeRepr
type which builds the string representation lazily,
analogous to how the Go type information is built within
the same algorithm. This way, even if a type
representation is still unknown at some level in the
recursion, representations dependant on it can still
be created correctly.
R=rsc
CC=golang-dev
https://golang.org/cl/4244052
The path package now contains only functions which
deal with slashed paths, sensible for any OS when dealing
with network paths or URLs. OS-specific functionality
has been moved into the new path/filepath package.
This also includes fixes for godoc, goinstall and other
packages which were mixing slashed and OS-specific paths.
R=rsc, gri, mattn, brainman
CC=golang-dev
https://golang.org/cl/4252044
Cgo changed to write these files into _obj, but some
trees may still have the old ones in the source directory.
They need to be removed during make clean so that
a subsequent build will use the ones in _obj.
R=r, r2
CC=golang-dev
https://golang.org/cl/4254056
FreeBSD's execve implementation has an integer underflow in a bounds test which
causes it to erroneously think the argument list is too long when argv[0] is
longer than interpreter + path.
R=rsc, bradfitz, rsc1
CC=golang-dev
https://golang.org/cl/4259056
A change a while back stop sending data for unexported fields
but due to an oversight the type info was being sent also. It's
inconsequential but wrong to do that.
R=rsc, rh
CC=golang-dev
https://golang.org/cl/4252058
This also breaks fs_test into two parts
as the range tests test http's private httpRange
and I had to change the fs_test package from
"http" to "http_test" to use httptest which otherwise
has a cyclic depedency back on http.
Aside: we should start exposing the Range
stuff in the future.
R=rsc
CC=golang-dev
https://golang.org/cl/4261047
The test was checking for a buffer to be empty but
actually racing with the background goroutine that
was emptying it. Left a comment so that the check
is not reintroduced later.
Fixes#1557.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4248063
Passing a frame size of 1 was causing the cgo callback
to push 1 byte of arguments onto the stack, making
the stack pointer misaligned, which had the effect of
hiding all the pointers on the stack from the garbage
collector.
SWIG only wraps calls to C++ virtual methods, so it
always has at least 1 argument, so SWIG does not need
to be fixed too.
Fixes#1328.
R=iant
CC=golang-dev
https://golang.org/cl/4261046
These allow data items to control their own representation.
For now, the implementation requires that the value passed
to Encode and Decode must be exactly the type of the
methods' receiver; it cannot be, for instance, T if the receiver
is of type *T. This will be fixed in a later CL.
R=rsc
CC=golang-dev
https://golang.org/cl/4235051
This allows a data item that can marshal itself to be transmitted by its
own encoding, enabling some types to be handled that cannot be
normally, plus providing a way to use gobs on data with unexported
fields.
In this CL, the necessary methods are protected by leading _, so only
package gob can use the facilities (in its tests, of course); this
code is not ready for real use yet. I could be talked into enabling
it for experimentation, though. The main drawback is that the
methods must be implemented by the actual type passed through,
not by an indirection from it. For instance, if *T implements
GobEncoder, you must send a *T, not a T. This will be addressed
in due course.
Also there is improved commentary and a couple of unrelated
minor bug fixes.
R=rsc
CC=golang-dev
https://golang.org/cl/4243056
Currently all http handlers reply to HTTP/1.1 requests with
chunked responses. This patch allows handlers to opt-out of
that behavior by pre-declaring their Content-Length (which is
then enforced) and unsetting their Transfer-Encoding or
setting it to the "identity" encoding.
R=rsc, bradfitzwork
CC=golang-dev
https://golang.org/cl/4245058
It's a little confusing that os.TempDir and ioutil.TempDir have
different meanings. I don't know what to change the names to,
if anything. At least they also have different signatures.
R=golang-dev, bradfitzgo, r, gri
CC=golang-dev
https://golang.org/cl/4247051
Detect when scan is being called recursively and
re-use the same scan state.
On my machine, for a recursion-heavy benchmark, this
results in 44x speed up. This does impose a 4% penalty
on the non-recursive case, which can be removed by
heap-allocating the saved state, at 40% performance penalty
on the recursive case. Either way is fine with me.
R=r
CC=golang-dev
https://golang.org/cl/4253049
This change makes it possible to take the address of a
struct field or slice element in order to call a method that
requires a pointer receiver.
Existing code that uses the Value.Addr method will have
to change (as gob does in this CL) to call UnsafeAddr instead.
R=r, rog
CC=golang-dev
https://golang.org/cl/4239052
This borrows a trick from the bzip2 source and effects a decent speed
up when decompressing highly compressed sources. Rather than unshuffle
the BTW block when performing the IBTW, a linked-list is threaded
through the array, in place. This improves cache hit rates.
R=bradfitzgo, bradfitzwork, cw
CC=golang-dev
https://golang.org/cl/4247047
The test image was converted from doc/video-001.png using the
convert command line tool (ImageMagick 6.5.7-8) at -quality 100.
R=r, nigeltao_gnome
CC=golang-dev
https://golang.org/cl/4259047