]> Cypherpunks.ru repositories - gostls13.git/log
gostls13.git
13 years agoweekly.2011-03-28 weekly.2011-03-28
Andrew Gerrand [Tue, 29 Mar 2011 03:17:04 +0000 (14:17 +1100)]
weekly.2011-03-28

R=r, rsc
CC=golang-dev
https://golang.org/cl/4272072

13 years agogo/printer, gofmt: rely on existing line breaks when formatting expression lists
Robert Griesemer [Tue, 29 Mar 2011 01:48:52 +0000 (18:48 -0700)]
go/printer, gofmt: rely on existing line breaks when formatting expression lists

No impact on existing sources.

Fixes #1632.

R=rsc
CC=golang-dev
https://golang.org/cl/4271083

13 years agogo/scanner: return literal as string instead of []byte
Robert Griesemer [Mon, 28 Mar 2011 23:44:28 +0000 (16:44 -0700)]
go/scanner: return literal as string instead of []byte

Removed many string conversions in dependent code.
Runs all tests. No change to gofmt output.

R=r
CC=golang-dev
https://golang.org/cl/4291070

13 years agogodoc: fix spelling error
Robert Griesemer [Mon, 28 Mar 2011 22:55:48 +0000 (15:55 -0700)]
godoc: fix spelling error

R=r, r2
CC=golang-dev
https://golang.org/cl/4289079

13 years agodoc: gccgo now supports method expressions and multiple init functions.
Ian Lance Taylor [Mon, 28 Mar 2011 21:48:35 +0000 (14:48 -0700)]
doc: gccgo now supports method expressions and multiple init functions.

R=gri
CC=golang-dev
https://golang.org/cl/4314047

13 years agogo/token: use array instead of map for token->string table
Robert Griesemer [Mon, 28 Mar 2011 20:38:24 +0000 (13:38 -0700)]
go/token: use array instead of map for token->string table

R=rsc
CC=golang-dev
https://golang.org/cl/4284070

13 years agonet: let OS-specific AddFD routine wake up polling thread.
Ian Lance Taylor [Mon, 28 Mar 2011 19:39:09 +0000 (12:39 -0700)]
net: let OS-specific AddFD routine wake up polling thread.

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

13 years agogo/ast: implemented NewPackage
Robert Griesemer [Mon, 28 Mar 2011 17:46:26 +0000 (10:46 -0700)]
go/ast: implemented NewPackage

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

13 years agostrings: Map: avoid allocation when string is unchanged
Brad Fitzpatrick [Mon, 28 Mar 2011 16:41:57 +0000 (09:41 -0700)]
strings: Map: avoid allocation when string is unchanged

This speeds up strings.ToLower, etc.

before/after:
strings_test.BenchmarkMapNoChanges 1000000 1013 ns/op
strings_test.BenchmarkMapNoChanges 5000000  442 ns/op

R=r, rog, eh, rsc
CC=golang-dev
https://golang.org/cl/4306056

13 years agoruntime: fix gdb support for goroutines.
Luuk van Dijk [Mon, 28 Mar 2011 15:34:22 +0000 (17:34 +0200)]
runtime: fix gdb support for goroutines.

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

13 years agobuild: add all-qemu.bash, handful of arm fixes
Russ Cox [Mon, 28 Mar 2011 03:39:42 +0000 (23:39 -0400)]
build: add all-qemu.bash, handful of arm fixes

R=r
CC=golang-dev
https://golang.org/cl/4313051

13 years agotest: match gccgo error messages for bug323.go.
Ian Lance Taylor [Mon, 28 Mar 2011 03:38:28 +0000 (20:38 -0700)]
test: match gccgo error messages for bug323.go.

bug323.go:18:3: error: reference to undefined field or method ‘Meth’
bug323.go:19:3: error: reference to undefined field or method ‘Meth2’

R=golang-dev, rsc1
CC=golang-dev
https://golang.org/cl/4280072

