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

13745 Commits

Author SHA1 Message Date
Russ Cox
51266761fd cmd/gc: fix divide by zero error in compiler
Fixes #6399.

R=ken2
CC=golang-dev
https://golang.org/cl/13253055
2013-09-16 14:22:37 -04:00
Russ Cox
a70cbf1329 runtime: fix freebsd build
TBR=golang-dev
CC=golang-dev
https://golang.org/cl/13720044
2013-09-16 14:22:24 -04:00
Russ Cox
d9fdf88f34 net: make all.bat run for ordinary Windows users
This CL is required for all.bat to work out of the box on
my Windows 8 laptop.

These tests either require the firewall to be turned off
or require the user to be in the Administrators group.
I don't know which.

Alex may follow up with a refinement of the test to
allow them to run if the user is in the Administrators
group.

Fixes #6392.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13421049
2013-09-16 14:05:06 -04:00
Russ Cox
647eaed93b cmd/cgo: allow C.malloc(0) always
Because we can, and because it otherwise might crash
the program if we think we're out of memory.

Fixes #6390.

R=golang-dev, iant, minux.ma
CC=golang-dev
https://golang.org/cl/13345048
2013-09-16 14:04:55 -04:00
Russ Cox
b2794a1c2e runtime: make ARM integer div-by-zero traceback-friendly
The implementation of division in the 5 toolchain is a bit too magical.
Hide the magic from the traceback routines.

Also add a test for the results of the software divide routine.

Fixes #5805.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/13239052
2013-09-16 14:04:45 -04:00
Russ Cox
555da73c56 runtime, syscall: work around FreeBSD/amd64 kernel bug
The kernel implementation of the fast system call path,
the one invoked by the SYSCALL instruction, is broken for
restarting system calls. A C program demonstrating this is below.

Change the system calls to use INT $0x80 instead, because
that (perhaps slightly slower) system call path actually works.

I filed http://www.freebsd.org/cgi/query-pr.cgi?pr=182161.

The C program demonstrating that it is FreeBSD's fault is below.
It reports the same "Bad address" failures from wait.

#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*);

