]> Cypherpunks repositories - gostls13.git/log
gostls13.git
12 years agogo/ast: FuncType.Params may be nil (per AST documentation)
Robert Griesemer [Fri, 16 Nov 2012 19:53:26 +0000 (11:53 -0800)]
go/ast: FuncType.Params may be nil (per AST documentation)

ast.Walk needs to check for it or it will crash.

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

12 years agoruntime: hide mheap from race detector
Dmitriy Vyukov [Fri, 16 Nov 2012 16:06:11 +0000 (20:06 +0400)]
runtime: hide mheap from race detector
This significantly decreases amount of shadow memory
mapped by race detector.
I haven't tested on Windows, but on Linux it reduces
virtual memory size from 1351m to 330m for fmt.test.
Fixes #4379.

R=golang-dev, alex.brainman, iant
CC=golang-dev
https://golang.org/cl/6849057

12 years agoruntime: remove extra parentheses.
Oling Cat [Fri, 16 Nov 2012 12:09:37 +0000 (23:09 +1100)]
runtime: remove extra parentheses.

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

12 years agocrypto/tls: add support for loading EC X.509 key pairs
Joel Sing [Fri, 16 Nov 2012 08:33:59 +0000 (19:33 +1100)]
crypto/tls: add support for loading EC X.509 key pairs

Add support for loading X.509 key pairs that consist of a certificate
with an EC public key and its corresponding EC private key.

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

12 years agosyscall: fix data races in LazyDLL/LazyProc
Dmitriy Vyukov [Fri, 16 Nov 2012 08:06:48 +0000 (12:06 +0400)]
syscall: fix data races in LazyDLL/LazyProc
Reincarnation of https://golang.org/cl/6817086 (sent from another account).
It is ugly because sync.Once will cause allocation of a closure.
Fixes #4343.

R=golang-dev, bradfitz, alex.brainman
CC=golang-dev
https://golang.org/cl/6856046

12 years agoexp/locale/collate: changed implementation of Compare and CompareString to
Marcel van Lohuizen [Thu, 15 Nov 2012 21:23:56 +0000 (22:23 +0100)]
exp/locale/collate: changed implementation of Compare and CompareString to
compare incrementally. Also modified collation API to be more high-level
by removing the need for an explicit buffer to be passed as an argument.
This considerably speeds up Compare and CompareString.  This change also eliminates
the need to reinitialize the normalization buffer for each use of an iter. This
also significantly improves performance for Key and KeyString.

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

12 years agoos: add FileMode.IsRegular
Brad Fitzpatrick [Thu, 15 Nov 2012 19:46:00 +0000 (11:46 -0800)]
os: add FileMode.IsRegular

API change.

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

12 years agomisc/git: add gofmt git pre-commit hook
Andrew Gerrand [Thu, 15 Nov 2012 18:58:49 +0000 (19:58 +0100)]
misc/git: add gofmt git pre-commit hook

R=golang-dev, bradfitz, ftrvxmtrx, franciscossouza, r, minux.ma
CC=golang-dev
https://golang.org/cl/6843044

12 years agosudo.bash: diagnose when the go tool is not in $PATH
Rob Pike [Thu, 15 Nov 2012 18:42:39 +0000 (10:42 -0800)]
sudo.bash: diagnose when the go tool is not in $PATH
Fixes #4386.

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

12 years agosync/atomic: fix race instrumentation
Dmitriy Vyukov [Thu, 15 Nov 2012 17:30:24 +0000 (21:30 +0400)]
sync/atomic: fix race instrumentation

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

12 years agoruntime/cgo: include <string.h> as needed so that strerror is declared
Ian Lance Taylor [Thu, 15 Nov 2012 06:04:03 +0000 (22:04 -0800)]
runtime/cgo: include <string.h> as needed so that strerror is declared

R=golang-dev, dave, jsing
CC=golang-dev
https://golang.org/cl/6847051

12 years agorun.bash: fix linux/arm build
Dave Cheney [Thu, 15 Nov 2012 02:59:46 +0000 (13:59 +1100)]
run.bash: fix linux/arm build

Revert to the shell builtin to avoid hosts that do not have /usr/bin/time.

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