13 years agohttp: avoid crash when asked for multiple file ranges
Russ Cox [Mon, 28 Mar 2011 03:35:31 +0000 (23:35 -0400)]
http: avoid crash when asked for multiple file ranges

R=adg
CC=golang-dev
https://golang.org/cl/4289076

13 years agoruntime: fix darwin/amd64 thread VM footprint
Alexey Borzenkov [Sun, 27 Mar 2011 21:15:48 +0000 (17:15 -0400)]
runtime: fix darwin/amd64 thread VM footprint

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

13 years agoA+C: Alexey Borzenkov (individual CLA)
Russ Cox [Sun, 27 Mar 2011 21:03:43 +0000 (17:03 -0400)]
A+C: Alexey Borzenkov (individual CLA)

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4316042

13 years agotest: match gccgo error messages for bug325.go.
Ian Lance Taylor [Sun, 27 Mar 2011 19:10:50 +0000 (12:10 -0700)]
test: match gccgo error messages for bug325.go.

bug325.go:13:10: error: invalid indirect of ‘unsafe.Pointer’
bug325.go:14:31: error: reference to field ‘foo’ in object which has no fields or methods

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4313050

13 years agotesting: shorten some more tests
Rob Pike [Sat, 26 Mar 2011 18:25:22 +0000 (11:25 -0700)]
testing: shorten some more tests

R=rsc
CC=golang-dev
https://golang.org/cl/4314044

13 years agotest: match gccgo error messages for init.go
Ian Lance Taylor [Sat, 26 Mar 2011 18:24:02 +0000 (11:24 -0700)]
test: match gccgo error messages for init.go

init.go:16:10: error: invalid reference to unexported identifier ‘runtime.init’
init.go:15:2: error: reference to undefined name ‘init’
init.go:17:10: error: reference to undefined name ‘init’

R=golang-dev, rsc1
CC=golang-dev
https://golang.org/cl/4289074

13 years agogob: trivial cleanup
Robert Hencke [Sat, 26 Mar 2011 03:45:21 +0000 (20:45 -0700)]
gob: trivial cleanup

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4279074

13 years agogc: remove interim ... error which rejects valid code.
Ian Lance Taylor [Sat, 26 Mar 2011 01:31:55 +0000 (18:31 -0700)]
gc: remove interim ... error which rejects valid code.

It's been six months.

R=rsc
CC=golang-dev
https://golang.org/cl/4289073

13 years agodashboard: remove old python/bash builder, update README
Andrew Gerrand [Sat, 26 Mar 2011 00:56:34 +0000 (11:56 +1100)]
dashboard: remove old python/bash builder, update README

R=rsc
CC=golang-dev
https://golang.org/cl/4275076

13 years agotest: match gccgo error messages for cmp6.go
Ian Lance Taylor [Sat, 26 Mar 2011 00:51:02 +0000 (17:51 -0700)]
test: match gccgo error messages for cmp6.go

cmp6.go:28:9: error: incompatible types in binary expression
cmp6.go:29:9: error: incompatible types in binary expression
cmp6.go:40:9: error: incompatible types in binary expression
cmp6.go:41:9: error: incompatible types in binary expression
cmp6.go:48:9: error: expected integer, floating, complex, string, pointer, boolean, interface, slice, map, channel, or function type

R=rsc, r2
CC=golang-dev
https://golang.org/cl/4281071

13 years agotesting: shorten some tests.
Rob Pike [Fri, 25 Mar 2011 23:31:10 +0000 (16:31 -0700)]
testing: shorten some tests.
These are the top runners.  More to come.
Also print two digits of timing info under -test.v.

R=rsc
CC=golang-dev
https://golang.org/cl/4317044

13 years agotest: match gccgo error messages for bug081.go.
Ian Lance Taylor [Fri, 25 Mar 2011 22:28:53 +0000 (15:28 -0700)]
test: match gccgo error messages for bug081.go.