int
main(void)
{
        int i;
        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(SIGCHLD, &sa, 0);

        for(i=0; i<2; i++)
                pthread_create(0, 0, looper, 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)
{
}

int
mywait4(int pid, int *stat, int options, struct rusage *rusage)
{
        int result;

        asm("movq %%rcx, %%r10; syscall"
                : "=a" (result)
                : "a" (7),
                  "D" (pid),
                  "S" (stat),
                  "d" (options),
                  "c" (rusage));
}

static void*
looper(void *v)
{
        int pid, stat, out;
        struct rusage rusage;

        for(;;) {
                if((pid = fork()) == 0)
                        _exit(0);
                out = mywait4(pid, &stat, 0, &rusage);
                if(out != pid) {
                        printf("wait4 returned %d\n", out);
                }
        }
}

Fixes #6372.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13582047
2013-09-16 14:04:32 -04:00
Rob Pike
29b4de25b3 cmd/go: document that "main" is a reserved import path
Fixes #6312.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/13391049
2013-09-16 22:53:12 +10:00
Han-Wen Nienhuys
ab578e12ff net/rpc: log I/O and internal errors only if debugLog is set.
Fixes #6367.

R=rsc, r
CC=golang-dev
https://golang.org/cl/13395047
2013-09-16 16:29:04 +10:00
Rob Pike
2ec53b0705 cmd/nm: put the -S flag in the usage message
The -S flag reports symbol size, but is missing from the usage message.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/13660046
2013-09-16 16:13:27 +10:00
Andrew Gerrand
49eeef5927 sort: move example to package level and simplify further
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13634044
2013-09-16 13:02:01 +10:00
Andrew Gerrand
d445b76331 cmd/gofmt: document -s transformations
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/13721043
2013-09-16 11:19:39 +10:00
Rob Pike
1fba73de45 encoding/gob: ignore chan and func fields of structures
Previously, fields of type chan or func caused an error.
Now we just treat them like unexported fields and ignore them.
This makes it easier to guarantee long-term compatibilty since
a substructure from another package cannot break gob
encoding by adding a func or chan field.

Fixes #6071

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/13693043
2013-09-16 10:26:23 +10:00
Russ Cox
6d68fc8eea runtime: fix CPU profiling on Windows
The test 'gp == m->curg' is not valid on Windows,
because the goroutine being profiled is not from the
current m.

TBR=golang-dev
CC=golang-dev
https://golang.org/cl/13718043
2013-09-15 12:05:24 -04:00
Russ Cox
aa53b37fa6 go/build: add ctxt.MatchFile
Fixes #6369.

R=dsymonds, r
CC=golang-dev
https://golang.org/cl/13708043
2013-09-15 11:29:47 -04:00
Russ Cox
1385e394cf encoding/xml: document behavior for undefined name space prefixes
Fixes #5626.

R=golang-dev, dominik.honnef
CC=golang-dev
https://golang.org/cl/13702043
2013-09-15 11:29:06 -04:00
Rob Pike
89dacb9cca fmt: %b for complex64 and complex128
Just an oversight they were missing.
Fixes #6387

R=golang-dev, dominik.honnef, rsc
CC=golang-dev
https://golang.org/cl/13715043
2013-09-15 10:45:36 +10:00
Rémy Oudompheng
04c40c97c3 cmd/gc: don't generate algs for internal map types.
Fake types describing the internal structure of hashmaps are
generated for use by precise GC.

Generating hash and eq functions for these fake types slows down
the build and wastes space: the go tool binary size is 13MB
instead of 12MB, and the package size on amd64 is 48.7MB instead
of 45.3MB.

R=golang-dev, daniel.morsing, r, khr, rsc, iant
CC=golang-dev
https://golang.org/cl/13698043
2013-09-14 09:30:36 +02:00
Russ Cox
22e8f82e8d os/exec: add more caveats to StdoutPipe, StderrPipe
(StdinPipe was taken care of by CL 13329043.)

Fixes #6008.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/13606046
2013-09-13 15:43:54 -04:00
Russ Cox
439f9397fc runtime: avoid inconsistent goroutine state in profiler
Because profiling signals can arrive at any time, we must
handle the case where a profiling signal arrives halfway
through a goroutine switch. Luckily, although there is much
to think through, very little needs to change.

Fixes #6000.
Fixes #6015.

R=golang-dev, dvyukov
CC=golang-dev
https://golang.org/cl/13421048
2013-09-13 14:19:23 -04:00
Russ Cox
7fb3d8e45e reflect: document FieldByName shortcoming
Fixes #4876.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/13701044
2013-09-13 13:56:39 -04:00
Dave Cheney
bd9cd6e30e syscall: add TCIOFLUSH family of constants
Fixes #6355.

zerrors_linux_{386,amd64,arm}.go were regenerated using mkerrors.sh but I opted to add the three TC.*FLUSH lines by hand to keep the diff smaller and avoid problems with the API checker.

I'll check freebsd and darwin, could I ask for help with net/open bsd.

R=mikioh.mikioh, jsing, minux.ma, bradfitz
CC=golang-dev
https://golang.org/cl/13660043
2013-09-13 15:01:22 +10:00
Russ Cox
3acddba2ec cmd/5l: fix handling of RET.EQ in wrapper function
Keith is too clever for me.

R=ken2
CC=golang-dev, khr
https://golang.org/cl/13272050
2013-09-13 03:50:50 +00:00
Jamie Wilkinson
27cb23ceb1 goyacc: Fix debug printing of the lexed token's ID and name, and add whitespace in the 'stateX saw' message.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13352048
2013-09-13 13:18:02 +10:00
Rob Pike
c842e43ef6 text/template/parse: mostly roll back the error detection for unmatched right delimiters
It's too late to change this behavior: it breaks templates with minimized JavaScript.

Makes me sad because this common error can never be caught: "{foo}}".
Three cheers for compatibility.

(Leave in a fix to a broken test.)

R=golang-dev, dsymonds, rsc
CC=golang-dev
https://golang.org/cl/13689043
2013-09-13 12:44:45 +10:00
Russ Cox
913f1f1557 cmd/go: do not support code.google.com/r/zzz projects
This reverts CL 13261048. I have just learned that these are
no longer supported on code.google.com (that is, it is impossible
to create them), so there is little reason to add support in
Go 1.2.

Update #5408

R=golang-dev, dave, r
CC=golang-dev
https://golang.org/cl/13317046
2013-09-12 21:47:56 -04:00
Russ Cox
3c11dd8ebc encoding/xml: add Encoder.Flush
Fixes #6365.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13627046
2013-09-12 16:54:01 -04:00
Russ Cox
7276c02b41 runtime, cmd/gc, cmd/ld: ignore method wrappers in recover
Bug #1:

Issue 5406 identified an interesting case:
        defer iface.M()
may end up calling a wrapper that copies an indirect receiver
from the iface value and then calls the real M method. That's
two calls down, not just one, and so recover() == nil always
in the real M method, even during a panic.

[For the purposes of this entire discussion, a wrapper's
implementation is a function containing an ordinary call, not
the optimized tail call form that is somtimes possible. The
tail call does not create a second frame, so it is already
handled correctly.]

Fix this bug by introducing g->panicwrap, which counts the
number of bytes on current stack segment that are due to
wrapper calls that should not count against the recover
check. All wrapper functions must now adjust g->panicwrap up
on entry and back down on exit. This adds slightly to their
expense; on the x86 it is a single instruction at entry and
exit; on the ARM it is three. However, the alternative is to
make a call to recover depend on being able to walk the stack,
which I very much want to avoid. We have enough problems
walking the stack for garbage collection and profiling.
Also, if performance is critical in a specific case, it is already
faster to use a pointer receiver and avoid this kind of wrapper
entirely.

Bug #2:

The old code, which did not consider the possibility of two
calls, already contained a check to see if the call had split
its stack and so the panic-created segment was one behind the
current segment. In the wrapper case, both of the two calls
might split their stacks, so the panic-created segment can be
two behind the current segment.

Fix this by propagating the Stktop.panic flag forward during
stack splits instead of looking backward during recover.

Fixes #5406.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/13367052
2013-09-12 14:00:16 -04:00
Josh Bleecher Snyder
1ea0c480dc go/token: rename RemoveLine to MergeLine, improve documentation
This is a follow-up to feedback from gri in
https://golang.org/cl/12837044/. Most of the wording
and naming improvements are lifted shamelessly from him.

R=gri
CC=golang-dev
https://golang.org/cl/13670043
2013-09-12 09:31:07 -07:00
Nicholas Sullivan
4874bc9b76 crypto/x509: allow ECDSA public keys to be marshaled.
The public key serialization from CreateCertificate is factored out to be
used in MarshalPKIXPublicKey.
Testcode with one P224 ECDSA keypair has been added.

R=golang-dev, agl
CC=agl, golang-dev
https://golang.org/cl/13427044
2013-09-12 12:23:34 -04:00
Han-Wen Nienhuys
1e71e74262 net/rpc: document thread safety requirements of codec types.
Fixes #6306.

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/13474043
2013-09-12 22:03:53 +10:00
Brad Fitzpatrick
1a819be590 net/http: document ServeMux handling of pattern "/"
Fixes #4799

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/13457047
2013-09-12 11:20:16 +01:00
Rob Pike
caa462137a text/template: catch unmatched right delimiter
It was simply a missing error case: when scanning plain text
outside of an action, a right delimiter should be an error.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/13468045
2013-09-12 13:22:56 +10:00
Mikio Hara
fe62a1f1fe net: move mock ICMP into separate file
This is in prepartion for fixing issue 6320.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/13611043
2013-09-12 11:59:18 +09:00
Mikio Hara
81737a9a51 net: make TestDialFailPDLeak shorter
Reduces a number of trials but it still can detect memory leak
when we make blunders in runtime-integarted network poller work,
like just forgetting to call runtime_pollClose in code paths.

Also disables the test on windows/386.

R=alex.brainman, r
CC=golang-dev
https://golang.org/cl/13022046
2013-09-12 11:10:25 +09:00
Dave Cheney
e38eddbfe4 cmd/8l: fix 386 builds
Remove set but unused variable.

R=rsc
CC=golang-dev
https://golang.org/cl/13490047
2013-09-12 11:18:34 +10:00
Russ Cox
1a6576db34 cmd/5l, cmd/6l, cmd/8l: refactor stack split code
Pull the stack split generation into its own function.
This will make an upcoming change to fix recover
easier to digest.

R=ken2
CC=golang-dev
https://golang.org/cl/13611044
2013-09-11 20:29:45 -04:00
Russ Cox
bab302dea2 undo CL 13348045 / 43675523c526
There is no reason to do this, and it's more work.

««« original CL description
net: make channel-based semaphore depend on receive, not send

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

»»»

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13632047
2013-09-11 20:29:22 -04:00
Russ Cox
7f6a7e22a8 net/http: explain the "1.1" in the default User-Agent
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/13263052
2013-09-11 20:28:14 -04:00
Rémy Oudompheng
ff416a3f19 cmd/gc: inline copy in frontend to call memmove directly.
A new node type OSPTR is added to refer to the data pointer of
strings and slices in a simple way during walk(). It will be
useful for future work on simplification of slice arithmetic.

benchmark                  old ns/op    new ns/op    delta
BenchmarkCopy1Byte                 9            8  -13.98%
BenchmarkCopy2Byte                14            8  -40.49%
BenchmarkCopy4Byte                13            8  -35.04%
BenchmarkCopy8Byte                13            8  -37.10%
BenchmarkCopy12Byte               14           12  -15.38%
BenchmarkCopy16Byte               14           12  -17.24%
BenchmarkCopy32Byte               19           14  -27.32%
BenchmarkCopy128Byte              31           26  -15.29%
BenchmarkCopy1024Byte            100           92   -7.50%
BenchmarkCopy1String              10            7  -28.99%
BenchmarkCopy2String              10            7  -28.06%
BenchmarkCopy4String              10            8  -22.69%
BenchmarkCopy8String              10            8  -23.30%
BenchmarkCopy12String             11           11   -5.88%
BenchmarkCopy16String             11           11   -5.08%
BenchmarkCopy32String             15           14   -6.58%
BenchmarkCopy128String            28           25  -10.60%
BenchmarkCopy1024String           95           95   +0.53%

R=golang-dev, bradfitz, cshapiro, dave, daniel.morsing, rsc, khr, khr
CC=golang-dev
https://golang.org/cl/9101048
2013-09-12 00:15:28 +02:00
Russ Cox
6d47de2f40 cmd/5g, cmd/6g, cmd/8g: remove O(n) reset loop in copyprop
Simpler version of CL 13084043.

R=ken2
CC=golang-dev
https://golang.org/cl/13602045
2013-09-11 15:22:11 -04:00
Russ Cox
a0bc379d46 undo CL 13084043 / ef4ee02a5853
There is a cleaner, simpler way.

««« original CL description
cmd/5g, cmd/6g, cmd/8g: faster compilation
Replace linked list walk with memset.
This reduces CPU time taken by 'go install -a std' by ~10%.
Before:
real		user		sys
0m23.561s	0m16.625s	0m5.848s
0m23.766s	0m16.624s	0m5.846s
0m23.742s	0m16.621s	0m5.868s
after:
0m22.714s	0m14.858s	0m6.138s
0m22.644s	0m14.875s	0m6.120s
0m22.604s	0m14.854s	0m6.081s

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

TBR=dvyukov
CC=golang-dev
https://golang.org/cl/13352049
2013-09-11 15:14:11 -04:00
Russ Cox
8cd6341cf8 cmd/gc: allow x[i:j:k] (and x[:j:k]) into the release
R=ken2
CC=golang-dev
https://golang.org/cl/13512053
2013-09-11 14:55:46 -04:00
Russ Cox
cdc5356c93 cmd/api: fix tool for recent go/build change
Asking about runtime/cgo when CgoEnabled=false now correctly
returns an error from build.Import (specifically, NoGoError), because
there are no buildable Go files in that directory.

The API tool was depending on it returning a package with no Go
files instead. Correct that assumption.

Fixes all.bash on local machines.
(Dashboard appears not to be running the api tool at all.)

Update #6124

TBR=golang-dev
CC=golang-dev
https://golang.org/cl/13385046
2013-09-11 14:42:34 -04:00
Russ Cox
6624b70866 undo CL 13632053 / dc7bfe0f022d
It was never going to last.

««« original CL description
cmd/api: break the builds

There is some question about whether the api tool is
running on Windows (see issue 6124), and now I'm
starting to question whether it runs on any of the builders,
since both darwin/amd64 and linux/amd64 are crashing for me
in the api tool due to a recent cgo-related change, and yet
the dashboard is happy.

If the dashboard is still happy after this CL, we have a problem.

Update #6124

TBR=golang-dev
CC=golang-dev
https://golang.org/cl/13632053
»»»

TBR=golang-dev
CC=golang-dev
https://golang.org/cl/13474045
2013-09-11 14:35:08 -04:00
Russ Cox
89a6a8fdb3 cmd/api: break the builds
There is some question about whether the api tool is
running on Windows (see issue 6124), and now I'm
starting to question whether it runs on any of the builders,
since both darwin/amd64 and linux/amd64 are crashing for me
in the api tool due to a recent cgo-related change, and yet
the dashboard is happy.

If the dashboard is still happy after this CL, we have a problem.

Update #6124

TBR=golang-dev
CC=golang-dev
https://golang.org/cl/13632053
2013-09-11 14:34:11 -04:00
Russ Cox
ce9ddd0eee runtime: keep args and frame in struct Func
args is useful for printing tracebacks.

frame is not necessary anymore, but we might some day
get back to functions where the frame size does not vary
by program counter, and if so we'll need it. Avoid needing
to introduce a new struct format later by keeping it now.

Fixes #5907.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/13632051
2013-09-11 14:18:52 -04:00
Russ Cox
611b182190 go/build: reject directory with only cgo files if cgo not in use
The old test for "no Go files" was p.Name == "", meaning we never
saw a Go package statement. That test fails if there are cgo files
that we parsed (and recorded the package name) but then chose
not to use (because cgo is not available).

Test the actual file lists instead.

Fixes #6078.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/13661043
2013-09-11 13:25:30 -04:00
Ian Lance Taylor
fdaf88ea5b cmd/yacc: replace units example with simpler expr example
The units example is nice but is covered by the Lucent
license, which may be a concern for some people making a
commercial source code distribution of Go.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13283045
2013-09-11 09:01:47 -07:00
Russ Cox
ab38e2a498 runtime: show m stack during crash on m stack
The various throwing > 0 finish a change started
in a previous CL, which sets throwing = -1 to mean
"don't show the internals". That gets set during the
"all goroutines are asleep - deadlock!" crash, and it
should also be set during any other expected crash
that does not indicate a problem within the runtime.

Most runtime.throw do indicate a problem within the
runtime, however, so we should be able to enumerate
the ones that should be silent. The goroutine sleeping
deadlock is the only one I can think of.

Update #5139

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/13662043
2013-09-11 12:00:37 -04:00
Russ Cox
fa4984d535 runtime: show runtime.panic frame in traceback
Otherwise, if panic starts running deferred functions,
the code that panicked appears to be calling those
functions directly, which is not the case and can be
confusing.

For example:

main.Two()
        /Users/rsc/x.go:12 +0x2a
runtime.panic(0x20dc0, 0x2100cc010)
        /Users/rsc/g/go/src/pkg/runtime/panic.c:248 +0x106
main.One()
        /Users/rsc/x.go:8 +0x55

This makes clear(er) that main.Two is being called during
a panic, not as a direct call from main.One.

Fixes #5832.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/13302051
2013-09-11 11:59:19 -04:00
Russ Cox
382738af51 net: defend against broken getaddrinfo on Linux
getaddrinfo is supposed to set errno when it returns
EAI_SYSTEM, but sometimes it does not.

Fixes #6232.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/13532045
2013-09-11 11:38:56 -04:00
Russ Cox
397ba2cb4a cmd/cgo: replace C.malloc with our own wrapper
This allows us to make two changes:

1. Force the argument type to be size_t, even on broken
   systems that declare malloc to take a ulong.

2. Call runtime.throw if malloc fails.
   (That is, the program crashes; it does not panic.)

Fixes #3403.
Fixes #5926.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/13413047
2013-09-11 11:30:08 -04:00
Mikio Hara
89b26760d7 net: implement TCP connection setup with fast failover
This CL adds minimal support of Happy Eyeballs-like TCP connection
setup to Dialer API. Happy Eyeballs and derivation techniques are
described in the following:

- Happy Eyeballs: Success with Dual-Stack Hosts
  http://tools.ietf.org/html/rfc6555

- Analysing Dual Stack Behaviour and IPv6 Quality
  http://www.potaroo.net/presentations/2012-04-17-dual-stack-quality.pdf

Usually, the techniques consist of three components below.

- DNS query racers, that run A and AAAA queries in parallel or series
- A short list of destination addresses
- TCP SYN racers, that run IPv4 and IPv6 transport in parallel or series

This CL implements only the latter two. The existing DNS query
component gathers together A and AAAA records in series, so we don't
touch it here. This CL just uses extended resolveInternetAddr and makes
it possible to run multiple Dial racers in parallel.

For example, when the given destination is a DNS name and the name has
multiple address family A and AAAA records, and it happens on the TCP
wildcard network "tcp" with DualStack=true like the following:

(&net.Dialer{DualStack: true}).Dial("tcp", "www.example.com:80")

The function will return a first established connection either TCP over
IPv4 or TCP over IPv6, and close the other connection internally.

Fixes #3610.
Fixes #5267.

Benchmark results on freebsd/amd64 virtual machine, tip vs. tip+12416043:

benchmark                           old ns/op    new ns/op    delta
BenchmarkTCP4OneShot                    50696        52141   +2.85%
BenchmarkTCP4OneShotTimeout             65775        66426   +0.99%
BenchmarkTCP4Persistent                 10986        10457   -4.82%
BenchmarkTCP4PersistentTimeout          11207        10445   -6.80%
BenchmarkTCP6OneShot                    62009        63718   +2.76%
BenchmarkTCP6OneShotTimeout             78351        79138   +1.00%
BenchmarkTCP6Persistent                 14695        14659   -0.24%
BenchmarkTCP6PersistentTimeout          15032        14646   -2.57%
BenchmarkTCP4ConcurrentReadWrite         7215         6217  -13.83%
BenchmarkTCP6ConcurrentReadWrite         7528         7493   -0.46%

benchmark                          old allocs   new allocs    delta
BenchmarkTCP4OneShot                       36           36    0.00%
BenchmarkTCP4OneShotTimeout                36           36    0.00%
BenchmarkTCP4Persistent                     0            0     n/a%
BenchmarkTCP4PersistentTimeout              0            0     n/a%
BenchmarkTCP6OneShot                       37           37    0.00%
BenchmarkTCP6OneShotTimeout                37           37    0.00%
BenchmarkTCP6Persistent                     0            0     n/a%
BenchmarkTCP6PersistentTimeout              0            0     n/a%
BenchmarkTCP4ConcurrentReadWrite            0            0     n/a%
BenchmarkTCP6ConcurrentReadWrite            0            0     n/a%

benchmark                           old bytes    new bytes    delta
BenchmarkTCP4OneShot                     2500         2503    0.12%
BenchmarkTCP4OneShotTimeout              2508         2505   -0.12%
BenchmarkTCP4Persistent                     0            0     n/a%
BenchmarkTCP4PersistentTimeout              0            0     n/a%
BenchmarkTCP6OneShot                     2713         2707   -0.22%
BenchmarkTCP6OneShotTimeout              2722         2720   -0.07%
BenchmarkTCP6Persistent                     0            0     n/a%
BenchmarkTCP6PersistentTimeout              0            0     n/a%
BenchmarkTCP4ConcurrentReadWrite            0            0     n/a%
BenchmarkTCP6ConcurrentReadWrite            0            0     n/a%

R=golang-dev, bradfitz, nightlyone, rsc
CC=golang-dev
https://golang.org/cl/12416043
2013-09-11 10:48:53 -04:00
Russ Cox
e6a49555a7 cmd/go: use pattern to prune file tree walk
For example, if the pattern is m... there is
no need to look in directories not beginning with m.

Fixes #5214.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/13253049
2013-09-11 09:57:05 -04:00
Russ Cox
08b26e4104 cmd/cgo: don't say "gcc produced no output" if we ran clang
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/13420048
2013-09-11 09:56:51 -04:00
Dave Cheney
3ee0744c06 bytes: additional test coverage
Add coverage for some uncovered bytes methods. The increase in actual coverage is disapointing small.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13651044
2013-09-11 21:20:15 +10:00
Robert Daniel Kortschak
b34ec90e19 cmd/api: make api check directory per-user
Fixes #6353.

R=golang-dev, bradfitz, alex.brainman
CC=golang-dev
https://golang.org/cl/13652043
2013-09-11 10:50:56 +10:00
Russ Cox
b99fdb2a11 cmd/go: report correct directory for 'no version control'
The scan starts at the directory we care about and works
backward to the GOPATH root. The error should say the
original directory name, not the name of the GOPATH root.

Fixes #6175.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/13366050
2013-09-10 15:28:29 -04:00
Russ Cox
6034406eae build: more "undefined behavior" fixes
Fixes #5764.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13441051
2013-09-10 14:54:55 -04:00
Russ Cox
80a153dd51 cmd/6l, cmd/8l: fix MOVL MOVQ optab
The entry for LEAL/LEAQ in these optabs was listed as having
two data bytes in the y array. In fact they had and expect no data
bytes. However, the general loop expects to be able to look at at
least one data byte, to make sure it is not 0x0f. So give them each
a single data byte set to 0 (not 0x0f).

Since the MOV instructions have the largest optab cases, this
requires growing the size of the data array.

Clang found this bug because the general o->op[z] == 0x0f
test was using z == 22, which was out of bounds.

In practice the next byte in memory was probably not 0x0f
so it wasn't truly broken. But might as well be clean.

Update #5764

R=ken2
CC=golang-dev
https://golang.org/cl/13241050
2013-09-10 14:53:41 -04:00
Arnaud Ysmal
8edf764fa3 libmach: accept OS X binary generated by external linker
Fixes cpu subtype check when using external linker which sets the CPU_SUBTYPE_LIB64 bit (1<<31).
Fixes #6197.

R=golang-dev, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/13248046
2013-09-10 11:50:34 -07:00
Russ Cox
baed067d87 cmd/go: show FAIL for errors during test setup
For example, if an x_test.go file contains a syntax error,
b.test fails with an error message. But it wasn't printing
the same FAIL line that a build failure later would print.
This makes all the test failures that happen (once we
decide to start running tests) consistently say FAIL.

Fixes #4701.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13431044
2013-09-10 14:43:57 -04:00
Russ Cox
627d17cf29 cmd/go: fix go test using package main_test
A package main binary (that is, a command) being installed
does not mean we can skip the build of the package archive
during a test.

Fixes #3417.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13462046
2013-09-10 14:43:35 -04:00
Russ Cox
90f9192886 cmd/go: run benchmarks in sequence
Fixes #5662.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13650043
2013-09-10 14:43:21 -04:00
Russ Cox
6706931a71 go/doc: restore handling of multi-paragraph BUG comments
It was lost when the generic "Notes" support went in.

Had to change the test setup, because it precluded even
being able test multi-line comments, much less multi-paragraph
comments.

Now 'godoc sync/atomic' works correctly again.

Fixes #6135.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13427045
2013-09-10 14:41:20 -04:00
Russ Cox
159c2b7e46 cmd/go: fix error for 'go install x.go' when GOBIN is not set
Fixes #6191.
Fixes #5426.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13234052
2013-09-10 14:41:07 -04:00
Ian Lance Taylor
a547ad6ac0 cmd/go: report real package in errors for go get with wildcard
Fixes #5054.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/13609043
2013-09-10 11:27:29 -07:00
Ian Lance Taylor
7f062fa2de cmd/go: build SWIG shared libraries in work directory
Remove test of whether SWIG shared library is older than
sources--should be covered by test of package file anyhow.

Fixes #5739.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/13352046
2013-09-10 11:00:26 -07:00
Russ Cox
d5fbad0de8 cmd/go: better error for shadowed directories in GOPATH
Fixes #5774.

R=golang-dev, adg, r, bradfitz
CC=golang-dev
https://golang.org/cl/9164043
2013-09-10 13:17:21 -04:00
Alexis Imperial-Legrand
927b7ac327 runtime: explicit init of runtime-gdb helpers
If using other gdb python scripts loaded before Go's gdb-runtime.py
and that have a different init prototype:
Traceback (most recent call last):
  File "/usr/lib/go/src/pkg/runtime/runtime-gdb.py", line 446, in <module>
    k()
TypeError: __init__() takes exactly 3 arguments (1 given)

The problem is that gdb keeps all python scripts in the same namespace,
so vars() contains them. To avoid that, load helpers one by one.

R=iant, rsc
CC=gobot, golang-dev
https://golang.org/cl/9752044
2013-09-10 13:00:08 -04:00
Russ Cox
7d249ef28f cmd/go: fix build -n output when using swig
$INTBITS will not be defined, of course, but that's the best we can do.

Fixes #5978.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/13253048
2013-09-10 12:55:07 -04:00
Russ Cox
7c6db642b0 cmd/go: implement -x correctly for 'go vet', 'go fmt', and so on
Fixes #5676.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13250047
2013-09-10 12:47:52 -04:00
Russ Cox
c971f95c10 go/build: allow $ in cgo LDFLAGS
Fixes #6038.

R=iant
CC=golang-dev
https://golang.org/cl/13649043
2013-09-10 12:47:43 -04:00
Russ Cox
358ae20777 libmach: change three more BGET macro invocations back
Various compilers complain about the macro expansion not
being used. I fixed a few yesterday. More today.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13643044
2013-09-10 12:24:43 -04:00
Keith Randall
4487054751 runtime: clean up / align comment tabbing
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13336046
2013-09-10 09:02:22 -07:00
Mikio Hara
02faa939d3 net: remove dreg of obsoleted network poller
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/13396051
2013-09-10 20:00:21 +09:00
Alex Brainman
a6149da08a os/exec: change windows LookPath so it works like cmd.exe
Fixes #6224

R=golang-dev, hcwfrichter, bradfitz
CC=golang-dev
https://golang.org/cl/13410045
2013-09-10 14:50:29 +10:00
Russ Cox
5d2c3a687c encoding/json: document actual behavior for Unmarshal into interface{}
Fixes #4900.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13400044
2013-09-09 19:11:05 -04:00
Richard Eric Gavaletz
7adb42eee4 container/list: unexpected panic if Next/Prev called outside of list.
Before CL 7065067 calling Next on an element returned either the
next/prev element or nil was returned.  After the CL if an element
was not part of a list e.Next() and e.Prev() will panic.  This CL
returns to the documented behavior, that Next/Prev returns the
next/prev list element or nil.

Fixes #6349.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/13234051
2013-09-09 15:41:36 -07:00
Russ Cox
5dc8c4dbfb path/filepath: fix race with other tests
Bug3486 tried to walk the entire file tree, but other tests might
be creating and removing files in that tree. In particular, package os
creates and removes files in the os directory, and issue 5863
reports failures due to seeing those files appear and then disappear.

Change the test to walk just the test tree, which should not be
changing.

Fixes #5863.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13467045
2013-09-09 16:42:18 -04:00
Russ Cox
10c36fbc9d encoding/xml: fix panic in Marshal
Fixes #6341.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13512048
2013-09-09 16:42:07 -04:00
Russ Cox
1b651556c3 syslog: fix data race on 'crashy' in test function
Fixes #5894.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/13303051
2013-09-09 16:17:59 -04:00
Russ Cox
87a6d75012 log/syslog: use alternate format for logging to local syslog daemon
Fixes #5803.
Is it correct behavior? Who knows.

R=golang-dev, bradfitz, jgc
CC=golang-dev, jgc
https://golang.org/cl/13248048
2013-09-09 16:17:44 -04:00
Ian Lance Taylor
f0ff63ea64 cmd/go: if there are C++ sources, use g++ as default external linker
This will bring in the C++ standard library without requiring
any special #cgo LDFLAGS options.

When using gccgo, just add -lstdc++ to link line; this should
do no harm if it is not needed.

No tests, since we don't want to assume a C++ compiler.

Update #5629

R=golang-dev, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/13394045
2013-09-09 12:50:49 -07:00
Russ Cox
7d734d9252 build: remove various uses of C undefined behavior
If you thought gcc -ansi -pedantic was pedantic, just wait
until you meet clang -fsanitize=undefined.

I think this addresses all the reported "errors", but we'll
need another run to be sure.

all.bash still passes.

Update #5764

Dave, can you please try again?

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13334049
2013-09-09 15:07:23 -04:00
Russ Cox
6252b41981 runtime: remove OABI check from ARM startup
The code in question is trying to print a nice error message
when a Go EABI binary runs on an OABI machine.
Unfortunately, the only way to do that is to use
ARM Thumb instructions, which we otherwise don't use.

There exist ARM EABI machines that do not support Thumb.
We could run on them if not for this OABI check, so disable it.

Fixes #5685.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/13234050
2013-09-09 15:06:05 -04:00
Rémy Oudompheng
9c21ce54dd cmd/6g: handle very wide offsets.
Fixes #6036.

R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/12992043
2013-09-09 20:36:19 +02:00
Russ Cox
0218dfe7eb cmd/gc: allow inlined struct == to mention unsafe.Pointer even in safe mode
Fixes #5578.

R=ken2
CC=golang-dev
https://golang.org/cl/13417044
2013-09-09 13:11:41 -04:00
Russ Cox
5b04d67091 cmd/cgo: record full source path to input .go files
Fixes #5122.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/13395046
2013-09-09 13:04:14 -04:00
Russ Cox
933d7129c0 cmd/gc: squelch spurious "invalid recursive type" error
R=ken2
CC=golang-dev
https://golang.org/cl/13512047
2013-09-09 13:03:59 -04:00
Russ Cox
903c2fda18 cmd/gc: diagnose '_ = nil' better
Fixes #6004.

R=ken2
CC=golang-dev
https://golang.org/cl/13616044
2013-09-09 12:49:39 -04:00
Russ Cox
85195e2ccf cmd/gc: more detail in import conflict error message
Cannot happen when using the go command, but help
people running commands by hand or with other tools.

Fixes #5888.

R=ken2
CC=golang-dev
https://golang.org/cl/13324048
2013-09-09 12:30:53 -04:00
Russ Cox
8d530f2472 cmd/gc: show package name in 'imported and not used' error
Fixes #5957.

R=ken2
CC=golang-dev
https://golang.org/cl/13250046
2013-09-09 12:21:09 -04:00
Russ Cox
a7d8b35aac cmd/gc: fix 'internal error: typename ideal bool'
Fixes #6298.

R=ken2
CC=golang-dev
https://golang.org/cl/13624043
2013-09-09 12:00:16 -04:00
Joel Sing
3b089179c4 runtime: unbreak build on dragonfly
Update dragonfly memory functions to work with new memory statistics.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/13615043
2013-09-09 08:48:06 -07:00
Alex Brainman
5f75314e18 time: allow more time for TestOverflowRuntimeTimer to succeed
Attempting to fix windows gobuilders

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13507044
2013-09-09 15:50:11 +10:00
Dominik Honnef
a789ae9e8e compress/flate: small documentation fix
R=golang-dev, adg
CC=bradfitz, golang-dev, remyoudompheng
https://golang.org/cl/13568045
2013-09-09 09:37:05 +10:00
Robert Daniel Kortschak
c01945afc9 sort: fix up example expected output formatting
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13426046
2013-09-08 13:21:03 +10:00
Andriy Lytvynov
467122ce0b sort: add a simpler sort.Interface example
Existing example renamed to Example_sortWrapper.
Fixes #6335.

R=golang-dev, rsc, taj.khattra, r
CC=golang-dev
https://golang.org/cl/13586043
2013-09-08 11:17:23 +10:00
Keith Randall
78338d8c66 runtime: Smhasher tests of our map hash function.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/13436045
2013-09-06 16:23:46 -07:00
Brad Fitzpatrick
da7a51d16b net: don't error when marshalling nil IP addresses
See https://code.google.com/p/go/issues/detail?id=6339#c3

Fixes #6339

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/13553044
2013-09-06 15:29:09 -07:00
Ehren Kret
3b6b53f493 compress/flate: prevent panic when reinitializing huffmanDecoder with bad input
The huffmanDecoder struct appears to be intented for reuse by calling init a
second time with a second sequence of code lengths. Unfortunately, it can
currently panic if the second sequence of code lengths has a minimum value
greater than 10 due to failure to reinitialize the links table.

This change prevents the panic by resetting the huffmanDecoder struct back to
the struct's zero value at the beginning of the init method if the
huffmanDecoder is being reused (determined by checking if min has been set to a
non-zero value).

Fixes #6255.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/13230043
2013-09-06 15:09:42 -07:00
Dmitriy Vyukov
a33ef8d11b runtime: account for all sys memory in MemStats
Currently lots of sys allocations are not accounted in any of XxxSys,
including GC bitmap, spans table, GC roots blocks, GC finalizer blocks,
iface table, netpoll descriptors and more. Up to ~20% can unaccounted.
This change introduces 2 new stats: GCSys and OtherSys for GC metadata
and all other misc allocations, respectively.
Also ensures that all XxxSys indeed sum up to Sys. All sys memory allocation
functions require the stat for accounting, so that it's impossible to miss something.
Also fix updating of mcache_sys/inuse, they were not updated after deallocation.

test/bench/garbage/parser before:
Sys		670064344
HeapSys		610271232
StackSys	65536
MSpanSys	14204928
MCacheSys	16384
BuckHashSys	1439992

after:
Sys		670064344
HeapSys		610271232
StackSys	65536
MSpanSys	14188544
MCacheSys	16384
BuckHashSys	3194304
GCSys		39198688
OtherSys	3129656

Fixes #5799.

R=rsc, dave, alex.brainman
CC=golang-dev
https://golang.org/cl/12946043
2013-09-06 16:55:40 -04:00
Alex Brainman
52f15df9e2 cmd/go: rename go.exe if cannot delete it during clean
Fixes #6179

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12916047
2013-09-06 16:55:35 -04:00
Rémy Oudompheng
c929ac5f7e cmd/gc: add missing typecheck for walk-generated constants.
Fixes #6131.

R=golang-dev, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/12800045
2013-09-06 16:55:30 -04:00
Marco Hennings
4e998d71c9 archive/tar: fix a case where USTAR-split is not working correctly.
For some long filenames the USTAR-split code does not work
correctly. It is wrongly assumed that the path would not be too long,
but it is.

The user visible result was that a filename was split, but it still
caused an error.

The cause was a wrongly calculated nlen. In addition I noticed that
at this place it is also seems necessary to check if the prefix will
fit in the 155 chars available for the prefix.

R=dsymonds, rsc
CC=golang-dev
https://golang.org/cl/13300046
2013-09-06 16:49:38 -04:00
Andriy Lytvynov
fb25a61872 sort: fix Example_sortMultiKeys
Old example referenced global var from multiSorter.Sort and ignored it's argument.
Changed one of example calls to actually pass slice to sort.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/13551044
2013-09-06 16:49:34 -04:00
Russ Cox
af2a3193af cmd/5g, cmd/6g, cmd/8g: simplify for loop in bitmap generation
Lucio De Re reports that the more complex
loop miscompiles on Plan 9.

R=ken2
CC=golang-dev
https://golang.org/cl/13602043
2013-09-06 16:49:11 -04:00
Josh Bleecher Snyder
08925ce6ee cmd/gofmt: sort more, remove some duplicate imports
* Sort imports by import path, then import name, then comment. Currently, gofmt sorts only by import path.
* If two imports have the same import path and import name, and one of them has no comment, remove the import with no comment. (See the discussion at issue 4414.)

Based on @rsc's https://golang.org/cl/7231070/

Fixes #4414.

R=gri, rsc
CC=golang-dev
https://golang.org/cl/12837044
2013-09-06 16:25:15 -04:00
Russ Cox
e1ac15743b cmd/gc: remove "send used as value" hint
This message was helpful for pre-Go 1 users updating to Go 1.
That time is past. Now the message is confusing because it
depends on knowing what pre-Go 1 looked like.

Update #4697.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13335051
2013-09-06 15:47:52 -04:00
Anthony Martin
3548ab5ebb runtime: handle timer overflow in tsleep
Make sure we never pass a timer into timerproc with
a negative duration since it will cause other timers
to never expire.

Fixes #5321.

R=golang-dev, minux.ma, remyoudompheng, mikioh.mikioh, r, bradfitz, rsc, dvyukov
CC=golang-dev
https://golang.org/cl/9035047
2013-09-06 15:47:39 -04:00
Brad Fitzpatrick
8a70b50b1f cmd/api: include constant values
Update #5935

R=golang-dev, rsc, iant, dave
CC=golang-dev
https://golang.org/cl/13261050
2013-09-06 12:01:01 -07:00
Brad Fitzpatrick
da50221e8e reflect: unexport BUCKETSIZE, MAXKEYSIZE, MAXVALSIZE
But keep their case for ease of searching.

They were added recently. We don't want them part of go1.2's API.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13569044
2013-09-06 12:00:42 -07:00
Brad Fitzpatrick
c327e82ddb crypto/rand: make Read use io.ReadFull
Fixes #6084

R=golang-dev, rsc, dave
CC=golang-dev
https://golang.org/cl/13523044
2013-09-06 12:00:27 -07:00
Kamil Kisiel
a3834a2e8a net: Fix inaccurate docs for AcceptTCP and AcceptUnix.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13592043
2013-09-06 12:00:03 -07:00
Lucio De Re
fd7ddad160 cmd/dist: Plan 9 build needs an additional include path
cmd/cc: bv.c imports libc.h twice

When using the Plan 9 compiler, the invocation

        #include <../ld/textflag.h>

works for the toolchain, but not for the MACH library.

Module cmd/cc/bv.c includes libc.h and "cc.h", which in
turn also includes libc.h.  In the Plan 9 context, this
causes a number of duplicate definitions.

R=golang-dev, rsc, r
CC=golang-dev
https://golang.org/cl/13303047
2013-09-06 16:15:44 +10:00
Rob Pike
6833d1b436 cmd/go: don't leave test binary around for coverage
It's not needed to analyze coverage data.
Fixes #6120

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/13343050
2013-09-06 15:54:26 +10:00
Rob Pike
46f96079df undo CL 13004046 / 5db14b33d6ef
Flushing after every token negates the point of buffering. A different approach is required.

««« original CL description
encoding/xml: flush buffer after encoding token

R=rsc, bradfitz, adg
CC=golang-dev
https://golang.org/cl/13004046

»»»

R=golang-dev, adg, rsc
CC=golang-dev
https://golang.org/cl/13515043
2013-09-06 07:54:43 +10:00
Ian Lance Taylor
28bbc6c27a cmd/ld: emit relocations for .debug_frame in external link mode
This should have been part of revision 16731:cdedb129e020, but
I missed it.  This fixes printing local variables when doing
an external link.

No test because we aren't doing any debug info testing yet.

Fixes #5719.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13464046
2013-09-05 12:55:21 -07:00
Rémy Oudompheng
86c0cf10cb compress/zlib: add Reset method to Writer.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13171046
2013-09-05 21:50:47 +02:00
Rémy Oudompheng
780f5b714d reflect: do not cache trivial values in DeepEqual.
DeepEqual caches addresses of compared values
each time it visits addressable values. This is
more expensive than actually comparing them in
the common case of large slices of bytes or integers.

Also add a fast path for slices with identical
underlying array.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13000044
2013-09-05 21:37:07 +02:00
Ian Lance Taylor
f2380a81d7 cmd/dist: don't print misleading warning when using GOROOT_FINAL
Fixes #5240.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13546044
2013-09-04 17:02:08 -07:00
Brad Fitzpatrick
fca660892d compress/flate: use bytes.NewReader instead of NewBuffer in test
Also, report allocations in benchmark.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13410044
2013-09-04 15:31:46 -07:00
Rob Pike
80f39f7b73 html/template: export the parse.Tree for the escaped template
The underlying parse tree is visible in text/template, so it should be visible here.
Done by copying the underlying *parse.Tree up to the top level of the struct, and then making sure it's kept up to date.
Fixes #6318.

R=mikesamuel
CC=golang-dev
https://golang.org/cl/13479044
2013-09-05 08:23:11 +10:00
Aulus Egnatius Varialus
2b44b36487 cgo: enable cgo on dragonfly
Enable cgo for dragonfly/386 and dragonfly/amd64.

R=golang-dev, jsing, iant, bradfitz
CC=golang-dev
https://golang.org/cl/13247046
2013-09-04 15:19:21 -07:00
Ian Lance Taylor
d011f0aa89 cmd/ld: don't allocate unused garbage space in pclntab file table
Fixes #6319.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13539043
2013-09-04 13:26:49 -07:00
Ian Lance Taylor
97d6a1e130 cmd/cgo: document command line options
Also remove incorrect statement that cgo does not support
gccgo.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13511043
2013-09-03 21:23:52 -07:00
Ian Lance Taylor
f68c23e2bb cmd/cgo: don't let #cgo directives mess up line numbering
Fixes #5272.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13498046
2013-09-03 21:15:15 -07:00
Rob Pike
0ba7ffe289 text/template: allow eq to take more than two arguments
Based on an old suggestion by rsc, it compares the second
and following arguments to the first.

Unfortunately the code cannot be as pretty as rsc's original
because it doesn't require identical types.

R=golang-dev, dsymonds, adg
CC=golang-dev
https://golang.org/cl/13509046
2013-09-04 13:42:22 +10:00
Mikio Hara
54b2a83d9a net/http: remove dreg of obsoleted network poller
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13261049
2013-09-04 10:04:12 +09:00
Brad Fitzpatrick
8272c14f7e net/http: sniff less
We were reading 1024 bytes but only using 512.

Fixes #6311

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/13289047
2013-09-03 09:11:25 -07:00
Mikio Hara
c576bcbad5 net: fix TestFirstFavoriteAddr failure on single IP stack kernel
Update #3610
Update #5267
Update #5707

R=golang-dev, bradfitz, dave
CC=golang-dev
https://golang.org/cl/13465043
2013-09-02 16:44:51 +09:00
Keith Randall
23f9751e83 runtime: clean up map code. Remove hashmap.h.
Use cnew/cnewarray instead of mallocgc.

R=golang-dev, dvyukov
CC=golang-dev
https://golang.org/cl/13396045
2013-08-31 14:09:34 -07:00
Joel Sing
fd0af9b56c cmd/8l: add support for dragonfly/386
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/13328045
2013-08-31 09:33:38 -07:00
Joel Sing
465ba6b78c runtime, syscall: add support for dragonfly/386
Add runtime and syscall support for dragonfly/386.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/13237051
2013-08-31 09:32:07 -07:00
Joel Sing
f6f02a69ae syscall: z* files for dragonfly/386
Add generated z* files for dragonfly/386.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/13303046
2013-08-31 09:29:38 -07:00
Keith Randall
fb376021be runtime: record type information for hashtable internal structures.
Remove all hashtable-specific GC code.

Fixes bug 6119.

R=cshapiro, dvyukov, khr
CC=golang-dev
https://golang.org/cl/13078044
2013-08-31 09:09:50 -07:00
Joel Sing
d0206101c8 cmd/5l,cmd/6l,cmd/8l: fix dragonflydynld path
R=golang-dev, bradfitz, dave
CC=golang-dev
https://golang.org/cl/13225043
2013-08-31 22:02:21 +10:00
Mikio Hara
29de03adf3 net: keep lookup IP stuff close
Also flattens import declaration.

R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/13373046
2013-08-31 16:29:50 +09:00
Mikio Hara
7c59c8bdee net: make resolveInternetAddr return a list of addresses
This CL makes resolveInternetAddr return a list of addresses that
contain a pair of different address family IP addresses if possible,
but doesn't contain any API behavioral changes yet. A simple IP
address selection mechanism for Resolve{TCP,UDP,IP}Addr and Dial API
still prefers IPv4.

This is in preparation for TCP connection setup with fast failover on
dual IP stack node as described in RFC 6555.

Update #3610
Update #5267

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13374043
2013-08-31 10:28:49 +09:00
Brad Fitzpatrick
db12f9d4e4 compress/gzip: add Writer.Reset
compress/flate is https://golang.org/cl/12953048
compress/zlib is https://golang.org/cl/13171046

Update #6138

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/13435043
2013-08-30 11:41:12 -07:00
Tad Glines
41c5d8d85f database/sql: add SetMaxOpenConns
Update #4805

Add the ability to set an open connection limit.
Fixed case where the Conn finalCloser was being called with db.mu locked.
Added separate benchmarks for each path for Exec and Query.
Replaced slice based idle pool with list based idle pool.

R=bradfitz
CC=golang-dev
https://golang.org/cl/10726044
2013-08-30 09:27:33 -07:00
Adam Langley
87404c9887 crypto/x509: expose arbitary X.509 extensions.
This change allows people who want to parse or set odd X.509 extensions
to do so without having to add support for them all to the package.

I tried to make it so that only a single member: Extensions would be
needed. However, that would mean detecting when the caller had altered
the contents of it so that parsing and marshaling a certificate
wouldn't ignore all changes to the other members. This ended up being
messy, thus the current design where there are two members: one for
reading and another for writing.

As crypto/x509 adds support for more extensions in the future, the raw
extensions will still be in Extensions for older code that expects it
there. Also, future extensions will be overridden by any raw extensions
added to ExtraExtensions by code that was written before support was
added.

R=golang-dev, r
CC=golang-dev, jpsugar
https://golang.org/cl/12056043
2013-08-30 10:14:45 -04:00
Dmitriy Vyukov
79dca0327e libbio, all cmd: consistently use BGETC/BPUTC instead of Bgetc/Bputc
Also introduce BGET2/4, BPUT2/4 as they are widely used.
Slightly improve BGETC/BPUTC implementation.
This gives ~5% CPU time improvement on go install -a -p1 std.
Before:
real		user		sys
0m23.561s	0m16.625s	0m5.848s
0m23.766s	0m16.624s	0m5.846s
0m23.742s	0m16.621s	0m5.868s
after:
0m22.999s	0m15.841s	0m5.889s
0m22.845s	0m15.808s	0m5.850s
0m22.889s	0m15.832s	0m5.848s

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12745047
2013-08-30 15:46:12 +04:00
Nigel Tao
2df3d80037 go/build: fix deps_test for Plan 9's os/user dependencies and to
include the new image/color/palette package.

R=r
CC=golang-dev
https://golang.org/cl/13314044
2013-08-30 17:12:42 +10:00
Nigel Tao
aeb8b45866 image/color/palette: move Plan9Palette and WebSafePalette out of the
image/color package into their own package. They require some non-
trivial init-time code (interface conversions, currently 40KiB of text)
that would otherwise burden any Go program that imported image/color.

R=r
CC=golang-dev
https://golang.org/cl/13256046
2013-08-30 16:03:16 +10:00
Mikio Hara
20692c22d7 net: add addrList
This CL adds a new type addrList that will carry a short list of IP
addresses to dial helper functions in the upcoming CLs.

This is in preparation for TCP connection setup with fast failover on
dual IP stack node as described in RFC 6555.

Update #3610
Update #5267

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13241046
2013-08-30 09:28:26 +09:00
Brad Fitzpatrick
9456adb36b undo CL 10726044 / c9bea548fb6f
Breaks build, and has a race.

««« original CL description
database/sql: add SetMaxOpenConns

Update #4805

Add the ability to set an open connection limit.
Fixed case where the Conn finalCloser was being called with db.mu locked.
Added seperate benchmarks for each path for Exec and Query.
Replaced slice based idle pool with list based idle pool.

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

»»»

R=golang-dev
CC=golang-dev
https://golang.org/cl/13252046
2013-08-29 17:26:00 -07:00
Tad Glines
4572e48483 database/sql: add SetMaxOpenConns
Update #4805

Add the ability to set an open connection limit.
Fixed case where the Conn finalCloser was being called with db.mu locked.
Added seperate benchmarks for each path for Exec and Query.
Replaced slice based idle pool with list based idle pool.

R=bradfitz
CC=golang-dev
https://golang.org/cl/10726044
2013-08-29 17:20:39 -07:00
Mikio Hara
3c6558ad90 net: add netaddr interface
This CL adds the netaddr interface that will carry a single network
endpoint address or a short list of IP addresses to dial helper
functions in the upcoming CLs.

This is in preparation for TCP connection setup with fast failover on
dual IP stack node as described in RFC 6555.

Update #3610
Update #5267

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13368044
2013-08-30 09:09:45 +09:00
Keith Randall
32b770b2c0 runtime: jump to badmcall instead of calling it.
This replaces the mcall frame with the badmcall frame instead of
leaving the mcall frame on the stack and adding the badmcall frame.
Because mcall is no longer on the stack, traceback will now report what
called mcall, which is what we would like to see in this situation.

R=golang-dev, cshapiro
CC=golang-dev
https://golang.org/cl/13012044
2013-08-29 15:53:34 -07:00
Brad Fitzpatrick
90351506d4 regexp/syntax: optimize EmptyOpContext
Minor. Saw this in a profile at few percent of CPU and was
curious what it was. Improves overall regexp benchmarks
anywhere from 0 to 3%, but they're a pain to run. You need to
run them in isolation for long runs to get stable numbers.

benchmark                  old ns/op    new ns/op    delta
BenchmarkEmptyOpContext          537          473  -11.92%

R=golang-dev, crawshaw
CC=golang-dev
https://golang.org/cl/13407043
2013-08-29 14:31:10 -07:00
Adam Langley
2fe9a5a3e8 crypto/tls: support AES-GCM.
AES-GCM is the only current TLS ciphersuite that doesn't have
cryptographic weaknesses (RC4), nor major construction issues (CBC mode
ciphers) and has some deployment (i.e. not-CCM).

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13249044
2013-08-29 17:18:59 -04:00
Brad Fitzpatrick
c4aa9c5c4e regexp: fix a benchmark case
I noticed that this one benchmark in particular was very
noisy.  Looking into it, I saw that the table was wrong
and inconsistent with the lines above and below.

R=golang-dev, crawshaw
CC=golang-dev
https://golang.org/cl/13393045
2013-08-29 13:55:30 -07:00
Shenghou Ma
716a409b90 net/http: redirect handlers from mux.Handler() shouldn't clear the query string
R=bradfitz, alberto.garcia.hierro, rsc, adg
CC=golang-dev
https://golang.org/cl/7099045
2013-08-29 13:55:12 -07:00
Carl Shapiro
c51152f438 runtime: check bitmap word for allocated bit in markonly
When searching for an allocated bit, flushptrbuf would search
backward in the bitmap word containing the bit of pointer
being looked-up before searching the span.  This extra check
was not replicated in markonly which, instead, after not
finding an allocated bit for a pointer would directly look in
the span.

Using statistics generated from godoc, before this change span
lookups were, on average, more common than word lookups.  It
was common for markonly to consult spans for one third of its
pointer lookups.  With this change in place, what were
previously span lookups are overwhelmingly become by the word
lookups making the total number of span lookups a relatively
small fraction of the whole.

This change also introduces some statistics gathering about
lookups guarded by the CollectStats enum.

R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/13311043
2013-08-29 13:52:38 -07:00
Keith Randall
ed467db6d8 cmd/cc,runtime: change preprocessor to expand macros inside of
#pragma textflag and #pragma dataflag directives.
Update dataflag directives to use symbols instead of integer constants.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13310043
2013-08-29 12:36:59 -07:00
Rémy Oudompheng
f5f0e40e80 compress/flate: implement Reset method on Writer.
Fixes #6138.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12953048
2013-08-29 21:09:23 +02:00
Daniel Morsing
280c8b90e2 cmd/gc: make method names for function scoped types unique
Types in function scope can have methods on them if they embed another type, but we didn't make the name unique, meaning that 2 identically named types in different functions would conflict with eachother.

Fixes #6269.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13326045
2013-08-29 16:48:44 +02:00
Lucio De Re
bf58d20999 cmd/8g: add descriptions for some missing instructions.
These instructions are emitted when GO386=387 or the target
i386 CPU does not have SSE2 capabilities.

Fixes #6215.

R=golang-dev, remyoudompheng
CC=golang-dev
https://golang.org/cl/12812045
2013-08-29 14:41:01 +02:00
Rémy Oudompheng
66c8935f73 cmd/gc: fix detection of initialization loop.
The compiler computes initialization order by finding
a spanning tree between a package's global variables.
But it does so by walking both variables and functions
and stops detecting cycles between variables when they
mix with a cycle of mutually recursive functions.

Fixes #4847.

R=golang-dev, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/9663047
2013-08-29 10:16:09 +02:00
Rémy Oudompheng
a9e119ac70 cmd/gc: fix method values whose receiver is an unnamed interface.
Fixes #6140.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/13083043
2013-08-29 10:00:58 +02:00
Rob Pike
65f21ca2c6 cmd/go: make it work for code.google.com cloned repositories
Thanks to beatgammit for the fix.

Fixes #5408.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13261048
2013-08-29 17:15:35 +10:00
Robert Daniel Kortschak
b3fd434ae0 net: make channel-based semaphore depend on receive, not send
R=r, dvyukov
CC=golang-dev
https://golang.org/cl/13348045
2013-08-29 17:14:57 +10:00
Andrew Gerrand
27f4166e37 undo CL 13180043 / 318540e7857f
Accidentally submitted.

««« original CL description
encoding/json: add "overflow" struct tag option

Fixes #6213.

R=golang-dev, dsymonds, bradfitz
CC=golang-dev
https://golang.org/cl/13180043
»»»

R=golang-dev
CC=golang-dev
https://golang.org/cl/13234045
2013-08-29 14:45:59 +10:00
Andrew Gerrand
10e2ffdf2c os/exec: return idempotent Closer from StdinPipe
Before this fix, it was always an error to use the Close method on the
io.WriteCloser obtained from Cmd.StdinPipe, as it would race with the
Close performed by Cmd.Wait.

Fixes #6270.

R=golang-dev, r, remyoudompheng, bradfitz, dsymonds
CC=golang-dev
https://golang.org/cl/13329043
2013-08-29 14:41:44 +10:00
Andrew Gerrand
466001d05d encoding/json: add "overflow" struct tag option
Fixes #6213.

R=golang-dev, dsymonds, bradfitz
CC=golang-dev
https://golang.org/cl/13180043
2013-08-29 14:39:55 +10:00
Dave Cheney
9169372749 sort: use a very fast random generator for benchmarks
Adapted from https://golang.org/cl/11564044.

Fixes breakage of darwin-amd64-race builder.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13352045
2013-08-29 13:21:21 +10:00
Rob Pike
7c7d22ac5f runtime: re-enable TestParForParallel
See how it flies. We'll disable it again if the underlying issue is not resolved.
See issue 4155 for details.

Fixes #4155.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13368045
2013-08-29 11:42:18 +10:00
Mikio Hara
e4bb139e75 net: make protocol-specific Dial and Listen return consistent error value
Update #4856

R=golang-dev, bradfitz, dave
CC=golang-dev
https://golang.org/cl/12916046
2013-08-28 19:51:02 +09:00
Mikio Hara
a8b4a1e63a net: BUG section for ReadFrom, ReadFromIP methods of IPConn on "ip4" network
Fixes #3944.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13263043
2013-08-28 19:49:17 +09:00
Rob Pike
d595b67a12 cmd/go: add -race flag to 'go list'
Causes the package dependencies to include those for race detection.
Fixes #5653.

R=golang-dev, dave, bradfitz
CC=golang-dev
https://golang.org/cl/13236045
2013-08-29 11:16:53 +10:00
Robin Eklind
cfb02f7b74 fmt: Remove some unnecessary conversions.
R=golang-dev, remyoudompheng
CC=golang-dev
https://golang.org/cl/12795052
2013-08-28 11:55:39 -07:00
Brad Fitzpatrick
8159b6901f time: add more docs on Sleep
Merge the comment from runtime/time.goc ("at least")
and also note that negative is okay and won't crash.
I see people going out of their way to avoid passing
a negative value to Sleep.

R=golang-dev, adg, r, alex.brainman
CC=golang-dev
https://golang.org/cl/13271045
2013-08-28 11:16:55 -07:00
Rob Pike
37cee77ac6 text/template: allow {{else if ... }} to simplify if chains
The method is simple: the parser just parses

        {{if A}}a{{else if B}}b{{end}}

to the same tree that would be produced by

        {{if A}}a{{else}}{{if B}}b{{end}}{{end}}

Thus no changes are required in text/template itself
or in html/template, only in text/template/parse.

Fixes #6085

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/13327043
2013-08-28 14:43:56 +10:00
Josh Bleecher Snyder
cbea724378 sync: improve once.Do documentation readability
The previous wording, though accurate, was hard to parse.
In particular, it was tempting to interpret "the method"
as referring to "the function f" instead of "Do", and
required effort to find the correct antecedent for
"this receiver".

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/13307043
2013-08-28 12:53:59 +10:00
Brad Fitzpatrick
2ede818ae0 net/http: document Request.Body more
Fixes #6221

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13289043
2013-08-27 16:13:21 -07:00
Brad Fitzpatrick
c7c1a1bbaa net/smtp: clarify that SendMail's auth param is optional
It wasn't obvious that the Auth could be nil.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/13060048
2013-08-27 16:12:11 -07:00
Rémy Oudompheng
a85cfbd433 cmd/gc: tag builtin error, byte, rune to avoid exporting them.
Fixes #5910.
Fixes #6260.

R=golang-dev, daniel.morsing
CC=golang-dev
https://golang.org/cl/13257044
2013-08-27 21:18:32 +02:00
Rémy Oudompheng
4fc7ff497d cmd/5g: avoid clash between R13 and F3 registers.
Fixes #6247.

R=golang-dev, lucio.dere, bradfitz
CC=golang-dev
https://golang.org/cl/13216043
2013-08-27 21:09:16 +02:00
Caleb Spare
8b047893a0 go/ast: fix comment formatting
A bullet list was getting mangled in godoc.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13060047
2013-08-27 09:03:38 -07:00
Volker Dobler
2f81dfd53f sort: harden limit in stable test
Reduce the number of allowed swap operations during stable sort. 

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12907045
2013-08-27 08:41:43 -07:00
Volker Dobler
7c8be15b8a cmd/gc: mark panicslice as unlikely
No measurable impact on performance on amd64

R=golang-dev, khr, bradfitz
CC=golang-dev
https://golang.org/cl/13096045
2013-08-27 06:38:11 -07:00
Mathieu Lonjaret
d5c806d581 encoding/binary: use bytes.Reader in read example
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/13274043
2013-08-27 06:32:24 -07:00
Alex Brainman
11320fa500 net: have separate read and write processing threads on windows
Fixes #4195

R=golang-dev, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/12960046
2013-08-27 14:53:57 +10:00
Rob Pike
1f661fc205 text/template: make the escapers for HTML etc. handle pointers correctly
Apply the same rules for argument evaluation and indirection that are
used by the regular evaluator.

Fixes #5802

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/13257043
2013-08-27 13:29:07 +10:00
Mikio Hara
519a9e8e9b net: enable PacketConn test for raw IP network on Windows
Just forgot to include this in CL 12843043.
Also consolidates the code dealing with test environment.

Update #6122

R=alex.brainman
CC=golang-dev
https://golang.org/cl/13184043
2013-08-26 18:36:58 +09:00
Evan Shaw
f033d988b1 bytes, strings: use copy in Repeat
R=golang-dev, dave, bradfitz, adg
CC=golang-dev
https://golang.org/cl/13249043
2013-08-27 09:21:08 +10:00
Volker Dobler
f1d61b959f net/http: do not send leading dot in cookie domain attribute
RFC 6265 allows a leading dot in a cookie domain attribute
but is clear (see section 4.1.1) that a Set-Cookie header
should be sent without these dots.

R=bradfitz
CC=golang-dev
https://golang.org/cl/13111043
2013-08-26 07:41:37 -05:00
Mikio Hara
9a7947288b syscall: update routing socket parser for NetBSD 6 and beyond
NetBSD 6 kernel and beyond require 64-bit aligned access to routing
facilities.

Fixes #6226.

R=golang-dev, bsiegert, bradfitz
CC=golang-dev
https://golang.org/cl/13170043
2013-08-25 08:44:31 +09:00
Brad Fitzpatrick
9ec0f30a25 bytes: clarify Equal docs
== isn't defined on slices, so don't use it in docs.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/12983045
2013-08-24 17:05:27 -05:00
Brad Fitzpatrick
e7b125fc65 cmd/api: be more robust against OS deleting temp files
OS X in particular deletes tmp files (but not directories)
pretty reliably.

Ask hg whether the go.tools directory in tmp is good before
using it.

Fixes issue Rob and others were reporting, which I just hit
myself now.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13084049
2013-08-24 16:54:56 -05:00
Brad Fitzpatrick
cb79c57dfa cmd/api: ignore GOARCH when building cmd/api.
This was breaking people setting GOARCH=386 before running
all.bash on amd64 machines.

cmd/go puts different architecture binaries where "go tool"
can't find them.

R=golang-dev, r, khr
CC=golang-dev
https://golang.org/cl/13139044
2013-08-24 09:51:42 -05:00
Mikio Hara
33f3dffa7c net: allow TestDialFailPDLeak run in long-mode test
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/12917050
2013-08-24 22:05:14 +09:00
Nicolas Owens
de8de8912e os/user: Current support on Plan 9
Current for Plan 9 is implemented with /dev/user for
Uid/Gid/Username/Name, and $home environment variable for
HomeDir.

Implementing Lookup/LookupId is not done, which would
require parsing /adm/users. It is unclear of how much benefit
this would be.

R=golang-dev
CC=bradfitz, golang-dev, r
https://golang.org/cl/13203043
2013-08-23 21:05:49 -05:00
Rémy Oudompheng
534c67abc4 syscall: add Cloneflags to Linux SysProcAttr.
Also use clone(2) syscall instead of fork().

Fixes #6214.

R=golang-dev, bradfitz, dave
CC=golang-dev
https://golang.org/cl/13159044
2013-08-24 03:34:07 +02:00
Keith Randall
d0dd420a24 runtime: rename FlagNoPointers to FlagNoScan. Better represents
the use of the flag, especially for objects which actually do have
pointers but we don't want the GC to scan them.

R=golang-dev, cshapiro
CC=golang-dev
https://golang.org/cl/13181045
2013-08-23 17:28:47 -07:00
Keith Randall
b15a64e35d cmd/gc: Reset haspointers computation. When converting from a
slice type to an array type, the haspointer-ness may change.
Before this change, we'd sometimes get types like [1]int marked
as having pointers.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13189044
2013-08-23 17:28:15 -07:00
Carl Shapiro
221eef6808 os/exec: remove flaky TestExtraFilesFDShuffle test
Update #5780

R=golang-dev, cshapiro, dave, bradfitz
CC=golang-dev
https://golang.org/cl/12869049
2013-08-23 16:53:32 -07:00
Rémy Oudompheng
d4f719ee13 syscall: define CLONE_* constants on Linux.
Update #6214

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13160043
2013-08-23 22:26:49 +02:00
Joel Sing
4186e9d313 all: dragonfly support
Enable remaining packages (crypto, mime, path, time) to build on dragonfly.

R=bradfitz
CC=golang-dev
https://golang.org/cl/13190043
2013-08-24 02:22:52 +10:00
Joel Sing
fce0608561 net: dragonfly support
Make the net package build and work on dragonfly.

R=bradfitz
CC=golang-dev
https://golang.org/cl/13173044
2013-08-24 02:18:22 +10:00
Joel Sing
6939061d47 os: dragonfly support
Make the os package build and work on dragonfly.

R=bradfitz
CC=golang-dev
https://golang.org/cl/13183044
2013-08-24 02:15:50 +10:00
Joel Sing
f3442a80c3 syscall: dragonfly/amd64 z-files
Add generated z-files for dragonfly/amd64.

R=bradfitz
CC=golang-dev
https://golang.org/cl/13056045
2013-08-24 01:52:33 +10:00
Joel Sing
8f3f4c96a3 syscall: dragonfly/amd64 support
Add syscall support for dragonfly/amd64.

Also add support for generating syscall z* files for dragonfly.

R=bradfitz
CC=golang-dev
https://golang.org/cl/13188043
2013-08-24 01:51:25 +10:00
Joel Sing
ac00524beb runtime: add dragonfly/amd64 port
Go runtime support for dragonfly/amd64, largely based of the existing
FreeBSD runtime (with some clues from the varialus/godfly work).

R=bradfitz
CC=golang-dev
https://golang.org/cl/13088044
2013-08-24 01:50:24 +10:00
Joel Sing
e18ed3c111 cmd/5l,cmd/8l: unbreak arm and 386 linkers
Add dragonflydynld to 5l and 8l so that they compile again.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12739048
2013-08-24 01:32:01 +10:00
Joel Sing
71dc91db0f all: compiler/bootstrap for dragonfly/amd64
Add dragonfly/amd64 support to the Go compiler, bootstrap and GOOS list.

R=devon.odell, bradfitz
CC=golang-dev
https://golang.org/cl/12796050
2013-08-24 01:18:04 +10:00
Mikio Hara
180da80e90 net: fix dial to raw IP networks on Windows
Also avoids platform-dependent datagram truncation in raw IP tests.
At least it's different between Windows and others.

Fixes #6122.

R=alex.brainman
CC=golang-dev
https://golang.org/cl/12843043
2013-08-23 19:31:24 +09:00
Mikio Hara
910a6faa93 net: fix race in TestDNSThreadLimit
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13141045
2013-08-23 14:26:52 +09:00
Alex Brainman
ec9e3e62a1 net: wait longer before failing TestVariousDeadlines4Proc on windows
This is an attempt to make our slow
windows-386 builder more reliable.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/12798045
2013-08-23 15:07:42 +10:00
Mikio Hara
6383896fee net: update doc on socket
Also makes variable names a bit cleaner.

R=golang-dev, dave, r
CC=golang-dev
https://golang.org/cl/12808047
2013-08-23 13:13:43 +09:00
Mikio Hara
d3043b7b4a net: add test for protocol numbers lookup using internal information base
Update #5344

R=alex.brainman
CC=golang-dev
https://golang.org/cl/12966046
2013-08-22 12:13:54 +09:00
Alex Brainman
e541c861a3 net: fix misspelled variable name (fixes windows build)
R=golang-dev, adg
CC=golang-dev, mikioh.mikioh
https://golang.org/cl/12848047
2013-08-22 12:34:05 +10:00
Mikio Hara
fd58320f32 net: add minimal internet protocol number information base
This CL adds minimal information for supporting platforms that don't
have a complete list of internet protocol numbers.

Fixes #5344.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12898045
2013-08-22 10:33:37 +09:00
Mikio Hara
3b961bf88b net: remove redundant argument check from Dial on udp, unix networks
The net package consists of thin three layers like the follwoing;

- Exposed API, that contains net.Dial, net.DialUDP, net.DialUnix
- Socket and network file descriptor, that contains net.netFD and
  its methods, helper functions such as dialUDP, dialUnix
- Network pollster, that contains net.pollDesc and its methods

This CL removes redundant argument check which is already done by
API layer.

R=golang-dev, dave, bradfitz
CC=golang-dev
https://golang.org/cl/13092043
2013-08-22 10:33:06 +09:00
Rémy Oudompheng
4a7a72b8c1 syscall: fix stale URL for linux/arm unistd.h
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13105047
2013-08-22 00:59:48 +02:00
Dmitriy Vyukov
dfdd1ba028 runtime: do not trigger GC on g0
GC acquires worldsema, which is a goroutine-level semaphore
which parks goroutines. g0 can not be parked.
Fixes #6193.

R=khr, khr
CC=golang-dev
https://golang.org/cl/12880045
2013-08-22 02:17:45 +04:00
Carl Shapiro
87fdb8fb9a undo CL 13010045 / 04f8101b46dd
Update the original change but do not read interface types in
the arguments area.  Once the arguments area is zeroed as the
locals area is we can safely read interface type values there
too.

««« original CL description
undo CL 12785045 / 71ce80dc4195

This has broken the 32-bit builds.

««« original CL description
cmd/gc, runtime: use type information to scan interface values

R=golang-dev, rsc, dvyukov
CC=golang-dev
https://golang.org/cl/12785045
»»»

R=khr, golang-dev, khr
CC=golang-dev
https://golang.org/cl/13010045
»»»

R=khr, khr
CC=golang-dev
https://golang.org/cl/13073045
2013-08-21 13:51:00 -07:00
Sokolov Yura
fcf6a7e5ce time: make timers heap 4-ary
This slightly improves performance when a lot of timers are present

$ misc/benchcmp ../old_timers_m.txt ../new_timers_m.txt
benchmark                           old ns/op    new ns/op    delta
BenchmarkAfterFunc                       6884         6605   -4.05%
BenchmarkAfterFunc-2                     4473         4144   -7.36%
BenchmarkAfterFunc-3                     8601         6185  -28.09%
BenchmarkAfterFunc-4                     9378         8773   -6.45%
BenchmarkAfter                           7237         7278   +0.57%
BenchmarkAfter-2                         4638         3923  -15.42%
BenchmarkAfter-3                         8751         6239  -28.71%
BenchmarkAfter-4                         9223         8737   -5.27%
BenchmarkStop                             603          496  -17.74%
BenchmarkStop-2                           795          577  -27.42%
BenchmarkStop-3                           982          680  -30.75%
BenchmarkStop-4                          1164          739  -36.51%
BenchmarkSimultaneousAfterFunc            657          593   -9.74%
BenchmarkSimultaneousAfterFunc-2          816          757   -7.23%
BenchmarkSimultaneousAfterFunc-3          844          830   -1.66%
BenchmarkSimultaneousAfterFunc-4          785          771   -1.78%
BenchmarkStartStop                        238          239   +0.42%
BenchmarkStartStop-2                      249          234   -6.02%
BenchmarkStartStop-3                      271          268   -1.11%
BenchmarkStartStop-4                      293          295   +0.68%

R=golang-dev, dvyukov, bradfitz, r
CC=golang-dev
https://golang.org/cl/13094043
2013-08-21 18:51:37 +04:00
Dmitriy Vyukov
2f2d4c6bc3 net: ensure that Read/Write on all platforms do 0 mallocs
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12780045
2013-08-21 14:21:02 +04:00
Dmitriy Vyukov
06e686def6 cmd/5g, cmd/6g, cmd/8g: faster compilation
Replace linked list walk with memset.
This reduces CPU time taken by 'go install -a std' by ~10%.
Before:
real		user		sys
0m23.561s	0m16.625s	0m5.848s
0m23.766s	0m16.624s	0m5.846s
0m23.742s	0m16.621s	0m5.868s
after:
0m22.714s	0m14.858s	0m6.138s
0m22.644s	0m14.875s	0m6.120s
0m22.604s	0m14.854s	0m6.081s

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13084043
2013-08-21 14:20:28 +04:00
Todd Wang
0e73497a4b reflect: Fix Convert to add indir bit when the value is actually a
pointer.  An example that triggers the bad behavior on a 64bit
machine http://play.golang.org/p/GrNFakAYLN
        rv1 := reflect.ValueOf(complex128(0))
        rt := rv1.Type()
        rv2 := rv1.Convert(rt)
        rv3 := reflect.New(rt).Elem()
        rv3.Set(rv2)

Running the code fails with the following:
        panic: reflect: internal error: storeIword of 16-byte value

I've tested on a 64bit machine and verified this fixes the panic.  I
haven't tested on a 32bit machine so I haven't verified the other
cases, but they follow logically.

R=golang-dev, r, iant
CC=golang-dev
https://golang.org/cl/12805045
2013-08-21 14:41:55 +10:00
Rob Pike
f578726de1 all: protect alloc count tests by -testing.short
Update #5000
Should reduce the flakiness a little. Malloc counting is important
to general testing but not to the build dashboard, which uses -short.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/12866047
2013-08-21 14:00:45 +10:00
Rob Pike
7bbe320679 text/template: implement comparison of basic types
Add eq, lt, etc. to allow one to do simple comparisons.
It's basic types only (booleans, integers, unsigned integers,
floats, complex, string) because that's easy, easy to define,
and covers the great majority of useful cases, while leaving
open the possibility of a more sweeping definition later.

