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

14786 Commits

Author SHA1 Message Date
Robert Griesemer
614b02d22a spec: clarify language about unary operator &
A composite literal may be parenthesized when
used as operand for the unary operator &.

R=rsc, iant, r, ken
CC=golang-dev
https://golang.org/cl/6996053
2013-01-02 18:11:49 -08:00
Rémy Oudompheng
cf77dd37e7 cmd/8g: extend elimination of temporaries to SSE2 code.
Before:
(erf.go:188)    TEXT     Erf+0(SB),$220
(erf.go:265)    TEXT     Erfc+0(SB),$204
(lgamma.go:174) TEXT     Lgamma+0(SB),$948

After:
(erf.go:188)    TEXT     Erf+0(SB),$84
(erf.go:265)    TEXT     Erfc+0(SB),$84
(lgamma.go:174) TEXT     Lgamma+0(SB),$44

SSE before vs. SSE after:

benchmark             old ns/op    new ns/op    delta
BenchmarkAcosh               81           49  -39.14%
BenchmarkAsinh              109          109   +0.00%
BenchmarkAtanh               73           74   +0.68%
BenchmarkLgamma             138           42  -69.20%
BenchmarkModf                24           15  -36.95%
BenchmarkSqrtGo             565          556   -1.59%

R=rsc
CC=golang-dev
https://golang.org/cl/7028048
2013-01-03 00:44:31 +01:00
Russ Cox
5e46d540c8 cmd/dist: use separate args for separate compiler flags
This makes dist safe for CL 7035043 (but keeps working now too).

R=golang-dev, remyoudompheng
CC=golang-dev
https://golang.org/cl/7029047
2013-01-02 17:52:54 -05:00
Brad Fitzpatrick
5e8ca201d1 net/http: make NewRequest pick a ContentLength from a *bytes.Reader too
It already did so for its sibling, *strings.Reader, as well as *bytes.Buffer.

R=edsrzf, dave, adg, kevlar, remyoudompheng, adg, rsc
CC=golang-dev
https://golang.org/cl/7031045
2013-01-02 14:40:27 -08:00
Thomas Kappler
cdec0850f8 encoding/json: don't panic marshaling anonymous non-struct field
Add a check for this case and don't try to follow the anonymous
type's non-existent fields.

Fixes #4474.

R=rsc
CC=golang-dev
https://golang.org/cl/6945065
2013-01-02 17:39:41 -05:00
Russ Cox
a29702f067 A+C: Thomas Kappler (individual CLA)
Generated by addca.

R=gobot
CC=golang-dev
https://golang.org/cl/7038049
2013-01-02 17:39:20 -05:00
Rick Arnold
948f0b7a0b net/http: document Request.URL
Request.URL had no documentation before and some people were expecting all fields to be populated.

Fixes #3805.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7008046
2013-01-02 17:37:27 -05:00
Rémy Oudompheng
15f2c01f44 cmd/8g: fix possibly uninitialized variable in foptoas.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7045043
2013-01-02 23:20:52 +01:00
Rémy Oudompheng
9afb34b42e 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
2013-01-02 22:55:23 +01:00
Russ Cox
64a0017d6e 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
2013-01-02 15:44:00 -05:00
Rémy Oudompheng
20c76f7f3f 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
2013-01-02 21:42:26 +01:00
Russ Cox
ae2131ab3b cmd/gc: make redeclaration between import and func less confusing
Fixes #4510.

R=ken2
CC=golang-dev
https://golang.org/cl/7001054
2013-01-02 15:34:28 -05:00
Russ Cox
8850d14fe9 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
2013-01-02 15:31:49 -05:00
Russ Cox
7ced3f12bc api: add go/types to next.txt
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/7035045
2013-01-02 15:28:30 -05:00
Robert Griesemer
a846d479b3 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
2013-01-02 09:27:33 -08:00
Dmitriy Vyukov
b2e9ca7f2e doc: add race detector manual
R=minux.ma, franciscossouza, rsc, adg, adg
CC=golang-dev
https://golang.org/cl/6948043
2013-01-02 16:38:47 +04:00
Andrew Gerrand
d5d046e306 doc: update standard copyright header
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/7034044
2013-01-02 16:26:25 +11:00
Andrew Gerrand
53d3bbcb95 A+C: Kamil Kisiel (individual CLA)
Generated by addca.