12 years agorun.{bash,bat,rc}: unset GOMAXPROCS before ../test
Dave Cheney [Thu, 15 Nov 2012 00:40:10 +0000 (11:40 +1100)]
run.{bash,bat,rc}: unset GOMAXPROCS before ../test

test/run.go already executes tests in parallel where
possible. An unknown GOMAXPROCS value during the tests
is known to cause failures with tests that measure
allocations.

ref: https://groups.google.com/d/topic/golang-nuts/tgMhFJ3F5WY/discussion

R=fullung, minux.ma, r
CC=golang-dev
https://golang.org/cl/6847050

12 years agostrconv: Removed unnecessary use of goto. Made code easier to read.
Robin Eklind [Wed, 14 Nov 2012 17:42:48 +0000 (09:42 -0800)]
strconv: Removed unnecessary use of goto. Made code easier to read.

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

12 years agocrypto/x509: add support for SEC1/EC private keys.
Joel Sing [Wed, 14 Nov 2012 16:39:00 +0000 (03:39 +1100)]
crypto/x509: add support for SEC1/EC private keys.

Add support for parsing SEC1 EC private keys and PKCS8 encapsulated
EC private key structures.

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

12 years agodebug/elf: fix offset for GNU version symbols
Joel Sing [Wed, 14 Nov 2012 16:36:19 +0000 (03:36 +1100)]
debug/elf: fix offset for GNU version symbols

Since we no longer skip the first entry when reading a symbol table,
we no longer need to allow for the offset difference when processing
the GNU version symbols.

Unbreaks builds on Linux.

R=golang-dev, agl, iant
CC=golang-dev
https://golang.org/cl/6843057

12 years agodebug/elf: do not skip first symbol in the symbol table
Joel Sing [Wed, 14 Nov 2012 15:24:14 +0000 (02:24 +1100)]
debug/elf: do not skip first symbol in the symbol table

Do not skip the first symbol in the symbol table. Any other indexes
into the symbol table (for example, indexes in relocation entries)
will now refer to the symbol following the one that was intended.

Add an object that contains debug relocations, which debug/dwarf
failed to decode correctly. Extend the relocation tests to cover
this case.

Note that the existing tests passed since the symbol following the
symbol that required relocation is also of type STT_SECTION.

Fixes #4107.

R=golang-dev, mikioh.mikioh, iant, iant
CC=golang-dev
https://golang.org/cl/6848044

12 years agoruntime/race: more precise handling of finalizers
Dmitriy Vyukov [Wed, 14 Nov 2012 12:58:10 +0000 (16:58 +0400)]
runtime/race: more precise handling of finalizers
Currently race detector runtime just disables race detection in the finalizer goroutine.
It has false positives when a finalizer writes to shared memory -- the race with finalizer is reported in a normal goroutine that accesses the same memory.
After this change I am going to synchronize the finalizer goroutine with the rest of the world in racefingo(). This is closer to what happens in reality and so
does not have false positives.
And also add README file with instructions how to build the runtime.

R=golang-dev, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6810095

12 years agoruntime: add RaceRead/RaceWrite functions
Dmitriy Vyukov [Wed, 14 Nov 2012 12:51:23 +0000 (16:51 +0400)]
runtime: add RaceRead/RaceWrite functions
It allows to catch e.g. a data race between atomic write and non-atomic write,
or Mutex.Lock() and mutex overwrite (e.g. mu = Mutex{}).

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

12 years agocmd/gc: racewalk: handle OEFACE/OCONVIFACE
Dmitriy Vyukov [Wed, 14 Nov 2012 12:30:53 +0000 (16:30 +0400)]
cmd/gc: racewalk: handle OEFACE/OCONVIFACE

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

12 years agocmd/gc: racewalk: fix instrumentation of structs
Dmitriy Vyukov [Wed, 14 Nov 2012 12:26:00 +0000 (16:26 +0400)]
cmd/gc: racewalk: fix instrumentation of structs
+ do not instrument go.itab.*

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

12 years agoregexp: add simple package-level example
Andrew Gerrand [Wed, 14 Nov 2012 09:43:21 +0000 (10:43 +0100)]
regexp: add simple package-level example

Update #4125

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