bug081.go:9:9: error: expected type

R=rsc
CC=golang-dev
https://golang.org/cl/4280071

13 years agobuild: handle broken awk in version.bash
Dave Cheney [Fri, 25 Mar 2011 22:00:19 +0000 (18:00 -0400)]
build: handle broken awk in version.bash

R=adg, rsc, ality
CC=golang-dev
https://golang.org/cl/4281069

13 years agotesting: set up structure for faster testing using the new -test.short flag.
Rob Pike [Fri, 25 Mar 2011 21:50:44 +0000 (14:50 -0700)]
testing: set up structure for faster testing using the new -test.short flag.
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

13 years agotest: match gccgo error messages for bug016.go.
Ian Lance Taylor [Fri, 25 Mar 2011 20:31:30 +0000 (13:31 -0700)]
test: match gccgo error messages for bug016.go.

bug016.go:11:8: error: negative shift count

R=rsc, gri
CC=golang-dev
https://golang.org/cl/4312055

13 years agonet: fix Windows build
Peter Mundy [Fri, 25 Mar 2011 20:11:19 +0000 (16:11 -0400)]
net: fix Windows build

R=rsc
CC=golang-dev
https://golang.org/cl/4314042

13 years agosyscall: GetsockoptInt for darwin, freebsd.
Albert Strasheim [Fri, 25 Mar 2011 18:43:59 +0000 (14:43 -0400)]
syscall: GetsockoptInt for darwin, freebsd.

R=rsc
CC=golang-dev
https://golang.org/cl/4298060

13 years agonet: add FileConn, FilePacketConn, FileListener
Albert Strasheim [Fri, 25 Mar 2011 18:42:25 +0000 (14:42 -0400)]
net: add FileConn, FilePacketConn, FileListener

R=iant, rsc, brainman
CC=golang-dev
https://golang.org/cl/4306042

13 years agotest/run: clear $E in case it's already set in environment.
Rob Pike [Fri, 25 Mar 2011 18:33:07 +0000 (11:33 -0700)]
test/run: clear $E in case it's already set in environment.

R=rsc
CC=golang-dev
https://golang.org/cl/4312054

13 years agotest: match gccgo error messages for bug274.go.
Ian Lance Taylor [Fri, 25 Mar 2011 18:32:32 +0000 (11:32 -0700)]
test: match gccgo error messages for bug274.go.

bug274.go:23:3: error: missing statement after label
bug274.go:25:3: error: missing statement after label
bug274.go:28:3: error: label ‘L2’ defined and not used

R=rsc
CC=golang-dev
https://golang.org/cl/4273114

13 years agoflag: fix error in documentation example.
Rob Pike [Fri, 25 Mar 2011 18:28:31 +0000 (11:28 -0700)]
flag: fix error in documentation example.
Fixes #1615.
This time for sure.

R=rsc, gri
CC=golang-dev
https://golang.org/cl/4275079

13 years agoruntime/pprof: disable test on darwin
Russ Cox [Fri, 25 Mar 2011 17:47:07 +0000 (13:47 -0400)]
runtime/pprof: disable test on darwin

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-perftools
   http://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

13 years agotest: match gccgo error messages for label.go and label1.go.
Ian Lance Taylor [Fri, 25 Mar 2011 17:36:46 +0000 (10:36 -0700)]
test: match gccgo error messages for label.go and label1.go.

label.go:30:1: error: label ‘L6’ already defined
label.go:28:1: note: previous definition of ‘L6’ was here
label.go:23:1: error: label ‘L4’ defined and not used
label.go:52:2: error: label ‘defalt’ defined and not used
label.go:17:1: error: label ‘L2’ defined and not used
label.go:26:1: error: label ‘L5’ defined and not used
label.go:20:1: error: label ‘L3’ defined and not used
label.go:14:1: error: label ‘L1’ defined and not used

