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

12861 Commits

Author SHA1 Message Date
Adam Langley
d2a19e9fd1 crypto/elliptic: add constant-time, P-256 implementation.
On my 64-bit machine, despite being 32-bit code, fixed-base
multiplications are 7.1x faster and arbitary multiplications are 2.6x
faster.

It is difficult to review this change. However, the code is essentially
the same as code that has been open-sourced in Chromium. There it has
been successfully performing P-256 operations for several months on
many machines so the arithmetic of the code should be sound.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/10551044
2013-06-27 13:31:05 -04:00
Dmitriy Vyukov
7ebb187e8e undo CL 9776044 / 1e280889f997
Failure on bot:
http://build.golang.org/log/f4c648906e1289ec2237c1d0880fb1a8b1852a08

««« original CL description
runtime: fix CPU underutilization
runtime.newproc/ready are deliberately sloppy about waking new M's,
they only ensure that there is at least 1 spinning M.
Currently to compensate for that, schedule() checks if the current P
has local work and there are no spinning M's, it wakes up another one.
It does not work if goroutines do not call schedule.
With this change a spinning M wakes up another M when it finds work to do.
It's also not ideal, but it fixes the underutilization.
A proper check would require to know the exact number of runnable G's,
but it's too expensive to maintain.
Fixes #5586.

R=rsc
TBR=rsc
CC=gobot, golang-dev
https://golang.org/cl/9776044
»»»

R=golang-dev
CC=golang-dev
https://golang.org/cl/10692043
2013-06-27 21:03:35 +04:00
Dmitriy Vyukov
15a1c3d1e4 runtime: fix CPU underutilization
runtime.newproc/ready are deliberately sloppy about waking new M's,
they only ensure that there is at least 1 spinning M.
Currently to compensate for that, schedule() checks if the current P
has local work and there are no spinning M's, it wakes up another one.
It does not work if goroutines do not call schedule.
With this change a spinning M wakes up another M when it finds work to do.
It's also not ideal, but it fixes the underutilization.
A proper check would require to know the exact number of runnable G's,
but it's too expensive to maintain.
Fixes #5586.

R=rsc
CC=gobot, golang-dev
https://golang.org/cl/9776044
2013-06-27 20:52:12 +04:00
Dmitriy Vyukov
eac6bee7c1 runtime: fix argument printing during traceback
Current code can print more arguments than necessary
and also incorrectly prints "...".
Update #5723.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/10689043
2013-06-27 20:43:43 +04:00
Russ Cox
6fa3c89b77 runtime: record proper goroutine state during stack split
Until now, the goroutine state has been scattered during the
execution of newstack and oldstack. It's all there, and those routines
know how to get back to a working goroutine, but other pieces of
the system, like stack traces, do not. If something does interrupt
the newstack or oldstack execution, the rest of the system can't
understand the goroutine. For example, if newstack decides there
is an overflow and calls throw, the stack tracer wouldn't dump the
goroutine correctly.

For newstack to save a useful state snapshot, it needs to be able
to rewind the PC in the function that triggered the split back to
the beginning of the function. (The PC is a few instructions in, just
after the call to morestack.) To make that possible, we change the
prologues to insert a jmp back to the beginning of the function
after the call to morestack. That is, the prologue used to be roughly:

        TEXT myfunc
                check for split
                jmpcond nosplit
                call morestack
        nosplit:
                sub $xxx, sp

Now an extra instruction is inserted after the call:

        TEXT myfunc
        start:
                check for split
                jmpcond nosplit
                call morestack
                jmp start
        nosplit:
                sub $xxx, sp

The jmp is not executed directly. It is decoded and simulated by
runtime.rewindmorestack to discover the beginning of the function,
and then the call to morestack returns directly to the start label
instead of to the jump instruction. So logically the jmp is still
executed, just not by the cpu.

The prologue thus repeats in the case of a function that needs a
stack split, but against the cost of the split itself, the extra few
instructions are noise. The repeated prologue has the nice effect of
making a stack split double-check that the new stack is big enough:
if morestack happens to return on a too-small stack, we'll now notice
before corruption happens.

The ability for newstack to rewind to the beginning of the function
should help preemption too. If newstack decides that it was called
for preemption instead of a stack split, it now has the goroutine state
correctly paused if rescheduling is needed, and when the goroutine
can run again, it can return to the start label on its original stack
and re-execute the split check.

Here is an example of a split stack overflow showing the full
trace, without any special cases in the stack printer.
(This one was triggered by making the split check incorrect.)

runtime: newstack framesize=0x0 argsize=0x18 sp=0x6aebd0 stack=[0x6b0000, 0x6b0fa0]
        morebuf={pc:0x69f5b sp:0x6aebd8 lr:0x0}
        sched={pc:0x68880 sp:0x6aebd0 lr:0x0 ctxt:0x34e700}
runtime: split stack overflow: 0x6aebd0 < 0x6b0000
fatal error: runtime: split stack overflow

goroutine 1 [stack split]:
runtime.mallocgc(0x290, 0x100000000, 0x1)
        /Users/rsc/g/go/src/pkg/runtime/zmalloc_darwin_amd64.c:21 fp=0x6aebd8
runtime.new()
        /Users/rsc/g/go/src/pkg/runtime/zmalloc_darwin_amd64.c:682 +0x5b fp=0x6aec08
go/build.(*Context).Import(0x5ae340, 0xc210030c71, 0xa, 0xc2100b4380, 0x1b, ...)
        /Users/rsc/g/go/src/pkg/go/build/build.go:424 +0x3a fp=0x6b00a0
main.loadImport(0xc210030c71, 0xa, 0xc2100b4380, 0x1b, 0xc2100b42c0, ...)
        /Users/rsc/g/go/src/cmd/go/pkg.go:249 +0x371 fp=0x6b01a8
main.(*Package).load(0xc21017c800, 0xc2100b42c0, 0xc2101828c0, 0x0, 0x0, ...)
        /Users/rsc/g/go/src/cmd/go/pkg.go:431 +0x2801 fp=0x6b0c98
main.loadPackage(0x369040, 0x7, 0xc2100b42c0, 0x0)
        /Users/rsc/g/go/src/cmd/go/pkg.go:709 +0x857 fp=0x6b0f80
----- stack segment boundary -----
main.(*builder).action(0xc2100902a0, 0x0, 0x0, 0xc2100e6c00, 0xc2100e5750, ...)
        /Users/rsc/g/go/src/cmd/go/build.go:539 +0x437 fp=0x6b14a0
main.(*builder).action(0xc2100902a0, 0x0, 0x0, 0xc21015b400, 0x2, ...)
        /Users/rsc/g/go/src/cmd/go/build.go:528 +0x1d2 fp=0x6b1658
main.(*builder).test(0xc2100902a0, 0xc210092000, 0x0, 0x0, 0xc21008ff60, ...)
        /Users/rsc/g/go/src/cmd/go/test.go:622 +0x1b53 fp=0x6b1f68
----- stack segment boundary -----
main.runTest(0x5a6b20, 0xc21000a020, 0x2, 0x2)
        /Users/rsc/g/go/src/cmd/go/test.go:366 +0xd09 fp=0x6a5cf0
main.main()
        /Users/rsc/g/go/src/cmd/go/main.go:161 +0x4f9 fp=0x6a5f78
runtime.main()
        /Users/rsc/g/go/src/pkg/runtime/proc.c:183 +0x92 fp=0x6a5fa0
runtime.goexit()
        /Users/rsc/g/go/src/pkg/runtime/proc.c:1266 fp=0x6a5fa8

And here is a seg fault during oldstack:

SIGSEGV: segmentation violation
PC=0x1b2a6

runtime.oldstack()
        /Users/rsc/g/go/src/pkg/runtime/stack.c:159 +0x76
runtime.lessstack()
        /Users/rsc/g/go/src/pkg/runtime/asm_amd64.s:270 +0x22

goroutine 1 [stack unsplit]:
fmt.(*pp).printArg(0x2102e64e0, 0xe5c80, 0x2102c9220, 0x73, 0x0, ...)
        /Users/rsc/g/go/src/pkg/fmt/print.go:818 +0x3d3 fp=0x221031e6f8
fmt.(*pp).doPrintf(0x2102e64e0, 0x12fb20, 0x2, 0x221031eb98, 0x1, ...)
        /Users/rsc/g/go/src/pkg/fmt/print.go:1183 +0x15cb fp=0x221031eaf0
fmt.Sprintf(0x12fb20, 0x2, 0x221031eb98, 0x1, 0x1, ...)
        /Users/rsc/g/go/src/pkg/fmt/print.go:234 +0x67 fp=0x221031eb40
flag.(*stringValue).String(0x2102c9210, 0x1, 0x0)
        /Users/rsc/g/go/src/pkg/flag/flag.go:180 +0xb3 fp=0x221031ebb0
flag.(*FlagSet).Var(0x2102f6000, 0x293d38, 0x2102c9210, 0x143490, 0xa, ...)
        /Users/rsc/g/go/src/pkg/flag/flag.go:633 +0x40 fp=0x221031eca0
flag.(*FlagSet).StringVar(0x2102f6000, 0x2102c9210, 0x143490, 0xa, 0x12fa60, ...)
        /Users/rsc/g/go/src/pkg/flag/flag.go:550 +0x91 fp=0x221031ece8
flag.(*FlagSet).String(0x2102f6000, 0x143490, 0xa, 0x12fa60, 0x0, ...)
        /Users/rsc/g/go/src/pkg/flag/flag.go:563 +0x87 fp=0x221031ed38
flag.String(0x143490, 0xa, 0x12fa60, 0x0, 0x161950, ...)
        /Users/rsc/g/go/src/pkg/flag/flag.go:570 +0x6b fp=0x221031ed80
testing.init()
        /Users/rsc/g/go/src/pkg/testing/testing.go:-531 +0xbb fp=0x221031edc0
strings_test.init()
        /Users/rsc/g/go/src/pkg/strings/strings_test.go:1115 +0x62 fp=0x221031ef70
main.init()
        strings/_test/_testmain.go:90 +0x3d fp=0x221031ef78
runtime.main()
        /Users/rsc/g/go/src/pkg/runtime/proc.c:180 +0x8a fp=0x221031efa0
runtime.goexit()
        /Users/rsc/g/go/src/pkg/runtime/proc.c:1269 fp=0x221031efa8

goroutine 2 [runnable]:
runtime.MHeap_Scavenger()
        /Users/rsc/g/go/src/pkg/runtime/mheap.c:438
runtime.goexit()
        /Users/rsc/g/go/src/pkg/runtime/proc.c:1269
created by runtime.main
        /Users/rsc/g/go/src/pkg/runtime/proc.c:166

rax     0x23ccc0
rbx     0x23ccc0
rcx     0x0
rdx     0x38
rdi     0x2102c0170
rsi     0x221032cfe0
rbp     0x221032cfa0
rsp     0x7fff5fbff5b0
r8      0x2102c0120
r9      0x221032cfa0
r10     0x221032c000
r11     0x104ce8
r12     0xe5c80
r13     0x1be82baac718
r14     0x13091135f7d69200
r15     0x0
rip     0x1b2a6
rflags  0x10246
cs      0x2b
fs      0x0
gs      0x0

Fixes #5723.

R=r, dvyukov, go.peter.90, dave, iant
CC=golang-dev
https://golang.org/cl/10360048
2013-06-27 11:32:01 -04:00
Robin Eklind
2546a54148 crypto/sha512: update comment for the Sum512 function.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/10660043
2013-06-27 20:51:46 +10:00
Ian Lance Taylor
8cd0689a63 runtime: remove unused typedef
R=golang-dev, dave, r
CC=golang-dev
https://golang.org/cl/10660044
2013-06-26 22:02:32 -07:00
Alex Brainman
04b405c7fc syscall: handle empty environment variable values properly on windows
Setenv("AN_ENV_VAR", "") deletes AN_ENV_VAR instead of setting it
to "" at this moment. Also Getenv("AN_ENV_VAR") returns "not found",
if AN_ENV_VAR is "". Change it, so they behave like unix.

Fixes #5610

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/10594043
2013-06-27 10:11:30 +10:00
Rob Pike
fa7e46c884 crypto/sha512: provide top-level Sum512 and Sum384 functions
Makes it easy to ask the simple question, what is the hash of this data?
Also fix the commentary and prints in Sum256.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/10630043
2013-06-26 13:14:11 -07:00
Rob Pike
5cd5d88954 crypto/sha256: provide top-level Sum and Sum224 functions
Makes it easy to ask the simple question, what is the hash of this data?

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/10629043
2013-06-26 11:36:18 -07:00
Russ Cox
8b9c1a224b cmd/go: proper rebuild of affected packages during go test
With this CL, go test -short -cover std successfully builds and
runs all the standard package tests. The tests that look a file
line numbers (log and runtime/debug) fail, because cover is
not inserting //line directives. Everything else passes.

