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

14293 Commits

Author SHA1 Message Date
Robert Griesemer
27c990e794 encoding/binary: skip blank fields when (en/de)coding structs
- minor unrelated cleanups
- performance impact in the noise

benchmark                       old ns/op    new ns/op    delta
BenchmarkReadSlice1000Int32s        83462        83346   -0.14%
BenchmarkReadStruct                  4141         4247   +2.56%
BenchmarkReadInts                    1588         1586   -0.13%
BenchmarkWriteInts                   1550         1489   -3.94%
BenchmarkPutUvarint32                  39           39   +1.02%
BenchmarkPutUvarint64                 142          144   +1.41%

benchmark                        old MB/s     new MB/s  speedup
BenchmarkReadSlice1000Int32s        47.93        47.99    1.00x
BenchmarkReadStruct                 16.90        16.48    0.98x
BenchmarkReadInts                   18.89        18.91    1.00x
BenchmarkWriteInts                  19.35        20.15    1.04x
BenchmarkPutUvarint32              101.90       100.82    0.99x
BenchmarkPutUvarint64               56.11        55.45    0.99x

Fixes #4185.

R=r, rsc
CC=golang-dev
https://golang.org/cl/6750053
2012-11-01 12:39:20 -07:00
Russ Cox
8fadb70cf8 build: do not run race tests with cgo disabled
R=dvyukov
CC=golang-dev
https://golang.org/cl/6810067
2012-11-01 15:13:00 -04:00
Dmitriy Vyukov
936498e5dc cmd/gc: fix build
R=golang-dev
CC=golang-dev
https://golang.org/cl/6826047
2012-11-01 22:59:53 +04:00
Dmitriy Vyukov
de10a23db1 cmd/gc: racewalk: fix a bunch of minor issues
1. Prepend racefuncenter() to fn->enter -- fn->enter can contain new() calls,
and we want them to be in the scope of the function.
2. Dump fn->enter and fn->exit.
3. Add TODO that OTYPESW expression can contain interesting memory accesses.
4. Ignore only _ names instead of all names starting with _.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6822048
2012-11-01 22:56:04 +04:00
Han-Wen Nienhuys
4094c1bae7 syscall: add {Get,Set,List,Remove}xattr on Linux.
R=golang-dev, minux.ma, fullung, dave, rsc, hanwenn
CC=golang-dev
https://golang.org/cl/6350074
2012-11-01 14:49:38 -04:00
Rémy Oudompheng
ce287933d6 cmd/gc, runtime: pass PC directly to racefuncenter.
go test -race -run none -bench . encoding/json
benchmark                      old ns/op    new ns/op    delta
BenchmarkCodeEncoder          3207689000   1716149000  -46.50%
BenchmarkCodeMarshal          3206761000   1715677000  -46.50%
BenchmarkCodeDecoder          8647304000   4482709000  -48.16%
BenchmarkCodeUnmarshal        8032217000   3451248000  -57.03%
BenchmarkCodeUnmarshalReuse   8016722000   3480502000  -56.58%
BenchmarkSkipValue           10340453000   4560313000  -55.90%

benchmark                       old MB/s     new MB/s  speedup
BenchmarkCodeEncoder                0.60         1.13    1.88x
BenchmarkCodeMarshal                0.61         1.13    1.85x
BenchmarkCodeDecoder                0.22         0.43    1.95x
BenchmarkCodeUnmarshal              0.24         0.56    2.33x
BenchmarkCodeUnmarshalReuse         0.24         0.56    2.33x
BenchmarkSkipValue                  0.19         0.44    2.32x

Fixes #4248.

R=dvyukov, golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6815066
2012-11-01 19:43:29 +01:00
Robert Griesemer
5d15963a1f exp/types/staging: filling in more blanks
- simplified assignment checking by removing duplicate code
- implemented field lookup (methods, structs, embedded fields)
- importing methods (not just parsing them)
- type-checking functions and methods
- typechecking more statements (inc/dec, select, return)
- tracing support for easier debugging
- handling nil more correctly (comparisons)
- initial support for [...]T{} arrays
- initial support for method expressions
- lots of bug fixes