{{if eq .X .Y}}X and Y are equal{{else}}X and Y are unequal{{end}}

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/13091045
2013-08-21 11:27:27 +10:00
Rob Pike
9364868a07 archive/tar,zip: implement the os.FileInfo interface correctly.
This is potentially an API-breaking change, but it is an important bug fix.

The CL https://golang.org/cl/7305072/ added stuff to make
the tar file look more like a file system internally, including providing an
implementation of os.FileInfo for the file headers within the archive.
But the code is incorrect because FileInfo.Name is supposed to return
the base name only; this implementation returns the full path. A round
trip test added in the same shows this in action, as the slashes are
preserved as we create a header using the local implementation of
FileInfo.

The CL here changes the behavior of the tar (and zip) FileInfo to honor
the Go spec for that interface. It also clarifies that the FileInfoHeader
function, which takes a FileInfo as an argument, will therefore create
a header with only the base name of the file recorded, and that
subsequent adjustment may be necessary.

There may be code out there that depends on the broken behavior.
We can call out the risk in the release notes.

Fixes #6180.

R=golang-dev, dsymonds, adg, bradfitz
CC=golang-dev
https://golang.org/cl/13118043
2013-08-21 08:29:41 +10:00
Mikio Hara
ed738ad354 net: remove obsolete builtin network pollster
Update #5199
Update #6146