12 years agosyscall: regenerate z-files for openbsd/386
Joel Sing [Wed, 14 Nov 2012 08:06:12 +0000 (19:06 +1100)]
syscall: regenerate z-files for openbsd/386

Regenerate z-files for OpenBSD/386 on OpenBSD 5.2.

R=golang-dev, bradfitz, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/6844044

12 years agonet/http: add missing error checking reading trailers
Brad Fitzpatrick [Wed, 14 Nov 2012 06:38:25 +0000 (22:38 -0800)]
net/http: add missing error checking reading trailers

This is a simplified version of earlier versions of this CL
and now only fixes obviously incorrect things, without
changing the locking on bodyEOFReader.

I'd like to see if this is sufficient before changing the
locking.

Update #4191

R=golang-dev, rsc, dave
CC=golang-dev
https://golang.org/cl/6739055

12 years agoreflect: fix FieldByNameFunc
Robert Griesemer [Tue, 13 Nov 2012 18:45:30 +0000 (10:45 -0800)]
reflect: fix FieldByNameFunc

The existing algorithm did not properly propagate the type
count from one level to the next, and as a consequence it
missed collisions.

Properly propagate multiplicity (count) information to the
next level.

benchmark                old ns/op    new ns/op    delta
BenchmarkFieldByName1          182          180   -1.10%
BenchmarkFieldByName2         6273         6183   -1.43%
BenchmarkFieldByName3        49267        46784   -5.04%

Fixes #4355.

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

12 years agocmd/ld: fix build on elf systems
Russ Cox [Tue, 13 Nov 2012 18:12:11 +0000 (13:12 -0500)]
cmd/ld: fix build on elf systems

TBR=iant
CC=golang-dev
https://golang.org/cl/6843050

12 years agoreflect: add ArrayOf, ChanOf, MapOf, SliceOf
Russ Cox [Tue, 13 Nov 2012 18:06:29 +0000 (13:06 -0500)]
reflect: add ArrayOf, ChanOf, MapOf, SliceOf

In order to add these, we need to be able to find references
to such types that already exist in the binary. To do that, introduce
a new linker section holding a list of the types corresponding to
arrays, chans, maps, and slices.

To offset the storage cost of this list, and to simplify the code,
remove the interface{} header from the representation of a
runtime type. It was used in early versions of the code but was
made obsolete by the kind field: a switch on kind is more efficient
than a type switch.

In the godoc binary, removing the interface{} header cuts two
words from each of about 10,000 types. Adding back the list of pointers
to array, chan, map, and slice types reintroduces one word for
each of about 500 types. On a 64-bit machine, then, this CL *removes*
a net 156 kB of read-only data from the binary.

This CL does not include the needed support for precise garbage
collection. I have created issue 4375 to track that.

This CL also does not set the 'algorithm' - specifically the equality
and copy functions - for a new array correctly, so I have unexported
ArrayOf for now. That is also part of issue 4375.

Fixes #2339.

R=r, remyoudompheng, mirtchovski, iant
CC=golang-dev
https://golang.org/cl/6572043

12 years agocmd/api: use one token.FileSet for all contexts
Brad Fitzpatrick [Tue, 13 Nov 2012 17:59:46 +0000 (09:59 -0800)]
cmd/api: use one token.FileSet for all contexts

Prep for future CL.

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

12 years agoruntime: allow up to 128 GB of allocated memory
Russ Cox [Tue, 13 Nov 2012 17:45:08 +0000 (12:45 -0500)]
runtime: allow up to 128 GB of allocated memory

Incorporates code from CL 6828055.

Fixes #2142.

R=golang-dev, iant, devon.odell
CC=golang-dev
https://golang.org/cl/6826088

12 years agosyscall: regenerate z-files for openbsd/amd64
Joel Sing [Tue, 13 Nov 2012 16:19:34 +0000 (03:19 +1100)]
syscall: regenerate z-files for openbsd/amd64

Regenerate z-files for OpenBSD/amd64 on OpenBSD 5.2.

R=golang-dev, bradfitz, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/6843045

12 years agodoc: link to Go coding screencast
Andrew Gerrand [Tue, 13 Nov 2012 15:50:44 +0000 (16:50 +0100)]
doc: link to Go coding screencast

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