ok  	cmd/api	0.038s	coverage: 66.6% of statements
?   	cmd/cgo	[no test files]
ok  	cmd/fix	0.043s	coverage: 27.2% of statements
ok  	cmd/go	0.063s	coverage: 2.4% of statements
?   	cmd/godoc	[no test files]
ok  	cmd/gofmt	0.085s	coverage: 61.3% of statements
?   	cmd/yacc	[no test files]
ok  	archive/tar	0.023s	coverage: 74.2% of statements
ok  	archive/zip	0.075s	coverage: 71.8% of statements
ok  	bufio	0.149s	coverage: 88.2% of statements
ok  	bytes	0.135s	coverage: 90.4% of statements
ok  	compress/bzip2	0.087s	coverage: 85.1% of statements
ok  	compress/flate	0.632s	coverage: 79.3% of statements
ok  	compress/gzip	0.027s	coverage: 76.7% of statements
ok  	compress/lzw	0.141s	coverage: 71.2% of statements
ok  	compress/zlib	1.123s	coverage: 77.2% of statements
ok  	container/heap	0.020s	coverage: 85.8% of statements
ok  	container/list	0.021s	coverage: 92.5% of statements
ok  	container/ring	0.030s	coverage: 86.5% of statements
?   	crypto	[no test files]
ok  	crypto/aes	0.054s	coverage: 54.3% of statements
ok  	crypto/cipher	0.027s	coverage: 68.8% of statements
ok  	crypto/des	0.041s	coverage: 83.8% of statements
ok  	crypto/dsa	0.027s	coverage: 33.1% of statements
ok  	crypto/ecdsa	0.048s	coverage: 48.7% of statements
ok  	crypto/elliptic	0.030s	coverage: 91.6% of statements
ok  	crypto/hmac	0.019s	coverage: 83.3% of statements
ok  	crypto/md5	0.020s	coverage: 78.7% of statements
ok  	crypto/rand	0.057s	coverage: 20.8% of statements
ok  	crypto/rc4	0.092s	coverage: 70.8% of statements
ok  	crypto/rsa	0.261s	coverage: 80.8% of statements
ok  	crypto/sha1	0.019s	coverage: 83.9% of statements
ok  	crypto/sha256	0.021s	coverage: 89.0% of statements
ok  	crypto/sha512	0.023s	coverage: 88.7% of statements
ok  	crypto/subtle	0.027s	coverage: 83.9% of statements
ok  	crypto/tls	0.833s	coverage: 79.7% of statements
ok  	crypto/x509	0.961s	coverage: 74.9% of statements
?   	crypto/x509/pkix	[no test files]
ok  	database/sql	0.033s	coverage: 75.0% of statements
ok  	database/sql/driver	0.020s	coverage: 46.2% of statements
ok  	debug/dwarf	0.023s	coverage: 71.5% of statements
ok  	debug/elf	0.035s	coverage: 58.2% of statements
ok  	debug/gosym	0.022s	coverage: 1.8% of statements
ok  	debug/macho	0.023s	coverage: 63.7% of statements
ok  	debug/pe	0.024s	coverage: 50.5% of statements
ok  	encoding/ascii85	0.021s	coverage: 89.7% of statements
ok  	encoding/asn1	0.022s	coverage: 77.9% of statements
ok  	encoding/base32	0.022s	coverage: 91.4% of statements
ok  	encoding/base64	0.020s	coverage: 90.7% of statements
ok  	encoding/binary	0.022s	coverage: 66.2% of statements
ok  	encoding/csv	0.022s	coverage: 88.5% of statements
ok  	encoding/gob	0.064s	coverage: 82.2% of statements
ok  	encoding/hex	0.019s	coverage: 86.3% of statements
ok  	encoding/json	0.047s	coverage: 77.3% of statements
ok  	encoding/pem	0.026s	coverage: 80.5% of statements
ok  	encoding/xml	0.039s	coverage: 85.0% of statements
ok  	errors	0.022s	coverage: 100.0% of statements
ok  	expvar	0.048s	coverage: 72.0% of statements
ok  	flag	0.019s	coverage: 86.9% of statements
ok  	fmt	0.062s	coverage: 91.2% of statements
ok  	go/ast	0.028s	coverage: 46.3% of statements
ok  	go/build	0.190s	coverage: 75.4% of statements
ok  	go/doc	0.095s	coverage: 76.7% of statements
ok  	go/format	0.036s	coverage: 79.8% of statements
ok  	go/parser	0.075s	coverage: 82.0% of statements
ok  	go/printer	0.733s	coverage: 88.6% of statements
ok  	go/scanner	0.031s	coverage: 86.5% of statements
ok  	go/token	0.062s	coverage: 79.7% of statements
?   	hash	[no test files]
ok  	hash/adler32	0.029s	coverage: 49.0% of statements
ok  	hash/crc32	0.020s	coverage: 64.2% of statements
ok  	hash/crc64	0.021s	coverage: 53.5% of statements
ok  	hash/fnv	0.018s	coverage: 75.5% of statements
ok  	html	0.022s	coverage: 4.5% of statements
ok  	html/template	0.087s	coverage: 83.9% of statements
ok  	image	0.108s	coverage: 67.1% of statements
ok  	image/color	0.026s	coverage: 20.1% of statements
ok  	image/draw	0.049s	coverage: 69.6% of statements
ok  	image/gif	0.019s	coverage: 65.2% of statements
ok  	image/jpeg	0.197s	coverage: 78.6% of statements
ok  	image/png	0.055s	coverage: 56.5% of statements
ok  	index/suffixarray	0.027s	coverage: 82.4% of statements
ok  	io	0.037s	coverage: 83.4% of statements
ok  	io/ioutil	0.022s	coverage: 70.1% of statements
FAIL	log	0.020s
ok  	log/syslog	2.063s	coverage: 71.1% of statements
ok  	math	0.023s	coverage: 76.5% of statements
ok  	math/big	0.235s	coverage: 79.2% of statements
ok  	math/cmplx	0.020s	coverage: 66.5% of statements
ok  	math/rand	0.031s	coverage: 69.9% of statements
ok  	mime	0.022s	coverage: 83.0% of statements
ok  	mime/multipart	0.389s	coverage: 76.1% of statements
ok  	net	2.219s	coverage: 58.0% of statements
ok  	net/http	4.744s	coverage: 82.9% of statements
ok  	net/http/cgi	0.593s	coverage: 68.5% of statements
ok  	net/http/cookiejar	0.038s	coverage: 90.3% of statements
ok  	net/http/fcgi	0.047s	coverage: 37.6% of statements
ok  	net/http/httptest	0.068s	coverage: 68.9% of statements
ok  	net/http/httputil	0.058s	coverage: 52.8% of statements
?   	net/http/pprof	[no test files]
ok  	net/mail	0.025s	coverage: 80.3% of statements
ok  	net/rpc	0.063s	coverage: 71.5% of statements
ok  	net/rpc/jsonrpc	0.047s	coverage: 81.3% of statements
ok  	net/smtp	0.032s	coverage: 74.1% of statements
ok  	net/textproto	0.023s	coverage: 66.0% of statements
ok  	net/url	0.020s	coverage: 78.2% of statements
ok  	os	4.729s	coverage: 73.3% of statements
ok  	os/exec	39.620s	coverage: 65.1% of statements
ok  	os/signal	0.541s	coverage: 89.9% of statements
ok  	os/user	0.022s	coverage: 62.2% of statements
ok  	path	0.018s	coverage: 90.8% of statements
ok  	path/filepath	10.834s	coverage: 88.4% of statements
ok  	reflect	0.055s	coverage: 83.2% of statements
ok  	regexp	0.084s	coverage: 75.5% of statements
ok  	regexp/syntax	0.547s	coverage: 85.2% of statements
ok  	runtime	4.755s	coverage: 75.9% of statements
?   	runtime/cgo	[no test files]
FAIL	runtime/debug	0.018s
ok  	runtime/pprof	0.368s	coverage: 8.5% of statements
?   	runtime/race	[no test files]
ok  	sort	0.059s	coverage: 97.7% of statements
ok  	strconv	0.315s	coverage: 95.6% of statements
ok  	strings	0.147s	coverage: 96.1% of statements
ok  	sync	0.083s	coverage: 56.7% of statements
ok  	sync/atomic	0.035s	coverage: 0.0% of statements
ok  	syscall	0.043s	coverage: 24.0% of statements
ok  	testing	0.018s	coverage: 24.0% of statements
?   	testing/iotest	[no test files]
ok  	testing/quick	0.062s	coverage: 83.2% of statements
ok  	text/scanner	0.020s	coverage: 91.5% of statements
ok  	text/tabwriter	0.021s	coverage: 90.4% of statements
ok  	text/template	0.052s	coverage: 81.1% of statements
ok  	text/template/parse	0.024s	coverage: 86.1% of statements
ok  	time	2.431s	coverage: 88.8% of statements
ok  	unicode	0.024s	coverage: 92.1% of statements
ok  	unicode/utf16	0.017s	coverage: 97.3% of statements
ok  	unicode/utf8	0.019s	coverage: 97.4% of statements
?   	unsafe	[no test files]

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/10586043
2013-06-26 14:31:12 -04:00
Rob Pike
4850f5d5ea crypto/md5: provide a top-level Sum function
Makes it easy to ask the simple question, what is the hash of this data?
Also mark block as non-escaping.

R=golang-dev, agl
CC=golang-dev
https://golang.org/cl/10624044
2013-06-26 11:29:30 -07:00
Rob Pike
53a00e2812 cmd/go: log compilation errors when scanning directories and packages
Before, some packages disappear silently if the package cannot be imported,
such as if the import statement is unparseable.
Before:
        % ls src
        foo   issue
        % go list ./...
        _/home/r/bug/src/foo
        %
After:
        % go list ./...
        src/issue/issue.go:3:5: expected 'STRING', found newline
        _/home/r/bug/src/foo
        %

R=rsc
CC=golang-dev
https://golang.org/cl/10568043
2013-06-26 10:48:04 -07:00
Rob Pike
4cf73890a2 crypto/sha1: provide a top-level Sum function
Makes it easy to ask the simple question, what is the hash of this data?

R=golang-dev, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/10571043
2013-06-25 17:04:18 -07:00
Russ Cox
148fac79a3 cmd/gc: fix escape analysis ordering
Functions without bodies were excluded from the ordering logic,
because when I wrote the ordering logic there was no reason to
analyze them.

But then we added //go:noescape tags that need analysis, and we
didn't update the ordering logic.

So in the absence of good ordering, //go:noescape only worked
if it appeared before the use in the source code.

Fixes #5773.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/10570043
2013-06-25 17:28:49 -04:00
Russ Cox
a14e143c21 cmd/ld: fix line numbers when using fieldtrack
USEFIELD is a special kind of NOP, so treat it like a NOP
when generating the pc-ln table.

There are more invasive fixes that could be applied here.
I am going for minimum number of lines changed.

The smallest test case we know of is five distinct Go files
in four packages, and the bug only happens with
GOEXPERIMENT=fieldtrack enabled, which we don't
normally build with, so the test would never run
meaningfully anyway.

Fixes #5762.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/10495044
2013-06-25 17:23:33 -04:00
Ian Lance Taylor
7590e28d24 lib9: avoid all -Wconversion warnings
Built after adding -Wconversion to the list of compiler
arguments used when building.  I believe these are all OK
assuming we will not change the API.  There is no effort to
detect overflow due to very long strings.

R=golang-dev, dave, rsc, r
CC=golang-dev
https://golang.org/cl/10195044
2013-06-25 10:44:25 -07:00
Dmitriy Vyukov
07cb48c31f sync: fix race instrumentation of WaitGroup
Currently more than 1 gorutine can execute raceWrite() in Wait()
in the following scenario:
1. goroutine 1 executes first check of wg.counter, sees that it's == 0
2. goroutine 2 executes first check of wg.counter, sees that it's == 0
3. goroutine 2 locks the mutex, sees that he is the first waiter and executes raceWrite()
4. goroutine 2 block on the semaphore
5. goroutine 3 executes Done() and unblocks goroutine 2
6. goroutine 1 lock the mutex, sees that he is the first waiter and executes raceWrite()

It produces the following false report:
WARNING: DATA RACE
Write by goroutine 35:
  sync.raceWrite()
      src/pkg/sync/race.go:41 +0x33
  sync.(*WaitGroup).Wait()
      src/pkg/sync/waitgroup.go:103 +0xae
  command-line-arguments_test.TestNoRaceWaitGroupMultipleWait2()
      src/pkg/runtime/race/testdata/waitgroup_test.go:156 +0x19a
  testing.tRunner()
      src/pkg/testing/testing.go:361 +0x108

Previous write by goroutine 36:
  sync.raceWrite()
      src/pkg/sync/race.go:41 +0x33
  sync.(*WaitGroup).Wait()
      src/pkg/sync/waitgroup.go:103 +0xae
  command-line-arguments_test.func·012()
      src/pkg/runtime/race/testdata/waitgroup_test.go:148 +0x4d

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/10424043
2013-06-25 20:27:19 +04:00
Alex Brainman
3d513faa6f runtime: do not mark os memory as executable on windows
Resubmit 3c2cddfbdaec now that windows callbacks
are not generated during runtime.

Fixes #5494

R=golang-dev, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/10487043
2013-06-25 17:20:14 +10:00
Dave Cheney
3a3b53da88 libmach: trivial: resolve unused parameter warnings
Fix a bunch of warnings detected by https://golang.org/cl/8090044.

Same as CL 10483044, but for FreeBSD.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/10498044
2013-06-25 15:29:02 +10:00
Alex Brainman
8486d96a27 runtime: change netpoll in preparation for windows implementation
- change runtime_pollWait so it does not return
  closed or timeout if IO is ready - windows must
  know if IO has completed or not even after
  interruption;
- add (*pollDesc).Prepare(mode int) that can be
  used for both read and write, same for Wait;
- introduce runtime_pollWaitCanceled and expose
  it in net as (*pollDesc).WaitCanceled(mode int);

Full windows netpoll changes are
here https://golang.org/cl/8670044/.

R=golang-dev, dvyukov
CC=golang-dev
https://golang.org/cl/10485043
2013-06-25 12:29:00 +10:00
Dave Cheney
02991bb960 libmach: trivial: resolve unused parameter warnings
Fix a bunch of warnings detected by https://golang.org/cl/8090044

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/10483044
2013-06-25 10:52:37 +10:00
Rob Pike
793bb6cce7 crypto/sha1: mark block as non-escaping
The compiler still gets the escape analysis wrong, but the annotation here is correct.

