]> Cypherpunks repositories - gostls13.git/log
gostls13.git
12 years agocmd/8g: fix possibly uninitialized variable in foptoas.
Rémy Oudompheng [Wed, 2 Jan 2013 22:20:52 +0000 (23:20 +0100)]
cmd/8g: fix possibly uninitialized variable in foptoas.

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

12 years agocmd/dist, cmd/8g: implement GO386=387/sse to choose FPU flavour.
Rémy Oudompheng [Wed, 2 Jan 2013 21:55:23 +0000 (22:55 +0100)]
cmd/dist, cmd/8g: implement GO386=387/sse to choose FPU flavour.

A new environment variable GO386 is introduced to choose between
code generation targeting 387 or SSE2. No auto-detection is
performed and the setting defaults to 387 to preserve previous
behaviour.

The patch is a reorganization of CL6549052 by rsc.

Fixes #3912.

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

12 years agosync/atomic: document that users must deal with 64-bit alignment
Russ Cox [Wed, 2 Jan 2013 20:44:00 +0000 (15:44 -0500)]
sync/atomic: document that users must deal with 64-bit alignment

Update #599.

R=dvyukov, iant, minux.ma
CC=golang-dev
https://golang.org/cl/7001056

12 years agocmd/gc: mark wrapper methods for unnamed types as DUPOK.
Rémy Oudompheng [Wed, 2 Jan 2013 20:42:26 +0000 (21:42 +0100)]
cmd/gc: mark wrapper methods for unnamed types as DUPOK.

Unnamed types like structs with embedded fields can have methods.
These methods are generated on-the-fly by the compiler and
it may happen for identical types in different packages.
The linker must accept these multiple definitions.

Fixes #4590.

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

12 years agocmd/gc: make redeclaration between import and func less confusing
Russ Cox [Wed, 2 Jan 2013 20:34:28 +0000 (15:34 -0500)]
cmd/gc: make redeclaration between import and func less confusing

Fixes #4510.

R=ken2
CC=golang-dev
https://golang.org/cl/7001054

12 years agotest/run: handle compiledir and errorcheckdir with multi-file packages
Russ Cox [Wed, 2 Jan 2013 20:31:49 +0000 (15:31 -0500)]
test/run: handle compiledir and errorcheckdir with multi-file packages

Multiple files with the same package all get compiled together.

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

12 years agoapi: add go/types to next.txt
Russ Cox [Wed, 2 Jan 2013 20:28:30 +0000 (15:28 -0500)]
api: add go/types to next.txt

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

12 years agogo/types: remove most remaining uses of ast.Object from exported API
Robert Griesemer [Wed, 2 Jan 2013 17:27:33 +0000 (09:27 -0800)]
go/types: remove most remaining uses of ast.Object from exported API

Also: Return first error whether an error handler is set in the
      context or not (bug fix).

R=adonovan
CC=golang-dev
https://golang.org/cl/7024043

12 years agodoc: add race detector manual
Dmitriy Vyukov [Wed, 2 Jan 2013 12:38:47 +0000 (16:38 +0400)]
doc: add race detector manual

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

12 years agodoc: update standard copyright header
Andrew Gerrand [Wed, 2 Jan 2013 05:26:25 +0000 (16:26 +1100)]
doc: update standard copyright header

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

12 years agoA+C: Kamil Kisiel (individual CLA)
Andrew Gerrand [Wed, 2 Jan 2013 05:04:32 +0000 (16:04 +1100)]
A+C: Kamil Kisiel (individual CLA)

Generated by addca.

R=gobot
CC=golang-dev
https://golang.org/cl/7038046

12 years agocmd/godoc: ignore misnamed examples and print a warning
Kamil Kisiel [Wed, 2 Jan 2013 05:00:41 +0000 (16:00 +1100)]
cmd/godoc: ignore misnamed examples and print a warning

Fixes #4211.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6970051

12 years agoruntime: fix freebsd/arm instruction cache flush
Dave Cheney [Tue, 1 Jan 2013 10:47:42 +0000 (21:47 +1100)]
runtime: fix freebsd/arm instruction cache flush

sysarch requires arguments to be passed on the stack, not in registers.

Credit to Shenghou Ma (minux) for the fix.

R=minux.ma, devon.odell
CC=golang-dev
https://golang.org/cl/7037043

12 years agogo/build: disable cgo on freebsd/arm
Dave Cheney [Tue, 1 Jan 2013 10:46:18 +0000 (21:46 +1100)]
go/build: disable cgo on freebsd/arm

Under FreeBSD-CURRENT on arm, cgo enabled binaries segfault. Disable cgo support for the moment so we can have a freebsd/arm builder on the dashboard.

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

12 years agocmd/gc: do not generate code for var _ = ... unless necessary
Russ Cox [Sun, 30 Dec 2012 17:01:53 +0000 (12:01 -0500)]
cmd/gc: do not generate code for var _ = ... unless necessary

Fixes #2443.

R=ken2
CC=golang-dev
https://golang.org/cl/6997048