12 years agonet: consolidate common socket functions for Plan 9
Mikio Hara [Tue, 13 Nov 2012 07:18:37 +0000 (16:18 +0900)]
net: consolidate common socket functions for Plan 9

This CL extends changeset 13126:fc4a62e14aba to Plan 9.

R=ality, golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6820124

12 years agocmd/8g: eliminate obviously useless temps before regopt.
Rémy Oudompheng [Tue, 13 Nov 2012 06:39:18 +0000 (07:39 +0100)]
cmd/8g: eliminate obviously useless temps before regopt.

This patch introduces a sort of pre-regopt peephole optimization.
When a temporary is introduced that just holds a value for the
duration of the next instruction and is otherwise unused, we
elide it to make the job of regopt easier.

Since x86 has very few registers, this situation happens very
often. The result is large savings in stack variables for
arithmetic-heavy functions.

crypto/aes

benchmark                 old ns/op    new ns/op    delta
BenchmarkEncrypt               1301          392  -69.87%
BenchmarkDecrypt               1309          368  -71.89%
BenchmarkExpand                2913         1036  -64.44%
benchmark                  old MB/s     new MB/s  speedup
BenchmarkEncrypt              12.29        40.74    3.31x
BenchmarkDecrypt              12.21        43.37    3.55x

crypto/md5

benchmark                 old ns/op    new ns/op    delta
BenchmarkHash8Bytes            1761          914  -48.10%
BenchmarkHash1K               16912         5570  -67.06%
BenchmarkHash8K              123895        38286  -69.10%
benchmark                  old MB/s     new MB/s  speedup
BenchmarkHash8Bytes            4.54         8.75    1.93x
BenchmarkHash1K               60.55       183.83    3.04x
BenchmarkHash8K               66.12       213.97    3.24x

bench/go1

benchmark                 old ns/op    new ns/op    delta
BenchmarkBinaryTree17    8364835000   8303154000   -0.74%
BenchmarkFannkuch11      7511723000   6381729000  -15.04%
BenchmarkGobDecode         27764090     27103270   -2.38%
BenchmarkGobEncode         11240880     11184370   -0.50%
BenchmarkGzip            1470224000    856668400  -41.73%
BenchmarkGunzip           240660800    201697300  -16.19%
BenchmarkJSONEncode       155225800    185571900  +19.55%
BenchmarkJSONDecode       243347900    282123000  +15.93%
BenchmarkMandelbrot200     12240970     12201880   -0.32%
BenchmarkParse              8837445      8765210   -0.82%
BenchmarkRevcomp         2556310000   1868566000  -26.90%
BenchmarkTemplate         389298000    379792000   -2.44%
benchmark                  old MB/s     new MB/s  speedup
BenchmarkGobDecode            27.64        28.32    1.02x
BenchmarkGobEncode            68.28        68.63    1.01x
BenchmarkGzip                 13.20        22.65    1.72x
BenchmarkGunzip               80.63        96.21    1.19x
BenchmarkJSONEncode           12.50        10.46    0.84x
BenchmarkJSONDecode            7.97         6.88    0.86x
BenchmarkParse                 6.55         6.61    1.01x
BenchmarkRevcomp              99.43       136.02    1.37x
BenchmarkTemplate              4.98         5.11    1.03x

Fixes #4035.

R=golang-dev, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6828056

12 years agocmd/gc: fix typos in clearslim.
Rémy Oudompheng [Tue, 13 Nov 2012 06:08:29 +0000 (07:08 +0100)]
cmd/gc: fix typos in clearslim.

Fixes build failure.

R=golang-dev, bradfitz, dave
CC=golang-dev
https://golang.org/cl/6847043

12 years agonet: protocol specific listen functions return a proper local socket address
Mikio Hara [Tue, 13 Nov 2012 03:56:28 +0000 (12:56 +0900)]
net: protocol specific listen functions return a proper local socket address

When a nil listener address is passed to some protocol specific
listen function, it will create an unnamed, unbound socket because
of the nil listener address. Other listener functions may return
invalid address error.

This CL allows to pass a nil listener address to all protocol
specific listen functions to fix above inconsistency. Also make it
possible to return a proper local socket address in case of a nil
listner address.