R=golang-dev, dave, bradfitz
CC=golang-dev
https://golang.org/cl/10514046
2013-06-24 17:48:31 -07:00
Dave Cheney
3b76d70e11 syscall: reduce duplication between *bsd and linux
Part 2 of several.

R=rsc, mikioh.mikioh, r
CC=golang-dev
https://golang.org/cl/10462043
2013-06-25 10:14:40 +10:00
Rob Pike
feab3f4986 hash: tweak the package docs
No semantic change.
I found the wording distracting in a couple of instances and was moved to improve it.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/10478048
2013-06-24 16:53:13 -07:00
Brad Fitzpatrick
a054028471 net/http: Transport should return an error when response body ends early
If a server response contains a Content-Length and the body is short,
the Transport should end in io.ErrUnexpectedEOF, not io.EOF.

Fixes #5738

R=golang-dev, kevlar, r
CC=golang-dev
https://golang.org/cl/10237050
2013-06-24 13:27:56 -07:00
ChaiShushan
3eaaed5030 net/rpc: fix RegisterName rejects "." character.
Fixes #5617.

R=r, rsc
CC=gobot, golang-dev
https://golang.org/cl/10370043
2013-06-24 13:23:02 -07:00
ChaiShushan
b78aaec22f net/rpc: call client.Close() when test exit
Fixes #5768.

R=golang-dev
CC=golang-dev
https://golang.org/cl/10503043
2013-06-24 13:18:50 -07:00
Dmitriy Vyukov
bd105b2bca runtime/pprof: disable testing under race detector
until we decide what to do with issues 5659/5736.
Profiling with race detector is not very useful in general,
and now it makes race builders red.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/10523043
2013-06-24 23:51:00 +04:00
Russ Cox
f21bc7920d time: avoid garbage collector aliasing bug
Time is a tiny struct, so the compiler copies a Time by
copying each of the three fields.

The layout of a time on amd64 is [ptr int32 gap32 ptr].
Copying a Time onto a location that formerly held a pointer in the
second word changes only the low 32 bits, creating a different
but still plausible pointer. This confuses the garbage collector
when it appears in argument or result frames.

To avoid this problem, declare nsec as uintptr, so that there is
no gap on amd64 anymore, and therefore no partial pointers.

Note that rearranging the fields to put the int32 last still leaves
a gap - [ptr ptr int32 gap32] - because Time must have a total
size that is ptr-width aligned.

Update #5749

This CL is enough to fix the problem, but we should still do
the other actions listed in the initial report. We're not too far
from completely precise collection.

R=golang-dev, dvyukov, r
CC=golang-dev
https://golang.org/cl/10504043
2013-06-24 14:49:35 -04:00
Adam Langley
ce5d91baa5 compress/bzip2: don't panic on invalid input.
Fixes 5747.

R=golang-dev, r, bradfitz
CC=golang-dev
https://golang.org/cl/10401050
2013-06-24 10:59:41 -04:00
Alex Brainman
05a5de30f0 runtime: do not generate code during runtime in windows NewCallback
Update #5494

R=golang-dev, minux.ma, rsc, iant
CC=golang-dev
https://golang.org/cl/10368043
2013-06-24 17:17:45 +10:00
Dave Cheney
28a55111b2 os: rename error_posix.go to error_unix.go
The tradition is to use _posix when the platform extends beyond unix variants. As windows has its own file, rename to the more usual _unix.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/10320043
2013-06-24 11:23:37 +10:00
Rémy Oudompheng
20ebee2c31 cmd/gc: fix pointer composite literals in exported if statements.
Fixes #4230 (again).

R=rsc, golang-dev, r
CC=golang-dev
https://golang.org/cl/10470043
2013-06-23 18:39:07 +02:00
Rick Arnold
fc0b5ef0fd time: handle integer overflow in Sub
If time.Sub results in a value that won't fit in a Duration (int64),
return either the min or max int64 value as appropriate.

Fixes #5011.

R=golang-dev, bradfitz, r, rsc
CC=golang-dev
https://golang.org/cl/10328043
2013-06-21 18:07:57 -07:00
Dave Cheney
dd3a3cfa49 syscall: reduce duplication between *bsd and linux
See discussion: https://groups.google.com/forum/#!topic/golang-dev/zSmH0lQxKAs

Part 1 of several.

Move identical types and functions to syscall_unix.go.

R=rsc, mikioh.mikioh, r
CC=golang-dev
https://golang.org/cl/10392048
2013-06-22 11:03:40 +10:00
Robert Griesemer
fc1e298ba1 go/parser: always provide a non-nil path for imports
The go/ast ImportSpec always requires a non-nil path.