12 years agoencoding/json: encode map key is of string kind, decode only of string type
Ryan Slade [Sun, 30 Dec 2012 04:40:42 +0000 (15:40 +1100)]
encoding/json: encode map key is of string kind, decode only of string type

Allows encoding and decoding of maps with key of string kind, not just string type.
Fixes #3519.

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

12 years agoruntime: say 'fatal error' instead of 'throw'
Russ Cox [Sun, 30 Dec 2012 02:48:25 +0000 (21:48 -0500)]
runtime: say 'fatal error' instead of 'throw'

Fixes #4597.

R=ken2
CC=golang-dev
https://golang.org/cl/7032043

12 years agocmd/dist: use -pipe during bootstrap
Dave Cheney [Sat, 29 Dec 2012 23:33:33 +0000 (10:33 +1100)]
cmd/dist: use -pipe during bootstrap

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

12 years agoruntime: handle locked mmap failure on Linux
Sébastien Paolacci [Sat, 29 Dec 2012 19:34:06 +0000 (14:34 -0500)]
runtime: handle locked mmap failure on Linux

Used to then die on a nil pointer situation. Most Linux standard setups are rather
restrictive regarding the default amount of lockable memory.

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

12 years agocrypto/rsa: ensure that RSA keys use the full number of bits.
Adam Langley [Sat, 29 Dec 2012 00:11:37 +0000 (19:11 -0500)]
crypto/rsa: ensure that RSA keys use the full number of bits.

While half of all numbers don't have their most-significant bit set,
this is becoming increasingly impermissible for RSA moduli. In an
attempt to exclude weak keys, several bits of software either do, or
will, enforce that RSA moduli are >= 1024-bits.

However, Go often generates 1023-bit RSA moduli which this software
would then reject.

This change causes crypto/rsa to regenerate the primes in the event
that the result is shorter than requested.

It also alters crypto/rand in order to remove the performance impact
of this:

The most important change to crypto/rand is that it will now set the
top two bits in a generated prime (OpenSSL does the same thing).
Multiplying two n/2 bit numbers, where each have the top two bits set,
will always result in an n-bit product. (The effectively makes the
crypto/rsa change moot, but that seems too fragile to depend on.)

Also this change adds code to crypto/rand to rapidly eliminate some
obviously composite numbers and reduce the number of Miller-Rabin
tests needed to generate a prime.

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

12 years agodoc: fix id attributes in links to godoc
Péter Surányi [Fri, 28 Dec 2012 23:41:39 +0000 (10:41 +1100)]
doc: fix id attributes in links to godoc

CL6449105 changed godoc id attributes to ensure uniqueness.
This CL updates links to godoc pages in documents that used
the old id attributes.

R=golang-dev, dsymonds
CC=golang-dev, speter.go1
https://golang.org/cl/7015051

12 years agogo/types: Steps towards removing ast.Object from exported API.
Robert Griesemer [Fri, 28 Dec 2012 22:30:36 +0000 (14:30 -0800)]
go/types: Steps towards removing ast.Object from exported API.

- introduced type Method for methods
- renamed StructField -> Field
- removed ObjList
- methods are not sorted anymore in interfaces (for now)

R=adonovan
CC=golang-dev
https://golang.org/cl/7023043

12 years agogo/types: moved from exp/types
Robert Griesemer [Fri, 28 Dec 2012 19:41:44 +0000 (11:41 -0800)]
go/types: moved from exp/types

This is a just a file move with no other changes
besides the manual import path adjustments in these
two files:

src/pkg/exp/gotype/gotype.go
src/pkg/exp/gotype/gotype_test.go

Note: The go/types API continues to be subject to
possibly significant changes until Go 1.1. Do not
rely on it being stable at this point.

R=adonovan
CC=golang-dev
https://golang.org/cl/7013049

12 years agoexp/types: resolve composite literal keys
Robert Griesemer [Fri, 28 Dec 2012 18:40:36 +0000 (10:40 -0800)]
exp/types: resolve composite literal keys

The parser/resolver cannot accurately resolve
composite literal keys that are identifiers;
it needs type information.
Instead, try to resolve them but leave final
judgement to the type checker.

R=adonovan
CC=golang-dev
https://golang.org/cl/6994047

12 years agoio/ioutil: fix Discard data race
Brad Fitzpatrick [Fri, 28 Dec 2012 17:33:22 +0000 (09:33 -0800)]
io/ioutil: fix Discard data race

Fixes #4589

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

12 years agoruntime: fix potential crash in sigqueue
Dmitriy Vyukov [Fri, 28 Dec 2012 11:36:06 +0000 (15:36 +0400)]
runtime: fix potential crash in sigqueue
Fixes #4383.

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

12 years agonet: consolidate fd_{free,net,open}bsd.go into fd_bsd.go
Dave Cheney [Fri, 28 Dec 2012 10:01:52 +0000 (21:01 +1100)]
net: consolidate fd_{free,net,open}bsd.go into fd_bsd.go

These files are identical, so probably pre date // +build.

With a little work, fd_darwin could be merged as well.

R=mikioh.mikioh, jsing, devon.odell, lucio.dere, minux.ma
CC=golang-dev
https://golang.org/cl/7004053