Fixes #4190.
Fixes #3847.

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

12 years agonet: make LocalAddr on multicast UDPConn return a listening address
Mikio Hara [Tue, 13 Nov 2012 03:26:20 +0000 (12:26 +0900)]
net: make LocalAddr on multicast UDPConn return a listening address

The package go.net/ipv4 allows to exist a single UDP listener
that join multiple different group addresses. That means that
LocalAddr on multicast UDPConn returns a first joined group
address is not desirable.

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

12 years agonet/textproto: faster header canonicalization with fewer allocations
Jeff R. Allen [Mon, 12 Nov 2012 23:31:42 +0000 (15:31 -0800)]
net/textproto: faster header canonicalization with fewer allocations

By keeping a single copy of the strings that commonly show up
in headers, we can avoid one string allocation per header.

benchmark                  old ns/op    new ns/op    delta
BenchmarkReadMIMEHeader        19590        10824  -44.75%
BenchmarkUncommon               3168         1861  -41.26%

benchmark                 old allocs   new allocs    delta
BenchmarkReadMIMEHeader           32           25  -21.88%
BenchmarkUncommon                  5            5    0.00%

R=bradfitz, golang-dev, dave, rsc, jra
CC=golang-dev
https://golang.org/cl/6721055

12 years agonet/http: handle 413 responses more robustly
Brad Fitzpatrick [Mon, 12 Nov 2012 23:20:18 +0000 (15:20 -0800)]
net/http: handle 413 responses more robustly

When HTTP bodies were too large and we didn't want to finish
reading them for DoS reasons, we previously found it necessary
to send a FIN and then pause before closing the connection
(which might send a RST) if we wanted the client to have a
better chance at receiving our error response. That was Issue 3595.

This issue adds the same fix to request headers which
are too large, which might fix the Windows flakiness
we observed on TestRequestLimit at:
http://build.golang.org/log/146a2a7d9b24441dc14602a1293918191d4e75f1

R=golang-dev, alex.brainman, rsc
CC=golang-dev
https://golang.org/cl/6826084

12 years agocmd/6g: extend componentgen to small arrays and structs.
Rémy Oudompheng [Mon, 12 Nov 2012 23:08:04 +0000 (00:08 +0100)]
cmd/6g: extend componentgen to small arrays and structs.

Fixes #4092.

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6819083

12 years agocmd/5g, cmd/6g: pass the full torture test.
Rémy Oudompheng [Mon, 12 Nov 2012 22:56:11 +0000 (23:56 +0100)]
cmd/5g, cmd/6g: pass the full torture test.

The patch adds more cases to agenr to allocate registers later,
and makes 6g generate addresses for sgen in something else than
SI and DI. It avoids a complex save/restore sequence that
amounts to allocate a register before descending in subtrees.

Fixes #4207.

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6817080

12 years agoexp/types: avoid init race in check_test.go.
David Symonds [Mon, 12 Nov 2012 22:08:33 +0000 (09:08 +1100)]
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

12 years agoencoding/json: skip unexpected null values
Rick Arnold [Mon, 12 Nov 2012 20:35:11 +0000 (15:35 -0500)]
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

12 years agoA+C: Rick Arnold (individual CLA)
Russ Cox [Mon, 12 Nov 2012 20:34:09 +0000 (15:34 -0500)]
A+C: Rick Arnold (individual CLA)

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

12 years agocrypto/x509: implement EncryptPEMBlock
Roger Peppe [Mon, 12 Nov 2012 15:31:23 +0000 (15:31 +0000)]
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

12 years agoencoding/pem: write Proc-Type header first.
Roger Peppe [Mon, 12 Nov 2012 15:29:17 +0000 (15:29 +0000)]
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

12 years agofaq: mention go vet in "What happens with closures running as goroutines?"
Christian Himpel [Mon, 12 Nov 2012 15:25:54 +0000 (07:25 -0800)]
faq: mention go vet in "What happens with closures running as goroutines?"

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

12 years agoarchive/zip: Fix bounds check panic for ZIP files with a truncated extra header.
David McLeish [Mon, 12 Nov 2012 11:21:00 +0000 (12:21 +0100)]
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

