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

7909 Commits

Author SHA1 Message Date
Evan Shaw
ac74f14b6b kate: reorganize, remove closed()
R=rsc
CC=golang-dev
https://golang.org/cl/4325041
2011-03-29 01:12:39 -04:00
Alexey Borzenkov
2f45f72dce net: implement non-blocking connect
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
2011-03-28 23:40:01 -04:00
Russ Cox
98828f033a fix build
TBR=adg
CC=golang-dev
https://golang.org/cl/4322041
2011-03-28 23:39:39 -04:00
Russ Cox
2a1b4a83fc gofix: netdial
R=adg
CC=golang-dev
https://golang.org/cl/4278053
2011-03-28 23:29:00 -04:00
Russ Cox
5546cc7eab update tree for package net changes
Converted with gofix.

R=adg
CC=golang-dev
https://golang.org/cl/4284049
2011-03-28 23:28:53 -04:00
Russ Cox
41f93a430f net: drop laddr from Dial, cname from LookupHost; new functions
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
2011-03-28 23:28:42 -04:00
Andrew Gerrand
188a17db80 tag release.2011-03-28
R=rsc
CC=golang-dev
https://golang.org/cl/4321041
2011-03-29 14:19:21 +11:00
Andrew Gerrand
33e41802f9 weekly.2011-03-28
R=r, rsc
CC=golang-dev
https://golang.org/cl/4272072
2011-03-29 14:17:04 +11:00
Robert Griesemer
5a3aae4bf7 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
2011-03-28 18:48:52 -07:00
Robert Griesemer
b2658452a6 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
2011-03-28 16:44:28 -07:00
Robert Griesemer
c98145fb50 godoc: fix spelling error
R=r, r2
CC=golang-dev
https://golang.org/cl/4289079
2011-03-28 15:55:48 -07:00
Ian Lance Taylor
d38d66e646 doc: gccgo now supports method expressions and multiple init functions.
R=gri
CC=golang-dev
https://golang.org/cl/4314047
2011-03-28 14:48:35 -07:00
Robert Griesemer
2796ac1466 go/token: use array instead of map for token->string table
R=rsc
CC=golang-dev
https://golang.org/cl/4284070
2011-03-28 13:38:24 -07:00
Ian Lance Taylor
0caa0c0923 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
2011-03-28 12:39:09 -07:00
Robert Griesemer
5be77a204b 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
2011-03-28 10:46:26 -07:00
Brad Fitzpatrick
a7a854b82f 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
2011-03-28 09:41:57 -07:00
Luuk van Dijk
43512e6c70 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
2011-03-28 17:34:22 +02:00
Russ Cox
6b3357129a build: add all-qemu.bash, handful of arm fixes
R=r
CC=golang-dev
https://golang.org/cl/4313051
2011-03-27 23:39:42 -04:00
Ian Lance Taylor
dacd1cad77 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
2011-03-27 20:38:28 -07:00
Russ Cox
732f2fa2c1 http: avoid crash when asked for multiple file ranges
R=adg
CC=golang-dev
https://golang.org/cl/4289076
2011-03-27 23:35:31 -04:00
Alexey Borzenkov
59a8926829 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
2011-03-27 17:15:48 -04:00
Russ Cox
ffb0a2d42a A+C: Alexey Borzenkov (individual CLA)
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4316042
2011-03-27 17:03:43 -04:00
Ian Lance Taylor
4675e3332b 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
2011-03-27 12:10:50 -07:00
Rob Pike
7f9acb53cb testing: shorten some more tests
R=rsc
CC=golang-dev
https://golang.org/cl/4314044
2011-03-26 11:25:22 -07:00
Ian Lance Taylor
d607cb289d 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
2011-03-26 11:24:02 -07:00
Robert Hencke
a4df525a79 gob: trivial cleanup
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4279074
2011-03-25 20:45:21 -07:00
Ian Lance Taylor
2795b13156 gc: remove interim ... error which rejects valid code.
It's been six months.

R=rsc
CC=golang-dev
https://golang.org/cl/4289073
2011-03-25 18:31:55 -07:00
Andrew Gerrand
c3fa7305d1 dashboard: remove old python/bash builder, update README
R=rsc
CC=golang-dev
https://golang.org/cl/4275076
2011-03-26 11:56:34 +11:00
Ian Lance Taylor
4100d1a07c 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
2011-03-25 17:51:02 -07:00
Rob Pike
f0cf7d296c 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
2011-03-25 16:31:10 -07:00
Ian Lance Taylor
4cb660aad8 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
2011-03-25 15:28:53 -07:00
Dave Cheney
d165dc6036 build: handle broken awk in version.bash
R=adg, rsc, ality
CC=golang-dev
https://golang.org/cl/4281069
2011-03-25 18:00:19 -04:00
Rob Pike
d406f8f650 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
2011-03-25 14:50:44 -07:00
Ian Lance Taylor
47c1cef56b 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
2011-03-25 13:31:30 -07:00
Peter Mundy
91bcdb620b net: fix Windows build
R=rsc
CC=golang-dev
https://golang.org/cl/4314042
2011-03-25 16:11:19 -04:00
Albert Strasheim
e83d69647f syscall: GetsockoptInt for darwin, freebsd.
R=rsc
CC=golang-dev
https://golang.org/cl/4298060
2011-03-25 14:43:59 -04:00
Albert Strasheim
e480b81971 net: add FileConn, FilePacketConn, FileListener
R=iant, rsc, brainman
CC=golang-dev
https://golang.org/cl/4306042
2011-03-25 14:42:25 -04:00
Rob Pike
2363784653 test/run: clear $E in case it's already set in environment.
R=rsc
CC=golang-dev
https://golang.org/cl/4312054
2011-03-25 11:33:07 -07:00
Ian Lance Taylor
237ae64146 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
2011-03-25 11:32:32 -07:00
Rob Pike
9db2bc741e flag: fix error in documentation example.
Fixes #1615.
This time for sure.

R=rsc, gri
CC=golang-dev
https://golang.org/cl/4275079
2011-03-25 11:28:31 -07:00
Russ Cox
071d212a22 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
2011-03-25 13:47:07 -04:00
Ian Lance Taylor
8beb4be850 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
2011-03-25 10:36:46 -07:00
Ian Lance Taylor
7c616b3809 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
2011-03-25 10:36:22 -07:00
Ian Lance Taylor
f6d0e81179 runtime/darwin: remove unused local variables.
R=rsc
CC=golang-dev
https://golang.org/cl/4309049
2011-03-25 10:35:46 -07:00
Russ Cox
e857dd5d3f http/pprof: cpu profiling support
R=r
CC=golang-dev
https://golang.org/cl/4280060
2011-03-25 12:50:12 -04:00
Roger Pau Monné
500effe79e 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
2011-03-25 09:33:45 -07:00
Russ Cox
1f2234633f runtime: fix arm build
R=adg, dfc, r
CC=golang-dev
https://golang.org/cl/4296042
2011-03-25 12:30:49 -04:00
Russ Cox
c0168f8f90 A+C: Roger Pau Monné (individual CLA)
R=golang-dev
CC=golang-dev
https://golang.org/cl/4276077
2011-03-25 12:30:09 -04:00
Devon H. O'Dell
e37892c36c freebsd-386: update defs
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4273102
2011-03-25 10:18:04 +11:00
Robert Griesemer
1b2c3e664b 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
2011-03-24 11:45:52 -07:00