12 years agocmd/ld: fix valgrind warning in strnput
Dave Cheney [Fri, 28 Dec 2012 04:32:24 +0000 (15:32 +1100)]
cmd/ld: fix valgrind warning in strnput

Fixes #4592.

Thanks to minux for the suggestion.

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

12 years agoreflect: declare slice as *[]unsafe.Pointer instead of *[]byte
Jan Ziak [Thu, 27 Dec 2012 18:35:04 +0000 (02:35 +0800)]
reflect: declare slice as *[]unsafe.Pointer instead of *[]byte

The new garbage collector (CL 6114046) may find the fake *[]byte value
and interpret its contents as bytes rather than as potential pointers.
This may lead the garbage collector to free memory blocks that
shouldn't be freed.

R=dvyukov, rsc, dave, minux.ma, remyoudompheng, iant
CC=golang-dev
https://golang.org/cl/7000059

12 years agolog/syslog: add stub for Plan 9
Akshat Kumar [Thu, 27 Dec 2012 00:45:03 +0000 (11:45 +1100)]
log/syslog: add stub for Plan 9

Proper local system log semantics still need to be
created for Plan 9. In the meantime, the test suite
(viz., exp/gotype) expects there to be some Go
source for each import path. Thus, here is a stub,
equivalent to syslog_windows, for this purpose.

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

12 years agoexp/types: some comment fixes
Robert Griesemer [Wed, 26 Dec 2012 22:04:50 +0000 (14:04 -0800)]
exp/types: some comment fixes

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

12 years agoexp/types: configurable types.Check API
Robert Griesemer [Wed, 26 Dec 2012 20:48:26 +0000 (12:48 -0800)]
exp/types: configurable types.Check API

- added Context type for configuration of type checker
- type check all function and method bodies
- (partial) fixes to shift hinting (still not complete)
- revamped test harness - does not rely on specific position
  representation anymore, just a standard (compiler) error
  message
- lots of bug fixes

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

12 years agofmt: update an old comment; fix a typo.
Oling Cat [Tue, 25 Dec 2012 22:54:24 +0000 (14:54 -0800)]
fmt: update an old comment; fix a typo.

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

12 years agoruntime: diagnose double wakeup on Note
Dmitriy Vyukov [Mon, 24 Dec 2012 17:06:57 +0000 (21:06 +0400)]
runtime: diagnose double wakeup on Note
Double wakeup is prohibited by the Note interface
and checked in lock_sema.c.

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

12 years agoexp/norm: changed API of Iter.
Marcel van Lohuizen [Mon, 24 Dec 2012 15:53:25 +0000 (16:53 +0100)]
exp/norm: changed API of Iter.
Motivations:
 - Simpler UI. Previous API proved a bit awkward for practical purposes.
 - Iter is often used in cases where one want to be able to bail out early.
   The old implementaton had too much look-ahead to be efficient.
Disadvantages:
 - ASCII performance is bad. This is unavoidable for tiny iterations.
   Example is included to show how to work around this.

Description:
Iter now iterates per boundary/segment. It returns a slice of bytes that
either points to the input bytes, the internal decomposition strings,
or the small internal buffer that each iterator has. In many cases, copying
bytes is avoided.
The method Seek was added to support jumping around the input without
having to reinitialize.

Details:
 - Table adjustments: some decompositions exist of multiple segments.
   Decompositions that are of this type are now marked so that Iter can
   handle them separately.
 - The old iterator had a different next function for different normal forms
   that was assigned to a function pointer called by Next.
   The new iterator uses this mechanism to switch between different modes
   for handling different type of input as well.  This greatly improves
   performance for Hangul and ASCII. It is also used for multi-segment
   decompositions.
 - input is now a struct of sting and []byte, instead of an interface.
   This simplifies optimizing the ASCII case.

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

12 years agoexp/locale/collate: include composed characters into the table. This eliminates
Marcel van Lohuizen [Mon, 24 Dec 2012 15:42:29 +0000 (16:42 +0100)]
exp/locale/collate: include composed characters into the table. This eliminates
the need to decompose characters for the majority of cases.  This considerably
speeds up collation while increasing the table size minimally.

To detect non-normalized strings, rather than relying on exp/norm, the table
now includes CCC information. The inclusion of this information does not
increase table size.

DETAILS
 - Raw collation elements are now a struct that includes the CCC, rather
   than a slice of ints.
 - Builder now ensures that NFD and NFC counterparts are included in the table.
   This also fixes a bug for Korean which is responsible for most of the growth
   of the table size.
 - As there is no more normalization step, code should now handle both strings
   and byte slices as input. Introduced source type to facilitate this.

NOTES
 - This change does not handle normalization correctly entirely for contractions.
   This causes a few failures with the regtest. table_test.go contains a few
   uncommented tests that can be enabled once this is fixed.  The easiest is to
   fix this once we have the new norm.Iter.
 - Removed a test cases in table_test that covers cases that are now guaranteed
   to not exist.

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