12 years agoC: add David McLeish (Google CLA)
Andrew Gerrand [Mon, 12 Nov 2012 11:20:54 +0000 (12:20 +0100)]
C: add David McLeish (Google CLA)

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

12 years agodoc/install: document system requirements for the FreeBSD/ARM port
Shenghou Ma [Mon, 12 Nov 2012 11:20:42 +0000 (12:20 +0100)]
doc/install: document system requirements for the FreeBSD/ARM port

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

12 years agocmd/5g: enable xtramodes optimisation
Dave Cheney [Sat, 10 Nov 2012 20:51:20 +0000 (07:51 +1100)]
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

12 years agoruntime, runtime/cgo: track memory allocated by non-Go code
Ian Lance Taylor [Sat, 10 Nov 2012 19:19:06 +0000 (11:19 -0800)]
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

12 years agonet: add more tests for protocol specific methods
Mikio Hara [Sat, 10 Nov 2012 05:34:34 +0000 (14:34 +0900)]
net: add more tests for protocol specific methods

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

12 years agocmd/6c, cmd/8c: use signed char explicitly in mul.c
Rémy Oudompheng [Fri, 9 Nov 2012 20:06:45 +0000 (21:06 +0100)]
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

12 years agocmd/go: fix selection of packages for testing
Dmitriy Vyukov [Fri, 9 Nov 2012 10:00:41 +0000 (14:00 +0400)]
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

12 years agoruntime/pprof: fix typo in comment
Ian Lance Taylor [Fri, 9 Nov 2012 07:48:13 +0000 (23:48 -0800)]
runtime/pprof: fix typo in comment

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

12 years agoruntime: use vDSO clock_gettime for time.now & runtime.nanotime on Linux/amd64
Shenghou Ma [Fri, 9 Nov 2012 06:19:07 +0000 (14:19 +0800)]
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

12 years agonet: consolidate multiple init functions
Mikio Hara [Fri, 9 Nov 2012 03:09:22 +0000 (12:09 +0900)]
net: consolidate multiple init functions

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

12 years agoruntime: re-enable crash test on FreeBSD
Mikio Hara [Fri, 9 Nov 2012 01:05:46 +0000 (10:05 +0900)]
runtime: re-enable crash test on FreeBSD

It also passes on FreeBSD.

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

12 years agotest: change index.go to test size of int, not GOARCH == "amd64"
Ian Lance Taylor [Thu, 8 Nov 2012 23:43:28 +0000 (15:43 -0800)]
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

12 years agoarchive/tar: accept binary format when reading numeric header fields.
David Symonds [Thu, 8 Nov 2012 21:50:10 +0000 (08:50 +1100)]
archive/tar: accept binary format when reading numeric header fields.

Fixes #4358.

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

12 years agocmd/gc: fix export of inlined function body with type guard
Russ Cox [Thu, 8 Nov 2012 21:07:05 +0000 (16:07 -0500)]
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

12 years agonet: fix non-unixen build
Mikio Hara [Thu, 8 Nov 2012 17:09:09 +0000 (02:09 +0900)]
net: fix non-unixen build

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

12 years agotest: run some more tests by default
Ian Lance Taylor [Thu, 8 Nov 2012 17:04:27 +0000 (09:04 -0800)]
test: run some more tests by default

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

12 years agoruntime: re-enable crash test on NetBSD
Joel Sing [Thu, 8 Nov 2012 16:41:43 +0000 (03:41 +1100)]
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

12 years agoruntime: fix instrumentation of slice append for race detection
Dmitriy Vyukov [Thu, 8 Nov 2012 16:37:05 +0000 (20:37 +0400)]
runtime: fix instrumentation of slice append for race detection

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

12 years agonet: close fds eagerly in DialTimeout
Brad Fitzpatrick [Thu, 8 Nov 2012 16:35:16 +0000 (10:35 -0600)]
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

12 years agocmd/api: bug fix for goapi's lame type checker
Brad Fitzpatrick [Thu, 8 Nov 2012 16:34:54 +0000 (10:34 -0600)]
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

12 years agotime: clarify why timer.Stop and ticker.Stop don't close the channel
Shenghou Ma [Thu, 8 Nov 2012 15:25:48 +0000 (23:25 +0800)]
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