R=golang-dev, dvyukov
CC=golang-dev
https://golang.org/cl/13112044
2013-08-20 17:32:55 +09:00
Mikio Hara
9b65dac494 net: enable runtime-integrated network pollster on freebsd/arm
Fixes #6146.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12927048
2013-08-20 17:02:42 +09:00
Mikio Hara
e82614e5be runtime: integrated network pollster for freebsd/arm
Update #6146

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12927047
2013-08-20 16:57:30 +09:00
Brad Fitzpatrick
33d531dfa4 net/http: support WriteString on the ResponseWriter
Fixes #5377

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12991046
2013-08-19 22:56:54 -07:00
Rob Pike
94b42fb14a os: fix windows build
The os windows source uses file as the receiver, not f.
TBR=golang-dev@googlegroups.com

R=adg
CC=golang-dev
https://golang.org/cl/12922044
2013-08-20 14:45:46 +10:00
Rob Pike
4cb086b838 os: be consistent about File methods with nil receivers
Some crashed, some didn't. Make a nil receiver always
return ErrInvalid rather than crash.
Fixes #5824.
The program in the bug listing is silent now, at least on my Mac.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/13108044
2013-08-20 14:33:03 +10:00
Carl Shapiro
ca2d32b46d undo CL 12785045 / 71ce80dc4195
This has broken the 32-bit builds.

