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

14382 Commits

Author SHA1 Message Date
David Symonds
80f4ff226f exp/types: avoid init race in check_test.go.
There was an init race between
	check_test.go:init
        universe.go:def
        use of Universe
and
	universe.go:init
        creation of Universe

The order in which init funcs are executed in a package is unspecified.
The test is not currently broken in the golang.org environment
because the go tool compiles the test with non-test sources before test sources,
but other environments may, say, sort the source files before compiling,
and thus trigger this race, causing a nil pointer panic.

R=gri
CC=golang-dev
https://golang.org/cl/6827076
2012-11-13 09:08:33 +11:00
Rick Arnold
c90739e41e encoding/json: skip unexpected null values
As discussed in issue 2540, nulls are allowed for any type in JSON so they should not result in an error during Unmarshal.
Fixes #2540.

R=rsc
CC=golang-dev
https://golang.org/cl/6759043
2012-11-12 15:35:11 -05:00
Russ Cox
17623c0f13 A+C: Rick Arnold (individual CLA)
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/6821110
2012-11-12 15:34:09 -05:00
Roger Peppe
791fb978dd crypto/x509: implement EncryptPEMBlock
Arbitrary decisions: order of the arguments and the
fact it takes a block-type argument (rather than
leaving to user to fill it in later); I'm happy whatever
colour we want to paint it.

We also change DecryptPEMBlock so that it won't
panic when the IV has the wrong size.

R=agl, agl
CC=golang-dev
https://golang.org/cl/6820114
2012-11-12 15:31:23 +00:00
Roger Peppe
1e1733a9ac encoding/pem: write Proc-Type header first.
See RFC 1421, section 4.6.1.1

R=agl, agl
CC=golang-dev
https://golang.org/cl/6814104
2012-11-12 15:29:17 +00:00
Christian Himpel
89ed40c44b faq: mention go vet in "What happens with closures running as goroutines?"
R=r
CC=golang-dev
https://golang.org/cl/6822111
2012-11-12 07:25:54 -08:00
David McLeish
20a1815833 archive/zip: Fix bounds check panic for ZIP files with a truncated extra header.
R=adg, dave
CC=gobot, golang-dev
https://golang.org/cl/6811080
2012-11-12 12:21:00 +01:00
Andrew Gerrand
9876fd99d6 C: add David McLeish (Google CLA)
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6814120
2012-11-12 12:20:54 +01:00
Shenghou Ma
a8accda52d doc/install: document system requirements for the FreeBSD/ARM port
R=golang-dev, r, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/6816080
2012-11-12 12:20:42 +01:00
Dave Cheney
3f26c5e124 cmd/5g: enable xtramodes optimisation
xtramodes' C_PBIT optimisation transforms:

MOVW          0(R3),R1
ADD           $4,R3,R3

into:

MOVW.P        4(R3),R1

and the AADD optimisation tranforms:

ADD          R0,R1
MOVBU        0(R1),R0

into:

MOVBU        R0<<0(R1),R0

5g does not appear to generate sequences that
can be transformed by xtramodes' AMOVW.

R=remyoudompheng, rsc
CC=golang-dev
https://golang.org/cl/6817085
2012-11-11 07:51:20 +11:00
Ian Lance Taylor
e9a3087e29 runtime, runtime/cgo: track memory allocated by non-Go code
Otherwise a poorly timed GC can collect the memory before it
is returned to the Go program.

R=golang-dev, dave, dvyukov, minux.ma
CC=golang-dev
https://golang.org/cl/6819119
2012-11-10 11:19:06 -08:00
Mikio Hara
5612edb13e net: add more tests for protocol specific methods
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6821100
2012-11-10 14:34:34 +09:00
Rémy Oudompheng
cc224c004d cmd/6c, cmd/8c: use signed char explicitly in mul.c
On ARM, char is unsigned, and the code generation for
multiplication gets totally broken.

Fixes #4354.

R=golang-dev, dave, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6826079
2012-11-09 21:06:45 +01:00
Dmitriy Vyukov
4ef91fc854 cmd/go: fix selection of packages for testing
Currently it works incorrectly if user specifies own build tags
and with race detection (e.g. runtime/race is not selected,
because it contains only test files with +build race).

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6814107
2012-11-09 14:00:41 +04:00
Ian Lance Taylor
5e57954f8c runtime/pprof: fix typo in comment
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6810102
2012-11-08 23:48:13 -08:00
Shenghou Ma
4022fc4e21 runtime: use vDSO clock_gettime for time.now & runtime.nanotime on Linux/amd64
Performance improvement aside, time.Now() now gets real nanosecond resolution
on supported systems.