R=gobot
CC=golang-dev
https://golang.org/cl/7038046
2013-01-02 16:04:32 +11:00
Kamil Kisiel
267a55397b cmd/godoc: ignore misnamed examples and print a warning
Fixes #4211.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6970051
2013-01-02 16:00:41 +11:00
Dave Cheney
c2d2bfcc49 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
2013-01-01 21:47:42 +11:00
Dave Cheney
52dc13b5f3 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
2013-01-01 21:46:18 +11:00
Russ Cox
6592456feb cmd/gc: do not generate code for var _ = ... unless necessary
Fixes #2443.

R=ken2
CC=golang-dev
https://golang.org/cl/6997048
2012-12-30 12:01:53 -05:00
Ryan Slade
a4600126d9 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
2012-12-30 15:40:42 +11:00
Russ Cox
a22389ec38 runtime: say 'fatal error' instead of 'throw'
Fixes #4597.

R=ken2
CC=golang-dev
https://golang.org/cl/7032043
2012-12-29 21:48:25 -05:00
Dave Cheney
0c6beb00fb cmd/dist: use -pipe during bootstrap
R=golang-dev, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/7025044
2012-12-30 10:33:33 +11:00
Sébastien Paolacci
e786829e83 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
2012-12-29 14:34:06 -05:00
Adam Langley
975bf6d323 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
2012-12-28 19:11:37 -05:00
Péter Surányi
be7c0f31c7 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
2012-12-29 10:41:39 +11:00
Robert Griesemer
c8eb71b057 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
2012-12-28 14:30:36 -08:00
Robert Griesemer
73aaa44c24 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
2012-12-28 11:41:44 -08:00
Robert Griesemer
d0428379e7 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
2012-12-28 10:40:36 -08:00
Brad Fitzpatrick
eb43ce2d77 io/ioutil: fix Discard data race
Fixes #4589

R=golang-dev, iant, dvyukov
CC=golang-dev
https://golang.org/cl/7011047
2012-12-28 09:33:22 -08:00
Dmitriy Vyukov
91484c6c48 runtime: fix potential crash in sigqueue
Fixes #4383.

R=golang-dev, minux.ma, rsc, iant
CC=golang-dev
https://golang.org/cl/6996060
2012-12-28 15:36:06 +04:00
Dave Cheney
7c4183ac24 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
2012-12-28 21:01:52 +11:00
Dave Cheney
6535eb3a6d 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
2012-12-28 15:32:24 +11:00
Jan Ziak
90f9beca15 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
2012-12-28 02:35:04 +08:00
Akshat Kumar
5bcb9707b6 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
2012-12-27 11:45:03 +11:00
Robert Griesemer
3e8304b377 exp/types: some comment fixes
R=adonovan, bradfitz
CC=golang-dev
https://golang.org/cl/7018046
2012-12-26 14:04:50 -08:00
Robert Griesemer
888111e081 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
2012-12-26 12:48:26 -08:00
Oling Cat
f296adf819 fmt: update an old comment; fix a typo.
R=golang-dev, iant
CC=golang-dev, minux.ma
https://golang.org/cl/6998055
2012-12-25 14:54:24 -08:00
Dmitriy Vyukov
4380fa6d99 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
2012-12-24 21:06:57 +04:00
Marcel van Lohuizen
cfcc3ebfa4 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
2012-12-24 16:53:25 +01:00
Marcel van Lohuizen
9aa70984a9 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
2012-12-24 16:42:29 +01:00
Dmitriy Vyukov
43f2fc308b 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
2012-12-24 15:33:32 +04:00
Rémy Oudompheng
ecbf99ad97 cmd/gc: fix race instrumentation of unaddressable arrays.
Fixes #4578.

R=dvyukov, golang-dev
CC=golang-dev
https://golang.org/cl/7005050
2012-12-24 12:14:41 +01:00
Shenghou Ma
fcc5cf639e doc/articles/wiki/test.bash: suppress unnecessary output
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7000045
2012-12-24 03:48:17 +08:00
Brad Fitzpatrick
82ae6434b3 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
2012-12-22 17:41:00 -08:00
Russ Cox
403f012534 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
2012-12-22 18:23:26 -05:00
Russ Cox
e49a183b76 runtime/debug: document that Stack is deprecated
Fixes #4070.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7004050
2012-12-22 17:23:50 -05:00
Russ Cox
3aed92f811 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
2012-12-22 17:23:33 -05:00