label1.go:32:13: error: invalid continue label ‘L2’
label1.go:44:13: error: invalid continue label ‘L3’
label1.go:52:10: error: invalid break label ‘L4’
label1.go:55:13: error: invalid continue label ‘L4’
label1.go:65:9: error: invalid break label ‘L5’
label1.go:68:12: error: invalid continue label ‘L5’
label1.go:76:10: error: invalid break label ‘L1’
label1.go:79:13: error: invalid continue label ‘L1’

R=rsc
CC=golang-dev
https://golang.org/cl/4275078

13 years agoruntime: always set *received in chanrecv.
Ian Lance Taylor [Fri, 25 Mar 2011 17:36:22 +0000 (10:36 -0700)]
runtime: always set *received in chanrecv.

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

13 years agoruntime/darwin: remove unused local variables.
Ian Lance Taylor [Fri, 25 Mar 2011 17:35:46 +0000 (10:35 -0700)]
runtime/darwin: remove unused local variables.

R=rsc
CC=golang-dev
https://golang.org/cl/4309049

13 years agohttp/pprof: cpu profiling support
Russ Cox [Fri, 25 Mar 2011 16:50:12 +0000 (12:50 -0400)]
http/pprof: cpu profiling support

R=r
CC=golang-dev
https://golang.org/cl/4280060

13 years agohttp: modified perl cgi test to remove newline from env variables
Roger Pau Monné [Fri, 25 Mar 2011 16:33:45 +0000 (09:33 -0700)]
http: modified perl cgi test to remove newline from env variables

Fixes #1639

R=golang-dev, bradfitzgo
CC=golang-dev
https://golang.org/cl/4291069

13 years agoruntime: fix arm build
Russ Cox [Fri, 25 Mar 2011 16:30:49 +0000 (12:30 -0400)]
runtime: fix arm build

R=adg, dfc, r
CC=golang-dev
https://golang.org/cl/4296042

13 years agoA+C: Roger Pau Monné (individual CLA)
Russ Cox [Fri, 25 Mar 2011 16:30:09 +0000 (12:30 -0400)]
A+C: Roger Pau Monné (individual CLA)

R=golang-dev
CC=golang-dev
https://golang.org/cl/4276077

13 years agofreebsd-386: update defs
Devon H. O'Dell [Thu, 24 Mar 2011 23:18:04 +0000 (10:18 +1100)]
freebsd-386: update defs

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4273102

13 years agogo/parser: resolve identifiers properly
Robert Griesemer [Thu, 24 Mar 2011 18:45:52 +0000 (11:45 -0700)]
go/parser: resolve identifiers properly

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

13 years agomisc/emacs: gofmt: don't clobber the current buffer on failure
Sameer Ajmani [Thu, 24 Mar 2011 14:35:39 +0000 (10:35 -0400)]
misc/emacs: gofmt: don't clobber the current buffer on failure

Change M-x gofmt to display errors in a new buffer instead of
clobbering the current buffer.

Add gofmt-before-save, which runs gofmt when in go-mode.  This
can be used with before-save-hook.  Add to your .emacs:
  (add-hook 'before-save-hook 'gofmt-before-save)

R=rsc, aclements, amdragon
CC=golang-dev
https://golang.org/cl/4276059

13 years agogob: remove another allocation.
Rob Pike [Thu, 24 Mar 2011 04:49:19 +0000 (21:49 -0700)]
gob: remove another allocation.
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

13 years agoruntime: fix freebsd-amd64 (and part of 386)
Andrew Gerrand [Thu, 24 Mar 2011 00:45:12 +0000 (11:45 +1100)]
runtime: fix freebsd-amd64 (and part of 386)

R=rsc
CC=golang-dev
https://golang.org/cl/4285063

13 years agosyscall: StartProcess fixes for windows
Alex Brainman [Thu, 24 Mar 2011 00:20:28 +0000 (11:20 +1100)]
syscall: StartProcess fixes for windows

- 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