12 years agoruntime/race: make test driver print compilation errors
Dmitriy Vyukov [Mon, 24 Dec 2012 11:33:32 +0000 (15:33 +0400)]
runtime/race: make test driver print compilation errors
Currently it silently "succeeds" saying that it run 0 tests
if there are compilations errors.
With this change it fails and outputs the compilation error.

R=golang-dev, remyoudompheng
CC=golang-dev
https://golang.org/cl/7002058

12 years agocmd/gc: fix race instrumentation of unaddressable arrays.
Rémy Oudompheng [Mon, 24 Dec 2012 11:14:41 +0000 (12:14 +0100)]
cmd/gc: fix race instrumentation of unaddressable arrays.

Fixes #4578.

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

12 years agodoc/articles/wiki/test.bash: suppress unnecessary output
Shenghou Ma [Sun, 23 Dec 2012 19:48:17 +0000 (03:48 +0800)]
doc/articles/wiki/test.bash: suppress unnecessary output

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

12 years agonet/http: match curl and others' NO_PROXY wildcard handling
Brad Fitzpatrick [Sun, 23 Dec 2012 01:41:00 +0000 (17:41 -0800)]
net/http: match curl and others' NO_PROXY wildcard handling

NO_PROXY="example.com" should match "foo.example.com", just
the same as NO_PROXY=".example.com".  This is what curl and
Python do.

Fixes #4574

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

12 years agoruntime: zero d.free field
Russ Cox [Sat, 22 Dec 2012 23:23:26 +0000 (18:23 -0500)]
runtime: zero d.free field

Not programming in Go anymore:
have to clear fields in local variables.

R=ken2
CC=golang-dev
https://golang.org/cl/7002053

12 years agoruntime/debug: document that Stack is deprecated
Russ Cox [Sat, 22 Dec 2012 22:23:50 +0000 (17:23 -0500)]
runtime/debug: document that Stack is deprecated

Fixes #4070.

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

12 years agocmd/gc: add diagnostic for var, type, const named init
Russ Cox [Sat, 22 Dec 2012 22:23:33 +0000 (17:23 -0500)]
cmd/gc: add diagnostic for var, type, const named init

Before this CL, defining the variable worked fine, but then when
the implicit package-level init func was created, that caused a
name collision and a confusing error about the redeclaration.

Also add a test for issue 3705 (func init() needs body).

Fixes #4517.

R=ken2
CC=golang-dev
https://golang.org/cl/7008045

12 years agocmd/go: remove debugging flag introduced in CL 6996054
Russ Cox [Sat, 22 Dec 2012 22:04:56 +0000 (17:04 -0500)]
cmd/go: remove debugging flag introduced in CL 6996054

R=remyoudompheng
CC=golang-dev
https://golang.org/cl/7002052

12 years agocmd/gc: make forward declaration in pure Go package an error
Russ Cox [Sat, 22 Dec 2012 21:46:46 +0000 (16:46 -0500)]
cmd/gc: make forward declaration in pure Go package an error

An error during the compilation can be more precise
than an error at link time.

For 'func init', the error happens always: you can't forward
declare an init func because the name gets mangled.

For other funcs, the error happens only with the special
(and never used by hand) -= flag, which tells 6g the
package is pure go.

The go command now passes -= for pure Go packages.

Fixes #3705.

R=ken2
CC=golang-dev
https://golang.org/cl/6996054

12 years agocmd/gc: fix eval order in select
Russ Cox [Sat, 22 Dec 2012 21:46:01 +0000 (16:46 -0500)]
cmd/gc: fix eval order in select

Ordinary variable load was assumed to be not worth saving,
but not if one of the function calls later might change
its value.

Fixes #4313.

R=ken2
CC=golang-dev
https://golang.org/cl/6997047

12 years agocmd/yacc: fix debug print of token name
Russ Cox [Sat, 22 Dec 2012 21:45:35 +0000 (16:45 -0500)]
cmd/yacc: fix debug print of token name

The array skips the first TOKSTART entries.

Fixes #4410.

R=golang-dev, ken2, ken
CC=golang-dev
https://golang.org/cl/6999054

12 years agoruntime: coalesce 0-size allocations
Russ Cox [Sat, 22 Dec 2012 21:42:22 +0000 (16:42 -0500)]
runtime: coalesce 0-size allocations

Fixes #3996.

R=ken2
CC=golang-dev
https://golang.org/cl/7001052

12 years agoruntime: ignore failure from madvise
Russ Cox [Sat, 22 Dec 2012 20:06:28 +0000 (15:06 -0500)]
runtime: ignore failure from madvise

When we release memory to the OS, if the OS doesn't want us
to release it (for example, because the program executed
mlockall(MCL_FUTURE)), madvise will fail. Ignore the failure
instead of crashing.

Fixes #3435.

R=ken2
CC=golang-dev
https://golang.org/cl/6998052

12 years agoruntime: aggregate defer allocations
Russ Cox [Sat, 22 Dec 2012 19:54:39 +0000 (14:54 -0500)]
runtime: aggregate defer allocations