««« original CL description
cmd/gc, runtime: use type information to scan interface values

R=golang-dev, rsc, dvyukov
CC=golang-dev
https://golang.org/cl/12785045
»»»

R=khr, golang-dev, khr
CC=golang-dev
https://golang.org/cl/13010045
2013-08-19 14:16:55 -07:00
Keith Randall
6401e0f83f runtime: don't run finalizers if we're still on the g0 stack.
R=golang-dev, rsc, dvyukov, khr
CC=golang-dev
https://golang.org/cl/11386044
2013-08-19 12:20:50 -07:00
Dmitriy Vyukov
88ee849a8a net: annotate Read/Write for race detector
Fixes #6167.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13052043
2013-08-19 23:09:24 +04:00
Dmitriy Vyukov
d017f578d0 runtime: do not preempt race calls
In the crash stack trace race cgocall() calls endcgo(),
this means that m->racecall is wrong.
Indeed this can happen is a goroutine is rescheduled to another M
during race call.
Disable preemption for race calls.
Fixes #6155.

R=golang-dev, rsc, cshapiro
CC=golang-dev
https://golang.org/cl/12866045
2013-08-19 23:06:46 +04:00
Carl Shapiro
21ea5103a4 cmd/gc, runtime: use type information to scan interface values
R=golang-dev, rsc, dvyukov
CC=golang-dev
https://golang.org/cl/12785045
2013-08-19 10:19:59 -07:00
Andrew Gerrand
2f6e9a1e24 cmd/go: only try to clean executables for package main
Fixes #5665.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12807044
2013-08-19 16:22:33 +10:00
Rob Pike
c974b8b6ac cmd/go: diagnose import cycles better
Before this CL, the import stack was a) not printed and b) overwritten later
in the build, destroying the information about the cycle. This CL fixes both.