13 years agodoc: update contrib.html to be more enticing
Andrew Gerrand [Thu, 24 Mar 2011 00:06:02 +0000 (11:06 +1100)]
doc: update contrib.html to be more enticing
doc: refer to golang-dev instead of -nuts in contribute.html

R=r, rsc
CC=golang-dev
https://golang.org/cl/4309043

13 years agotesting: add -test.cpuprofile flag
Russ Cox [Wed, 23 Mar 2011 22:17:14 +0000 (18:17 -0400)]
testing: add -test.cpuprofile flag

R=r
CC=golang-dev
https://golang.org/cl/4272066

13 years ago5l/6l/8l: undo spadj cleanup at ARET for following instructions in the same stackframe.
Luuk van Dijk [Wed, 23 Mar 2011 22:11:29 +0000 (23:11 +0100)]
5l/6l/8l: undo spadj cleanup at ARET for following instructions in the same stackframe.

5l was already correct, clarified comment and added diags for unmaintained code.

R=rsc
CC=golang-dev
https://golang.org/cl/4277070

13 years agohttp: don't chunk 304 responses
Brad Fitzpatrick [Wed, 23 Mar 2011 21:29:26 +0000 (14:29 -0700)]
http: don't chunk 304 responses

rsc's earlier fix, plus tests.

R=rsc
CC=golang-dev
https://golang.org/cl/4285062

13 years agogotest: fix gofmt issue in generated _testmain.go
Brad Fitzpatrick [Wed, 23 Mar 2011 21:23:05 +0000 (14:23 -0700)]
gotest: fix gofmt issue in generated _testmain.go

R=rsc, r
CC=golang-dev
https://golang.org/cl/4287074

13 years agosyscall: GetsockoptInt.
Albert Strasheim [Wed, 23 Mar 2011 18:33:48 +0000 (14:33 -0400)]
syscall: GetsockoptInt.

R=rsc, iant
CC=golang-dev
https://golang.org/cl/4271060

13 years agogofmt: add profiling flag
Russ Cox [Wed, 23 Mar 2011 18:28:38 +0000 (14:28 -0400)]
gofmt: add profiling flag

R=gri
CC=golang-dev
https://golang.org/cl/4295062

13 years agoruntime/pprof: cpu profiling support
Russ Cox [Wed, 23 Mar 2011 17:54:31 +0000 (13:54 -0400)]
runtime/pprof: cpu profiling support

R=r, bradfitzgo, r2
CC=golang-dev
https://golang.org/cl/4313041

13 years agohttp: export Transport, add keep-alive support
Brad Fitzpatrick [Wed, 23 Mar 2011 17:38:18 +0000 (10:38 -0700)]
http: export Transport, add keep-alive support

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

13 years agoCONTRIBUTORS: John DeNero, Sameer Ajmani (Google CLA)
Russ Cox [Wed, 23 Mar 2011 17:33:45 +0000 (13:33 -0400)]
CONTRIBUTORS: John DeNero, Sameer Ajmani (Google CLA)

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4274079

13 years agoruntime: cpu profiling support
Russ Cox [Wed, 23 Mar 2011 15:43:37 +0000 (11:43 -0400)]
runtime: cpu profiling support

R=r
CC=golang-dev
https://golang.org/cl/4306043

13 years agoruntime: fix print - no %v in C
Russ Cox [Wed, 23 Mar 2011 15:34:03 +0000 (11:34 -0400)]
runtime: fix print - no %v in C

R=r
CC=golang-dev
https://golang.org/cl/4280061

13 years agogodefs: handle volatile
Russ Cox [Wed, 23 Mar 2011 15:33:53 +0000 (11:33 -0400)]
godefs: handle volatile

R=iant
CC=golang-dev
https://golang.org/cl/4291063

13 years agoruntime: os-specific types and code for setitimer
Russ Cox [Wed, 23 Mar 2011 15:31:42 +0000 (11:31 -0400)]
runtime: os-specific types and code for setitimer