benchmark             old ns/op    new ns/op    delta
BenchmarkDefer              165          113  -31.52%
BenchmarkDefer10            155          103  -33.55%
BenchmarkDeferMany          216          158  -26.85%

benchmark            old allocs   new allocs    delta
BenchmarkDefer                1            0  -100.00%
BenchmarkDefer10              1            0  -100.00%
BenchmarkDeferMany            1            0  -100.00%

benchmark             old bytes    new bytes    delta
BenchmarkDefer               64            0  -100.00%
BenchmarkDefer10             64            0  -100.00%
BenchmarkDeferMany           64           66    3.12%

Fixes #2364.

R=ken2
CC=golang-dev
https://golang.org/cl/7001051

12 years agomisc/benchcmp: show byte allocation statistics
Shenghou Ma [Sat, 22 Dec 2012 19:51:16 +0000 (14:51 -0500)]
misc/benchcmp: show byte allocation statistics

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

12 years agotesting: fix example test fd leak
Emil Hessman [Sat, 22 Dec 2012 18:41:01 +0000 (13:41 -0500)]
testing: fix example test fd leak

Close the read side of the pipe.
Fixes #4551.

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

12 years agoencoding/json: A JSON tag can be any valid JSON string.
Stéphane Travostino [Sat, 22 Dec 2012 18:36:55 +0000 (13:36 -0500)]
encoding/json: A JSON tag can be any valid JSON string.

Fixes #3887.

R=golang-dev, daniel.morsing, remyoudompheng, rsc
CC=golang-dev
https://golang.org/cl/6997045

12 years agofmt: document width and flags a bit more
Russ Cox [Sat, 22 Dec 2012 18:36:39 +0000 (13:36 -0500)]
fmt: document width and flags a bit more

Fixes #4581.

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

12 years agoflag: add implicit boolFlag interface
Rick Arnold [Sat, 22 Dec 2012 18:34:48 +0000 (13:34 -0500)]
flag: add implicit boolFlag interface

Any flag.Value that has an IsBoolFlag method that returns true
will be treated as a bool flag type during parsing.

Fixes #4262.

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

12 years agocmd/gc: fix wrong interaction between inlining and embedded builtins.
Rémy Oudompheng [Sat, 22 Dec 2012 18:16:31 +0000 (19:16 +0100)]
cmd/gc: fix wrong interaction between inlining and embedded builtins.

The patch makes the compile user an ordinary package-local
symbol for the name of embedded fields of builtin type.

This is incompatible with the fix delivered for issue 2687
(revision 3c060add43fb) but fixes it in a different way, because
the explicit symbol on the field makes the typechecker able to
find it in lookdot.

Fixes #3552.

R=lvd, rsc, daniel.morsing
CC=golang-dev
https://golang.org/cl/6866047

12 years agocmd/gc: do not accept (**T).Method expressions.
Rémy Oudompheng [Sat, 22 Dec 2012 18:13:45 +0000 (19:13 +0100)]
cmd/gc: do not accept (**T).Method expressions.

The typechecking code was doing an extra, unnecessary
indirection.

Fixes #4458.

R=golang-dev, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/6998051

12 years agocmd/gc: Reject parenthesised .(type) expressions.
Daniel Morsing [Sat, 22 Dec 2012 16:36:10 +0000 (17:36 +0100)]
cmd/gc: Reject parenthesised .(type) expressions.

Fixes #4470.

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

12 years agocmd/6l, cmd/8l: add -Z flag to zero stack frame on entry
Russ Cox [Sat, 22 Dec 2012 16:20:17 +0000 (11:20 -0500)]
cmd/6l, cmd/8l: add -Z flag to zero stack frame on entry

Replacement for GOEXPERIMENT=zerostack, easier to use.
Does not require a separate toolchain.

R=ken2
CC=golang-dev
https://golang.org/cl/6996051

12 years agoundo CL 6938073 / 1542912cf09d
Russ Cox [Sat, 22 Dec 2012 16:18:04 +0000 (11:18 -0500)]
undo CL 6938073 / 1542912cf09d

remove zerostack compiler experiment; will do at link time instead

««« original CL description
cmd/gc: add GOEXPERIMENT=zerostack to clear stack on function entry

This is expensive but it might be useful in cases where
people are suffering from false positives during garbage
collection and are willing to trade the CPU time for getting
rid of the false positives.

On the other hand it only eliminates false positives caused
by other function calls, not false positives caused by dead
temporaries stored in the current function call.

The 5g/6g/8g changes were pulled out of the history, from
the last time we needed to do this (to work around a goto bug).
The code in go.h, lex.c, pgen.c is new but tiny.

R=ken2
CC=golang-dev
https://golang.org/cl/6938073
»»»

R=ken2
CC=golang-dev
https://golang.org/cl/7002051

12 years ago regexp: fix index panic in Replace
Erik St. Martin [Sat, 22 Dec 2012 16:14:56 +0000 (11:14 -0500)]
  regexp: fix index panic in Replace

When using subexpressions ($1) as replacements, when they either don't exist or values weren't found causes a panic.
This patch ensures that the match location isn't -1, to prevent out of bounds errors.
Fixes #3816.

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