12 years agolib9: remove unreferenced externs and getuser()
Carl Mastrangelo [Thu, 8 Nov 2012 14:39:24 +0000 (09:39 -0500)]
lib9: remove unreferenced externs and getuser()

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6820115

12 years agoruntime: use vDSO for gettimeofday on linux/amd64
Anthony Martin [Thu, 8 Nov 2012 02:29:31 +0000 (18:29 -0800)]
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

12 years agocmd/go: say that -race flag can be used on windows/amd64
Alex Brainman [Thu, 8 Nov 2012 02:00:54 +0000 (13:00 +1100)]
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

12 years agocmd/gc: warn about slice indexes larger than int in typecheck pass
Ian Lance Taylor [Thu, 8 Nov 2012 01:34:06 +0000 (17:34 -0800)]
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

12 years agodoc/effective_go: don't use ALL_CAPS for variable names.
Nigel Tao [Thu, 8 Nov 2012 00:55:46 +0000 (11:55 +1100)]
doc/effective_go: don't use ALL_CAPS for variable names.

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

12 years agoimage/jpeg: handle fill bytes.
Nigel Tao [Wed, 7 Nov 2012 23:36:29 +0000 (10:36 +1100)]
image/jpeg: handle fill bytes.

Fixes #4337.

R=r, minux.ma
CC=golang-dev
https://golang.org/cl/6814098

12 years agocmd/gc: fix internal compiler error with broken structs.
Rémy Oudompheng [Wed, 7 Nov 2012 22:09:01 +0000 (23:09 +0100)]
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

12 years agoarchive/tar: avoid writing ModTime that is out of range.
David Symonds [Wed, 7 Nov 2012 21:22:40 +0000 (08:22 +1100)]
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

12 years agocmd/6g, cmd/8g: mark used registers in indirect addressing.
Rémy Oudompheng [Wed, 7 Nov 2012 20:36:15 +0000 (21:36 +0100)]
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

12 years agoruntime: use runtime·callers when racefuncenter's pc is on the heap.
Rémy Oudompheng [Wed, 7 Nov 2012 20:35:21 +0000 (21:35 +0100)]
runtime: use runtime·callers when racefuncenter's pc is on the heap.

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

12 years agotest: run index test by default
Ian Lance Taylor [Wed, 7 Nov 2012 20:33:54 +0000 (12:33 -0800)]
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

12 years agoapi: refresh next.txt
Russ Cox [Wed, 7 Nov 2012 20:26:41 +0000 (15:26 -0500)]
api: refresh next.txt

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

12 years agocmd/gc: fix escape analysis bug
Russ Cox [Wed, 7 Nov 2012 20:15:21 +0000 (15:15 -0500)]
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

12 years agoruntime/race: add Windows support
Dmitriy Vyukov [Wed, 7 Nov 2012 19:59:09 +0000 (23:59 +0400)]
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

12 years agoreflect: fix test of whether structs are identical
Ian Lance Taylor [Wed, 7 Nov 2012 19:55:35 +0000 (11:55 -0800)]
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

12 years agocrypto/x509: fix DecryptPEMBlock
Roger Peppe [Wed, 7 Nov 2012 15:16:34 +0000 (15:16 +0000)]
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

12 years agocmd/gc: annotate local variables with unique ids for inlining
Russ Cox [Wed, 7 Nov 2012 14:59:19 +0000 (09:59 -0500)]
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

12 years agocmd/gc: fix go:nointerface export comment
Russ Cox [Wed, 7 Nov 2012 14:14:21 +0000 (09:14 -0500)]
cmd/gc: fix go:nointerface export comment

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

12 years agonet: fix protocol number for IPv6 test
Mikio Hara [Wed, 7 Nov 2012 12:55:29 +0000 (21:55 +0900)]
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

12 years agoruntime/race: lazily allocate shadow memory
Dmitriy Vyukov [Wed, 7 Nov 2012 08:48:58 +0000 (12:48 +0400)]
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

12 years agocmd/gc: racewalk: instrument returnsfromheap params
Dmitriy Vyukov [Wed, 7 Nov 2012 08:10:35 +0000 (12:10 +0400)]
cmd/gc: racewalk: instrument returnsfromheap params
Fixes #4307.

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