R=r
CC=golang-dev
https://golang.org/cl/4273097

13 years agoruntime: more stack split fixes
Russ Cox [Wed, 23 Mar 2011 15:28:24 +0000 (11:28 -0400)]
runtime: more stack split fixes

Found by stkcheck after 6l, 8l bug fixes Luuk is about to submit.

R=lvd
CC=golang-dev
https://golang.org/cl/4306047

13 years agomisc/bbedit: remove closed keyword
Anthony Starks [Wed, 23 Mar 2011 05:29:40 +0000 (16:29 +1100)]
misc/bbedit: remove closed keyword

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4284058

13 years agomisc/vim: remove 'closed' as a builtin function.
David Symonds [Wed, 23 Mar 2011 03:26:28 +0000 (14:26 +1100)]
misc/vim: remove 'closed' as a builtin function.

R=adg, r
CC=golang-dev
https://golang.org/cl/4285059

13 years agosync: fix example code
Andrew Gerrand [Wed, 23 Mar 2011 03:24:30 +0000 (14:24 +1100)]
sync: fix example code

Fixes #1631.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4303046

13 years agochan: allocate a new chan with one
Ken Thompson [Wed, 23 Mar 2011 01:41:17 +0000 (18:41 -0700)]
chan: allocate a new chan with one
malloc rather than nelements + 1.

R=rob
CC=golang-dev
https://golang.org/cl/4291064

13 years agogodoc: add -template flag to specify custom templates
Andrew Gerrand [Tue, 22 Mar 2011 22:44:23 +0000 (09:44 +1100)]
godoc: add -template flag to specify custom templates

R=gri, niemeyer, rsc1
CC=golang-dev
https://golang.org/cl/4291059

13 years agogo/printer: Revert API change of CL 4274075.
Robert Griesemer [Tue, 22 Mar 2011 21:14:26 +0000 (14:14 -0700)]
go/printer: Revert API change of CL 4274075.

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

13 years agoMake.pkg: Always define _CGO_CFLAGS and friends.
Ian Lance Taylor [Tue, 22 Mar 2011 20:30:16 +0000 (13:30 -0700)]
Make.pkg: Always define _CGO_CFLAGS and friends.

Submitting TBR to fix Darwin build.

TBR=rsc
CC=golang-dev
https://golang.org/cl/4273096

13 years agoMake.pkg: add support for SWIG, and add two SWIG examples
Ian Lance Taylor [Tue, 22 Mar 2011 20:05:51 +0000 (13:05 -0700)]
Make.pkg: add support for SWIG, and add two SWIG examples

The SWIG examples are not yet built or tested by default.

R=r, rsc, iant2
CC=golang-dev
https://golang.org/cl/4287056

13 years agogob: fix up ugly formatting introduced by buggy (now fixed) gofmt.
Rob Pike [Tue, 22 Mar 2011 18:52:41 +0000 (11:52 -0700)]
gob: fix up ugly formatting introduced by buggy (now fixed) gofmt.

R=rsc
CC=golang-dev
https://golang.org/cl/4281065

13 years agogob: use pointers in bootstrapType so interfaces behave properly
Rob Pike [Tue, 22 Mar 2011 18:43:00 +0000 (11:43 -0700)]
gob: use pointers in bootstrapType so interfaces behave properly
and don't lead to a nil reflect.Type.
Fixes #1626.

R=rsc
CC=golang-dev
https://golang.org/cl/4289062

13 years agogo/printer, gofmt: simplify struct formatting and respect line breaks
Robert Griesemer [Tue, 22 Mar 2011 18:05:26 +0000 (11:05 -0700)]
go/printer, gofmt: simplify struct formatting and respect line breaks

Also: gofmt src misc

Fixes #1627.

R=rsc
CC=golang-dev
https://golang.org/cl/4303042