R=adonovan
CC=golang-dev
https://golang.org/cl/10402047
2013-06-21 15:09:04 -07:00
Rob Pike
279c48444a testing: include cover mode in cover profile
R=adg, rsc
CC=golang-dev
https://golang.org/cl/10392049
2013-06-21 14:19:08 -07:00
Robert Griesemer
f243584d29 go/*: support for slices with cap: s[:j:k] and s[i:j:k]
Experimental, per rsc's proposal.

R=rsc
CC=golang-dev
https://golang.org/cl/10204043
2013-06-21 13:14:06 -07:00
Adam Langley
6bea504b94 cmd/6a, cmd/6l: add PCLMULQDQ instruction.
This Intel instruction implements multiplication in binary fields.

R=golang-dev, minux.ma, dave, rsc
CC=golang-dev
https://golang.org/cl/10428043
2013-06-21 15:17:13 -04:00
Dave Cheney
a00958aac6 all: avoid leaking fds during tests
trivial: it is not a serious problem to leak a fd in a short lived process, but it was obscuring my investigation of issue 5593.

R=golang-dev, iant, bradfitz
CC=golang-dev
https://golang.org/cl/10391043
2013-06-21 11:13:14 +10:00
Rob Pike
0bc7e79afd all: excise some warts found by vet -shadow
These are not erroneous, just poor or confusing.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/10448043
2013-06-20 16:14:40 -07:00
Brad Fitzpatrick
5b0bf9db8e net/http: fix confusing shadowing in ProxyFromEnvironment
The old code worked, somewhat on accident, but was confusing,
and had a useless assignment to the inner err. It worked
because url.Parse parses just about anything, so the outer err
was always nil, so it always fell through to the bottom return
statement, even without the "err = nil" line.

Instead, just have two return statements, and add a comment.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/10448044
2013-06-20 11:58:24 -07:00
Rob Pike
3e710c0ba5 all: fix shadowing bugs found by go tool vet -shadow
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/10328044
2013-06-20 11:50:44 -07:00
Rob Pike
9824b018ce cmd/go: put the coverage information on the summary line.
Output now:
ok  	crypto/aes	0.060s	coverage: 89.8% of statements
ok  	crypto/des	0.074s	coverage: 92.2% of statements
ok  	crypto/dsa	0.056s	coverage: 34.5% of statements
ok  	crypto/ecdsa	0.058s	coverage: 86.8% of statements
ok  	crypto/elliptic	0.039s	coverage: 94.6% of statements
ok  	crypto/hmac	0.037s	coverage: 93.5% of statements
ok  	crypto/md5	0.031s	coverage: 96.2% of statements
ok  	crypto/rand	0.074s	coverage: 9.9% of statements
ok  	crypto/rc4	0.090s	coverage: 66.7% of statements
ok  	crypto/rsa	0.253s	coverage: 83.5% of statements

R=rsc, adg
CC=golang-dev
https://golang.org/cl/10413044
2013-06-20 10:27:44 -07:00
Adam Langley
9035297266 crypto/x509: add function to marshal EC private keys.
This complements the parsing function that we already have.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/10426043
2013-06-20 12:14:16 -04:00
Andrew Gerrand
2f70ac19d2 cmd/go: document that files beginning with . or _ are ignored
Fixes #5655.

R=golang-dev, minux.ma, r
CC=golang-dev
https://golang.org/cl/10410045
2013-06-20 10:29:38 +10:00
Adam Langley
966e889687 crypto/tls: change advertised ciphersuite order.
TLS clients send ciphersuites in preference order (most prefereable
first). This change alters the order so that ECDHE comes before plain
RSA, and RC4 comes before AES (because of the Lucky13 attack).

This is unlikely to have much effect: as a server, the code uses the
client's ciphersuite order by default and, as a client, the non-Go
server probably imposes its order.

R=golang-dev, r, raggi, jsing
CC=golang-dev
https://golang.org/cl/10372045
2013-06-19 16:46:53 -04:00
Rob Pike
cb2461ba46 cmd/go: another attempt at flag handling for coverage
The -cover flag is now just enable/disable and is implied if
either of the other flags is set.

R=rsc
CC=golang-dev
https://golang.org/cl/10420043
2013-06-19 09:44:40 -07:00
Rob Pike
27cca31ee1 cmd/go: simplify flags for coverage
The single flag -cover provides the default simplest behavior.
The other flags, -covermode and -coverprofile, provide more
control. The three flags interconnect to work well.

R=rsc, adg
CC=golang-dev
https://golang.org/cl/10364044
2013-06-18 17:15:26 -07:00
Rob Pike
8e8b8b85c2 cmd/go: write coverage to file, add percentage statistic
Move the data dumper to the testing package, where it has access
to file I/O.
Print a percentage value at the end of the run.

R=rsc, adg
CC=golang-dev
https://golang.org/cl/10264045
2013-06-18 14:18:25 -07:00
Robert Griesemer
6154ae8e24 math/big: fix Errorf verb
Pointed out by go vet.

R=r
CC=golang-dev
https://golang.org/cl/10368048
2013-06-18 14:16:40 -07:00
Russ Cox
269b2f2d4d cmd/gc: fix race detector on tail-call wrappers
(By not using the tail-call wrappers when the race
detector is enabled.)

R=golang-dev, minux.ma, dvyukov, daniel.morsing
CC=golang-dev
https://golang.org/cl/10227043
2013-06-18 14:43:37 -04:00
Cosmos Nicolaou
f882bc8708 os/exec: make exec_test.go:TestExtraFilesFDShuffle portable.
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/9103045
2013-06-18 08:55:32 -07:00
Dave Cheney
f9c22f7e78 cmd/cgo: avoid leaking fds
Fixes #5714.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/10386043
2013-06-18 23:20:17 +10:00
Alex Jin
83db738786 net/smtp: close conn in SendMail; add Client.Close method
R=rsc, dave, bradfitz
CC=golang-dev
https://golang.org/cl/10082044
2013-06-17 16:53:27 -07:00
Paul van Brouwershaven
4bd79e742a crypto/x509: Added RFC 5280, section 4.2.1.14 to parseCertificate and buildExtensions
Support for CRL Distribution Points

R=golang-dev, agl, bradfitz
CC=golang-dev
https://golang.org/cl/10258043
2013-06-17 14:56:45 -07:00
Nicolas Owens
2af974777d net: fix LookupNS on Plan 9
use correct field count when resolving nameservers via /net/dns on Plan 9.

we incorrectly check for 4 fields instead of 3 when parsing the result of /net/dns, and get no results

R=golang-dev, ality
CC=golang-dev
https://golang.org/cl/10182044
2013-06-17 11:38:07 -07:00
Dan Peterson
563d09cd14 testing: use -bench flag and fix flags doc link
R=golang-dev, r, kr
CC=golang-dev
https://golang.org/cl/10263043
2013-06-17 07:32:28 -07:00
Brad Fitzpatrick
14e52c74bc crypto/cipher: StreamWriter.Closer docs + behavior change
Don't panic when the underlying Writer isn't a Closer. And
document what Close does and clarify that it's not a Flush.

R=golang-dev, agl
CC=golang-dev
https://golang.org/cl/10310043
2013-06-17 07:30:04 -07:00
Dmitriy Vyukov
d660688f14 runtime/race: add tests for method thunks
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/10257043
2013-06-17 17:59:53 +04:00
Dmitriy Vyukov
f84cbd0950 runtime: fix test for new closure representation
I've hit it several times already.
Currently it crashes with nil deref.

R=golang-dev, daniel.morsing, r
CC=golang-dev
https://golang.org/cl/10317045
2013-06-17 15:41:17 +04:00
Benny Siegert
8a4efed63c run.bash: raise ulimit for the number of threads.
This is needed on NetBSD-current. Support for
ulimit -T in bash was added in 4.2nb3.

R=golang-dev, minux.ma, rsc, dave
CC=golang-dev
https://golang.org/cl/10078047
2013-06-17 19:31:58 +10:00
Dmitriy Vyukov
94dc963b55 runtime: fix race condition between GC and setGCPercent
If first GC runs concurrently with setGCPercent,
it can overwrite gcpercent value with default.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/10242047
2013-06-15 16:07:06 +04:00
Dmitriy Vyukov
4bb491b12e runtime: improve scheduler fairness
Currently global runqueue is starved if a group of goroutines
constantly respawn each other (local runqueue never becomes empty).
Fixes #5639.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/10042044
2013-06-15 16:06:28 +04:00
Dmitriy Vyukov
5caf762457 runtime: remove unused moreframesize_minalloc field
It was used to request large stack segment for GC
when it was running not on g0.
Now GC is running on g0 with large stack,
and it is not needed anymore.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/10242045
2013-06-15 16:02:39 +04:00
Jonathan Rudenberg
8f6341d9ee cmd/godoc: don't link unexported identifiers
R=golang-dev, gri, gri
CC=golang-dev
https://golang.org/cl/9722045
2013-06-14 12:37:23 -07:00
Keith Randall
de316388a7 runtime: garbage collector runs on g0 now.
No need to change to Grunnable state.
Add some more checks for Grunning state.

R=golang-dev, rsc, khr, dvyukov
CC=golang-dev
https://golang.org/cl/10186045
2013-06-14 11:42:51 -07:00
Brad Fitzpatrick
61d3b2db62 net: coalesce duplicate in-flight DNS lookups
In Issue 5625, Russ says: "We should at least have a cache of
inflight lookups, so that 100 simultaneous dials of one host
name don't do the work 100x. That's easy and (assume we forget
the answer once they all get it) doesn't pose any consistency
problems. It just merges simultaneous work."

This brings in singleflight (unexported) from Google /
Camlistore, but without its tests. Maybe we should put it
somewhere in the standard library. But not now.

Update #5625

R=golang-dev, iant, cespare, rsc, dave, rogpeppe, remyoudompheng
CC=golang-dev
https://golang.org/cl/10079043
2013-06-14 08:59:43 -07:00
Rémy Oudompheng
3be794cdc2 cmd/gc: instrument arrays properly in race detector.
The previous implementation would only record access to
the address of the array but the memory access to the whole
memory range must be recorded instead.

R=golang-dev, dvyukov, r
CC=golang-dev
https://golang.org/cl/8053044
2013-06-14 11:14:45 +02:00
Caleb Spare
bc08124866 strconv: corrected several bad references to err.Error in doc comments.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/10253051
2013-06-13 17:04:47 -07:00
Rob Pike
92ea9fa108 cmd/go: change to use struct in go test -cover
Go tool half of https://golang.org/cl/10271044

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/10272043
2013-06-13 13:12:58 -07:00
Alan Donovan
568c4617ec go/ast: add {L,R}paren token.Pos field to ast.TypeAssertExpr.
These are required to correctly determine the End() of the node.

Also set these fields in go/parser and use them in go/printer.

This is a backward-compatible API change.

R=gri, r
CC=golang-dev
https://golang.org/cl/10189043
2013-06-13 14:41:44 -04:00
Dmitriy Vyukov
b9ddb0d8b3 runtime: fix bug introduced in cl/10256043
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/10260043
2013-06-13 16:40:10 +04:00
Dmitriy Vyukov
e2d95c1f24 runtime/race: remove now unused step parameter from range access functions
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/10259043
2013-06-13 16:38:44 +04:00
Dmitriy Vyukov
591d58a3bb cmd/gc: properly race-instrument for loops
Instrumentation of ntest expression should go to ntest->init.
Same for nincr.
Fixes #5340.

R=golang-dev, daniel.morsing
CC=golang-dev
https://golang.org/cl/10026046
2013-06-13 16:03:58 +04:00
Dmitriy Vyukov
2ffaefd161 runtime: use ROUND macro for rounding
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/10256043
2013-06-13 16:02:50 +04:00
Dmitriy Vyukov
cc99e6e949 runtime/race: update runtime to r183644
This revision properly handles memory range accesses.
Fixes #4453.
Fixes #5654.

R=golang-dev, iant, remyoudompheng
CC=golang-dev
https://golang.org/cl/10082043
2013-06-13 14:32:05 +04:00
Rob Pike
28a1c36d62 testing: add -outputdir flag so "go test" controls where the files are written
Obscure misfeature now fixed: When run from "go test", profiles were always
written in the package's source directory. This change puts them in the directory
where "go test" is run.
Also fix a couple of problems causing errors in testing.after to go unreported
unless -v was set.

R=rsc, minux.ma, iant, alex.brainman
CC=golang-dev
https://golang.org/cl/10234044
2013-06-12 18:13:34 -07:00
Ian Lance Taylor
0627248a1f runtime: update runtime·gogo comment in asm files
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/10244043
2013-06-12 15:05:10 -07:00
Russ Cox
d67e7e3acf runtime: add lr, ctxt, ret to Gobuf
Add gostartcall and gostartcallfn.
The old gogocall = gostartcall + gogo.
The old gogocallfn = gostartcallfn + gogo.

R=dvyukov, minux.ma
CC=golang-dev
https://golang.org/cl/10036044
2013-06-12 15:22:26 -04:00
Dmitriy Vyukov
a8ad859c30 runtime: more flexible heap memory mapping on 64-bits
Fixes #5641.

R=golang-dev, dave, daniel.morsing, iant
CC=golang-dev, kcc
https://golang.org/cl/10126044
2013-06-12 18:47:16 +04:00
Dmitriy Vyukov
dbcfed93e7 runtime: fix scheduler race condition
In starttheworld() we assume that P's with local work
are situated in the beginning of idle P list.
However, once we start the first M, it can execute all local G's
and steal G's from other P's.
That breaks the assumption above. Thus starttheworld() will fail
to start some P's with local work.
It seems that it can not lead to very bad things, but still
it's wrong and breaks other assumtions
(e.g. we can have a spinning M with local work).
The fix is to collect all P's with local work first,
and only then start them.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/10051045
2013-06-12 18:46:35 +04:00
Russ Cox
e5cbebc1ad runtime: fix plan9, windows builds
TBR=dvyukov
CC=golang-dev
https://golang.org/cl/10229043
2013-06-12 09:41:29 -04:00
Russ Cox
80efeff20a runtime: fix build
TBR=dvyukov
CC=golang-dev
https://golang.org/cl/10227044
2013-06-12 09:06:28 -04:00
Russ Cox
e58f798c0c runtime: adjust traceback / garbage collector boundary
The garbage collection routine addframeroots is duplicating
logic in the traceback routine that calls it, sometimes correctly,
sometimes incorrectly, sometimes incompletely.
Pass necessary information to addframeroots instead of
deriving it anew.

Should make addframeroots significantly more robust.
It's certainly smaller.

Also try to standardize on uintptr for saved pc, sp values.

Will make CL 10036044 trivial.

R=golang-dev, dave, dvyukov
CC=golang-dev
https://golang.org/cl/10169045
2013-06-12 08:49:38 -04:00
Russ Cox
7ea75a5f18 cmd/go: diagnose invalid coverage runs
# bufio
coverage analysis cannot handle package (bufio_test imports testing imports bufio)
# bytes
coverage analysis cannot handle package (bytes_test imports encoding/base64 imports bytes)
# crypto/cipher
coverage analysis cannot handle package (cipher_test imports crypto/aes imports crypto/cipher)
# debug/dwarf
coverage analysis cannot handle package (dwarf_test imports debug/elf imports debug/dwarf)
# errors
coverage analysis cannot handle package (errors_test imports fmt imports errors)
# flag
coverage analysis cannot handle package (flag_test imports testing imports flag)
# fmt
coverage analysis cannot handle package (fmt_test imports testing imports fmt)
# go/ast
coverage analysis cannot handle package (ast_test imports go/format imports go/ast)
# image
coverage analysis cannot handle package (image_test imports image/gif imports image)
# io
coverage analysis cannot handle package (io_test imports bytes imports io)
# math
coverage analysis cannot handle package (math_test imports fmt imports math)
# net/http
coverage analysis cannot handle package (http_test imports net/http/httptest imports net/http)
# os
coverage analysis cannot handle package (os_test imports flag imports os)
# path/filepath
coverage analysis cannot handle package (filepath_test imports io/ioutil imports path/filepath)
# reflect
coverage analysis cannot handle package (reflect_test imports flag imports reflect)
# runtime
coverage analysis cannot handle package (runtime_test imports fmt imports runtime)
# runtime/pprof
coverage analysis cannot handle package (pprof_test imports testing imports runtime/pprof)
# sort
coverage analysis cannot handle package (sort_test imports testing imports sort)
# strconv
coverage analysis cannot handle package (strconv_test imports fmt imports strconv)
# strings
coverage analysis cannot handle package (strings_test imports testing imports strings)
# sync
coverage analysis cannot handle package (sync_test imports fmt imports sync)
# sync/atomic
coverage analysis cannot handle package (atomic_test imports testing imports sync/atomic)
# syscall
coverage analysis cannot handle package (syscall_test imports flag imports syscall)
# text/tabwriter
coverage analysis cannot handle package (tabwriter_test imports testing imports text/tabwriter)
# time
coverage analysis cannot handle package (time_test imports encoding/gob imports time)
# unicode
coverage analysis cannot handle package (unicode_test imports testing imports unicode)
# unicode/utf8
coverage analysis cannot handle package (utf8_test imports bytes imports unicode/utf8)

R=r
CC=golang-dev
https://golang.org/cl/10216043
2013-06-12 08:42:05 -04:00
Shenghou Ma
da634dd703 cmd/go: clarify test filenames in help messages
Fixes #5655.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9944044
2013-06-12 19:40:58 +08:00
Rob Pike
bc7e26621e cmd/go: use -o option of cover tool
Separates correct from erroneous output so errors running the tool will appear
in the log.

R=rsc
CC=golang-dev
https://golang.org/cl/10191043
2013-06-11 20:47:35 -07:00
Ian Lance Taylor
ae5e791ed2 cmd/gc: save local var list before inlining
This avoids problems with inlining in genwrappers, which
occurs after functions have been compiled.  Compiling a
function may cause some unused local vars to be removed from
the list.  Since a local var may be unused due to
optimization, it is possible that a removed local var winds up
beingused in the inlined version, in which case hilarity
ensues.

Fixes #5515.

R=golang-dev, khr, dave
CC=golang-dev
https://golang.org/cl/10210043
2013-06-11 20:23:21 -07:00
Russ Cox
e440354c40 cmd/gc: turn race detector off for tail-call method wrapper functions
It was off in the old implementation (because there was no high-level
description of the function at all). Maybe some day the race detector
should be fixed to handle the wrapper and then enabled for it, but there's
no reason that has to be today.

R=golang-dev
TBR=dvyukov
CC=golang-dev
https://golang.org/cl/10037045
2013-06-11 22:37:07 -04:00
Shenghou Ma
e50e4f7ec1 cmd/ld: supply -s to gcc if -s is passed.
Fixes #5463.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/9239045
2013-06-12 06:56:50 +08:00
Shenghou Ma
ccd1d07cc4 runtime: round spans_size up to page boundary
in case we have weird (not page aligned) memory limit.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/10199043
2013-06-12 05:22:49 +08:00
Russ Cox
6120ef0799 runtime: rename _rt0_$GOARCH to _rt0_go
There's no reason to use a different name on each architecture,
and doing so makes it impossible for portable code to refer to
the original Go runtime entry point. Rename it _rt0_go everywhere.

This is a global search and replace only.

R=golang-dev, bradfitz, minux.ma
CC=golang-dev
https://golang.org/cl/10196043
2013-06-11 16:49:24 -04:00
Rémy Oudompheng
880d869764 cmd/gc: compute initialization order for top-level blank vars too.
Fixes #5244.

R=golang-dev, rsc, iant, r, daniel.morsing
CC=golang-dev
https://golang.org/cl/8601044
2013-06-11 22:21:51 +02:00
Daniel Morsing
e7657de717 cmd/gc: avoid creating circular lists when compiling with race detector.
Fixes #5431.

R=dvyukov, remyoudompheng, rsc
CC=gobot, golang-dev
https://golang.org/cl/9910043
2013-06-11 21:19:29 +02:00
Rob Pike
caefc5d0ca cmd/go: add coverage analysis
This feature is not yet ready for real use. The CL marks a bite-sized
piece that is ready for review. TODOs that remain:
        provide control over output
        produce output without setting -v
        make work on reflect, sync and time packages
                (fail now due to link errors caused by inlining)
        better documentation
Almost all packages work now, though, if clumsily; try:
        go test -v -cover=count encoding/binary

R=rsc
CC=gobot, golang-dev, remyoudompheng
https://golang.org/cl/10050045
2013-06-11 09:35:10 -07:00
Keith Randall
e4b5cbde46 cmd/cc: emit size of locals. Will be used for stack copying.
R=cshapiro, dvyukov, khr, rsc
CC=golang-dev
https://golang.org/cl/10005044
2013-06-11 09:01:27 -07:00
Russ Cox
1f51d27922 cmd/gc: move genembedtramp into portable code
Requires adding new linker instruction
        RET	f(SB)
meaning return but then immediately call f.
This is what you'd use to implement a tail call after
fiddling with the arguments, but the compiler only
uses it in genwrapper.

This CL eliminates the copy-and-paste genembedtramp
functions from 5g/8g/6g and makes the code run on ARM
for the first time. It removes a small special case for function
generation, which should help Carl a bit, but at the same time
it does not bother to implement general tail call optimization,
which we do not want anyway.

Fixes #5627.

R=ken2
CC=golang-dev
https://golang.org/cl/10057044
2013-06-11 09:41:49 -04:00
Alex Brainman
9b2561ef16 os: request appropriate access rights before calling windows TerminateProcess
Fixes #5615.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/9651047
2013-06-11 13:06:38 +10:00
Gerasimos Dimitriadis
02a891b30b asn1: Improved encoding/decoding for OID types
The first identifier in an Object Identifer must be between 0 and 2
inclusive. The range of values that the second one can take depends
on the value of the first one.
The two first identifiers are not necessarily encoded in a single octet,
but in a varint.

R=golang-dev, agl
CC=golang-dev
https://golang.org/cl/10140046
2013-06-10 18:14:47 -04:00
Shenghou Ma
71051953e0 cmd/ld: document -s flag.
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/10159043
2013-06-11 04:58:02 +08:00
Russ Cox
5b15b44434 cmd/cc: fix lexbody for negative chars
The new code matches the code in cc/lex.c and the #define GETC.
This was causing problems scanning runtime·foo if the leading
· byte was returned by the buffer fill.

R=ken2
CC=golang-dev
https://golang.org/cl/10167043
2013-06-10 16:13:25 -04:00
Shenghou Ma
35e1deaebf cmd/5l: use BLX for BL (Rx).
Fixes #5111.
Update #4718
This CL makes BL (Rx) to use BLX Rx instead of:
MOV LR, PC
MOV PC, Rx

R=cshapiro, rsc
CC=dave, gobot, golang-dev
https://golang.org/cl/9669045
2013-06-11 03:04:24 +08:00
Dmitriy Vyukov
fd41926347 runtime: fix one-time memory leak on linux
Update #5641.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/10144043
2013-06-10 22:59:39 +04:00
Dmitriy Vyukov
62747bde6c runtime: catch races between channel close and channel send in select
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/10137043
2013-06-10 22:58:04 +04:00
Shenghou Ma
06f55f5009 net: introduce netgo build tag to build a pure Go net package.
Fixes #4078.

R=golang-dev, bradfitz, rsc, iant
CC=golang-dev
https://golang.org/cl/7100050
2013-06-11 02:55:16 +08:00
Shenghou Ma
b637135003 cmd/cgo: makes clang happy by not using __gcc_struct__ attribute.
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/10150043
2013-06-11 02:51:01 +08:00
Shenghou Ma
46e30c7d70 syscall: add {Set,Get}priority for Linux, and consistency tests
R=golang-dev, iant, bradfitz, dave
CC=golang-dev
https://golang.org/cl/7430044
2013-06-11 02:47:04 +08:00
Dmitriy Vyukov
fc80764792 runtime/race: tell race detector what memory Read/Write syscalls touch
Fixes #5567.

R=golang-dev, dave, iant
CC=golang-dev
https://golang.org/cl/10085043
2013-06-10 22:40:35 +04:00
Dmitriy Vyukov
0f4897ae1a sync: improve race instrumentation of WaitGroup
Do not synchronize Add(1) with Wait().
Imitate read on first Add(1) and write on Wait(),
it allows to catch common misuses of WaitGroup:
- Add() called in the additional goroutine itself
- incorrect reuse of WaitGroup with multiple waiters

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/10093044
2013-06-10 22:38:58 +04:00
Shenghou Ma
ed6dce6f9d cmd/5l: use guaranteed undefined instruction for UNDEF to match [68]l.
R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/10085050
2013-06-11 02:02:42 +08:00
Alex Brainman
bb6e265fed os: return io.EOF from windows ReadAt as documented
Fixes #5619.

R=golang-dev, r, peter.armitage, go.peter.90
CC=golang-dev
https://golang.org/cl/9952044
2013-06-10 19:14:41 +10:00
Dmitriy Vyukov
4f514e8691 runtime: use persistentalloc instead of SysAlloc in FixAlloc
Also reduce FixAlloc allocation granulatiry from 128k to 16k,
small programs do not need that much memory for MCache's and MSpan's.

R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/10140044
2013-06-10 09:20:27 +04:00
Dmitriy Vyukov
83445fdcc3 runtime: use persistentalloc instead of mallocgc in symtab
Reduces heap size.

R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/10140043
2013-06-10 09:17:46 +04:00
Dmitriy Vyukov
99922aba8b runtime: use persistentalloc instead of SysAlloc in GC
Especially important for Windows because it reserves VM
only in multiple of 64k.

R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/10082048
2013-06-10 09:16:06 +04:00
Dmitriy Vyukov
b36f2db12a runtime: use persistentalloc instead of mallocgc for itab
Reduces heap size.

R=golang-dev, remyoudompheng, bradfitz
CC=golang-dev
https://golang.org/cl/10139043
2013-06-09 21:58:35 +04:00
Dmitriy Vyukov
5290e55164 runtime: use persistentalloc instead of SysAlloc in netpoll
Especially important for Windows because it reserves VM
only in multiple of 64k.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/10138043
2013-06-09 21:39:47 +04:00
Dmitriy Vyukov
8cf7044983 runtime: use persistentalloc instead of custom malloc in memory profiler
Removes code duplication.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/9874055
2013-06-09 21:38:37 +04:00
Shenghou Ma
949228a322 cmd/cgo: use gcc_struct attribute for packed structs to work around GCC PR52991.
Fixes #5603.

R=iant, dave
CC=gobot, golang-dev
https://golang.org/cl/9895043
2013-06-09 22:06:29 +08:00
Shenghou Ma
e880ab112e runtime: remove unused file mkversion.c
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/10107044
2013-06-09 22:04:17 +08:00
Shenghou Ma
faef52c214 all: fix typos
R=golang-dev, bradfitz, khr, r
CC=golang-dev
https://golang.org/cl/7461046
2013-06-09 21:50:24 +08:00
Roger Peppe
822da40814 cmd/go: update go vet documentation
R=rsc, minux.ma, r
CC=golang-dev
https://golang.org/cl/10110043
2013-06-07 19:01:07 +01:00
Ian Lance Taylor
b6e52ecffa runtime: remove unused mid function
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/10036047
2013-06-06 18:10:42 -07:00
Dmitriy Vyukov
8bf57c3dcb runtime: remove unused field from Hchan
Remove alignment logic as well, it's not respected by chanbuf() anyway.

R=golang-dev, dave, minux.ma, r, iant, rsc
CC=golang-dev
https://golang.org/cl/9678046
2013-06-06 23:06:12 +04:00
Dmitriy Vyukov
5d637b83a9 runtime: speedup malloc stats collection
Count only number of frees, everything else is derivable
and does not need to be counted on every malloc.
benchmark                    old ns/op    new ns/op    delta
BenchmarkMalloc8                    68           66   -3.07%
BenchmarkMalloc16                   75           70   -6.48%
BenchmarkMallocTypeInfo8           102           97   -4.80%
BenchmarkMallocTypeInfo16          108          105   -2.78%

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/9776043
2013-06-06 14:56:50 +04:00
Alex Brainman
07ea243d50 time: provide timezone abbreviations on windows
Use http://unicode.org/cldr/data/common/supplemental/windowsZones.xml
to generate the map.

Fixes #4838.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/9997043
2013-06-06 16:30:25 +10:00
Robert Obryk
9614119007 io/ioutil: make WriteFile notice errors from Close()
WriteFile should not successfully return if the file's
Close call failed.

Fixes #5644.

R=golang-dev, kr, r
CC=golang-dev
https://golang.org/cl/10067043
2013-06-05 21:16:44 -07:00
Russ Cox
f268c295a3 cmd/6c: use full 64-bit address in block copy
Already fixed independently in Plan 9.

R=ken2
CC=golang-dev
https://golang.org/cl/10041044
2013-06-05 10:39:06 -04:00
Russ Cox
26d43a0f22 cmd/6l: accept NOP of $x+10(SP) and of X0
Needed to link code compiled with 6c -N.

R=ken2
CC=golang-dev
https://golang.org/cl/10043044
2013-06-05 10:38:52 -04:00
Russ Cox
528534c1d4 runtime: fix comments (g->gobuf became g->sched long ago)
Should reduce size of CL 9868044.

R=golang-dev, ality
CC=golang-dev
https://golang.org/cl/10045043
2013-06-05 07:16:53 -04:00
Russ Cox
f032eefdb0 cmd/cgo, cmd/go, go/build: sort flag lists
CFLAGS comes before CPPFLAGS.
Also fix one typo CPPCFLAGS.

Cleanup for CL 8248043.

R=golang-dev, iant, alberto.garcia.hierro
CC=golang-dev
https://golang.org/cl/9965045
2013-06-05 07:14:05 -04:00
Anthony Martin
5567592c07 mime: add support for Plan 9
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/10028043
2013-06-04 17:30:45 -07:00
Nigel Tao
427bec62b5 image/jpeg: avoid documentation argument over whether it's luma
subsampling or chroma subsampling.

Fixes #5569.

R=r
CC=golang-dev
https://golang.org/cl/9900044
2013-06-05 10:18:06 +10:00
Anthony Martin
cdfbe00d91 runtime: fix description of SysAlloc
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/10010046
2013-06-04 17:12:29 -07:00
Adam Langley
2112fed743 crypto/tls: support TLS 1.1.
The significant change between TLS 1.0 and 1.1 is the addition of an explicit IV in the case of CBC encrypted records. Support for TLS 1.1 is needed in order to support TLS 1.2.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7880043
2013-06-04 20:02:22 -04:00
Adam Langley
eec014de66 encoding/asn1: harmonise error prefixes.
This change ensures that error messages always start with "asn1: ".

R=golang-dev, gedimitr
CC=golang-dev
https://golang.org/cl/9751043
2013-06-04 19:51:26 -04:00
Anthony Martin
781b2a2519 cmd/cc: support 21-bit runes in wide string constants
Changeset 7557a627e9b5 added a temporary stop-gap to silence
a print format warning for %S. This has been reverted.

None of this code is original. It was copied from the latest
Plan 9 compilers.

R=golang-dev, r, rsc
CC=golang-dev
https://golang.org/cl/8630044
2013-06-04 16:30:55 -07:00
Carl Shapiro
acd887ba57 cmd/5g, cmd/6g, cmd/8g: remove prototypes for proglist
Each of the backends has two prototypes for this function but
no corresponding definition.

R=golang-dev, bradfitz, khr
CC=golang-dev
https://golang.org/cl/9930045
2013-06-04 16:22:59 -07:00
Anthony Martin
2449909d81 cmd/5c, cmd/6c, cmd/8c: isolate textflag and dataflag
Fixes #5419.

R=golang-dev, dave, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/9241044
2013-06-04 15:18:02 -07:00
Anthony Martin
251baea1af cmd/ld: fix gcdata and gcbss symbols
These two symbols don't show up in the Go symbol table
since they're defined in dodata which is called sometime
after symtab. They do, however, show up in the ELF symbol
table.

This regression was introduced in changeset 01c40d533367.

Also, remove the corresponding strings from the ELF strtab
section now that they're unused.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/8650043
2013-06-04 07:07:22 -07:00
Ian Lance Taylor
941db1ed39 encoding/gob: consistently use unsafe.Pointer for pointer values
Fixes #5621.

R=golang-dev, cshapiro, r, fullung
CC=golang-dev
https://golang.org/cl/9988043
2013-06-04 06:20:57 -07:00
Rémy Oudompheng
2c0b00744f cmd/6c, cmd/8c: avoid generating long multiplication when not necessary.
On amd64
benchmark                        old ns/op    new ns/op    delta
BenchmarkHashStringSpeed                91           74  -18.49%
BenchmarkHashInt32Speed                 54           45  -17.88%
BenchmarkHashInt64Speed                 76           58  -23.53%
BenchmarkHashStringArraySpeed          231          188  -18.61%

Fixes #5367.

R=golang-dev, iant, dave, daniel.morsing, ality, rsc
CC=golang-dev
https://golang.org/cl/9040043
2013-06-04 08:33:00 +02:00
Rémy Oudompheng
62891fb811 cmd/gc: fix missing slice/array types in export data.
Fixes #5614.

R=golang-dev
CC=golang-dev
https://golang.org/cl/9953044
2013-06-04 08:18:36 +02:00
Alex Brainman
9bc0eaf60e runtime: update defs_windows_*.h files
New version of cmd/cgo from
https://golang.org/cl/9574043/
is used to regenerate these.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/9679046
2013-06-04 12:50:40 +10:00
Russ Cox
fa4a9ff764 cmd/ld, runtime: clean up CL 9666047
Remove unnecessary ( ) around == in && clause.
Add { } around multiline if body, even though it's one statement.

Add runtime: prefix to printed errors.

R=cshapiro, iant
CC=golang-dev
https://golang.org/cl/9685047
2013-06-03 16:44:35 -04:00
Rob Pike
59fb90ac85 cmd/go: document flag passing for tests
Fixes #5566.

R=rsc
CC=gobot, golang-dev
https://golang.org/cl/9882043
2013-06-03 16:39:42 -04:00
Rémy Oudompheng
394706b646 compress/bzip2: faster decoding.
benchmark                old ns/op    new ns/op    delta
BenchmarkDecodeDigits     19451173     14347829  -26.24%
BenchmarkDecodeTwain      57516800     42619978  -25.90%

benchmark                 old MB/s     new MB/s  speedup
BenchmarkDecodeDigits         2.22         3.01    1.36x
BenchmarkDecodeTwain          2.17         2.93    1.35x

R=golang-dev, dave, bradfitz, agl
CC=golang-dev
https://golang.org/cl/9915043
2013-06-03 20:38:00 +02:00
Dmitriy Vyukov
4a8ef1f65d runtime: disable preemption in several scheduler functions
Required for preemptive scheduler, see the comments for details.

R=golang-dev, khr, iant, khr
CC=golang-dev
https://golang.org/cl/9740051
2013-06-03 14:40:38 +04:00
Dmitriy Vyukov
354ec51666 runtime: introduce preemption function (not used for now)
This is part of preemptive scheduler.

R=golang-dev, cshapiro, iant
CC=golang-dev
https://golang.org/cl/9843046
2013-06-03 13:20:17 +04:00
Dmitriy Vyukov
f5becf4233 runtime: add stackguard0 to G
This is part of preemptive scheduler.
stackguard0 is checked in split stack checks and can be set to StackPreempt.
stackguard is not set to StackPreempt (holds the original value).

R=golang-dev, daniel.morsing, iant
CC=golang-dev
https://golang.org/cl/9875043
2013-06-03 12:28:24 +04:00
Rémy Oudompheng
0d0d57ccfe cmd/gc: do not corrupt init() with initializers of _ in closures.
Fixes #5607.

R=golang-dev, daniel.morsing, r, dsymonds
CC=golang-dev
https://golang.org/cl/9952043
2013-06-02 23:54:34 +02:00
Shenghou Ma
5b097e7951 cmd/cgo: using __typeof__(a->r) instead of putting invalid TYPE in "a->r = (const TYPE)"
Thanks kballard for the hint.
Fixes #4857.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/9649045
2013-06-02 22:46:53 +08:00
Rémy Oudompheng
5a810f7c0a cmd/fix: remove obsolete testdata.
The corresponding rules have been removed for Go 1.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9940044
2013-06-02 15:40:32 +02:00
Rémy Oudompheng
57d89fb659 cmd/fix: check type assertion in netipv6zone rule.
Fixes #5461.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9947043
2013-06-02 15:39:47 +02:00
Dave Cheney
a28609d66f testing: fix rounding error in roundDown10
Fixes #5599.

Thanks to minux.ma for the suggested fix.

As we now have a harness to test testing internal functions I added some coverage for testing.roundUp, as it is the main consumer of roundDown10.

R=minux.ma, kr, r
CC=golang-dev
https://golang.org/cl/9926043
2013-06-02 09:13:12 +10:00
Dmitriy Vyukov
83d4cd758c runtime: minor code style improvements (followup to change 9778049)
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9693044
2013-06-02 01:45:26 +04:00
Daniel Morsing
bf9a00bc8f cmd/gc: fix overflow in array bounds calculation.
Fixes #5609.

R=golang-dev, remyoudompheng, r
CC=golang-dev
https://golang.org/cl/9757045
2013-06-01 16:33:54 +02:00
Keith Randall
7f0ee023ba runtime: revert of CL 8852047: do hashmap grow work during reads.
seems to break freebsd-386.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/9915047
2013-05-31 21:44:32 -07:00
Keith Randall
07b6add0ca runtime: do hashmap grow work during reads.
Before this change, grow work was done only
during map writes to ensure multithreaded safety.
This can lead to maps remaining in a partially
grown state for a long time, potentially forever.
This change allows grow work to happen during reads,
which will lead to grow work finishing sooner, making
the resulting map smaller and faster.

Grow work is not done in parallel.  Reads can
happen in parallel while grow work is happening.

R=golang-dev, dvyukov, khr, iant
CC=golang-dev
https://golang.org/cl/8852047
2013-05-31 20:58:31 -07:00
Keith Randall
71f061043d runtime/gc: Run garbage collector on g0 stack
instead of regular g stack. We do this so that the g stack
we're currently running on is no longer changing.  Cuts
the root set down a bit (g0 stacks are not scanned, and
we don't need to scan gc's internal state).  Also an
enabler for copyable stacks.

R=golang-dev, cshapiro, khr, 0xe2.0x9a.0x9b, dvyukov, rsc, iant
CC=golang-dev
https://golang.org/cl/9754044
2013-05-31 20:43:33 -07:00
Anthony Martin
af7f7b7515 lib9/utf: remove unneccesary includes
R=golang-dev, r, bradfitz
CC=golang-dev
https://golang.org/cl/8651043
2013-05-31 15:53:26 -07:00
Carl Shapiro
31be5deae4 cmd/5g, cmd/6g, cmd/8g: provide embedded trampolines with argument size information
An embedded trampoline is a function that exists to marshal
a receiver of type *S to a receiver of type *T when T is an
embedded field in S.

Embedded trampolines are generated by a special path through
the compiler and are not subject to the general analysis and
annotation done to functions.  Their effects must be provided
explicitly.

R=golang-dev, r, daniel.morsing, minux.ma
CC=golang-dev
https://golang.org/cl/9874043
2013-05-31 13:34:57 -07:00
Alberto García Hierro
84485361f9 cmd/go: Add support for including C++ files in packages
* Add a CXXFiles field to Package, which includes .cc, .cpp and .cxx  files.
* CXXFiles are compiled using g++, which can be overridden using the CXX environment variable.
* Include .hh, .hpp and .hxx files in HFiles.
* Add support for CPPFLAGS (used for both C and C++) and CXXFLAGS (used only for C++) in cgo directive.
* Changed pkg-config cgo directive to modify CPPFLAGS rather than CFLAGS, so both C and C++ files get any flag returned by pkg-config --cflags.

Fixes #1476.

R=iant, r
CC=bradfitz, gobot, golang-dev, iant, minux.ma, remyoudompheng, seb.binet
https://golang.org/cl/8248043
2013-05-31 11:33:36 -07:00
Dave Cheney
787976c739 testing: add test for issue 5599
Update #5599

R=golang-dev, r, minux.ma
CC=golang-dev
https://golang.org/cl/9738052
2013-05-31 23:03:22 +10:00
Dmitriy Vyukov
9ba551bb87 runtime: fix heap coalescing bug introduced in cl/9802043
mheap.map become a pointer, so nelem(h->map) returns 1 rather than the map size.
As the result coalescing with subsequent spans does not happen.

R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/9649046
2013-05-31 10:58:50 +04:00
Dmitriy Vyukov
86da989ee5 runtime: introduce helper persistentalloc() function
It is a caching wrapper around SysAlloc() that can allocate small chunks.
Use it for symtab allocations. Reduces number of symtab walks from 4 to 3
(reduces buildfuncs time from 10ms to 7.5ms on a large binary,
reduces initial heap size by 680K on the same binary).
Also can be used for type info allocation, itab allocation.
There are also several places in GC where we do the same thing,
they can be changed to use persistentalloc().
Also can be used in FixAlloc, because each instance of FixAlloc allocates
in 128K regions, which is too eager.
Reincarnation of committed and rolled back https://golang.org/cl/9805043
The latent bugs that it revealed are fixed:
https://golang.org/cl/9837049
https://golang.org/cl/9778048

R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/9778049
2013-05-31 10:42:30 +04:00
Keith Randall
d6f89d735e runtime: set MSpan.limit properly for large spans.
Then use the limit to make sure MHeap_LookupMaybe & inlined
copies don't return a span if the pointer is beyond the limit.
Use this fact to optimize all call sites.

R=golang-dev, dvyukov
CC=golang-dev
https://golang.org/cl/9869045
2013-05-30 21:32:20 -07:00
Rob Pike
cf5dd6ad64 testing: quantize AllocsPerRun
As the code now says:

We are forced to return a float64 because the API is silly, but do
the division as integers so we can ask if AllocsPerRun()==1
instead of AllocsPerRun()<2.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/9837049
2013-05-30 11:28:08 -04:00
Dmitriy Vyukov
e17281b397 runtime: rename mheap.maps to mheap.spans
as was dicussed in cl/9791044

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9853046
2013-05-30 17:09:58 +04:00
Dmitriy Vyukov
573d25a423 runtime: mark runtime.goexit as nosplit
Required for preemptive scheduler, see the comment.

R=golang-dev, daniel.morsing
CC=golang-dev
https://golang.org/cl/9841047
2013-05-30 14:11:49 +04:00
Rémy Oudompheng
2c4b029b75 cmd/gc: use escape analysis result for make([]T, constant
Escape analysis already gives that the underlying array
does not escape but the result was ignored.

Fixes #5484.

R=golang-dev, dave, daniel.morsing
CC=golang-dev
https://golang.org/cl/9662046
2013-05-30 08:32:00 +02:00
Lucio De Re
0b88587d22 cmd/[568]l/obj.c: NULL is not recognised in Plan 9 build, use nil instead.
Fixes #5591.

R=golang-dev, dave, minux.ma, cshapiro
CC=carl shapiro <cshapiro, golang-dev
https://golang.org/cl/9839046
2013-05-30 15:02:10 +10:00
Carl Shapiro
037a1a9f31 cmd/ld, runtime: emit pointer maps for nosplits identified by the linker
A nosplits was assumed to have no argument information and no
pointer map.  However, nosplits created by the linker often
have both.  This change uses the pointer map size as an
alternate source of argument size when processing a nosplit.

In addition, the symbol table construction pointer map size
and argument size consistency check is strengthened.  If a
nptrs is greater than 0 it must be equal to the number of
argument words.

R=golang-dev, khr, khr
CC=golang-dev
https://golang.org/cl/9666047
2013-05-29 17:16:57 -07:00
Shenghou Ma
5d081792b6 cmd/5a, cmd/dist, runtime: support m/g in the assembler, drop support for R9/R10
to avoid unintentionally clobber R9/R10.
Thanks Lucio for the suggestion.

PS: yes, this could be considered a big change (but not an API change), but
as it turns out even temporarily changes R9/R10 in user code is unsafe and
leads to very hard to diagnose problems later, better to disable using R9/R10
when the user first uses it.
See CL 6300043 and CL 6305100 for two problems caused by misusing R9/R10.

R=golang-dev, khr, rsc
CC=golang-dev
https://golang.org/cl/9840043
2013-05-30 03:03:52 +08:00
Carl Shapiro
322c08f2f7 cmd/gc: remove unused bit vector comparison code
R=golang-dev, dave, iant
CC=golang-dev
https://golang.org/cl/9738045
2013-05-29 11:46:14 -07:00
Jan Ziak
a3e0002e6a runtime: remove all badcallback() functions
R=iant
CC=golang-dev
https://golang.org/cl/9738046
2013-05-29 17:51:17 +02:00
Rob Pike
d84132cce7 fmt: change evalutation of indexed arg to match docs
The old code put the index before the period in the precision;
it should be after so it's always before the star, as documented.
A little trickier to do in one pass but compensated for by more
tests and catching a couple of other error cases.

R=rsc
CC=golang-dev
https://golang.org/cl/9751044
2013-05-29 11:29:29 -04:00
John Shahid
ca986a2c81 crypto/tls: Check all certificates in the path.
Currently we only check the leaf node's issuer against the list of
distinguished names in the server's CertificateRequest message. This
will fail if the client certiciate has more than one certificate in
the path and the leaf node issuer isn't in the list of distinguished
names, but the issuer's issuer was in the distinguished names.

R=agl, agl
CC=gobot, golang-dev
https://golang.org/cl/9795043
2013-05-29 11:21:32 -04:00
Dmitriy Vyukov
e932c2035f runtime: make notetsleep() return false if timeout happens
This is needed for preemptive scheduler, because during
stoptheworld we want to wait with timeout and re-preempt
M's on timeout.

R=golang-dev, remyoudompheng, iant
CC=golang-dev
https://golang.org/cl/9375043
2013-05-29 11:49:45 +04:00
Carl Shapiro
4e0a51c210 cmd/5l, cmd/6l, cmd/8l, cmd/gc, runtime: generate and use bitmaps of argument pointer locations
With this change the compiler emits a bitmap for each function
covering its stack frame arguments area.  If an argument word
is known to contain a pointer, a bit is set.  The garbage
collector reads this information when scanning the stack by
frames and uses it to ignores locations known to not contain a
pointer.

R=golang-dev, bradfitz, daniel.morsing, dvyukov, khr, khr, iant, cshapiro
CC=golang-dev
https://golang.org/cl/9223046
2013-05-28 17:59:10 -07:00
Dmitriy Vyukov
8bbb08533d runtime: make mheap statically allocated again
This depends on: 9791044: runtime: allocate page table lazily
Once page table is moved out of heap, the heap becomes small.
This removes unnecessary dereferences during heap access.
No logical changes.

R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/9802043
2013-05-28 22:14:47 +04:00
Dmitriy Vyukov
671814b904 runtime: allocate page table lazily
This removes the 256MB memory allocation at startup,
which conflicts with ulimit.
Also will allow to eliminate an unnecessary memory dereference in GC,
because the page table is usually mapped at known address.
Update #5049.
Update #5236.

R=golang-dev, khr, r, khr, rsc
CC=golang-dev
https://golang.org/cl/9791044
2013-05-28 22:04:34 +04:00
Dmitriy Vyukov
081129e286 runtime: allocate internal symbol table eagerly
we need it for GC anyway.

R=golang-dev, khr, dave, khr
CC=golang-dev
https://golang.org/cl/9728044
2013-05-28 21:10:10 +04:00
Dmitriy Vyukov
4d6bfcf245 os/exec: fix test hang
Currently the test closes random files descriptors,
which leads to hang (in particular if netpoll fd is closed).
Try to open only fd 3, since the parent process expects it to be fd 3 anyway.
Fixes #5571.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9778048
2013-05-28 21:09:27 +04:00
Dmitriy Vyukov
2f5825d427 runtime: fix heap corruption during GC
The 'n' variable is used during rescan initiation in GC_END case,
but it's overwritten with chan capacity in GC_CHAN case.
As the result rescan is done with the wrong object size.
Fixes #5554.

R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/9831043
2013-05-28 19:17:47 +04:00
Shenghou Ma
d8fd8d89ea runtime: use m and g, instead of R9 and R10, in ARM assembly files
also don't clobber R9 if it is about to crash.

In response to https://golang.org/cl/9251043/#msg2.

R=golang-dev, khr, khr, dave
CC=golang-dev
https://golang.org/cl/9778046
2013-05-28 20:13:02 +08:00
Dmitriy Vyukov
828c68f8d8 undo CL 9805043 / 776aba85ece8
multiple failures on amd64

««« original CL description
runtime: introduce helper persistentalloc() function
It is a caching wrapper around SysAlloc() that can allocate small chunks.
Use it for symtab allocations. Reduces number of symtab walks from 4 to 3
(reduces buildfuncs time from 10ms to 7.5ms on a large binary,
reduces initial heap size by 680K on the same binary).
Also can be used for type info allocation, itab allocation.
There are also several places in GC where we do the same thing,
they can be changed to use persistentalloc().
Also can be used in FixAlloc, because each instance of FixAlloc allocates
in 128K regions, which is too eager.

R=golang-dev, daniel.morsing, khr
CC=golang-dev
https://golang.org/cl/9805043
»»»

R=golang-dev
CC=golang-dev
https://golang.org/cl/9822043
2013-05-28 11:14:39 +04:00
Dmitriy Vyukov
5166013f75 runtime: inline MCache_Alloc() into mallocgc()
benchmark                    old ns/op    new ns/op    delta
BenchmarkMalloc8                    68           62   -8.63%
BenchmarkMalloc16                   75           69   -7.94%
BenchmarkMallocTypeInfo8           102           98   -3.73%
BenchmarkMallocTypeInfo16          108          103   -4.63%

R=golang-dev, dave, khr
CC=golang-dev
https://golang.org/cl/9790043
2013-05-28 11:05:55 +04:00
Dmitriy Vyukov
47e0a3d7b1 runtime: introduce helper persistentalloc() function
It is a caching wrapper around SysAlloc() that can allocate small chunks.
Use it for symtab allocations. Reduces number of symtab walks from 4 to 3
(reduces buildfuncs time from 10ms to 7.5ms on a large binary,
reduces initial heap size by 680K on the same binary).
Also can be used for type info allocation, itab allocation.
There are also several places in GC where we do the same thing,
they can be changed to use persistentalloc().
Also can be used in FixAlloc, because each instance of FixAlloc allocates
in 128K regions, which is too eager.

R=golang-dev, daniel.morsing, khr
CC=golang-dev
https://golang.org/cl/9805043
2013-05-28 10:47:35 +04:00
Bill Neubauer
82ef961af5 runtime: fix runtime·netpoll() to call runtime·netpollready() only once per event.
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/9808043
2013-05-28 05:03:10 +08:00
Shenghou Ma
ae73b90369 runtime: make arm signal handler call runtime.badsignal
In preparation for CL 9249043 (already submitted).

Fixes #5553.

R=golang-dev, iant, capnm9, dave
CC=golang-dev
https://golang.org/cl/9251043
2013-05-27 20:46:53 +08:00
Dmitriy Vyukov
5782f4117d runtime: introduce cnewarray() to simplify allocation of typed arrays
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/9648044
2013-05-27 11:29:11 +04:00
Jan Ziak
e017e0cb24 runtime: flag static variables as no-pointers
Variables in data sections of 32-bit executables interfere with
garbage collector's ability to free objects and/or unnecessarily
slow down the garbage collector.

This changeset moves some static variables to .noptr sections.
'files' in symtab.c is now allocated dynamically.

R=golang-dev, dvyukov, minux.ma
CC=golang-dev
https://golang.org/cl/9786044
2013-05-27 08:11:59 +02:00
Dmitriy Vyukov
46137f227b runtime: update comment on stack allocator
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9665046
2013-05-25 22:47:36 +04:00
Alex Brainman
a2ec8abd2d cmd/cgo: do not output empty struct for -cdefs
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/9574043
2013-05-25 20:53:55 +10:00
Rob Pike
7472ce0e58 fmt.Printf: introduce notation for random access to arguments.
This text is added to doc.go:

        Explicit argument indexes:

        In Printf, Sprintf, and Fprintf, the default behavior is for each
        formatting verb to format successive arguments passed in the call.
        However, the notation [n] immediately before the verb indicates that the
        nth one-indexed argument is to be formatted instead. The same notation
        before a '*' for a width or precision selects the argument index holding
        the value. After processing a bracketed expression [n], arguments n+1,
        n+2, etc. will be processed unless otherwise directed.

        For example,
                fmt.Sprintf("%[2]d %[1]d\n", 11, 22)
        will yield "22, 11", while
                fmt.Sprintf("%[3]*[2].*[1]f", 12.0, 2, 6),
        equivalent to
                fmt.Sprintf("%6.2f", 12.0),
        will yield " 12.00". Because an explicit index affects subsequent verbs,
        this notation can be used to print the same values multiple times
        by resetting the index for the first argument to be repeated:
                fmt.Sprintf("%d %d %#[1]x %#x", 16, 17)
        will yield "16 17 0x10 0x11".

The notation chosen differs from that in C, but I believe it's easier to read
and to remember (we're indexing the arguments), and compatibility with
C's printf was never a strong goal anyway.

While we're here, change the word "field" to "arg" or "argument" in the
code; it was being misused and was confusing.

R=rsc, bradfitz, rogpeppe, minux.ma, peter.armitage
CC=golang-dev
https://golang.org/cl/9680043
2013-05-24 15:49:26 -07:00
David du Colombier
ffe8a3c5e2 build: fix make.rc on Plan 9
Set $status as null to prevent rc from exiting
on the last --no-banner argument checking when
used with rc -e. It allows all.rc to not exit
before executing run.rc

R=golang-dev, lucio.dere, rsc
CC=golang-dev
https://golang.org/cl/9611045
2013-05-24 13:55:19 -07:00
Adam Langley
ddc8679128 crypto/x509: harmonise error prefixes.
crypto/x509 has ended up with a variety of error formats. This change makes them all start with "x509: ".

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9736043
2013-05-24 16:23:13 -04:00
Rob Pike
650a1ef66f cmd/cov: delete
It doesn't work, it's not portable, it's not part of the released
binaries, and a better tool is due.

Fixes #1319.
Fixes #4621.

R=golang-dev, bradfitz, dave, rsc
CC=golang-dev
https://golang.org/cl/9681044
2013-05-24 11:06:06 -07:00
Christopher Nielsen
ee78a707c0 path/filepath: Skip TestEvalSymlinks. Plan 9 doesn't have symlinks.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9713044
2013-05-24 11:01:04 -07:00
Gerasimos Dimitriadis
af48543c54 asn1: Stricter checks for DER encoded booleans
According to X.690, only 0 and 255 are allowed as values
for encoded booleans. Also added some test for parsing
booleans

R=golang-dev, agl, r
CC=golang-dev
https://golang.org/cl/9692043
2013-05-24 12:37:42 -04:00
Dmitriy Vyukov
0806c97209 log/syslog: fix deadlock in test
The problem was that server handlers block on done<-,
the goroutine that reads from done blocks on count<-,
and the main goroutine that is supposed to read from count
waits for server handlers to exit.
Fixes #5547.

R=golang-dev, dave, bradfitz
CC=golang-dev
https://golang.org/cl/9722043
2013-05-24 18:35:48 +04:00
Ian Lance Taylor
598de87b0f cmd/cgo: change GoStringN and GoBytes from intgo to int32
Fixes build.

R=golang-dev
CC=golang-dev
https://golang.org/cl/9667047
2013-05-23 23:19:47 -07:00
Ian Lance Taylor
8f7863d638 cmd/cgo: use intgo, not int, for string and slice structures
Fixes #5548.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/9643044
2013-05-23 22:51:07 -07:00
Frederick Kelly Mayle III
7b9df09261 runtime: faster range on empty map
benchmark                old ns/op    new ns/op    delta
BenchmarkMapIter               191          190   -0.52%
BenchmarkMapIterEmpty           22            4  -78.96%

R=golang-dev, minux.ma, dvyukov, iant, khr
CC=golang-dev
https://golang.org/cl/9637043
2013-05-23 14:17:52 -07:00
Daniel Morsing
fdc4ce6ec7 io: Prioritize WriterTos over ReaderFroms in Copy.
This only affects calls where both ReaderFrom and WriterTo are implemented. WriterTo can issue one large write, while ReaderFrom must Read until EOF, potentially reallocating when out of memory. With one large Write, the Writer only needs to allocate once.

This also helps in ioutil.Discard since we can avoid copying memory when the Reader implements WriterTo.

R=golang-dev, dsymonds, remyoudompheng, bradfitz
CC=golang-dev, minux.ma
https://golang.org/cl/9462044
2013-05-23 18:29:19 +02:00
Nan Deng
876455f3ba crypto/rsa: implement PSS signatures.
This change contains an implementation of the RSASSA-PSS signature
algorithm described in RFC 3447.

R=agl, agl
CC=gobot, golang-dev, r
https://golang.org/cl/9438043
2013-05-23 11:10:41 -04:00
Mikio Hara
adbe59e332 syscall: add IPv6 socket options for Unix variants
This CL adds missing IPv6 socket options which are required
to control IPv6 as described in RFC 3493, RFC 3542.

Update #5538

R=golang-dev, dave, iant
CC=golang-dev
https://golang.org/cl/9373046
2013-05-23 16:22:05 +09:00
Alex Brainman
d67e300f28 cmd/go: check GOROOT directory is present before acting
Fixes #5042.

R=golang-dev, adg, rsc
CC=golang-dev
https://golang.org/cl/7786047
2013-05-23 14:13:02 +10:00
Robert Griesemer
e3a72b05f8 go/doc: fix build
1) go/doc:
   - create correct ast.FuncType
   - use more commonly used variable names in a test case

2) make ast.FuncType.Pos robust in case of incorrect ASTs

R=golang-dev
CC=golang-dev
https://golang.org/cl/9651044
2013-05-22 14:22:50 -07:00
Shenghou Ma
cb8782e8b3 bufio: fix SplitFunc docs
Fixes #5532.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/9672044
2013-05-23 04:38:32 +08:00
Robert Griesemer
75b62e367b go/ast: fix FuncType.Pos() impl. and FuncType.Params documentation
As pointed out by adonovan.

R=golang-dev, adonovan
CC=golang-dev
https://golang.org/cl/9662045
2013-05-22 13:36:43 -07:00
Rob Pike
e17a6d4b9d log/syslog: report errors from write
Fixes #5541.
This time for sure.

R=golang-dev, minux.ma, iant
CC=golang-dev
https://golang.org/cl/9668043
2013-05-22 12:45:52 -07:00
Daniel Morsing
dbee8ad0f9 cmd/cc: reject unions containing pointers
If a union contains a pointer, it will mess up the garbage collector, causing memory corruption.

R=golang-dev, dave, nightlyone, adg, dvyukov, bradfitz, minux.ma, r, iant
CC=golang-dev
https://golang.org/cl/8469043
2013-05-22 21:13:30 +02:00
Dmitriy Vyukov
72c4ee1a9d runtime: properly synchronize GC and finalizer goroutine
This is needed for preemptive scheduler, because the goroutine
can be preempted at surprising points.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/9376043
2013-05-22 23:04:46 +04:00
Dmitriy Vyukov
34c67eb24e runtime: detect deadlocks in programs using cgo
When cgo is used, runtime creates an additional M to handle callbacks on threads not created by Go.
This effectively disabled deadlock detection, which is a right thing, because Go program can be blocked
and only serve callbacks on external threads.
This also disables deadlock detection under race detector, because it happens to use cgo.
With this change the additional M is created lazily on first cgo call. So deadlock detector
works for programs that import "C", "net" or "net/http/pprof" but do not use them in fact.
Also fixes deadlock detector under race detector.
It should be fine to create the M later, because C code can not call into Go before first cgo call,
because C code does not know when Go initialization has completed. So a Go program need to call into C
first either to create an external thread, or notify a thread created in global ctor that Go
initialization has completed.
Fixes #4973.
Fixes #5475.

R=golang-dev, minux.ma, iant
CC=golang-dev
https://golang.org/cl/9303046
2013-05-22 22:57:47 +04:00
Shenghou Ma
a3393e1750 cmd/go: use "go get" instead of "go install" to install vet
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9662043
2013-05-23 02:46:07 +08:00
Rob Pike
f6c7b339a6 undo CL 9658043 / ac7877558dce
The original code was correct. The count returned must be the length
of the input slice, not the length of the formatted message.

««« original CL description
log/syslog: report errors from Fprintf
Thanks to chiparus for identifying this.

Fixes #5541.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/9658043
»»»

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/9644044
2013-05-22 11:42:04 -07:00
Dmitriy Vyukov
c075d82cca runtime: fix and speedup malloc stats
Currently per-sizeclass stats are lost for destroyed MCache's. This patch fixes this.
Also, only update mstats.heap_alloc on heap operations, because that's the only
stat that needs to be promptly updated. Everything else needs to be up-to-date only in ReadMemStats().

R=golang-dev, remyoudompheng, dave, iant
CC=golang-dev
https://golang.org/cl/9207047
2013-05-22 22:22:57 +04:00
Rob Pike
4c2df76b7d log/syslog: report errors from Fprintf
Thanks to chiparus for identifying this.

Fixes #5541.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/9658043
2013-05-22 11:03:10 -07:00
Dmitriy Vyukov
c4cfef075e runtime: simplify MCache
The nlistmin/size thresholds are copied from tcmalloc,
but are unnecesary for Go malloc. We do not do explicit
frees into MCache. For sparse cases when we do (mainly hashmap),
simpler logic will do.

R=rsc, dave, iant
CC=gobot, golang-dev, r, remyoudompheng
https://golang.org/cl/9373043
2013-05-22 13:29:17 +04:00
Rob Pike
23dec8d190 cmd/go: support new location for vet
Also delete the special case for exp, which isn't necessary any more.

Fixes #5529.

R=rsc, nightlyone
CC=golang-dev
https://golang.org/cl/9611048
2013-05-21 21:18:10 -07:00
Brad Fitzpatrick
950fa93531 net/http: add another Hijacker test
R=dsymonds
CC=gobot, golang-dev
https://golang.org/cl/9570043
2013-05-21 18:43:28 -07:00
Brad Fitzpatrick
99f6722860 bufio: reuse Writer buffers after Flush
A bufio.Writer.Flush marks the usual end of a Writer's
life. Recycle its internal buffer on those explicit flushes,
but not on normal, as-needed internal flushes.

benchmark               old ns/op    new ns/op    delta
BenchmarkWriterEmpty         1959          727  -62.89%

benchmark              old allocs   new allocs    delta
BenchmarkWriterEmpty            2            1  -50.00%

benchmark               old bytes    new bytes    delta
BenchmarkWriterEmpty         4215           83  -98.03%

R=gri, iant
CC=gobot, golang-dev, voidlogic7
https://golang.org/cl/9459044
2013-05-21 15:51:49 -07:00
Brad Fitzpatrick
ddda7980c5 net/http: don't send Accept-Encoding on HEAD requests
Works around a bug in nginx: http://trac.nginx.org/nginx/ticket/358

Fixes #5522

R=iant
CC=gobot, golang-dev
https://golang.org/cl/9627043
2013-05-21 15:21:30 -07:00
Brad Fitzpatrick
0e10196982 database/sql: remove extra RemoveDep call
This should have been removed in 45c12efb4635. Not a correctness
issue, but unnecessary work.

This CL also adds paranoia checks in removeDep so this doesn't
happen again.

Fixes #5502

R=adg
CC=gobot, golang-dev, google
https://golang.org/cl/9543043
2013-05-21 14:58:08 -07:00
Brad Fitzpatrick
509a1173a3 time: remove Time.FormatAppend
undo CL 8478044 / 0d28fd55e721

Lack of consensus.

««« original CL description
time: add Time.FormatAppend

This is a version of Time.Format that doesn't require allocation.

Fixes #5192
Update #5195

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

R=r
CC=golang-dev
https://golang.org/cl/9462049
2013-05-21 14:32:09 -07:00
Daniel Morsing
6f5af9c0b1 cmd/gc: fix confusing error with broken types and defer/go
Fixes #5172.

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/9614044
2013-05-21 18:35:47 +02:00
Shenghou Ma
bea7b51872 cmd/go: fix LDFLAGS handling, enable misc/cgo/testso on Darwin
Fixes #5479.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/9416047
2013-05-22 00:32:03 +08:00
Adam Langley
8590e1bd3c crypto/tls: don't send NPN extension if NextProtos is not set.
This isn't clearly a bug on Go's part, but it triggers a bug in Firefox
which means that crypto/tls and net/http cannot be wired up together
unless NextProtos includes "http/1.1". When net/http sets up the
tls.Config, it does this and so works fine. But anyone setting up the
tls.Config themselves will hit the Firefox bug.

Fixes #5445.

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/9539045
2013-05-21 10:47:31 -04:00
Shenghou Ma
f5d06da072 cmd/api: add more platforms
as OpenBSD lacks 4 errno constants, api/go1.txt is updated so that
api check won't fail.

R=golang-dev, iant, bradfitz, r
CC=golang-dev
https://golang.org/cl/9149045
2013-05-21 21:47:32 +08:00
Brad Fitzpatrick
c6c439d7a0 net/http: use WriteString directly when possible
Several places used io.WriteString unnecessarily when the
static type already implemented WriteString. No need to
check for it at runtime.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9608043
2013-05-20 19:26:26 -07:00
Rémy Oudompheng
fc3bec386e cmd/gc: clear n->list of OFOR range loop after walk.
It contains the LHS of the range clause and gets
instrumented by racewalk, but it doesn't have any meaning.

Fixes #5446.

R=golang-dev, dvyukov, daniel.morsing, r
CC=golang-dev
https://golang.org/cl/9560044
2013-05-20 23:45:22 +02:00
Rémy Oudompheng
4b0eb19a05 cmd/gc: eliminate a useless bounds check in inlined append().
R=golang-dev, daniel.morsing, r
CC=golang-dev
https://golang.org/cl/9358043
2013-05-20 23:19:41 +02:00
Adam Langley
b419e2b57c crypto/x509: provide better error messages for X.509 verify failures.
Failures caused by errors like invalid signatures or missing hash
functions cause rather generic, unhelpful error messages because no
trust chain can be constructed: "x509: certificate signed by unknown
authority."

With this change, authority errors may contain the reason why an
arbitary candidate step in the chain was rejected. For example, in the
event of a missing hash function the error looks like:

x509: certificate signed by unknown authority (possibly because of
"crypto/x509: cannot verify signature: algorithm unimplemented" while
trying to verify candidate authority certificate 'Thawte SGC CA')

Fixes 5058.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9104051
2013-05-20 14:20:26 -04:00
Brad Fitzpatrick
27f7427995 net/http: simplify transfer body; reduces allocations too
benchmark                                   old ns/op    new ns/op    delta
BenchmarkServerFakeConnNoKeepAlive              14431        14247   -1.28%
BenchmarkServerFakeConnWithKeepAlive            11618        11357   -2.25%
BenchmarkServerFakeConnWithKeepAliveLite         6735         6427   -4.57%
BenchmarkServerHandlerTypeLen                    8842         8740   -1.15%
BenchmarkServerHandlerNoLen                      8001         7828   -2.16%
BenchmarkServerHandlerNoType                     8270         8227   -0.52%
BenchmarkServerHandlerNoHeader                   6148         5920   -3.71%

benchmark                                  old allocs   new allocs    delta
BenchmarkServerFakeConnNoKeepAlive                 30           29   -3.33%
BenchmarkServerFakeConnWithKeepAlive               25           24   -4.00%
BenchmarkServerFakeConnWithKeepAliveLite           10            9  -10.00%
BenchmarkServerHandlerTypeLen                      18           17   -5.56%
BenchmarkServerHandlerNoLen                        15           14   -6.67%
BenchmarkServerHandlerNoType                       16           15   -6.25%
BenchmarkServerHandlerNoHeader                     10            9  -10.00%

benchmark                                   old bytes    new bytes    delta
BenchmarkServerFakeConnNoKeepAlive               2557         2492   -2.54%
BenchmarkServerFakeConnWithKeepAlive             2260         2194   -2.92%
BenchmarkServerFakeConnWithKeepAliveLite         1092         1026   -6.04%
BenchmarkServerHandlerTypeLen                    1941         1875   -3.40%
BenchmarkServerHandlerNoLen                      1898         1832   -3.48%
BenchmarkServerHandlerNoType                     1906         1840   -3.46%
BenchmarkServerHandlerNoHeader                   1092         1026   -6.04%

Update #5195

R=golang-dev, daniel.morsing
CC=golang-dev
https://golang.org/cl/9492044
2013-05-20 07:23:59 -07:00
Mikio Hara
b98a4d1a10 syscall: prefer PATH environment variable in bootstrap scripts
R=golang-dev, dave, iant
CC=golang-dev
https://golang.org/cl/9575043
2013-05-20 23:18:52 +09:00
Mikio Hara
c5732c8526 runtime: integrated network poller for freebsd/amd64,386, openbsd/amd64,386
Update #5199

R=golang-dev, dvyukov
CC=golang-dev
https://golang.org/cl/8825043
2013-05-20 19:25:32 +09:00
Alex Brainman
1a948950f7 net: move system common global variables into fd_unix.go
R=golang-dev, bradfitz
CC=dvyukov, golang-dev, mikioh.mikioh
https://golang.org/cl/9495044
2013-05-20 15:23:45 +10:00
Dmitriy Vyukov
1308194204 runtime: zeroize g->fnstart to not prevent GC of the closure
Fixes #5493.

R=golang-dev, minux.ma, iant
CC=golang-dev
https://golang.org/cl/9557043
2013-05-20 08:17:21 +04:00
Brad Fitzpatrick
d4cbc80d10 net/http: fewer allocations in the server path
Don't allocate for the Date or Content-Length headers.
A custom Date header formatter replaces use of time.Format.

benchmark                                   old ns/op    new ns/op    delta
BenchmarkClientServer                           67791        64424   -4.97%
BenchmarkClientServerParallel4                  62956        58533   -7.03%
BenchmarkClientServerParallel64                 62043        54789  -11.69%
BenchmarkServer                                254609       229060  -10.03%
BenchmarkServerFakeConnNoKeepAlive              17038        16316   -4.24%
BenchmarkServerFakeConnWithKeepAlive            14184        13226   -6.75%
BenchmarkServerFakeConnWithKeepAliveLite         8591         7532  -12.33%
BenchmarkServerHandlerTypeLen                   10750         9961   -7.34%
BenchmarkServerHandlerNoLen                      9535         8935   -6.29%
BenchmarkServerHandlerNoType                     9858         9362   -5.03%
BenchmarkServerHandlerNoHeader                   7754         6856  -11.58%

benchmark                                  old allocs   new allocs    delta
BenchmarkClientServer                              68           66   -2.94%
BenchmarkClientServerParallel4                     68           66   -2.94%
BenchmarkClientServerParallel64                    68           66   -2.94%
BenchmarkServer                                    21           19   -9.52%
BenchmarkServerFakeConnNoKeepAlive                 32           30   -6.25%
BenchmarkServerFakeConnWithKeepAlive               27           25   -7.41%
BenchmarkServerFakeConnWithKeepAliveLite           12           10  -16.67%
BenchmarkServerHandlerTypeLen                      19           18   -5.26%
BenchmarkServerHandlerNoLen                        17           15  -11.76%
BenchmarkServerHandlerNoType                       17           16   -5.88%
BenchmarkServerHandlerNoHeader                     12           10  -16.67%

Update #5195

R=nigeltao
CC=golang-dev
https://golang.org/cl/9432046
2013-05-19 20:15:40 -07:00
Alex Brainman
38abb09a2e runtime: change PollDesc.fd from int32 to uintptr
This is in preparation for netpoll windows version.

R=golang-dev, bradfitz
CC=dvyukov, golang-dev, mikioh.mikioh
https://golang.org/cl/9569043
2013-05-20 12:55:50 +10:00
Dmitriy Vyukov
fee1d1cda0 runtime: properly set G status after syscall
R=golang-dev, r, dave
CC=golang-dev
https://golang.org/cl/9307045
2013-05-19 19:35:09 +04:00
Anthony Martin
2dc751ac21 runtime, cmd/gc: clean up function protoypes
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8652043
2013-05-18 15:49:23 -07:00
Anthony Martin
8b85a3d480 runtime: mark usleep as NOSPLIT on Plan 9
Usleep is called from lockextra, also marked NOSPLIT.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9258043
2013-05-18 15:47:49 -07:00
Anthony Martin
b65271d008 runtime: fix newproc debugging print
R=golang-dev, remyoudompheng, r
CC=golang-dev
https://golang.org/cl/9249044
2013-05-18 15:47:15 -07:00
Keith Randall
28882bbd33 compress/flate: faster version of forwardCopy
benchmark                           old ns/op    new ns/op    delta
BenchmarkDecodeDigitsSpeed1e4          197767       203490   +2.89%
BenchmarkDecodeDigitsSpeed1e5         1873969      1912761   +2.07%
BenchmarkDecodeDigitsSpeed1e6        18922760     19021056   +0.52%
BenchmarkDecodeDigitsDefault1e4        194975       197054   +1.07%
BenchmarkDecodeDigitsDefault1e5       1704262      1719988   +0.92%
BenchmarkDecodeDigitsDefault1e6      16618354     16351957   -1.60%
BenchmarkDecodeDigitsCompress1e4       195281       194626   -0.34%
BenchmarkDecodeDigitsCompress1e5      1694364      1702372   +0.47%
BenchmarkDecodeDigitsCompress1e6     16463347     16492126   +0.17%
BenchmarkDecodeTwainSpeed1e4           200653       200127   -0.26%
BenchmarkDecodeTwainSpeed1e5          1861385      1759632   -5.47%
BenchmarkDecodeTwainSpeed1e6         18255769     17186679   -5.86%
BenchmarkDecodeTwainDefault1e4         189080       185157   -2.07%
BenchmarkDecodeTwainDefault1e5        1559222      1461465   -6.27%
BenchmarkDecodeTwainDefault1e6       14792125     13879051   -6.17%
BenchmarkDecodeTwainCompress1e4        188881       185151   -1.97%
BenchmarkDecodeTwainCompress1e5       1537031      1456945   -5.21%
BenchmarkDecodeTwainCompress1e6      14805972     13405094   -9.46%
BenchmarkPaeth                          4            4   -0.89%
BenchmarkDecodeGray                964679       937244   -2.84%
BenchmarkDecodeNRGBAGradient      3753769      3646416   -2.86%
BenchmarkDecodeNRGBAOpaque        3165856      2981300   -5.83%
BenchmarkDecodePaletted            713950       691984   -3.08%
BenchmarkDecodeRGB                3051718      2924260   -4.18%

R=nigeltao, bradfitz
CC=golang-dev, raph
https://golang.org/cl/9425046
2013-05-18 15:28:27 -07:00
Dominik Honnef
70f3b6097b cmd/go: Update documentation of go run to match current behaviour.
Fixes #5511.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/9530043
2013-05-18 19:22:30 +08:00
Brad Fitzpatrick
b25a53acd7 bufio: make Reader buffer transient
Share garbage between different bufio Readers. When a Reader
has zero buffered data, put its buffer into a pool.

This acknowledges that most bufio.Readers eventually get
read to completion, and their buffers are then no longer
needed.

benchmark               old ns/op    new ns/op    delta
BenchmarkReaderEmpty         2993         1058  -64.65%

benchmark              old allocs   new allocs    delta
BenchmarkReaderEmpty            3            2  -33.33%

benchmark               old bytes    new bytes    delta
BenchmarkReaderEmpty         4278          133  -96.89%

Update #5100

R=r
CC=adg, dvyukov, gobot, golang-dev, rogpeppe
https://golang.org/cl/8819049
2013-05-17 15:16:06 -07:00