12 years agoA+C: Erik St. Martin (individual CLA)
Russ Cox [Sat, 22 Dec 2012 16:13:25 +0000 (11:13 -0500)]
A+C: Erik St. Martin (individual CLA)

Generated by addca.

R=gobot
CC=golang-dev
https://golang.org/cl/7007051

12 years agocrypto/des: add an example to demonstrate EDE2 operation.
Adam Langley [Sat, 22 Dec 2012 15:50:11 +0000 (10:50 -0500)]
crypto/des: add an example to demonstrate EDE2 operation.

EDE2 is a rare DES mode that can be implemented with crypto/des, but
it's somewhat non-obvious so this CL adds an example of doing so.

Fixes #3537.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6721056

12 years agoencoding/gob: document that structs only encode/decode exported fields
Russ Cox [Sat, 22 Dec 2012 15:43:47 +0000 (10:43 -0500)]
encoding/gob: document that structs only encode/decode exported fields

Fixes #4579.

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

12 years agocmd/gc: fix error line in switch expr eval
Russ Cox [Sat, 22 Dec 2012 15:01:15 +0000 (10:01 -0500)]
cmd/gc: fix error line in switch expr eval

Fixes #4562.

R=ken2
CC=golang-dev
https://golang.org/cl/7008044

12 years agoencoding/xml: Marshal ",any" fields
Chris Jones [Sat, 22 Dec 2012 15:00:36 +0000 (10:00 -0500)]
encoding/xml: Marshal ",any" fields

Fixes #3559.

This makes Marshal handle fields marked ",any" instead of ignoring
them. That makes Marshal more symmetrical with Unmarshal, which seems
to have been a design goal.

Note some test cases were changed, because this patch changes
marshalling behavior. I think the previous behavior was buggy, but
there's still a backward-compatibility question to consider.

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

12 years agonet: fix timeout tests
Mikio Hara [Sat, 22 Dec 2012 05:56:02 +0000 (14:56 +0900)]
net: fix timeout tests

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

12 years agocmd/8g: introduce temporaries in byte multiplication.
Rémy Oudompheng [Fri, 21 Dec 2012 22:46:16 +0000 (23:46 +0100)]
cmd/8g: introduce temporaries in byte multiplication.

Also restore the smallintconst case for binary ops.

Fixes #3835.

R=daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/6999043

12 years agocmd/5g: avoid temporaries in agen OINDEX
Dave Cheney [Fri, 21 Dec 2012 22:09:31 +0000 (09:09 +1100)]
cmd/5g: avoid temporaries in agen OINDEX

Most benchmarks are within the 3% margin of error. This code path is quite common in the fmt package.

linux/arm, Freescale iMX.53 (cortex-a8)

fmt:
benchmark                      old ns/op    new ns/op    delta
BenchmarkSprintfEmpty                925          785  -15.14%
BenchmarkSprintfString              5050         5039   -0.22%
BenchmarkSprintfInt                 4425         4406   -0.43%
BenchmarkSprintfIntInt              5802         5762   -0.69%
BenchmarkSprintfPrefixedInt         7029         6541   -6.94%
BenchmarkSprintfFloat              10278        10083   -1.90%
BenchmarkManyArgs                  18558        17606   -5.13%
BenchmarkScanInts               15592690     15415360   -1.14%
BenchmarkScanRecursiveInt       25155020     25050900   -0.41%

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

12 years agogo/ast: ast.DeclStmt.Decl must be an *ast.GenDecl node (documentation)
Robert Griesemer [Fri, 21 Dec 2012 19:52:21 +0000 (11:52 -0800)]
go/ast: ast.DeclStmt.Decl must be an *ast.GenDecl node (documentation)

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

12 years agomisc/pprof: don't look for browser in current directory.
Rémy Oudompheng [Fri, 21 Dec 2012 19:40:44 +0000 (20:40 +0100)]
misc/pprof: don't look for browser in current directory.

Taken from upstream pprof.

Fixes #4564.

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

12 years agocmd/gc: mapassign2 doesn't exist anymore.
Rémy Oudompheng [Fri, 21 Dec 2012 19:39:30 +0000 (20:39 +0100)]
cmd/gc: mapassign2 doesn't exist anymore.

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

12 years agocmd/dist: make GOARM detection better compatible with thumb toolchain
Shenghou Ma [Fri, 21 Dec 2012 18:39:54 +0000 (02:39 +0800)]
cmd/dist: make GOARM detection better compatible with thumb toolchain
Fixes #4557.

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

12 years agoruntime/race: update linux runtime to r170876.
Dmitriy Vyukov [Fri, 21 Dec 2012 15:12:00 +0000 (19:12 +0400)]
runtime/race: update linux runtime to r170876.
This disables checks for limited address space
and unlimited stack. They are not required for Go.
Fixes #4577.

R=golang-dev, iant
CC=golang-dev, kamil.kisiel, minux.ma
https://golang.org/cl/7003045

12 years agocmd/go: improve wording of race detector documentation
Dmitriy Vyukov [Fri, 21 Dec 2012 15:11:10 +0000 (19:11 +0400)]
cmd/go: improve wording of race detector documentation

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