All packages under pkg/go as well as pkg/exp/types typecheck
now with pkg/exp/gotype applied to them; i.e., a significant
amount of typechecking works now (several statements are not
implemented yet, but handling statements is almost trivial in
comparison with typechecking expressions).

R=rsc
CC=golang-dev
https://golang.org/cl/6768063
2012-11-01 11:23:27 -07:00
Ian Lance Taylor
3b04d23cbf cmd/cgo: improve gccgo support
Use wrapper functions to tell scheduler what we are doing.

With this patch, and a separate patch to the go tool, all the
cgo tests pass with gccgo.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6812058
2012-11-01 11:21:30 -07:00
Ian Lance Taylor
f284a3ff4d cmd/go: fixes to gccgo support
* Use -fgo-pkgpath and -gccgopkgpath rather than -fgo-prefix
  and -gccgoprefix.
* Define GOPKGPATH when compiling .c or .s files for gccgo.
* Use -fgo-relative-import-path.
* Produce .o files for gccgo, not .[568] files.
* Pass -E when linking if using cgo.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6820064
2012-11-01 11:13:50 -07:00
Ian Lance Taylor
f07f9de8ec go/build: support compiler as build constraint
This supports writing different .c/.s code when using gccgo.

R=golang-dev, dsymonds, iant, rsc
CC=golang-dev
https://golang.org/cl/6823055
2012-11-01 11:12:15 -07:00
Dmitriy Vyukov
b11f85a8aa cmd/gc: racewalk: fix instrumentation of ninit lists
The idea is to (1) process ninit of all nodes,
and (2) put instrumentation of ninit into the nodes themselves (not the top-level statement ninit).
Fixes #4304.

R=golang-dev, rsc
CC=golang-dev, lvd
https://golang.org/cl/6818049
2012-11-01 22:11:12 +04:00
Rémy Oudompheng
8d95245d0d cmd/gc: fix incomplete export data when inlining with local variables.
When local declarations needed unexported types, these could
be missing in the export data.

Fixes build with -gcflags -lll, except for exp/gotype.

R=golang-dev, rsc, lvd
CC=golang-dev
https://golang.org/cl/6813067
2012-11-01 19:06:52 +01:00
Dmitriy Vyukov
95329d4cd4 run.bash: add sanity test for race detector
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6612064
2012-11-01 22:02:52 +04:00
Rémy Oudompheng
76500b14a1 cmd/gc: fix inlining bug with local variables.
Fixes #4323.

R=rsc, lvd, golang-dev
CC=golang-dev
https://golang.org/cl/6815061
2012-11-01 18:59:32 +01:00
Ryan Hitchman
c7873ff2a6 compress/flate: shrink decompressor struct for better performance
Helps with issue 2703.

R=dave, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/5536078
2012-11-01 13:57:24 -04:00
Daniel Morsing
85d60a727c cmd/gc: do simple bounds checking of constant indices/slices in typecheck.
This should make the compiler emit errors specific to the bounds checking instead of overflow errors on the underlying types.

Updates #4232.

R=rsc
CC=golang-dev
https://golang.org/cl/6783054
2012-11-01 18:45:19 +01:00
Robert Griesemer
1e8e14c901 spec: clarify returns, defer statements, and panics
This is an attempt at making the interaction between
these three constructs clearer. Specifically:

- return statements terminate a function, execute deferred
  functions, return to the caller, and then execution
  continues after the call

- panic calls terminate a function, execute deferred
  functions, return to the caller, and then re-panic

- deferred functions are executed before a function _returns_
  to its caller

The hope is that with this change it becomes clear when a
deferred function is executed (when a function returns),
and when it is not (when a program exits).