Benchmark done on Core i7-2600 @ 3.40GHz with kernel 3.5.2-gentoo.
original vDSO gettimeofday:
BenchmarkNow    100000000               27.4 ns/op
new vDSO gettimeofday fallback:
BenchmarkNow    100000000               27.6 ns/op
new vDSO clock_gettime:
BenchmarkNow    100000000               24.4 ns/op

R=golang-dev, bradfitz, iant, iant
CC=golang-dev
https://golang.org/cl/6814103
2012-11-09 14:19:07 +08:00
Mikio Hara
f668e0a5b3 net: consolidate multiple init functions
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6819117
2012-11-09 12:09:22 +09:00
Mikio Hara
e245ae7501 runtime: re-enable crash test on FreeBSD
It also passes on FreeBSD.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6812103
2012-11-09 10:05:46 +09:00
Ian Lance Taylor
3e50372f1f test: change index.go to test size of int, not GOARCH == "amd64"
Fixes the test to work correctly on other platforms with
64-bit ints, like Alpha.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6822099
2012-11-08 15:43:28 -08:00
David Symonds
86b9e3e2b4 archive/tar: accept binary format when reading numeric header fields.
Fixes #4358.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6840043
2012-11-09 08:50:10 +11:00
Russ Cox
761830f481 cmd/gc: fix export of inlined function body with type guard
When exporting a body containing
        x, ok := v.(Type)

the definition for Type was not being included, so when the body
was actually used, it would cause an "unknown type" compiler error.

Fixes #4370.

R=ken2
CC=golang-dev
https://golang.org/cl/6827064
2012-11-08 16:07:05 -05:00
Mikio Hara
5451708d5b net: fix non-unixen build
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6813101
2012-11-09 02:09:09 +09:00
Ian Lance Taylor
6694f14b67 test: run some more tests by default
R=golang-dev, remyoudompheng, iant, rsc
CC=golang-dev
https://golang.org/cl/6833043
2012-11-08 09:04:27 -08:00
Joel Sing
4e75d2c7d5 runtime: re-enable crash test on NetBSD
Re-enable the crash tests on NetBSD now that the issue has been
identified and fixed.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6813100
2012-11-09 03:41:43 +11:00
Dmitriy Vyukov
3f7f030c59 runtime: fix instrumentation of slice append for race detection
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/6819107
2012-11-08 20:37:05 +04:00
Brad Fitzpatrick
ef6806fb13 net: close fds eagerly in DialTimeout
Integrates with the pollserver now.

Uses the old implementation on windows and plan9.

Fixes #2631

R=paul, iant, adg, bendaglish, rsc
CC=golang-dev
https://golang.org/cl/6815049
2012-11-08 10:35:16 -06:00
Brad Fitzpatrick
a384b5b9c3 cmd/api: bug fix for goapi's lame type checker
This is blocking me submitting the net fd timeout
CL, since goapi chokes on my constant.

The much more extensive fix to goapi's type checker
in pending review in https://golang.org/cl/6742050

But I'd rather get this quick fix in first.

R=golang-dev, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/6818104
2012-11-08 10:34:54 -06:00
Shenghou Ma
48b739caac time: clarify why timer.Stop and ticker.Stop don't close the channel
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6818106
2012-11-08 23:25:48 +08:00
Carl Mastrangelo
148154b7e7 lib9: remove unreferenced externs and getuser()
R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6820115
2012-11-08 09:39:24 -05:00
Anthony Martin
024a92c1da runtime: use vDSO for gettimeofday on linux/amd64
Intel Core 2 Duo (2.16 GHz) running 3.6.5-1-ARCH

benchmark       old ns/op    new ns/op    delta
BenchmarkNow         1856         1034  -44.29%

R=rsc
CC=golang-dev
https://golang.org/cl/6826072
2012-11-07 18:29:31 -08:00
Alex Brainman
122c154c60 cmd/go: say that -race flag can be used on windows/amd64
R=golang-dev, r
CC=dvyukov, golang-dev
https://golang.org/cl/6810099
2012-11-08 13:00:54 +11:00
Ian Lance Taylor
e3977f0d3a cmd/gc: warn about slice indexes larger than int in typecheck pass
Fixes GOARCH=386 build.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6810098
2012-11-07 17:34:06 -08:00
Nigel Tao
3e2a888753 doc/effective_go: don't use ALL_CAPS for variable names.
R=r, dsymonds
CC=golang-dev
https://golang.org/cl/6826070
2012-11-08 11:55:46 +11:00
Nigel Tao
64b3e590c0 image/jpeg: handle fill bytes.
Fixes #4337.

R=r, minux.ma
CC=golang-dev
https://golang.org/cl/6814098
2012-11-08 10:36:29 +11:00
Rémy Oudompheng
c208a3a263 cmd/gc: fix internal compiler error with broken structs.
Fixes #4359.