13 years agotest: enable tests using v, ok := <-ch syntax
Robert Hencke [Tue, 22 Mar 2011 17:32:43 +0000 (10:32 -0700)]
test: enable tests using v, ok := <-ch syntax

R=rsc, r
CC=golang-dev
https://golang.org/cl/4290059

13 years agogopprof: fix bug: do not rotate 180 degrees for large scrolls
Russ Cox [Tue, 22 Mar 2011 06:04:59 +0000 (02:04 -0400)]
gopprof: fix bug: do not rotate 180 degrees for large scrolls

R=r
CC=golang-dev
https://golang.org/cl/4273088

13 years agold: return > 0 exit code on unsafe import
Andrew Gerrand [Tue, 22 Mar 2011 04:00:21 +0000 (15:00 +1100)]
ld: return > 0 exit code on unsafe import

R=rsc
CC=golang-dev
https://golang.org/cl/4273092

13 years agogo/printer, gofmt: avoid exponential layout algorithm
Robert Griesemer [Tue, 22 Mar 2011 00:15:59 +0000 (17:15 -0700)]
go/printer, gofmt: avoid exponential layout algorithm

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

13 years agocgi: extra failure debugging in host_test
Brad Fitzpatrick [Mon, 21 Mar 2011 21:43:38 +0000 (14:43 -0700)]
cgi: extra failure debugging in host_test

Trying to track down why this fails on some
people's machines.

R=rsc, adg, dsymonds
CC=golang-dev
https://golang.org/cl/4304041

13 years agotime: give a helpful message when we can't set the time zone for testing.
Rob Pike [Mon, 21 Mar 2011 20:48:31 +0000 (13:48 -0700)]
time: give a helpful message when we can't set the time zone for testing.
Fixes #1625.

R=bradfitzgo, bradfitzwork, r2
CC=golang-dev
https://golang.org/cl/4295060

13 years agosyscall: rename from .sh to .pl, because these files are in Perl.
Rob Pike [Mon, 21 Mar 2011 20:02:10 +0000 (13:02 -0700)]
syscall: rename from .sh to .pl, because these files are in Perl.
Also delete references to nacl.

R=rsc, r2
CC=golang-dev
https://golang.org/cl/4275060

13 years agoexec: document dir option for Run
Gustavo Niemeyer [Mon, 21 Mar 2011 14:25:00 +0000 (11:25 -0300)]
exec: document dir option for Run

R=golang-dev, bradfitzwork, rsc1, peterGo
CC=golang-dev
https://golang.org/cl/4271056

13 years agobuild: reenable clean.bash without gomake
Gustavo Niemeyer [Mon, 21 Mar 2011 03:27:50 +0000 (00:27 -0300)]
build: reenable clean.bash without gomake

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

13 years agogoinstall: add -clean flag to docs
Andrew Gerrand [Mon, 21 Mar 2011 03:18:12 +0000 (14:18 +1100)]
goinstall: add -clean flag to docs

Fixes #1629.

R=rsc
CC=golang-dev
https://golang.org/cl/4291057

13 years agorpc: increase server_test timeout
Gustavo Niemeyer [Mon, 21 Mar 2011 03:07:22 +0000 (00:07 -0300)]
rpc: increase server_test timeout

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

13 years agopath/filepath: fix TestEvalSymlinks when run under symlinked GOROOT
Andrew Gerrand [Mon, 21 Mar 2011 00:24:48 +0000 (11:24 +1100)]
path/filepath: fix TestEvalSymlinks when run under symlinked GOROOT

Fixes #1622.

R=rsc, bradfitzgo
CC=golang-dev
https://golang.org/cl/4287063

13 years agoflag: document Nflag function
Fazlul Shahriar [Sun, 20 Mar 2011 18:45:43 +0000 (11:45 -0700)]
flag: document Nflag function

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4279065

13 years agogopprof: update list of memory allocation functions
Russ Cox [Sat, 19 Mar 2011 00:55:21 +0000 (20:55 -0400)]
gopprof: update list of memory allocation functions