R=r, rsc, iant, ken, iant
CC=golang-dev
https://golang.org/cl/6736071
2012-11-01 10:13:48 -07:00
Jan Ziak
5c1422afab runtime: move Itab to runtime.h
The 'type' field of Itab will be used by the garbage collector.

R=rsc
CC=golang-dev
https://golang.org/cl/6815059
2012-11-01 13:13:20 -04:00
Alexey Borzenkov
1eae1252e9 net: fix a bad cast in dnsmsg.go
Incorrect cast was causing panics when
calling String() on dnsMsg with dnsRR_A
answers.

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6818043
2012-11-01 12:57:44 -04:00
Jan Ziak
e0c9d04aec runtime: add memorydump() debugging function
R=golang-dev
CC=golang-dev, remyoudompheng, rsc
https://golang.org/cl/6780059
2012-11-01 12:56:25 -04:00
Russ Cox
e4cef96be6 cmd/gc: avoid %#x of 0
Plan 9 and Go's lib9/fmt disagree on whether %#x includes the 0x prefix
when printing 0, because ANSI C gave bad advice long ago.

Avoiding that case makes binaries compiled on different systems compatible.

R=ken2
CC=akumar, golang-dev
https://golang.org/cl/6814066
2012-11-01 12:55:21 -04:00
Andrew Gerrand
c128474a7d website: remove floating topbar
This caused more problems than it was worth.

Fixes #4301.
Fixes #4317.

R=golang-dev, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6818076
2012-11-02 03:30:49 +11:00
Rémy Oudompheng
022b361ae2 cmd/5g, cmd/6g, cmd/8g: remove width check for componentgen.
The move to 64-bit ints in 6g made componentgen ineffective.
In componentgen, the code already selects which values it can handle.

On amd64:
benchmark                 old ns/op    new ns/op    delta
BenchmarkBinaryTree17    9477970000   9582314000   +1.10%
BenchmarkFannkuch11      5928750000   5255080000  -11.36%
BenchmarkGobDecode         37103040     31451120  -15.23%
BenchmarkGobEncode         16042490     16844730   +5.00%
BenchmarkGzip             811337400    741373600   -8.62%
BenchmarkGunzip           197928700    192844500   -2.57%
BenchmarkJSONEncode       224164100    140064200  -37.52%
BenchmarkJSONDecode       258346800    231829000  -10.26%
BenchmarkMandelbrot200      7561780      7601615   +0.53%
BenchmarkParse             12970340     11624360  -10.38%
BenchmarkRevcomp         1969917000   1699137000  -13.75%
BenchmarkTemplate         296182000    263117400  -11.16%

R=nigeltao, dave, daniel.morsing
CC=golang-dev
https://golang.org/cl/6821052
2012-11-01 14:36:08 +01:00
Alex Brainman
ee26a5e4f2 run.bat: make output consistent
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/6811059
2012-11-01 13:04:08 +11:00
Mikio Hara
b602c3dbbd all: clear execute bit
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6826044
2012-11-01 10:04:42 +09:00
Nigel Tao
de6bf20496 image/png: degrade gracefully for palette index values that aren't
defined by the PLTE chunk. Such pixels decode to opaque black,
which matches what libpng does.

Fixes #4319.

On my reading, the PNG spec isn't clear whether palette index values
outside of those defined by the PLTE chunk is an error, and if not,
what to do.

Libpng 1.5.3 falls back to opaque black. png_set_PLTE says:

/* Changed in libpng-1.2.1 to allocate PNG_MAX_PALETTE_LENGTH instead
 * of num_palette entries, in case of an invalid PNG file that has
 * too-large sample values.
 */
png_ptr->palette = (png_colorp)png_calloc(png_ptr,
        PNG_MAX_PALETTE_LENGTH * png_sizeof(png_color));

ImageMagick 6.5.7 returns an error:

$ convert -version
Version: ImageMagick 6.5.7-8 2012-08-17 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC
Features: OpenMP
$ convert packetloss.png x.bmp
convert: Invalid colormap index `packetloss.png' @ image.c/SyncImage/3849.

R=r
CC=golang-dev
https://golang.org/cl/6822065
2012-11-01 11:46:06 +11:00
Dan Callahan
15e50d7c7a encoding/json: clarify correct usage of struct tags in associated article.
Fixes #4297.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/6817045
2012-10-31 15:52:27 -07:00
Robert Griesemer
3ead7fb5dc A+C: adding Dan Callahan (individual CLA)
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6815062
2012-10-31 15:52:15 -07:00
Robert Griesemer
369a974b41 spec: slight wording change to remove a formal contradiction
Fixes #4324.

R=r
CC=golang-dev
https://golang.org/cl/6822062
2012-10-31 15:07:25 -07:00
Adam Langley
5176481f16 crypto/cipher: add examples
Fixes #1390.

R=golang-dev, minux.ma, adg, agl
CC=golang-dev
https://golang.org/cl/6631044
2012-10-31 16:37:26 -04:00
Robert Griesemer
0cbca268d8 gofmt: simplify slices of the form s[a : len(s)] to s[a:]
Fixes #4314.

R=r, rsc
CC=golang-dev
https://golang.org/cl/6822059
2012-10-31 11:48:55 -07:00
Rob Pike
c15afa887a src/lib9/utf: update to Unicode 6.2.0
Fixes #2874.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6820068
2012-10-31 10:52:59 -07:00
Rob Pike
7ea65e5154 spec: we're now at Unicode 6.2.0
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6812060
2012-10-31 10:32:15 -07:00
Rob Pike
a90b3a5528 strconv: update to unicode 6.2.0
Fixes build, too.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6775088
2012-10-31 10:11:04 -07:00
Marcel van Lohuizen
e14cf90a8b unicode: move unicode and related packages to Unicode 6.2.0.
R=r, mpvl
CC=golang-dev
https://golang.org/cl/6818067
2012-10-31 17:32:16 +01:00
Marcel van Lohuizen
b8b329451c exp/locale/collate: implementation of tailorings and table generation.
Tailorings are represented by removing and reinserting entries from a linked list.
After all tailorings are done, missing weights are computed and verified.
This implementation assumes that entries that are used in expansions are not
reinserted at a later point.  This considerably simplifies the implementation.

R=r
CC=golang-dev
https://golang.org/cl/6739052
2012-10-31 14:28:44 +01:00
Marcel van Lohuizen
4c1a6f84f8 exp/locale/collate: removed weights struct to allow for faster and easier
incremental comparisons. Instead, processing is now done directly on colElems.
As a result, the size of the weights array is now reduced by 75%.
Details:
- Primary value of type 1 colElem is shifted by 1 bit so that primaries
  of all types can be compared without shifting.
- Quaternary values are now stored in the colElem itself. This is possible
  as quaternary values other than 0 or maxQuaternary are only needed when other
  values are ignored.
- Simplified processWeights by removing cases that are needed for ICU but not
  for us (our CJK primary values fit in a single value).

R=r
CC=golang-dev
https://golang.org/cl/6817054
2012-10-31 14:28:18 +01:00
Marcel van Lohuizen
bc0783dbe5 exp/locale/collate: add context to entry.
R=r
CC=golang-dev
https://golang.org/cl/6727049
2012-10-31 14:02:43 +01:00
Ian Lance Taylor
7dc1182c27 test: match gccgo error messages for bug358.go
I fixed a bug in gccgo that was causing it to only give an
error for the first package that was imported and not used.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6813058
2012-10-30 20:56:32 -07:00
Peter Waller
3494010f7d syscall/exec_linux: enable changing controlling tty
As discussed in the following thread:
https://groups.google.com/forum/?fromgroups=#!topic/golang-dev/emeJffxWhVo

This is required to enable applications such as `less` to use something
other than stdin as the controlling terminal.

R=dave, iant
CC=bradfitz, golang-dev
https://golang.org/cl/6785057
2012-10-30 17:36:18 -07:00
Ian Lance Taylor
9b0f4be2fb A+C: add Peter Waller (individual CLA)
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6775083
2012-10-30 17:24:01 -07:00
Alex Brainman
fa3e4fc429 net: fix connection resets when closed on windows
It is common to close network connection while another goroutine is
blocked reading on another goroutine. This sequence corresponds to
windows calls to WSARecv to start io, followed by GetQueuedCompletionStatus
that blocks until io completes, and, finally, closesocket called from
another thread. We were expecting that closesocket would unblock
GetQueuedCompletionStatus, and it does, but not always
(http://code.google.com/p/go/issues/detail?id=4170#c5). Also that sequence
results in connection is being reset.

This CL inserts CancelIo between GetQueuedCompletionStatus and closesocket,
and waits for both WSARecv and GetQueuedCompletionStatus to complete before
proceeding to closesocket.  This seems to fix both connection resets and
issue 4170. It also makes windows code behave similar to unix version.

Unfortunately, CancelIo needs to be called on the same thread as WSARecv.
So we have to employ strategy we use for connections with deadlines to
every connection now. It means, there are 2 unavoidable thread switches
for every io. Some newer versions of windows have new CancelIoEx api that
doesn't have these drawbacks, and this CL uses this capability when available.
As time goes by, we should have less of CancelIo and more of CancelIoEx
systems. Computers with CancelIoEx are also not affected by issue 4195 anymore.

Fixes #3710
Fixes #3746
Fixes #4170
Partial fix for issue 4195

R=golang-dev, mikioh.mikioh, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/6604072
2012-10-31 10:24:37 +11:00
Nigel Tao
ad487dad75 image/jpeg: don't call ensureNBits unless we have to.
benchmark                     old ns/op    new ns/op    delta
BenchmarkDecodeBaseline         3155638      2783998  -11.78%
BenchmarkDecodeProgressive      4008088      3660310   -8.68%

R=r, bradfitz
CC=golang-dev
https://golang.org/cl/6775072
2012-10-31 10:02:11 +11:00
Alexey Borzenkov
d12a7d39d1 net: use read deadline in Accept on windows
Fixes #4296.

R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/6815044
2012-10-31 09:58:05 +11:00
Rob Pike
8884fabfd7 reflect: improve documentation for DeepEqual regarding maps
Keys use ==; values use deep equality. Also remove the word 'member'.
Fixes #4258.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6812055
2012-10-30 14:42:47 -07:00
Robert Griesemer
465b9c35e5 gofmt: apply gofmt -w src misc
Remove trailing whitespace in comments.
No other changes.

R=r
CC=golang-dev
https://golang.org/cl/6815053
2012-10-30 13:38:01 -07:00
Robert Griesemer
db2b6ed854 go/printer, gofmt: trim trailing whitespace in comments
Also: updated go fix testcases to pass tests.

Fixes #4310.

R=r
CC=golang-dev
https://golang.org/cl/6810055
2012-10-30 13:09:47 -07:00
Dave Cheney
640d818f2a archive/zip: handle corrupt extra data records
Fixes #4302.

R=golang-dev, bradfitz, adg
CC=golang-dev
https://golang.org/cl/6811048
2012-10-31 03:51:59 +11:00
Robert Griesemer
d77eb12998 exp/gotype: add more test packages
R=r
CC=golang-dev
https://golang.org/cl/6822051
2012-10-30 09:42:43 -07:00
Shenghou Ma
78a6f75241 cmd/ld: handle weak symbols
compiler_rt introduces a weak and hidden symbol compilerrt_abort_impl
into our pre-linked _all.o object, we have to handle it.

Fixes #4273.

R=iant, rsc, r
CC=golang-dev
https://golang.org/cl/6783050
2012-10-30 23:58:43 +08:00