12 years agonet: make unix connection tests more robust
Mikio Hara [Fri, 21 Dec 2012 05:19:33 +0000 (14:19 +0900)]
net: make unix connection tests more robust

Avoids unlink the underlying file before the socket close.

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

12 years agoos: remove dead code
Alex Brainman [Fri, 21 Dec 2012 05:02:39 +0000 (16:02 +1100)]
os: remove dead code

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

12 years agonet/http: simplify serve() connection close
Dave Cheney [Fri, 21 Dec 2012 04:14:38 +0000 (15:14 +1100)]
net/http: simplify serve() connection close

Followup to 6971049.

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

12 years agocmd/vet: expand printf flags understood by %s and %q.
David Symonds [Fri, 21 Dec 2012 02:48:36 +0000 (13:48 +1100)]
cmd/vet: expand printf flags understood by %s and %q.

Fixes #4580.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7002043

12 years agocmd/gc: remove an incorrect assertion in escape analysis.
Rémy Oudompheng [Thu, 20 Dec 2012 22:27:28 +0000 (23:27 +0100)]
cmd/gc: remove an incorrect assertion in escape analysis.

A fatal error used to happen when escassign-ing a multiple
function return to a single node. However, the situation
naturally appears when using "go f(g())" or "defer f(g())",
because g() is escassign-ed to sink.

Fixes #4529.

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

12 years agogo/doc: don't synthesize code for examples that are not self-contained
Andrew Gerrand [Thu, 20 Dec 2012 20:06:38 +0000 (07:06 +1100)]
go/doc: don't synthesize code for examples that are not self-contained

Fixes #4309.

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

12 years agocmd/godoc: redirect for file with trailing /
Andrew Gerrand [Thu, 20 Dec 2012 20:03:00 +0000 (07:03 +1100)]
cmd/godoc: redirect for file with trailing /

Fixes #4543.

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

12 years agomath: handle exponent separately in Log2
Russ Cox [Thu, 20 Dec 2012 17:23:27 +0000 (12:23 -0500)]
math: handle exponent separately in Log2

This guarantees that powers of two return exact answers.

We could do a multiprecision approximation for the
rest of the answer too, but this seems like it should be
good enough.

Fixes #4567.

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

12 years agocgo: enable cgo on openbsd
Joel Sing [Thu, 20 Dec 2012 14:43:19 +0000 (01:43 +1100)]
cgo: enable cgo on openbsd

Enable cgo on OpenBSD.

The OpenBSD ld.so(1) does not currently support PT_TLS sections. Work
around this by fixing up the TCB that has been provided by librthread
and reallocating a TCB with additional space for TLS. Also provide a
wrapper for pthread_create, allowing zeroed TLS to be allocated for
threads created externally to Go.

Joint work with Shenghou Ma (minux).

Requires change 6846064.

Fixes #3205.

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

12 years agocmd/[568]l: do not generate PT_TLS on openbsd
Joel Sing [Thu, 20 Dec 2012 14:27:50 +0000 (01:27 +1100)]
cmd/[568]l: do not generate PT_TLS on openbsd

The OpenBSD ld.so(1) does not currently support PT_TLS and refuses
to load ELF binaries that contain PT_TLS sections. Do not emit PT_TLS
sections - we will handle this appropriately in runtime/cgo instead.

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

12 years agonet/http: only call client SetCookie when needed
Joakim Sernbrant [Thu, 20 Dec 2012 00:24:38 +0000 (16:24 -0800)]
net/http: only call client SetCookie when needed

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

12 years agotesting: only capture stdout when running examples
Andrew Gerrand [Wed, 19 Dec 2012 23:48:33 +0000 (10:48 +1100)]
testing: only capture stdout when running examples

Fixes #4550.

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

12 years agonet/http: fix server connection leak on Handler's panic(nil)
Brad Fitzpatrick [Wed, 19 Dec 2012 23:39:19 +0000 (15:39 -0800)]
net/http: fix server connection leak on Handler's panic(nil)

If a handler did a panic(nil), the connection was never closed.

Fixes #4050

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6971049

12 years agogo/token: fix data race on FileSet.last
Dave Cheney [Wed, 19 Dec 2012 21:26:24 +0000 (08:26 +1100)]
go/token: fix data race on FileSet.last

Fixes #4345.

Benchmarks are promising,

benchmark         old ns/op    new ns/op    delta
BenchmarkPrint     14716391     14747131   +0.21%

benchmark         old ns/op    new ns/op    delta
BenchmarkParse      8846219      8809343   -0.42%

benchmark          old MB/s     new MB/s  speedup
BenchmarkParse         6.61         6.64    1.00x

Also includes additional tests to improve token.FileSet coverage.

R=dvyukov, gri
CC=golang-dev
https://golang.org/cl/6968044

12 years agogo/token: add test for concurrent use of FileSet.Pos
Dave Cheney [Wed, 19 Dec 2012 00:38:00 +0000 (16:38 -0800)]
go/token: add test for concurrent use of FileSet.Pos