12 years agocmd/gc: racewalk: do not double function calls
Dmitriy Vyukov [Wed, 7 Nov 2012 08:06:27 +0000 (12:06 +0400)]
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

12 years agocmd/gc: refactor racewalk
Dmitriy Vyukov [Wed, 7 Nov 2012 08:01:31 +0000 (12:01 +0400)]
cmd/gc: refactor racewalk
It is refactoring towards generic walk
+ it handles mode nodes.
Partially fixes 4228 issue.

R=golang-dev, lvd, rsc
CC=golang-dev
https://golang.org/cl/6775098

12 years agonet: implement IPv6 support for windows
Alex Brainman [Wed, 7 Nov 2012 05:58:20 +0000 (16:58 +1100)]
net: implement IPv6 support for windows

Thank you zhoumichaely for original CL 5175042.

Fixes #1740.
Fixes #2315.

R=golang-dev, bradfitz, mikioh.mikioh
CC=golang-dev, zhoumichaely
https://golang.org/cl/6822045

12 years agocrypto/sha1: Make sha-1 do block mixup in place
Carl Mastrangelo [Wed, 7 Nov 2012 02:41:02 +0000 (13:41 +1100)]
crypto/sha1: Make sha-1 do block mixup in place

Benchmarks:

benchmark              old ns/op    new ns/op    delta
BenchmarkHash8Bytes          762          674  -11.55%
BenchmarkHash1K             8791         7375  -16.11%
BenchmarkHash8K            65094        54881  -15.69%

benchmark               old MB/s     new MB/s  speedup
BenchmarkHash8Bytes        10.50        11.86    1.13x
BenchmarkHash1K           116.48       138.84    1.19x
BenchmarkHash8K           125.85       149.27    1.19x

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

12 years agoCONTRIBUTORS: Add Carl Mastrangelo (Google CLA).
Ian Lance Taylor [Tue, 6 Nov 2012 23:58:18 +0000 (15:58 -0800)]
CONTRIBUTORS: Add Carl Mastrangelo (Google CLA).

R=golang-dev, nigeltao
CC=golang-dev
https://golang.org/cl/6812095

12 years agocmd/6g: fix use of large integers as indexes or array sizes.
Rémy Oudompheng [Tue, 6 Nov 2012 21:53:57 +0000 (22:53 +0100)]
cmd/6g: fix use of large integers as indexes or array sizes.

A check for smallintconst was missing before generating the
comparisons.

Fixes #4348.

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

12 years agocmd/go: invoke gcc -print-libgcc-file-name only once
Shenghou Ma [Tue, 6 Nov 2012 21:09:54 +0000 (05:09 +0800)]
cmd/go: invoke gcc -print-libgcc-file-name only once

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

12 years agosort: fix comment for various Search routines
Shenghou Ma [Tue, 6 Nov 2012 21:07:46 +0000 (05:07 +0800)]
sort: fix comment for various Search routines
Fixes #4205 (again).

R=r, 0xjnml
CC=golang-dev
https://golang.org/cl/6819082

12 years agonet/rpc: give hint to pass a pointer to Register
Shenghou Ma [Tue, 6 Nov 2012 21:03:16 +0000 (05:03 +0800)]
net/rpc: give hint to pass a pointer to Register
Fixes #4325.

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

12 years agocmd/godoc: initialize filesystem and metadata for -url
Péter Surányi [Tue, 6 Nov 2012 20:59:21 +0000 (04:59 +0800)]
cmd/godoc: initialize filesystem and metadata for -url

Unlike when using -http, godoc -url didn't initialize the "filesystem"
and metadata that are used when generating responses. This CL adds this
initialization, so that -url provides the same results as an HTTP
request when using -http.

Fixes #4335.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/6817075

12 years agocmd/gc, runtime: avoid unnecessary copy on type assertion.
Daniel Morsing [Tue, 6 Nov 2012 19:40:40 +0000 (20:40 +0100)]
cmd/gc, runtime: avoid unnecessary copy on type assertion.

When the first result of a type assertion is blank, the compiler would still copy out a potentially large non-interface type.

Fixes #1021.

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