R=golang-dev, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/6834043
2012-11-07 23:09:01 +01:00
David Symonds
0ac317817b archive/tar: avoid writing ModTime that is out of range.
Update #4358
Still to do: support binary numeric format in Reader.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6818101
2012-11-08 08:22:40 +11:00
Rémy Oudompheng
7c0cbbfa18 cmd/6g, cmd/8g: mark used registers in indirect addressing.
Fixes #4094.
Fixes #4353.

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6810090
2012-11-07 21:36:15 +01:00
Rémy Oudompheng
f59a605645 runtime: use runtime·callers when racefuncenter's pc is on the heap.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6821069
2012-11-07 21:35:21 +01:00
Ian Lance Taylor
e08008e8c5 test: run index test by default
Running this test via "bash run" uncovered three different
bugs (4344, 4348, 4353).  We need to run it by default.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6832043
2012-11-07 12:33:54 -08:00
Russ Cox
ccef88c56f api: refresh next.txt
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/6811092
2012-11-07 15:26:41 -05:00
Russ Cox
71282131a1 cmd/gc: fix escape analysis bug
The code assumed that the only choices were EscNone, EscScope, and EscHeap,
so that it makes sense to set EscScope only if the current setting is EscNone.
Now that we have the many variants of EscReturn, this logic is false, and it was
causing important EscScopes to be ignored in favor of EscReturn.

Fixes #4360.

R=ken2
CC=golang-dev, lvd
https://golang.org/cl/6816103
2012-11-07 15:15:21 -05:00
Dmitriy Vyukov
1ebf2d85ba runtime/race: add Windows support
This is copy of https://golang.org/cl/6810080
but sent from another account (dvyukov@gmail.com is not in CONTRIBUTORS).

R=rsc
CC=golang-dev
https://golang.org/cl/6827060
2012-11-07 23:59:09 +04:00
Ian Lance Taylor
f8614a6645 reflect: fix test of whether structs are identical
The old code worked with gc, I assume because the linker
unified identical strings, but it failed with gccgo.

R=rsc
CC=gobot, golang-dev
https://golang.org/cl/6826063
2012-11-07 11:55:35 -08:00
Roger Peppe
768ba46cc1 crypto/x509: fix DecryptPEMBlock
The current implement can fail when the
block size is not a multiple of 8 bytes.
This CL makes it work, and also checks that the
data is in fact a multiple of the block size.

R=agl, agl
CC=golang-dev
https://golang.org/cl/6827058
2012-11-07 15:16:34 +00:00
Russ Cox
cb856adea9 cmd/gc: annotate local variables with unique ids for inlining
Avoids problems with local declarations shadowing other names.
We write a more explicit form than the incoming program, so there
may be additional type annotations. For example:

        int := "hello"
        j := 2

would normally turn into

        var int string = "hello"
        var j int = 2

but the int variable shadows the int type in the second line.

This CL marks all local variables with a per-function sequence number,
so that this would instead be:

        var int·1 string = "hello"
        var j·2 int = 2

Fixes #4326.

R=ken2
CC=golang-dev
https://golang.org/cl/6816100
2012-11-07 09:59:19 -05:00
Russ Cox
c6f363b22a cmd/gc: fix go:nointerface export comment
R=ken
CC=golang-dev
https://golang.org/cl/6815073
2012-11-07 09:14:21 -05:00
Mikio Hara
63f29d17d1 net: fix protocol number for IPv6 test
The protocol number of ICMP for IPv6 is 58, not 1.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6810093
2012-11-07 21:55:29 +09:00
Dmitriy Vyukov
1a19f01a68 runtime/race: lazily allocate shadow memory
Currently race detector runtime maps shadow memory eagerly at process startup.
It works poorly on Windows, because Windows requires reservation in swap file
(especially problematic if several Go program runs at the same, each consuming GBs
of memory).
With this change race detector maps shadow memory lazily, so Go runtime must notify
about all new heap memory.
It will help with Windows port, but also eliminates scary 16TB virtual mememory
consumption in top output (which sometimes confuses some monitoring scripts).

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6811085
2012-11-07 12:48:58 +04:00
Dmitriy Vyukov
a3a7244779 cmd/gc: racewalk: instrument returnsfromheap params
Fixes #4307.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6822073
2012-11-07 12:10:35 +04:00
Dmitriy Vyukov
abb313f8c8 cmd/gc: racewalk: do not double function calls
Current racewalk transformation looks like:
x := <-makeChan().c
\/\/\/\/\/\/\/\/\/
runtime.raceread(&makeChan().c)
x := <-makeChan().c
and so makeChan() is called twice.
With this CL the transformation looks like:
x := <-makeChan().c
\/\/\/\/\/\/\/\/\/
chan *tmp = &(makeChan().c)
raceread(&*tmp)
x := <-(*tmp)
Fixes #4245.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6822075
2012-11-07 12:06:27 +04:00