Update #4354.

Add a test to expose the race in the FileSet position cache.

R=dvyukov, gri
CC=fullung, golang-dev
https://golang.org/cl/6940078

12 years agoC: add Shawn Ledbetter (Google CLA)
Andrew Gerrand [Tue, 18 Dec 2012 23:14:05 +0000 (10:14 +1100)]
C: add Shawn Ledbetter (Google CLA)

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

12 years agoall: fix typos
Shenghou Ma [Tue, 18 Dec 2012 19:04:09 +0000 (03:04 +0800)]
all: fix typos
caught by https://github.com/lyda/misspell-check.

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

12 years agocmd/go: pass gccgoflags at the end of gccgo command line, warn if user passes the...
Shenghou Ma [Tue, 18 Dec 2012 17:48:09 +0000 (01:48 +0800)]
cmd/go: pass gccgoflags at the end of gccgo command line, warn if user passes the wrong toolchain options

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

12 years agoruntime: use "mp" and "gp" instead of "m" and "g" for local variable name to avoid...
Jingcheng Zhang [Tue, 18 Dec 2012 16:30:29 +0000 (00:30 +0800)]
runtime: use "mp" and "gp" instead of "m" and "g" for local variable name to avoid confusion with the global "m" and "g".

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

12 years agoA+C: Eric Milliken (individual CLA)
Adam Langley [Tue, 18 Dec 2012 16:28:40 +0000 (11:28 -0500)]
A+C: Eric Milliken (individual CLA)

Generated by addca.

R=gobot
CC=golang-dev
https://golang.org/cl/6945079

12 years agocmd/5l, cmd/6l, cmd/8l: fix function symbol generation from gcc compiled source code
Shenghou Ma [Tue, 18 Dec 2012 15:17:39 +0000 (23:17 +0800)]
cmd/5l, cmd/6l, cmd/8l: fix function symbol generation from gcc compiled source code
For CL 6853059.

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

12 years agoruntime: use clock_gettime to get ns resolution for time.now & runtime.nanotime
Shenghou Ma [Tue, 18 Dec 2012 14:57:25 +0000 (22:57 +0800)]
runtime: use clock_gettime to get ns resolution for time.now & runtime.nanotime

For Linux/{386,arm}, FreeBSD/{386,amd64,arm}, NetBSD/{386,amd64}, OpenBSD/{386,amd64}.
Note: our Darwin implementation already has ns resolution.

Linux/386 (Core i7-2600 @ 3.40GHz, kernel 3.5.2-gentoo)
benchmark       old ns/op    new ns/op    delta
BenchmarkNow          110          118   +7.27%

Linux/ARM (ARM Cortex-A8 @ 800MHz, kernel 2.6.32.28 android)
benchmark       old ns/op    new ns/op    delta
BenchmarkNow          625          542  -13.28%

Linux/ARM (ARM Cortex-A9 @ 1GHz, Pandaboard)
benchmark       old ns/op    new ns/op    delta
BenchmarkNow          992          909   -8.37%

FreeBSD 9-REL-p1/amd64 (Dell R610 Server with Xeon X5650 @ 2.67GHz)
benchmark       old ns/op    new ns/op    delta
BenchmarkNow          699          695   -0.57%

FreeBSD 9-REL-p1/amd64 (Atom D525 @ 1.80GHz)
benchmark       old ns/op    new ns/op    delta
BenchmarkNow         1553         1658   +6.76%

OpenBSD/amd64 (Dell E6410 with i5 CPU M 540 @ 2.53GHz)
benchmark       old ns/op    new ns/op    delta
BenchmarkNow         1262         1236   -2.06%

OpenBSD/i386 (Asus eeePC 701 with Intel Celeron M 900MHz - locked to 631MHz)
benchmark       old ns/op    new ns/op    delta
BenchmarkNow         5089         5043   -0.90%

NetBSD/i386 (VMware VM with Core i5 CPU @ 2.7GHz)
benchmark       old ns/op    new ns/op    delta
BenchmarkNow          277          278   +0.36%

NetBSD/amd64 (VMware VM with Core i5 CPU @ 2.7Ghz)
benchmark       old ns/op    new ns/op    delta
BenchmarkNow          103          105   +1.94%

Thanks Maxim Khitrov, Joel Sing, and Dave Cheney for providing benchmark data.

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

12 years agogo/doc: add "hdr-" prefix to headers generated from package overviews.
David Symonds [Tue, 18 Dec 2012 01:19:04 +0000 (12:19 +1100)]
go/doc: add "hdr-" prefix to headers generated from package overviews.

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

12 years agoexp/gotype: disable failing tests and add a few more
Robert Griesemer [Mon, 17 Dec 2012 22:32:46 +0000 (14:32 -0800)]
exp/gotype: disable failing tests and add a few more

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

12 years agocmd/6g: fix componentgen for funarg structs.
Rémy Oudompheng [Mon, 17 Dec 2012 21:29:43 +0000 (22:29 +0100)]
cmd/6g: fix componentgen for funarg structs.

Fixes #4518.

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