I made time depend on os (os already depends on time) and with this CL the error is:

/Users/r/go/src/pkg/fmt/print.go:10:2: import cycle not allowed
package code.google.com/p/XXX/YYY:
        imports fmt
        imports os
        imports time
        imports os

Doesn't give line numbers for the actual imports, as requested in the bug, but
I don't believe that's important.

Fixes #4292.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/13100043
2013-08-19 15:50:57 +10:00
David Symonds
a790388afb cmd/gc: regenerate y.tab.{c,h} with Bison 2.5.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12744048
2013-08-19 13:47:43 +10:00
Anthony Martin
f316a7ea87 cmd/gc: don't attempt to generate wrappers for blank interface methods
Fixes #5691.

R=golang-dev, bradfitz, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/10255047
2013-08-19 11:53:34 +10:00
Rob Pike
d00bd1d1f4 cmd/gc: better error messages for C-style if statements.
Given
        if (i == 0)
                x++
The old message was
        x.go:6: syntax error: unexpected semicolon or newline before {
Now we see
        x.go:6: syntax error: missing { after if clause

Fixes #5687

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/12822045
2013-08-19 11:49:59 +10:00
Rob Pike
bc6bb3efb4 math/big: fix nil bug in GobEncode
Update #5305.
This handles the case where the nil pointers are inside a slice.
A top-level nil pointer is harder, maybe fundamentally broken by gob's model.
Thinking required.
However, a slice is the important case since people don't expect to be sending
top-level nils much, but they can arise easily in slices.

R=golang-dev, josharian, adg
CC=golang-dev
https://golang.org/cl/13042044
2013-08-19 11:22:09 +10:00
Rob Pike
e8140bd03c make.bash: exit if dist fails
The shell's -e doesn't work across "eval"; need to error-check by hand.
The recent spate of Darwin build failures pointed out that if the first
run of cmd/dist fails, we keep going. We shouldn't.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/13098043
2013-08-19 11:18:43 +10:00
David Symonds
24f302a69d cmd/dist: join with TMPDIR more carefully to avoid // in path.
This might fix the mkdtemp problem on the darwin builders if they
have TMPDIR set to a path ending in a slash; at worse this will
result in cleaner path names.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13097043
2013-08-19 11:11:27 +10:00
Marco Hennings
a07c95a53c archive/tar: Fix support for long links and improve PAX support.
The tar/archive code from golang has a problem with linknames with length >
100. A pax header is added but the original header still written with a too
long field length.

As it is clear that pax support is incomplete I have added missing
implementation parts.

This commit contains code from the golang project in the folder tar/archiv.

The following pax header records are now automatically written:

- gname)
- linkpath
- path
- uname

The following fields can be written with PAX, but the default is to use the
star binary extension.

- gid  (value > 2097151)
- size (value > 8589934591)
- uid (value > 2097151)

The string fields are written when the value is longer as the field or if the
string contains a char that is not encodable as 7-bit ASCII value.

The change was tested against a current ubuntu-cloud image tarball comparing
the compressed result.

+ added some automated tests for the new functionality.

Fixes #6056.

R=dsymonds
CC=golang-dev
https://golang.org/cl/12561043
2013-08-19 10:45:44 +10:00
Rob Pike
6fb9cc1f63 testing: don't start timing a Parallel test until it's actually starting
Fixes #5285.

R=golang-dev, dvyukov
CC=golang-dev
https://golang.org/cl/13045044
2013-08-19 10:15:30 +10:00
Dominik Honnef
43a39bfd7f encoding/xml: flush buffer after encoding token
R=rsc, bradfitz, adg
CC=golang-dev
https://golang.org/cl/13004046
2013-08-19 10:14:10 +10:00
Rob Pike
7fb121aa47 cmd/dist: more informative error for mkdtemp failing
The Darwin builders are all failing here but strerror doesn't provide context.

R=golang-dev, bradfitz, adg
CC=golang-dev
https://golang.org/cl/13095043
2013-08-19 08:29:43 +10:00
Mikio Hara
7917b88a06 net: make protocol-specific WriteTo, WriteMsg methods return error instead of crash
R=golang-dev, dave, rsc, adg, bradfitz
CC=golang-dev
https://golang.org/cl/11809043
2013-08-18 19:19:36 +09:00
Emil Hessman
df7b93c175 net/textproto: use ReadDotBytes instead of non-existent ReadDotAll.
Fixes #5893.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13086043
2013-08-18 08:11:34 +10:00
Emil Hessman
20eb4cba37 net/textproto: replace '3-digit' with 'three-digit'
A matter on form in documentation.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13087043
2013-08-18 08:10:00 +10:00
Mikio Hara
ca01ab39ef net: fix garbage connection close in dual stack tests
This may possibly be the root cause of flaky dual stack tests.

Update #4176
Update #5001

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13050043
2013-08-17 13:40:55 +09:00
Mikio Hara
96d7997f03 net: enable runtime-integrated network pollster on netbsd
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13080043
2013-08-17 13:40:14 +09:00
Mikio Hara
c4cdd35e6e runtime: integrated network pollster for netbsd/amd64,386,arm
Original CL by minux (9545044).

Update #6146

R=golang-dev, rsc
CC=golang-dev, minux.ma
https://golang.org/cl/12949045
2013-08-17 12:11:29 +09:00
Russ Cox
1d3efd6533 net: limit number of concurrent cgo calls
The limit is 500. There is no way to change it.
This primarily affects name resolution.
If a million goroutines try to resolve DNS names,
only 500 will get to execute cgo calls at a time.
But in return the operating system will not crash.

Fixes #5625.

R=golang-dev, dan.kortschak, r, dvyukov
CC=bradfitz, golang-dev
https://golang.org/cl/13038043
2013-08-16 22:43:05 -04:00
Russ Cox
665feeedcb runtime: impose thread count limit
Actually working to stay within the limit could cause subtle deadlocks.
Crashing avoids the subtlety.

Fixes #4056.

R=golang-dev, r, dvyukov
CC=golang-dev
https://golang.org/cl/13037043
2013-08-16 22:25:26 -04:00
Russ Cox
3b4d792606 cmd/gc: separate "has pointers" from "needs zeroing" in stack frame
When the new call site-specific frame bitmaps are available,
we can cut the zeroing to just those values that need it due
to scope escaping.

R=cshapiro, cshapiro
CC=golang-dev
https://golang.org/cl/13045043
2013-08-16 21:45:59 -04:00
Dmitriy Vyukov
18f5ce8561 runtime/race: add output tests for different GORACE params
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13065043
2013-08-16 21:54:04 +04:00
Dmitriy Vyukov
187b9c695f runtime: fix goroutine stack accounting
Fixes #6166.
Fixes #6168.

R=golang-dev, bradfitz, remyoudompheng
CC=golang-dev
https://golang.org/cl/12927045
2013-08-16 21:04:05 +04:00
Dmitriy Vyukov
fbf5fd5f1e runtime/race: update runtime to rev 188542
Fixes #6107.
race: output goroutine 1 as main goroutine

Fixes #6130.
race: option to abort program on first detected error

R=golang-dev, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/12968044
2013-08-16 17:51:09 +04:00
Dmitriy Vyukov
727dd08cdf net: fix bug in fdMutex
Fixes #6165.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12984044
2013-08-16 16:02:55 +04:00
Carl Shapiro
d3b04f46b5 cmd/5g, cmd/6g, cmd/8g: update frame zeroing for new bitmap format
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12740046
2013-08-16 01:15:04 -04:00
Rob Pike
4c855f3830 time: fix time zones yet again.
This time we're going for 5!
http://goo.gl/3ETYH7

Fixes #3790
Yeah, right.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/13002044
2013-08-16 14:57:49 +10:00
David Symonds
ea6cfc57b3 undo CL 12822043 / 96fefaa02ae3
Fixes #6160.

««« original CL description
go/doc: permit a package synopsis to end with ":\n".

R=gri, r
CC=golang-dev
https://golang.org/cl/12822043
»»»

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13040043
2013-08-16 14:36:06 +10:00
Rob Pike
f0fef32383 cmd/go: fix at least some instances of double compilation
When the packages the tested package depends on don't build,
we weren't getting out early. Added a simple check for a successful
build to an existing early out.

There may be other ways that double compilation arises, but
this fixes the one listed in the issue.
Fixes #5679

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/13036043
2013-08-16 12:49:51 +10:00
Rob Pike
703b897f78 cmd/gc: remove mentions of "ideal" from error messages.
_ = complex("foo", 0)
        _ = complex(true, 0)
now trigger:
        x.go:4: invalid operation: complex("foo", 0) (mismatched types untyped string and untyped number)
        x.go:5: invalid operation: complex(true, 0) (mismatched types untyped bool and untyped number)

Fixes #4521

R=golang-dev, remyoudompheng, rsc
CC=golang-dev
https://golang.org/cl/12973043
2013-08-16 12:40:02 +10:00
Russ Cox
757e0de89f runtime: impose stack size limit
The goal is to stop only those programs that would keep
going and run the machine out of memory, but before they do that.
1 GB on 64-bit, 250 MB on 32-bit.
That seems implausibly large, and it can be adjusted.

Fixes #2556.
Fixes #4494.
Fixes #5173.

R=khr, r, dvyukov
CC=golang-dev
https://golang.org/cl/12541052
2013-08-15 22:34:06 -04:00
Dimitri Tcaciuc
205329aaf2 image: Inline example image data to make it runnable on playground.
Use more compressed image to reduce source clutter.

Fixes #5983.

R=nigeltao, adg
CC=golang-dev
https://golang.org/cl/12513044
2013-08-16 11:43:43 +10:00
Nigel Tao
bc21265074 database/sql: make Rows.Next returning false always implicitly call
Rows.Close.

Previously, callers that followed the example code (but not call
rows.Close after "for rows.Next() { ... }") could leak statements if
the driver returned an error other than io.EOF.

R=bradfitz, alex.brainman
CC=golang-dev, rsc
https://golang.org/cl/12677050
2013-08-16 11:23:35 +10:00
Russ Cox
b75a08d03c cmd/gc: ensure addable in checknil (fix race build)
TBR=dvyukov
CC=golang-dev
https://golang.org/cl/12791044
2013-08-15 21:05:05 -04:00
Brad Fitzpatrick
67a69bce6b net/http: don't send an automatic Content-Length on a 304 Not Modified
Also start of some test helper unification, long overdue.
I refrained from cleaning up the rest in this CL.

Fixes #6157

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/13030043
2013-08-15 17:40:05 -07:00
Rob Pike
71eae5a46a cmd/go: delete 'go doc'
It's next to useless and confusing as well. Let's make godoc better instead.

Fixes #4849.

R=golang-dev, dsymonds, adg, rogpeppe, rsc
CC=golang-dev
https://golang.org/cl/12974043
2013-08-16 10:30:05 +10:00
Brad Fitzpatrick
95e0a8c277 net/http: unify the confusingly-named serve_test and server_test
One was tiny. One was gigantic. Now one is gone and one is giganticer.

No code changes.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/13025043
2013-08-15 16:47:31 -07:00
Russ Cox
999a36f9af cmd/gc: &x panics if x does
See golang.org/s/go12nil.

This CL is about getting all the right checks inserted.
A followup CL will add an optimization pass to
remove redundant checks.

R=ken2
CC=golang-dev
https://golang.org/cl/12970043
2013-08-15 14:38:32 -04:00
Russ Cox
08fdf00906 tests: remove two misuses of nil pointers
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12858044
2013-08-15 11:51:04 -04:00
Mikio Hara
ff86d222be runtime: fix wrong syscall numbers on freebsd/386, openbsd/386
R=golang-dev, jsing
CC=golang-dev
https://golang.org/cl/12876044
2013-08-15 23:22:55 +09:00
Mikio Hara
cb3b292201 net: enable runtime-integrated network pollster on freebsd, openbsd
Fixes #5199.

Benchmark results on freebsd/amd64 (virtual machine):

benchmark                             old ns/op    new ns/op    delta
BenchmarkTCP4OneShot-2                   184566       187164   +1.41%
BenchmarkTCP4OneShotTimeout-2            215558       187722  -12.91%
BenchmarkTCP4Persistent-2                 59686        41294  -30.81%
BenchmarkTCP4PersistentTimeout-2          60692        39974  -34.14%
BenchmarkTCP6OneShot-2                   226595       223688   -1.28%
BenchmarkTCP6OneShotTimeout-2            253144       225161  -11.05%
BenchmarkTCP6Persistent-2                 69157        55605  -19.60%
BenchmarkTCP6PersistentTimeout-2          70426        53805  -23.60%
BenchmarkTCP4ConcurrentReadWrite-2        53878        56087   +4.10%
BenchmarkTCP6ConcurrentReadWrite-2        66538        68190   +2.48%

benchmark                            old allocs   new allocs    delta
BenchmarkTCP4OneShot-2                       39           36   -7.69%
BenchmarkTCP4OneShotTimeout-2                42           36  -14.29%
BenchmarkTCP4Persistent-2                     1            0  -100.00%
BenchmarkTCP4PersistentTimeout-2              1            0  -100.00%
BenchmarkTCP6OneShot-2                       41           36  -12.20%
BenchmarkTCP6OneShotTimeout-2                43           36  -16.28%
BenchmarkTCP6Persistent-2                     1            0  -100.00%
BenchmarkTCP6PersistentTimeout-2              1            0  -100.00%
BenchmarkTCP4ConcurrentReadWrite-2            0            0     n/a%
BenchmarkTCP6ConcurrentReadWrite-2            0            0     n/a%

benchmark                             old bytes    new bytes    delta
BenchmarkTCP4OneShot-2                     3084         2544  -17.51%
BenchmarkTCP4OneShotTimeout-2              3129         2519  -19.50%
BenchmarkTCP4Persistent-2                    30            0  -100.00%
BenchmarkTCP4PersistentTimeout-2             31            0  -100.00%
BenchmarkTCP6OneShot-2                     3297         2660  -19.32%
BenchmarkTCP6OneShotTimeout-2              3306         2655  -19.69%
BenchmarkTCP6Persistent-2                    31            0  -100.00%
BenchmarkTCP6PersistentTimeout-2             29            0  -100.00%
BenchmarkTCP4ConcurrentReadWrite-2            2            0  -100.00%
BenchmarkTCP6ConcurrentReadWrite-2            7            0  -100.00%

R=dvyukov, minux.ma, dave, bradfitz, alex.brainman
CC=golang-dev
https://golang.org/cl/8264043
2013-08-15 21:10:03 +09:00
Dmitriy Vyukov
f195ae94ca runtime: remove old preemption checks
runtime.gcwaiting checks are not needed anymore

R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/12934043
2013-08-15 14:32:10 +04:00
Dmitriy Vyukov
67c79da857 runtime: fix plan9 build
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12986043
2013-08-15 14:24:28 +04:00
Mikio Hara
5d5defc77f net: rearrange the call order of runtime-integrated network pollster and syscall functions
This CL rearranges the call order for raw networking primitives like
the following;

- For dialers that open active connections, pollDesc.Init will be
  called before syscall.Connect.

- For stream listeners that open passive stream connections,
  pollDesc.Init will be called just after syscall.Listen.

- For datagram listeners that open datagram connections,
  pollDesc.Init will be called just after syscall.Bind.

This is in preparation for runtime-integrated network pollster for BSD
variants.

Update #5199

R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/12730043
2013-08-15 16:40:33 +09:00
Rob Pike
a454d2fd2e time: expand acceptance of time zones when parsing
I tried to make it absolutely correct but there are too many
conflicting definitions for the official list of time zones.
Since when we're parsing we know when to expect
a time zone and we know what they look like if not exactly
what the definitive set is, we compromise. We accept any
three-character sequence of upper case letters, possibly
followed by a capital T (all four-letter zones end in T).

There is one crazy special case (ChST) and the possibility
of a signed hour offset for GMT.

Fixes #3790
I hope forever, but I doubt that very much.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/12969043
2013-08-15 16:42:54 +10:00
Brad Fitzpatrick
ec837ad73c archive/zip: speed up Zip64 test
Took 76 seconds or so before. By avoiding flate and crc32 on
4GB of data, it's now only 12 seconds.  Still a slow test, but
not painful to run anymore when you forget -short.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/12950043
2013-08-14 23:21:57 -07:00
Brad Fitzpatrick
35d8bb39bd testing: add TB, an interface common to T and B
R=golang-dev, kevlar, rsc, adg, r
CC=golang-dev
https://golang.org/cl/12962043
2013-08-14 23:21:32 -07:00
Rob Pike
a41a5bb207 os/exec: document that LookPath's result may be a relative path
Fixes #3622

R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/12971043
2013-08-15 14:29:04 +10:00
Alex Brainman
c7a64cce65 runtime/race: add end-to-end test on windows
whatever "end-to-end" means here

R=golang-dev, dvyukov
CC=golang-dev
https://golang.org/cl/12898044
2013-08-15 12:13:00 +10:00
Rob Pike
f718036217 cmd/go: fix bad error message in coverage for package without non-test files
Was checking for nil map; must check for empty map instead.

Fixes #6065

Before:

go test -cover
# testmain
/var/folders/00/013l0000h01000cxqpysvccm0004fc/T/go-build233480051/_/Users/r/issue/_test/_testmain.go:11: imported and not used: "_/Users/r/issue"
FAIL	_/Users/r/issue [build failed]

Now:

go test -cover
testing: warning: no tests to run
PASS
coverage: 0.0% of statements
ok  	_/Users/r/issue	0.021s

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12916043
2013-08-15 10:36:46 +10:00
Rob Pike
727b2b6f7d time: handle GMT possibly with offset
Update #3790
Handle time zones like GMT-8.
The more general time zone-matching problem is not yet resolved.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12922043
2013-08-15 10:10:49 +10:00
David Symonds
80ca8c5d04 cmd/go: fix detached heads that are remnants of bad git clones.
Fixes #6042.

R=adg
CC=golang-dev
https://golang.org/cl/12923043
2013-08-15 09:44:23 +10:00
Russ Cox
904e113615 encoding/xml: support generic encoding interfaces
Remove custom support for time.Time.
No new tests: the tests for the time.Time special case
now test the general case.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12751045
2013-08-14 18:52:09 -04:00
Carl Shapiro
3ec0427a07 cmd/go, runtime/cgo: explicitly target ARMv5T
The baseline architecture had been left to the GCC configured
default which can be more accomodating than the rest of the Go
toolchain.  This prevented instructions used by the 5g compiler,
like BLX, from being used in GCC compiled assembler code.

R=golang-dev, dave, rsc, elias.naur, cshapiro
CC=golang-dev
https://golang.org/cl/12954043
2013-08-14 15:21:53 -07:00
Mikio Hara
88411547d4 net: simplify dial
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12884044
2013-08-15 05:53:53 +09:00
Elias Naur
3b4da67ee3 cmd/ld: Remove superfluous redundant iself check
CL 12741044 added an extra iself condition to an if statement that already contained it. Remove it.

R=rsc
CC=golang-dev
https://golang.org/cl/12949043
2013-08-14 16:28:40 -04:00
Dmitriy Vyukov
3bd0b0a80d runtime: fix SetBlockProfileRate
It doughtily misses all possible corner cases.
In particular on machines with <1GHz processors,
SetBlockProfileRate(1) disables profiling.
Fixes #6114.

R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/12936043
2013-08-15 00:20:36 +04:00
Mikio Hara
2eb7c6ec8a net: simplify non-cgo DNS exchange
Also does less buffer allocation in case of TCP fallback.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12925043
2013-08-15 05:08:08 +09:00
Mikio Hara
3a93626b49 net: fix TestTCPLookup
R=golang-dev, dvyukov, dave
CC=golang-dev
https://golang.org/cl/12766044
2013-08-15 05:07:35 +09:00
Rémy Oudompheng
0d9db86f74 cmd/5g, cmd/6g, cmd/8g: restore occurrences of R replaced by nil in comments.
R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/12842043
2013-08-14 21:24:48 +02:00
Russ Cox
54bdfc007f encoding/xml: add, support Marshaler interface
See golang.org/s/go12xml for design.

Repeat of CL 12603044, which was submitted accidentally
and then rolled back.

Fixes #2771.
Fixes #4169.
Fixes #5975.
Fixes #6125.

R=golang-dev
CC=golang-dev
https://golang.org/cl/12919043
2013-08-14 14:58:28 -04:00
Russ Cox
84b0842a59 encoding/xml: add, support Unmarshaler interface
See golang.org/s/go12xml for design.

R=golang-dev, dominik.honnef, dan.kortschak
CC=golang-dev
https://golang.org/cl/12556043
2013-08-14 14:57:45 -04:00
Russ Cox
7e886740d1 encoding/json: support encoding.TextMarshaler, encoding.TextUnmarshaler
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12703043
2013-08-14 14:56:07 -04:00
Russ Cox
5822e7848a runtime: make SetFinalizer(x, f) accept any f for which f(x) is valid
Originally the requirement was f(x) where f's argument is
exactly x's type.

CL 11858043 relaxed the requirement in a non-standard
way: f's argument must be exactly x's type or interface{}.

If we're going to relax the requirement, it should be done
in a way consistent with the rest of Go. This CL allows f's
argument to have any type for which x is assignable;
that's the same requirement the compiler would impose
if compiling f(x) directly.

Fixes #5368.

R=dvyukov, bradfitz, pieter
CC=golang-dev
https://golang.org/cl/12895043
2013-08-14 14:54:31 -04:00
Russ Cox
2560f8fe22 runtime/cgo: use old-style indirect call on arm
TBR=elias.naur
CC=golang-dev
https://golang.org/cl/12943043
2013-08-14 14:54:08 -04:00
Dmitriy Vyukov
dd50dac56c runtime: fix windows build
R=golang-dev
CC=golang-dev
https://golang.org/cl/12941043
2013-08-14 22:18:49 +04:00
Dmitriy Vyukov
4e76abbc60 runtime: implement SysUnused on windows
Fixes #5584.

R=golang-dev, chaishushan, alex.brainman
CC=golang-dev
https://golang.org/cl/12720043
2013-08-14 21:54:07 +04:00
Dmitriy Vyukov
f8ca13c3e5 net: make TCPStress test shorter
It timeouts on freebsd builders:
http://build.golang.org/log/3d8169e13bff912bebf6fd3c54b34ad2d29a7221
but there are always runnable goroutines,
which suggests that it's slowly progressing.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12939043
2013-08-14 21:53:27 +04:00
Elias Naur
dc48e9516c runtime: Fix build on older ARM
The ARM external linking CL used BLX instructions in gcc assembler. Replace with BL to retain support on older ARM processors.

R=rsc
CC=golang-dev
https://golang.org/cl/12938043
2013-08-14 13:50:12 -04:00
Dmitriy Vyukov
9bbf1e1b72 net: make TestDeadlineRace shorter
1. Do less iterations in short mode
2. Bound number of times SetDeadline is executed

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12937043
2013-08-14 21:20:11 +04:00
Elias Naur
48c0d8b6e2 runtime: Fix netbsd/arm and freebsd/arm build
The ARM external linking CL left missed changes to sys_freebsd_arm.s and sys_netbsd_arm.s already done to sys_linux_arm.s.

R=rsc
CC=golang-dev
https://golang.org/cl/12842044
2013-08-14 13:18:32 -04:00
Russ Cox
308a3e6c52 cmd/dist: fix darwin build
The TLS block on Darwin is not the same as on ELF.

TBR=elias.naur
CC=golang-dev
https://golang.org/cl/12741044
2013-08-14 12:57:05 -04:00
Elias Naur
a5f257a042 cmd/cgo: fix windows build
The shared library changes broke the windows build because __attribute__ ((visibility ("hidden"))) is not supported in windows gcc. This change removes the attribute, as it is only needed when building shared libraries.

R=rsc
CC=golang-dev
https://golang.org/cl/12829044
2013-08-14 12:47:06 -04:00
Matt Joiner
13c7896fb6 database/sql: fix accumulation of bad conns on prepared statements
Fixes an issue where prepared statements that outlive many
connections become expensive to invoke.

Fixes #6081

R=golang-dev
CC=bradfitz, golang-dev
https://golang.org/cl/12646044
2013-08-14 09:27:30 -07:00
Elias Naur
45233734e2 runtime.cmd/ld: Add ARM external linking and implement -shared in terms of external linking
This CL is an aggregate of 10271047, 10499043, 9733044. Descriptions of each follow:

10499043
runtime,cmd/ld: Merge TLS symbols and teach 5l about ARM TLS

This CL prepares for external linking support to ARM.

The pseudo-symbols runtime.g and runtime.m are merged into a single
runtime.tlsgm symbol. When external linking, the offset of a thread local
variable is stored at a memory location instead of being embedded into a offset
of a ldr instruction. With a single runtime.tlsgm symbol for both g and m, only
one such offset is needed.

The larger part of this CL moves TLS code from gcc compiled to internally
compiled. The TLS code now uses the modern MRC instruction, and 5l is taught
about TLS fallbacks in case the instruction is not available or appropriate.

10271047
This CL adds support for -linkmode external to 5l.

For 5l itself, use addrel to allow for D_CALL relocations to be handled by the
host linker. Of the cases listed in rsc's comment in issue 4069, only case 5 and
63 needed an update. One of the TODO: addrel cases was since replaced, and the
rest of the cases are either covered by indirection through addpool (cases with
LTO or LFROM flags) or stubs (case 74). The addpool cases are covered because
addpool emits AWORD instructions, which in turn are handled by case 11.

In the runtime, change the argv argument in the rt0* functions slightly to be a
pointer to the argv list, instead of relying on a particular location of argv.

9733044
The -shared flag to 6l outputs a shared library, implemented in Go
and callable from non-Go programs such as C.

The main part of this CL change the thread local storage model.
Go uses the fastest and least general mode, local exec. TLS data in shared
libraries normally requires at least the local dynamic mode, however, this CL
instead opts for using the initial exec mode. Initial exec mode is faster than
local dynamic mode and can be used in linux since the linker has reserved a
limited amount of TLS space for performance sensitive TLS code.

Initial exec mode requires an extra load from the GOT table to determine the
TLS offset. This penalty will not be paid if ld is not in -shared mode, since
TLS accesses will be reduced to local exec.

The elf sections .init_array and .rela.init_array are added to register the Go
runtime entry with cgo at library load time.

The "hidden" attribute is added to Cgo functions called from Go, since Go
does not generate call through the GOT table, and adding non-GOT relocations for
a global function is not supported by gcc. Cgo symbols don't need to be global
and avoiding the GOT table is also faster.

The changes to 8l are only removes code relevant to the old -shared mode where
internal linking was used.

This CL only address the low level linker work. It can be submitted by itself,
but to be useful, the runtime changes in CL 9738047 is also needed.

Design discussion at
https://groups.google.com/forum/?fromgroups#!topic/golang-nuts/zmjXkGrEx6Q

Fixes #5590.

R=rsc
CC=golang-dev
https://golang.org/cl/12871044
2013-08-14 15:38:54 +00:00
Dmitriy Vyukov
c92287686d runtime: improve block profiler support for channels
1. Handle select statements.
2. Handle chan close.
3. Show top frame in debug mode (chansend/chanrecv/selectgo).
Fixes #6049.

R=golang-dev, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/12694050
2013-08-14 13:56:01 +04:00
Russ Cox
883530c019 sync/atomic: fix new swap on arm linux
TBR=dvyukov
CC=golang-dev
https://golang.org/cl/12920043
2013-08-14 00:50:47 -04:00
Russ Cox
72636eb506 cmd/5g: fix temp-merging on ARM
mkvar was taking care of the "LeftAddr" case,
effectively hiding it from the temp-merging optimization.

Move it into prog.c.

R=ken2
CC=golang-dev
https://golang.org/cl/12884045
2013-08-14 00:34:18 -04:00
Russ Cox
071e44e4e4 time: make Time implement encoding interfaces
See golang.org/s/go12encoding for design.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12706043
2013-08-14 00:34:00 -04:00
Russ Cox
413d4c6c11 net: make IP implement encoding.MarshalerText, encoding.UnmarshalerText
See golang.org/s/go12encoding for design.

R=golang-dev, bradfitz, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/12705043
2013-08-14 00:33:20 -04:00
Russ Cox
56ce83f7ba undo CL 12603044 / 2ca230b93195
fat fingers - did not intend to submit.
depends on the Unmarshaler CL anyway.

««« original CL description
encoding/xml: add, support Marshaler interface

See golang.org/s/go12xml for design.

Fixes #2771.
Fixes #4169.
Fixes #5975.
Fixes #6125.

R=golang-dev, iant, dan.kortschak
CC=golang-dev
https://golang.org/cl/12603044
»»»

TBR=golang-dev
CC=golang-dev
https://golang.org/cl/12918043
2013-08-14 00:20:55 -04:00
Russ Cox
ce3ba126a0 encoding/gob: support new generic interfaces in package encoding
R=r
CC=golang-dev
https://golang.org/cl/12681044
2013-08-14 00:18:48 -04:00
Russ Cox
48b90bbc55 encoding: new package
See golang.org/s/go12encoding for design.

R=r
CC=golang-dev
https://golang.org/cl/12541051
2013-08-14 00:18:20 -04:00
Russ Cox
85f3acd788 encoding/xml: add, support Marshaler interface
See golang.org/s/go12xml for design.

Fixes #2771.
Fixes #4169.
Fixes #5975.
Fixes #6125.

R=golang-dev, iant, dan.kortschak
CC=golang-dev
https://golang.org/cl/12603044
2013-08-14 00:17:42 -04:00
Andrew Gerrand
5dde7ccecf cmd/go: add -t flag to 'go get' to download test dependencies
Fixes #5126.

R=golang-dev, dsymonds, bradfitz, r, rsc, rogpeppe
CC=golang-dev
https://golang.org/cl/12566046
2013-08-14 11:01:17 +10:00
Russ Cox
1a09d70e23 runtime: fix build on arm
Do not use ? :
I cannot say this enough.

TBR=dvyukov
CC=golang-dev
https://golang.org/cl/12903043
2013-08-13 19:37:54 -04:00
Brad Fitzpatrick
a2599cf50e archive/zip: add File.DataOffset
Accessor to find where the bytes of a file start.

R=golang-dev, rsc, dsymonds, adg
CC=golang-dev
https://golang.org/cl/12784045
2013-08-13 16:29:51 -07:00
Mikio Hara
45cb2e1b70 net: make Dial, Listen and ListenPacket return consistent error value
Update #4856

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12763044
2013-08-14 07:04:39 +09:00
Brad Fitzpatrick
ca3ed9f352 database/sql: add a disabled broken test
Update #6081

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/12810043
2013-08-13 14:56:40 -07:00
Brad Fitzpatrick
c7d352c941 archive/zip: remove an allocation, speed up a test
Update #6138

TestOver65kFiles spends all its time garbage collecting.
Removing the 1.4 MB of allocations per each of the 65k
files brings this from 34 seconds to 0.23 seconds.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12894043
2013-08-13 14:48:08 -07:00
Rob Pike
c18af467fd encoding/binary: make Write work like Read
Use the fast path calculation to shorten the code.
No effect on benchmarks.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12696046
2013-08-14 07:03:56 +10:00
Rob Pike
c32a8830bd cmd/go: nicer error diagnosis in go test
Before,
        go test -bench .
would just dump the long generic "go help" message. Confusing and
unhelpful. Now the message is short and on point and also reminds the
user about the oft-forgotten "go help testflag".

        % go test -bench
        go test: missing argument for flag bench
        run "go help test" or "go help testflag" for more information
        %

R=rsc
CC=golang-dev
https://golang.org/cl/12662046
2013-08-14 07:03:18 +10:00
Dmitriy Vyukov
992374f8fb net: fix build fix
Now builders say:
pkg/net/dnsclient_unix_test.go:10: imported and not used: "runtime"

R=golang-dev
CC=golang-dev
https://golang.org/cl/12890043
2013-08-14 00:55:18 +04:00
Dmitriy Vyukov
d90a81c39f net: fix windows build
Windows builders say:
pkg\net\dnsclient_unix_test.go:24: undefined: dnsConfig
pkg\net\dnsclient_unix_test.go:25: undefined: exchange

R=golang-dev
CC=golang-dev
https://golang.org/cl/12889043
2013-08-14 00:44:57 +04:00
Dmitriy Vyukov
4f2e382c9f runtime: dump scheduler state if GODEBUG=schedtrace is set
The schedtrace value sets dump period in milliseconds.
In default mode the trace looks as follows:
SCHED 0ms: gomaxprocs=4 idleprocs=0 threads=3 idlethreads=0 runqueue=0 [1 0 0 0]
SCHED 1001ms: gomaxprocs=4 idleprocs=3 threads=6 idlethreads=3 runqueue=0 [0 0 0 0]
SCHED 2008ms: gomaxprocs=4 idleprocs=1 threads=6 idlethreads=1 runqueue=0 [0 1 0 0]
If GODEBUG=scheddetail=1 is set as well, then the detailed trace is printed:
SCHED 0ms: gomaxprocs=4 idleprocs=0 threads=3 idlethreads=0 runqueue=0 singleproc=0 gcwaiting=1 mlocked=0 nmspinning=0 stopwait=0 sysmonwait=0
  P0: status=3 tick=1 m=0 runqsize=1/128 gfreecnt=0
  P1: status=3 tick=0 m=-1 runqsize=0/128 gfreecnt=0
  P2: status=3 tick=0 m=-1 runqsize=0/128 gfreecnt=0
  P3: status=3 tick=0 m=-1 runqsize=0/128 gfreecnt=0
  M2: p=-1 curg=-1 mallocing=0 throwing=0 gcing=0 locks=1 dying=0 helpgc=0 spinning=0 lockedg=-1
  M1: p=-1 curg=-1 mallocing=0 throwing=0 gcing=0 locks=1 dying=0 helpgc=0 spinning=0 lockedg=-1
  M0: p=0 curg=1 mallocing=0 throwing=0 gcing=0 locks=1 dying=0 helpgc=0 spinning=0 lockedg=1
  G1: status=2() m=0 lockedm=0
  G2: status=1() m=-1 lockedm=-1

R=golang-dev, raggi, rsc
CC=golang-dev
https://golang.org/cl/11435044
2013-08-14 00:30:55 +04:00
Russ Cox
2642c6e24d sync/atomic: update comment for ARM 64-bit atomics
They don't work on older chips, just like the x86-32 64-bit atomics.

Update #6134

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12880043
2013-08-13 16:16:05 -04:00
Keith Randall
74e78df107 undo CL 12840043 / 3b9f54db72a1
Breaks the build.  Old bucket arrays kept by iterators
still need to be scanned.

««« original CL description
runtime: tell GC not to scan internal hashmap structures.
We'll do it ourselves via hash_gciter, thanks.
Fixes bug 6119.

R=golang-dev, dvyukov, cookieo9, rsc
CC=golang-dev
https://golang.org/cl/12840043
»»»

R=golang-dev
CC=golang-dev
https://golang.org/cl/12884043
2013-08-13 12:59:39 -07:00
Keith Randall
0df438c683 runtime: tell GC not to scan internal hashmap structures.
We'll do it ourselves via hash_gciter, thanks.
Fixes bug 6119.

R=golang-dev, dvyukov, cookieo9, rsc
CC=golang-dev
https://golang.org/cl/12840043
2013-08-13 12:36:03 -07:00
Russ Cox
ba14974e07 undo CL 12787044 / ed695cdf962b
The NetBSD and OpenBSD failures are apparently real,
not due to the test bug fixed in 100b9fc0c46f.

««« original CL description
runtime/pprof: test netbsd and openbsd again

Maybe these will work now.

R=golang-dev, dvyukov, bradfitz
CC=golang-dev
https://golang.org/cl/12787044
»»»

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12873043
2013-08-13 23:33:49 +04:00
Dmitriy Vyukov
4961483e7d runtime: fix LockOSThread
Fixes #6100.

R=golang-dev, dave, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/12703045
2013-08-13 22:37:04 +04:00
Dmitriy Vyukov
f9066fe1c0 runtime: more reliable preemption
Currently it's possible that a goroutine
that periodically executes non-blocking
cgo/syscalls is never preempted.
This change splits scheduler and syscall
ticks to prevent such situation.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12658045
2013-08-13 22:14:04 +04:00
Dmitriy Vyukov
cc4e6aad8e runtime: do no lose CPU profiling signals
Currently we lose lots of profiling signals.
Most notably, GC is not accounted at all.
But stack splits, scheduler, syscalls, etc are lost as well.
This creates seriously misleading profile.
With this change all profiling signals are accounted.
Now I see these additional entries that were previously absent:
161  29.7%  29.7%      164  30.3% syscall.Syscall
 12   2.2%  50.9%       12   2.2% scanblock
 11   2.0%  55.0%       11   2.0% markonly
 10   1.8%  58.9%       10   1.8% sweepspan
  2   0.4%  85.8%        2   0.4% runtime.newstack
It is still impossible to understand what causes stack splits,
but at least it's clear how many time is spent on them.
Update #2197.
Update #5659.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12179043
2013-08-13 22:12:02 +04:00
Dmitriy Vyukov
1da1030b5d runtime: fix false deadlock crash
Fixes #6070.
Update #6055.

R=golang-dev, nightlyone, rsc
CC=golang-dev
https://golang.org/cl/12602043
2013-08-13 22:07:42 +04:00
Dmitriy Vyukov
7eb6a6f46d sync/atomic: fix ARM nomenclature in comments
R=cshapiro
CC=golang-dev
https://golang.org/cl/12877043
2013-08-13 22:07:21 +04:00
Rick Arnold
4be93851c3 io: prevent write to PipeWriter after Close
Return an ErrClosedPipe rather than allowing the write to proceed.

Fixes #5330.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12541053
2013-08-13 11:04:09 -07:00
Dmitriy Vyukov
d3f36dbfc7 sync/atomic: add Swap to nil deref test
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12870043
2013-08-13 21:18:33 +04:00
Dmitriy Vyukov
66c58cea67 sync/atomic: trigger paging fault early on linux/arm
so that we don't need to traceback through __kuser_cmpxchg

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12869043
2013-08-13 21:15:47 +04:00
Alex A Skinner
0a3cb7ece3 net: implement DNS TCP fallback query if UDP response is truncated
Fixes #5686.

R=golang-dev, bradfitz, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/12458043
2013-08-13 09:44:12 -07:00
Alberto García Hierro
c18dc11ef2 cmd/cgo: Add support for C function pointers
* Add a new kind of Name, "fpvar" which stands for function pointer variable
* When walking the AST, find functions used as expressions and create a new Name object for them
* Track functions which are only used in expr contexts, and avoid generating bridge code for them

R=golang-dev, minux.ma, fullung, rsc, iant
CC=golang-dev
https://golang.org/cl/9835047
2013-08-13 12:42:21 -04:00
Russ Cox
469250fb77 runtime/pprof: test netbsd and openbsd again
Maybe these will work now.

R=golang-dev, dvyukov, bradfitz
CC=golang-dev
https://golang.org/cl/12787044
2013-08-13 12:35:37 -04:00
Dmitriy Vyukov
71c6da39ce runtime/pprof: fix test
R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/12790043
2013-08-13 12:18:29 -04:00
Dmitriy Vyukov
aaab946943 runtime: fix handling of network deadlines
Ensure that deadlines affect already issued IO.

R=golang-dev, mikioh.mikioh, bradfitz
CC=golang-dev
https://golang.org/cl/12847043
2013-08-13 19:11:42 +04:00
Dmitriy Vyukov
0e15b03f93 sync/atomic: add Swap functions
Fixes #5722.

R=golang-dev, khr, cshapiro, rsc, r
CC=golang-dev
https://golang.org/cl/12670045
2013-08-13 15:26:48 +04:00