R=r, r2
CC=golang-dev
https://golang.org/cl/4275057

13 years agobuild: diagnose Ubuntu's buggy copy of gold
Russ Cox [Fri, 18 Mar 2011 22:23:00 +0000 (18:23 -0400)]
build: diagnose Ubuntu's buggy copy of gold

R=iant, dsymonds
CC=golang-dev
https://golang.org/cl/4300041

13 years agonet: Use preallocated buffer for kqueue/kevent.
Ian Lance Taylor [Fri, 18 Mar 2011 19:48:12 +0000 (12:48 -0700)]
net: Use preallocated buffer for kqueue/kevent.

R=rsc
CC=golang-dev
https://golang.org/cl/4293056

13 years agocgo: fix index-out-of-bounds bug
Robert Griesemer [Fri, 18 Mar 2011 19:38:38 +0000 (12:38 -0700)]
cgo: fix index-out-of-bounds bug

R=rsc
CC=golang-dev
https://golang.org/cl/4284057

13 years agorpc: keep free lists of Request and Response structures.
Rob Pike [Fri, 18 Mar 2011 18:54:36 +0000 (11:54 -0700)]
rpc: keep free lists of Request and Response structures.
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

13 years agonet: Use preallocated buffer for epoll.
Ian Lance Taylor [Fri, 18 Mar 2011 18:50:19 +0000 (11:50 -0700)]
net: Use preallocated buffer for epoll.

Reduces rpc test "mallocs per rpc round trip" by 4.

Gains ~8% on a localhost client/server RPC test.

R=rsc
CC=golang-dev
https://golang.org/cl/4284056

13 years agogodoc: No need to use filepath.IsAbs()
Yasuhiro Matsumoto [Fri, 18 Mar 2011 16:28:23 +0000 (09:28 -0700)]
godoc: No need to use filepath.IsAbs()

R=golang-dev, brainman, gri
CC=golang-dev
https://golang.org/cl/4277062

13 years agogodoc: fix path problem for windows.
Yasuhiro Matsumoto [Fri, 18 Mar 2011 05:27:30 +0000 (22:27 -0700)]
godoc: fix path problem for windows.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4299044

13 years agosinit.c: recursion in sinit
Ken Thompson [Thu, 17 Mar 2011 23:47:00 +0000 (16:47 -0700)]
sinit.c: recursion in sinit
fixes #1617

R=rsc
CC=golang-dev
https://golang.org/cl/4277059

13 years agofilepath: do not run TestEvalSymlinks on Windows
Alex Brainman [Thu, 17 Mar 2011 23:19:19 +0000 (10:19 +1100)]
filepath: do not run TestEvalSymlinks on Windows

R=golang-dev, rsc1
CC=adg, golang-dev
https://golang.org/cl/4274069

13 years agogo/parser: fix memory leak by making a copy of token literals
Robert Griesemer [Thu, 17 Mar 2011 22:32:29 +0000 (15:32 -0700)]
go/parser: fix memory leak by making a copy of token literals

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

13 years agoflag: fix example in doc comment.
Rob Pike [Thu, 17 Mar 2011 22:29:52 +0000 (15:29 -0700)]
flag: fix example in doc comment.

Fixes #1615.

R=dsymonds
CC=golang-dev
https://golang.org/cl/4277058

13 years agonet: Don't force epoll/kqueue to wake up in order to add new events.
Ian Lance Taylor [Thu, 17 Mar 2011 20:42:40 +0000 (13:42 -0700)]
net: Don't force epoll/kqueue to wake up in order to add new events.

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

13 years agogo/scanner: to interpret line comments with Windows filenames
Alex Brainman [Thu, 17 Mar 2011 18:49:56 +0000 (11:49 -0700)]
go/scanner: to interpret line comments with Windows filenames

Fixes #1614.

R=gri
CC=golang-dev
https://golang.org/cl/4290054