]> Cypherpunks repositories - gostls13.git/log
gostls13.git
12 years agoimage/png: optimize encoding image.Gray and image.NRGBA images.
Nigel Tao [Thu, 13 Sep 2012 05:47:12 +0000 (15:47 +1000)]
image/png: optimize encoding image.Gray and image.NRGBA images.

benchmark                    old ns/op    new ns/op    delta
BenchmarkEncodeGray           23616080      5624558  -76.18%
BenchmarkEncodeNRGBOpaque     34181260     17144380  -49.84%
BenchmarkEncodeNRGBA          41235820     20345990  -50.66%
BenchmarkEncodePaletted        5594652      5620362   +0.46%
BenchmarkEncodeRGBOpaque      17242210     17168820   -0.43%
BenchmarkEncodeRGBA           66515720     67243560   +1.09%

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

12 years ago undo CL 6493071 / 56c7453d488f
Andrew Gerrand [Thu, 13 Sep 2012 01:14:20 +0000 (11:14 +1000)]
  undo CL 6493071 / 56c7453d488f

This change messes with anchor links. It obscures the item being linked to.
I don't see a way around it. Undoing for now.

      Fixes #4071.

      ««« original CL description
      doc css: topbar sticks to the top of large windows.
      Rationale: for large screens, the convenience of not having to scroll
      to the top of the page to do a search outweighs having less vertical
      space.
      Tested with Chrome, Firefox, Safari with various window and text sizes.

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

      Committer: Andrew Gerrand <adg@golang.org>
      »»»

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

12 years agonet/rpc/jsonrpc: fix test error message
Russ Cox [Wed, 12 Sep 2012 21:37:39 +0000 (17:37 -0400)]
net/rpc/jsonrpc: fix test error message

Fixes #4041.

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

12 years agogc: generate garbage collection info for types
Jan Ziak [Wed, 12 Sep 2012 16:08:27 +0000 (12:08 -0400)]
gc: generate garbage collection info for types

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

12 years agocmd/dist: emit \r in env -w output
Russ Cox [Wed, 12 Sep 2012 16:05:34 +0000 (12:05 -0400)]
cmd/dist: emit \r in env -w output

go tool dist env -w is supposed to print a Windows batch file.
Normally Windows will execute batch files without \r before \n,
but issue 3060 reports that if the file ends up containing paths
written in Chinese, Windows 7 cannot execute it without the \r.
So add the \r.

Fixes #3060.

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

12 years agospec: make bitwise operators stand out
Russ Cox [Wed, 12 Sep 2012 16:05:24 +0000 (12:05 -0400)]
spec: make bitwise operators stand out

The (and not) arguably sounds like it is trying to say something - and not what?.

Just an idea, won't be hurt if it gets rejected.

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

12 years agosyscall: add linux specific Getsockopt for Ucred struct
Andreas Jellinghaus [Wed, 12 Sep 2012 13:38:21 +0000 (06:38 -0700)]
syscall: add linux specific Getsockopt for Ucred struct

SO_PEERCRED on unix domain socket will fill a Ucred struct,
thus linux needs a custom Getsockopt variant.
Fixes #3836.

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

12 years agoC: Add Andreas Jellinghaus (Google CLA)
Ian Lance Taylor [Wed, 12 Sep 2012 13:34:42 +0000 (06:34 -0700)]
C: Add Andreas Jellinghaus (Google CLA)

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

12 years agocmd/6g, cmd/8g: clean up unnecessary switch code in componentgen.
Nigel Tao [Wed, 12 Sep 2012 11:47:05 +0000 (21:47 +1000)]
cmd/6g, cmd/8g: clean up unnecessary switch code in componentgen.
Code higher up in the function already catches these cases.

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

12 years agoos: detect and handle console in File.Write on windows
Alex Brainman [Wed, 12 Sep 2012 02:04:45 +0000 (12:04 +1000)]
os: detect and handle console in File.Write on windows

Fixes #3376.

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

12 years agostrings: fix NewReplacer(old0, new0, old1, new1, ...) to be consistent
Nigel Tao [Wed, 12 Sep 2012 00:40:39 +0000 (10:40 +1000)]
strings: fix NewReplacer(old0, new0, old1, new1, ...) to be consistent
when oldi == oldj.

Benchmark numbers show no substantial change.

R=eric.d.eisner, rogpeppe
CC=golang-dev
https://golang.org/cl/6496104

12 years agosync/atomic: add package doc for AddT, LoadT and StoreT.
Nigel Tao [Wed, 12 Sep 2012 00:36:22 +0000 (10:36 +1000)]
sync/atomic: add package doc for AddT, LoadT and StoreT.

Rename the first argument of CompareAndSwapT and AddT s/val/addr/
for consistency with LoadT and StoreT.

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

12 years agocmd/gc: Inline pointer sized T2I interface conversions
Daniel Morsing [Tue, 11 Sep 2012 19:42:30 +0000 (21:42 +0200)]
cmd/gc: Inline pointer sized T2I interface conversions

This CL also adds support for marking the likelyness of IF nodes in the AST being true. This feature is being used here to mark the slow path as unlikely.

src/pkg/runtime:
benchmark                  old ns/op    new ns/op    delta
BenchmarkConvT2IUintptr           16            1  -91.63%

test/bench/go1:
benchmark                 old ns/op    new ns/op    delta
BenchmarkBinaryTree17    5416917000   5461355000   +0.82%
BenchmarkFannkuch11      3810355000   3842609000   +0.85%
BenchmarkGobDecode         19950950     19855420   -0.48%
BenchmarkGobEncode         11301220     11308530   +0.06%
BenchmarkGzip             548119600    546869200   -0.23%
BenchmarkGunzip           176145400    180208300   +2.31%
BenchmarkJSONEncode        93117400     70163100  -24.65%
BenchmarkJSONDecode       406626800    409999200   +0.83%
BenchmarkMandelbrot200      6300992      6317866   +0.27%
BenchmarkParse              7664396      7451625   -2.78%
BenchmarkRevcomp         1189424000   1412332000  +18.74%
BenchmarkTemplate         491308400    458654200   -6.65%

benchmark                  old MB/s     new MB/s  speedup
BenchmarkGobDecode            38.47        38.66    1.00x
BenchmarkGobEncode            67.92        67.87    1.00x
BenchmarkGzip                 35.40        35.48    1.00x
BenchmarkGunzip              110.16       107.68    0.98x
BenchmarkJSONEncode           20.84        27.66    1.33x
BenchmarkJSONDecode            4.77         4.73    0.99x
BenchmarkParse                 7.56         7.77    1.03x
BenchmarkRevcomp             213.69       179.96    0.84x
BenchmarkTemplate              3.95         4.23    1.07x

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

12 years agocmd/gc: recognize small TPTR64 values as small integer constants.
Nigel Tao [Tue, 11 Sep 2012 09:45:28 +0000 (19:45 +1000)]
cmd/gc: recognize small TPTR64 values as small integer constants.

Given the following Go program:

func sum(s []int) int {
        ret := 0
        for _, x := range s {
                ret += x
        }
        return ret
}

6g would previously generate:

--- prog list "sum" ---
0000 (main.go:3) TEXT    sum+0(SB),$0-24
0001 (main.go:5) MOVQ    s+0(FP),CX
0002 (main.go:5) MOVL    s+8(FP),DI
0003 (main.go:5) MOVL    s+12(FP),BX
0004 (main.go:4) MOVL    $0,SI
0005 (main.go:5) MOVL    $0,AX
0006 (main.go:5) JMP     ,8
0007 (main.go:5) INCL    ,AX
0008 (main.go:5) CMPL    AX,DI
0009 (main.go:5) JGE     $0,16
0010 (main.go:5) MOVL    (CX),DX
0011 (main.go:5) MOVQ    $4,BX
0012 (main.go:5) ADDQ    CX,BX
0013 (main.go:5) MOVQ    BX,CX
0014 (main.go:6) ADDL    DX,SI
0015 (main.go:5) JMP     ,7
0016 (main.go:8) MOVL    SI,.noname+16(FP)
0017 (main.go:8) RET     ,

and now generates:

--- prog list "sum" ---
0000 (main.go:3) TEXT    sum+0(SB),$0-24
0001 (main.go:5) MOVQ    s+0(FP),CX
0002 (main.go:5) MOVL    s+8(FP),DI
0003 (main.go:5) MOVL    s+12(FP),BX
0004 (main.go:4) MOVL    $0,SI
0005 (main.go:5) MOVL    $0,AX
0006 (main.go:5) JMP     ,8
0007 (main.go:5) INCL    ,AX
0008 (main.go:5) CMPL    AX,DI
0009 (main.go:5) JGE     $0,14
0010 (main.go:5) MOVL    (CX),BP
0011 (main.go:5) ADDQ    $4,CX
0012 (main.go:6) ADDL    BP,SI
0013 (main.go:5) JMP     ,7
0014 (main.go:8) MOVL    SI,.noname+16(FP)
0015 (main.go:8) RET     ,

The key difference is that
0011 (main.go:5) MOVQ    $4,BX
0012 (main.go:5) ADDQ    CX,BX
0013 (main.go:5) MOVQ    BX,CX
has changed to
0011 (main.go:5) ADDQ    $4,CX

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

12 years agoC: add Francesc Campoy (Google CLA)
Andrew Gerrand [Tue, 11 Sep 2012 07:15:20 +0000 (17:15 +1000)]
C: add Francesc Campoy (Google CLA)

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

12 years agocmd/6g, cmd/8g: do not LEA[LQ] interfaces when calling methods.
Rémy Oudompheng [Tue, 11 Sep 2012 06:45:23 +0000 (08:45 +0200)]
cmd/6g, cmd/8g: do not LEA[LQ] interfaces when calling methods.

It is enough to load directly the data word and the itab word
from memory, so we save a LEA instruction for each method call,
and allow elimination of some extra temporaries.

Update #1914.

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

12 years agocmd/6g, cmd/8g: eliminate extra agen for nil comparisons.
Rémy Oudompheng [Tue, 11 Sep 2012 06:08:40 +0000 (08:08 +0200)]
cmd/6g, cmd/8g: eliminate extra agen for nil comparisons.

Removes an extra LEAL/LEAQ instructions there and usually saves
a useless temporary in the idiom
    if err := foo(); err != nil {...}

Generated code is also less involved:
    MOVQ err+n(SP), AX
    CMPQ AX, $0
(potentially CMPQ n(SP), $0) instead of
    LEAQ err+n(SP), AX
    CMPQ (AX), $0

Update #1914.

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

12 years agostrings: more thorough Replacer tests.
Nigel Tao [Tue, 11 Sep 2012 04:40:08 +0000 (14:40 +1000)]
strings: more thorough Replacer tests.

This verifies existing behavior. Some replacements are arguably wrong
(these are marked with TODO) but changing behavior is left for a
follow-up CL.

Also fix that BenchmarkGenericMatch wasn't actually matching anything.

R=rsc, eric.d.eisner
CC=bradfitz, golang-dev
https://golang.org/cl/6488110

12 years agoC: spell Brian's name correctly
Andrew Gerrand [Tue, 11 Sep 2012 04:13:49 +0000 (14:13 +1000)]
C: spell Brian's name correctly

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

12 years agomisc/cgo/life: disable it temporarily on windows, because go builder fails
Alex Brainman [Tue, 11 Sep 2012 04:06:34 +0000 (14:06 +1000)]
misc/cgo/life: disable it temporarily on windows, because go builder fails

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

12 years agoencoding/json: handle anonymous fields
Russ Cox [Tue, 11 Sep 2012 03:31:40 +0000 (23:31 -0400)]
encoding/json: handle anonymous fields

Fixes #3069.

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

12 years agodoc css: topbar sticks to the top of large windows.
Brian Slesinskya [Tue, 11 Sep 2012 01:38:47 +0000 (11:38 +1000)]
doc css: topbar sticks to the top of large windows.
Rationale: for large screens, the convenience of not having to scroll
to the top of the page to do a search outweighs having less vertical
space.
Tested with Chrome, Firefox, Safari with various window and text sizes.

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

12 years agoC: add Brian Slesinsky (Google CLA)
Andrew Gerrand [Tue, 11 Sep 2012 01:33:34 +0000 (11:33 +1000)]
C: add Brian Slesinsky (Google CLA)

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

12 years agonet: delete unused IP-level socket option helpers
Mikio Hara [Mon, 10 Sep 2012 23:56:28 +0000 (08:56 +0900)]
net: delete unused IP-level socket option helpers

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

12 years agodoc: Don't imply incorrect guarantees about data races.
David Symonds [Mon, 10 Sep 2012 22:47:30 +0000 (08:47 +1000)]
doc: Don't imply incorrect guarantees about data races.

A race between
        a = "hello, world"
and
        print(a)
is not guaranteed to print either "hello, world" or "".
Its behaviour is undefined.

Fixes #4039.

R=rsc
CC=dvyukov, gobot, golang-dev, r
https://golang.org/cl/6489075

12 years agonet: rename files to clarify platform dependency
Mikio Hara [Mon, 10 Sep 2012 22:37:43 +0000 (07:37 +0900)]
net: rename files to clarify platform dependency

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

12 years agoexp/types/staging: typechecker API
Robert Griesemer [Mon, 10 Sep 2012 21:54:52 +0000 (14:54 -0700)]
exp/types/staging: typechecker API

First set of type checker files for review.
The primary concern here is the typechecker
API (types.go).

R=rsc, adonovan, r, rogpeppe
CC=golang-dev
https://golang.org/cl/6490089

12 years agogc: initial BOM is legal.
Rob Pike [Mon, 10 Sep 2012 20:03:07 +0000 (13:03 -0700)]
gc: initial BOM is legal.
Fixes #4040.

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

12 years agoundo CL 6498092 / 4ff71bc1a199
Adam Langley [Mon, 10 Sep 2012 19:52:36 +0000 (15:52 -0400)]
undo CL 6498092 / 4ff71bc1a199

Broke tests on 386.

««« original CL description
6l/8l: emit correct opcodes to F(SUB|DIV)R?D.

When the destination was not F0, 6l and 8l swapped FSUBD/FSUBRD and
FDIVD/FDIVRD.

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

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

12 years ago6l/8l: emit correct opcodes to F(SUB|DIV)R?D.
Adam Langley [Mon, 10 Sep 2012 19:35:39 +0000 (15:35 -0400)]
6l/8l: emit correct opcodes to F(SUB|DIV)R?D.

When the destination was not F0, 6l and 8l swapped FSUBD/FSUBRD and
FDIVD/FDIVRD.

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

12 years agonet/http: add If-None-Match and If-Range support to ServeContent
Brad Fitzpatrick [Mon, 10 Sep 2012 17:16:09 +0000 (10:16 -0700)]
net/http: add If-None-Match and If-Range support to ServeContent

Also, clear Content-Type and Content-Length on Not Modified
responses before server.go strips them and spams the logs with
warnings.

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

12 years ago6g: delete unnecessary OXXX initialization.
Nigel Tao [Mon, 10 Sep 2012 01:24:34 +0000 (11:24 +1000)]
6g: delete unnecessary OXXX initialization.

No longer necessary after https://golang.org/cl/6497073/
removed the `if(n5.op != OXXX) { regfree(&n5); }`.

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

12 years agocrypto/rand: typo fix from a69e30463bf4
Adam Langley [Mon, 10 Sep 2012 00:11:58 +0000 (20:11 -0400)]
crypto/rand: typo fix from a69e30463bf4

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

12 years agocrypto/rand: zero length reads shouldn't crash on Windows.
Adam Langley [Mon, 10 Sep 2012 00:07:09 +0000 (20:07 -0400)]
crypto/rand: zero length reads shouldn't crash on Windows.

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

12 years agocmd/8g: import componentgen from 6g.
Rémy Oudompheng [Sun, 9 Sep 2012 18:30:08 +0000 (20:30 +0200)]
cmd/8g: import componentgen from 6g.

This makes the compilers code more similar and improves
code generation a lot.

The number of LEAL instructions generated for cmd/go drops
by 60%.

% GOARCH=386 go build -gcflags -S -a cmd/go | grep LEAL | wc -l
Before:       89774
After:        47548

benchmark                              old ns/op    new ns/op    delta
BenchmarkAppendFloatDecimal                  540          444  -17.78%
BenchmarkAppendFloat                        1160         1035  -10.78%
BenchmarkAppendFloatExp                     1060          922  -13.02%
BenchmarkAppendFloatNegExp                  1053          920  -12.63%
BenchmarkAppendFloatBig                     1773         1558  -12.13%
BenchmarkFormatInt                         13065        12481   -4.47%
BenchmarkAppendInt                         10981         9900   -9.84%
BenchmarkFormatUint                         3804         3650   -4.05%
BenchmarkAppendUint                         3506         3303   -5.79%
BenchmarkUnquoteEasy                         714          683   -4.34%
BenchmarkUnquoteHard                        5117         2915  -43.03%

Update #1914.

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

12 years agonet: change cname lookup test target to iana.org
Mikio Hara [Sun, 9 Sep 2012 14:53:48 +0000 (23:53 +0900)]
net: change cname lookup test target to iana.org

It might be meaningful, and stable than others.

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

12 years agoexp/locale/collate: added indices to builder for reusing blocks between locales.
Marcel van Lohuizen [Sat, 8 Sep 2012 01:46:55 +0000 (10:46 +0900)]
exp/locale/collate: added indices to builder for reusing blocks between locales.
Refactored build + buildTrie into build + buildOrdering.
Note that since the tailoring code is not checked in yet, all tailorings are identical
to root.  The table therefore should not and does not grow at this point.

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

12 years agoexp/locale/collate: switch from DUCET to CLDR for the default root table.
Marcel van Lohuizen [Sat, 8 Sep 2012 01:38:11 +0000 (10:38 +0900)]
exp/locale/collate: switch from DUCET to CLDR for the default root table.

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

12 years agotext/scanner: skip first character if it's a BOM
Robert Griesemer [Sat, 8 Sep 2012 00:15:42 +0000 (17:15 -0700)]
text/scanner: skip first character if it's a BOM

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

12 years agogo/scanner: add missing BOM test
Robert Griesemer [Fri, 7 Sep 2012 23:28:15 +0000 (16:28 -0700)]
go/scanner: add missing BOM test

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

12 years agofaq: go does not have duck typing
Rob Pike [Fri, 7 Sep 2012 21:01:02 +0000 (14:01 -0700)]
faq: go does not have duck typing

R=golang-dev, 0xjnml, iant, adonovan, aram
CC=golang-dev
https://golang.org/cl/6500092

12 years agogo/scanner: skip first character if it's a BOM
Robert Griesemer [Fri, 7 Sep 2012 20:56:31 +0000 (13:56 -0700)]
go/scanner: skip first character if it's a BOM

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

12 years agofaq: mercurial vs. git
Rob Pike [Fri, 7 Sep 2012 18:19:01 +0000 (11:19 -0700)]
faq: mercurial vs. git
Fixes #4052.

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

12 years agosyscall: Test SCM credentials on Linux.
Albert Strasheim [Fri, 7 Sep 2012 17:31:17 +0000 (10:31 -0700)]
syscall: Test SCM credentials on Linux.

This test was previously removed in 087c6e15702e.

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

12 years agospec: an initial BOM can be ignored
Rob Pike [Fri, 7 Sep 2012 17:28:24 +0000 (10:28 -0700)]
spec: an initial BOM can be ignored
After further deliberation, let's back down to the Unicode proposal.
Ignoring aBOMinations anywhere means that things like
        grep unsafe *.go
might fail because there's a BOM in the middle: unBOMsafe.

R=golang-dev, rsc, 0xjnml, gri, bradfitz
CC=golang-dev
https://golang.org/cl/6490091

12 years agonet,mime: Minor corrections to documentation comments.
Lucio De Re [Fri, 7 Sep 2012 17:24:55 +0000 (10:24 -0700)]
net,mime: Minor corrections to documentation comments.

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

12 years agocmd/yacc: allow leading underscore in token name
Rob Pike [Fri, 7 Sep 2012 16:31:51 +0000 (09:31 -0700)]
cmd/yacc: allow leading underscore in token name
Fixes #4037.

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

12 years agofaq: another way to solve the closure/variable/range complaint
Rob Pike [Fri, 7 Sep 2012 16:11:39 +0000 (09:11 -0700)]
faq: another way to solve the closure/variable/range complaint
It's easier just to declare a new variable.

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

12 years agocmd/6g: avoid taking the address of slices unnecessarily.
Rémy Oudompheng [Fri, 7 Sep 2012 04:54:42 +0000 (06:54 +0200)]
cmd/6g: avoid taking the address of slices unnecessarily.

The main case where it happens is when evaluating &s[i] without
bounds checking, which usually happens during range loops (i=0).

This allows registerization of the corresponding variables,
saving 16 bytes of stack frame for each such range loop and a
LEAQ instruction.

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

12 years agoruntime: arm: abort if hardware floating point missing
Dave Cheney [Fri, 7 Sep 2012 04:26:42 +0000 (14:26 +1000)]
runtime: arm: abort if hardware floating point missing

Fixes #3911.

Requires CL 6449127.

dfc@qnap:~$ ./runtime.test
runtime: this CPU has no floating point hardware, so it cannot run
this GOARM=7 binary. Recompile using GOARM=5.

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

12 years agocgo: use debug data section for ELF
Joel Sing [Fri, 7 Sep 2012 03:32:40 +0000 (13:32 +1000)]
cgo: use debug data section for ELF

When generating enums use the debug data section instead of the
DWARF debug info, if it is available in the ELF file. This allows
mkerrors.sh to work correctly on OpenBSD/386 and NetBSD/386.

Fixes #2470.

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

12 years agocmd/yacc: always import fmt, safely
Rob Pike [Thu, 6 Sep 2012 21:58:37 +0000 (14:58 -0700)]
cmd/yacc: always import fmt, safely
The parser depends on it but the client might not import it, so make sure it's there.
Fixes #4038.

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

12 years agospec: ignore BOMS outside of string and rune literals.
Rob Pike [Thu, 6 Sep 2012 17:37:13 +0000 (10:37 -0700)]
spec: ignore BOMS outside of string and rune literals.
Happy Birthday UTF-8.

R=golang-dev, rsc, 0xjnml
CC=golang-dev
https://golang.org/cl/6506083

12 years agosyscall: regenerate/update netbsd z-files
Joel Sing [Thu, 6 Sep 2012 16:13:14 +0000 (02:13 +1000)]
syscall: regenerate/update netbsd z-files

Regenerate/update netbsd z-files on NetBSD 6.0 RC1.

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

12 years agocrypto/tls: fix data race on conn.err
Dave Cheney [Thu, 6 Sep 2012 07:50:26 +0000 (17:50 +1000)]
crypto/tls: fix data race on conn.err

Fixes #3862.

There were many areas where conn.err was being accessed
outside the mutex. This proposal moves the err value to
an embedded struct to make it more obvious when the error
value is being accessed.

As there are no Benchmark tests in this package I cannot
feel confident of the impact of this additional locking,
although most will be uncontended.

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

12 years agoC: add Manu Garg (Google CLA)
Andrew Gerrand [Thu, 6 Sep 2012 05:02:42 +0000 (15:02 +1000)]
C: add Manu Garg (Google CLA)

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

12 years agoexp/locale/collate/build: moved some of the code to the appropriate file, as
Marcel van Lohuizen [Thu, 6 Sep 2012 04:16:02 +0000 (13:16 +0900)]
exp/locale/collate/build: moved some of the code to the appropriate file, as
promised in CL 13985.

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

12 years agoimage/jpeg: fix quantization tables to be in zig-zag order, not natural
Nigel Tao [Thu, 6 Sep 2012 01:10:47 +0000 (11:10 +1000)]
image/jpeg: fix quantization tables to be in zig-zag order, not natural
order.

JPEG images generated prior to this CL are still valid JPEGs, as the
quantization tables used are encoded in the wire format. Such JPEGs just
don't use the recommended quantization tables.

R=r, dsymonds, raph, adg
CC=golang-dev, tuom.larsen
https://golang.org/cl/6497083

12 years agocmd/gc: re-order some OFOO constants. Rename ORRC to ORROTC to be
Nigel Tao [Thu, 6 Sep 2012 00:47:25 +0000 (10:47 +1000)]
cmd/gc: re-order some OFOO constants. Rename ORRC to ORROTC to be
consistent with OLROT. Delete unused OBAD, OLRC.

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

12 years agoreflect: faster FieldByName, FieldByNameFunc
Russ Cox [Wed, 5 Sep 2012 13:35:53 +0000 (09:35 -0400)]
reflect: faster FieldByName, FieldByNameFunc

The old code was a depth first graph traversal that could, under the
right conditions, end up re-exploring the same subgraphs multiple
times, once for each way to arrive at that subgraph at a given depth.

The new code uses a breadth first search to make sure that it only
visits each reachable embedded struct once.

Also add fast path for the trivial case.

benchmark                old ns/op    new ns/op    delta
BenchmarkFieldByName1         1321          187  -85.84%
BenchmarkFieldByName2         6118         5186  -15.23%
BenchmarkFieldByName3      8218553        42112  -99.49%

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

12 years agodoc/go_spec: fix a typo
Oling Cat [Wed, 5 Sep 2012 04:53:13 +0000 (14:53 +1000)]
doc/go_spec: fix a typo

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

12 years agoA+C: Oling Cat (individual CLA)
Nigel Tao [Wed, 5 Sep 2012 04:52:12 +0000 (14:52 +1000)]
A+C: Oling Cat (individual CLA)

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

12 years agocmd/gc: add commentary to the OXXX constants.
Nigel Tao [Tue, 4 Sep 2012 23:34:52 +0000 (09:34 +1000)]
cmd/gc: add commentary to the OXXX constants.

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

12 years agoruntime: fix typo in openbsd-only symbol name.
Alan Donovan [Tue, 4 Sep 2012 20:35:05 +0000 (16:35 -0400)]
runtime: fix typo in openbsd-only symbol name.

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

12 years agonet: fix {FileConn, FileListener, FilePacketConn} fd leak to child process.
Sébastien Paolacci [Tue, 4 Sep 2012 19:37:23 +0000 (12:37 -0700)]
net: fix {FileConn, FileListener, FilePacketConn} fd leak to child process.

All of them call `newFileFD' which must properly restore close-on-exec on
duplicated fds.

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

12 years agoruntime: discard SIGPROF delivered to non-Go threads.
Alan Donovan [Tue, 4 Sep 2012 18:40:49 +0000 (14:40 -0400)]
runtime: discard SIGPROF delivered to non-Go threads.

Signal handlers are global resources but many language
environments (Go, C++ at Google, etc) assume they have sole
ownership of a particular handler.  Signal handlers in
mixed-language applications must therefore be robust against
unexpected delivery of certain signals, such as SIGPROF.

The default Go signal handler runtime·sigtramp assumes that it
will never be called on a non-Go thread, but this assumption
is violated by when linking in C++ code that spawns threads.
Specifically, the handler asserts the thread has an associated
"m" (Go scheduler).

This CL is a very simple workaround: discard SIGPROF delivered to non-Go threads.  runtime.badsignal(int32) now receives the signal number; if it returns without panicking (e.g. sig==SIGPROF) the signal is discarded.

I don't think there is any really satisfactory solution to the
problem of signal-based profiling in a mixed-language
application.  It's not only the issue of handler clobbering,
but also that a C++ SIGPROF handler called in a Go thread
can't unwind the Go stack (and vice versa).  The best we can
hope for is not crashing.

Note:
- I've ported this to all POSIX platforms, except ARM-linux which already ignores unexpected signals on m-less threads.
- I've avoided tail-calling runtime.badsignal because AFAICT the 6a/6l don't support it.
- I've avoided hoisting 'push sig' (common to both function calls) because it makes the code harder to read.
- Fixed an (apparently incorrect?) docstring.

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

12 years agoruntime/pprof: emit end-of-log marker at end of CPU profile.
Alan Donovan [Tue, 4 Sep 2012 18:34:03 +0000 (14:34 -0400)]
runtime/pprof: emit end-of-log marker at end of CPU profile.

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

12 years ago doc: fix typo in Concurrency Patterns article
Andrew Gerrand [Tue, 4 Sep 2012 05:28:09 +0000 (15:28 +1000)]
  doc: fix typo in Concurrency Patterns article

Fixes #3178.

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

12 years ago doc: link to references from docs page
Andrew Gerrand [Tue, 4 Sep 2012 05:26:51 +0000 (15:26 +1000)]
  doc: link to references from docs page

Fixes #3667.

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

12 years agonet/http/pprof: updated documentation (run an http server)
Patrick Crosby [Tue, 4 Sep 2012 01:27:20 +0000 (11:27 +1000)]
net/http/pprof: updated documentation (run an http server)

Added instructions for starting an http server
to the godoc header for this package.  With the old
instructions, the example "go tool pprof..." commands
wouldn't work unless you happen to be running an http
server on port 6060 in your application.

R=golang-dev, minux.ma, adg, giacomo.tartari
CC=golang-dev
https://golang.org/cl/6483049

12 years agoruntime: increase stack frame during cgo call on windows/amd64
Alex Brainman [Mon, 3 Sep 2012 02:12:51 +0000 (12:12 +1000)]
runtime: increase stack frame during cgo call on windows/amd64

Fixes #3945.

R=golang-dev, minux.ma
CC=golang-dev, vcc.163
https://golang.org/cl/6490056

12 years agorun.bat: do not run misc\cgo\stdio test on windows (fix build)
Alex Brainman [Mon, 3 Sep 2012 00:33:48 +0000 (10:33 +1000)]
run.bat: do not run misc\cgo\stdio test on windows (fix build)

It is enabled by mistake and should be part of CL 5847068 instead.

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

12 years agocmd/5l: embed $GOARM value into binary as runtime.goarm
Shenghou Ma [Sun, 2 Sep 2012 19:51:13 +0000 (03:51 +0800)]
cmd/5l: embed $GOARM value into binary as runtime.goarm

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

12 years agodoc/progs: use test/run.go for testing on Windows
Shenghou Ma [Sun, 2 Sep 2012 19:49:03 +0000 (03:49 +0800)]
doc/progs: use test/run.go for testing on Windows
        cgo[1-4].go, go1.go couldn't be tested now
(cgo[1-4].go can only be tested when cgo is enabled, go1.go
contain a list of filenames in the current directory)

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

12 years agocmd/gc: fix PkgPath of byte, rune types
Russ Cox [Sat, 1 Sep 2012 23:55:55 +0000 (19:55 -0400)]
cmd/gc: fix PkgPath of byte, rune types

Fixes #3853.

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

12 years agocodereview.py: correct error handling without decorator
Uriel Mangado [Sat, 1 Sep 2012 23:55:29 +0000 (19:55 -0400)]
codereview.py: correct error handling without decorator

The decorator hides the number of function arguments from Mercurial,
so Mercurial cannot give proper error messages about commands
invoked with the wrong number of arguments.

Left a 'dummy' hgcommand decorator in place as a way to document
what functions are hg commands, and just in case we need some other
kind of hack in the future.

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

12 years agoA+C: add Uriel Mangado (individual CLA)
Russ Cox [Sat, 1 Sep 2012 23:55:03 +0000 (19:55 -0400)]
A+C: add Uriel Mangado (individual CLA)

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

12 years agocmd/ld: support zero-filled section for Mach-O files
Shenghou Ma [Sat, 1 Sep 2012 20:50:58 +0000 (04:50 +0800)]
cmd/ld: support zero-filled section for Mach-O files

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

12 years agocmd/gc: Suggest *T in error for x.(T) if it would work.
Daniel Morsing [Sat, 1 Sep 2012 17:52:55 +0000 (13:52 -0400)]
cmd/gc: Suggest *T in error for x.(T) if it would work.

Accomplished by synchronizing the formatting of conversion errors between typecheck.c and subr.c

Fixes #3984.

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

12 years agocmd/6g, cmd/8g: eliminate short integer arithmetic when possible.
Rémy Oudompheng [Sat, 1 Sep 2012 14:40:54 +0000 (16:40 +0200)]
cmd/6g, cmd/8g: eliminate short integer arithmetic when possible.

Fixes #3909.
Fixes #3910.

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

12 years agocmd/go: be clear that import loops are bad
Russ Cox [Sat, 1 Sep 2012 14:34:58 +0000 (10:34 -0400)]
cmd/go: be clear that import loops are bad

There was mail on golang-nuts a few weeks ago
from someone who understood the message perfectly
and knew he had a cyclic dependency but assumed
that Go, like Python or Java, was supposed to handle it.

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

12 years agostrconv: faster FormatFloat for fixed number of digits.
Rémy Oudompheng [Sat, 1 Sep 2012 14:31:46 +0000 (16:31 +0200)]
strconv: faster FormatFloat for fixed number of digits.

The performance improvement applies to the case where
prec >= 0 and fmt is 'e' or 'g'.

Additional minor optimisations are included. A small
performance impact happens in some cases due to code
refactoring.

benchmark                              old ns/op    new ns/op    delta
BenchmarkAppendFloat64Fixed1                 623          235  -62.28%
BenchmarkAppendFloat64Fixed2                1050          272  -74.10%
BenchmarkAppendFloat64Fixed3                3723          243  -93.47%
BenchmarkAppendFloat64Fixed4               10285          274  -97.34%

BenchmarkAppendFloatDecimal                  190          206   +8.42%
BenchmarkAppendFloat                         387          377   -2.58%
BenchmarkAppendFloatExp                      397          339  -14.61%
BenchmarkAppendFloatNegExp                   377          336  -10.88%
BenchmarkAppendFloatBig                      546          482  -11.72%

BenchmarkAppendFloat32Integer                188          204   +8.51%
BenchmarkAppendFloat32ExactFraction          329          298   -9.42%
BenchmarkAppendFloat32Point                  400          372   -7.00%
BenchmarkAppendFloat32Exp                    369          306  -17.07%
BenchmarkAppendFloat32NegExp                 372          305  -18.01%

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

12 years agoexp/locale/collate: Added functionality to parse and process LDML files
Marcel van Lohuizen [Sat, 1 Sep 2012 12:15:00 +0000 (14:15 +0200)]
exp/locale/collate: Added functionality to parse and process LDML files
for both locale-specific exemplar characters and tailorings to
the collation table.
Some specifices:
- Moved stringSet to the beginning of the file and added some functionality
  to parse command line files.
- openReader now modifies the input URL for localFiles to guarantee that
  any http source listed in the generated file is indeed this source.
- Note that the implementation of the Tailoring API used by maketables.go
  is not yet checked in. So for now adding tailorings are simply no-ops.
- The generated file of exemplar characters will be used somewhere else.
  Here is a snippet of how the body of the generated file looks like:

type exemplarType int
const (
        exCharacters exemplarType = iota
        exContractions
        exPunctuation
        exAuxiliary
        exCurrency
        exIndex
        exN
)

var exemplarCharacters = map[string][exN]string{
        "af": [exN]string{
                0: "a á â b c d e é è ê ë f g h i î ï j k l m n o ô ö p q r s t u û v w x y z",
                3: "á à â ä ã æ ç é è ê ë í ì î ï ó ò ô ö ú ù û ü ý",
                4: "a b c d e f g h i j k l m n o p q r s t u v w x y z",
        },
        ...
}

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

12 years agoexp/locale/collate: first changes that introduce implementation of tailorings:
Marcel van Lohuizen [Sat, 1 Sep 2012 12:13:37 +0000 (14:13 +0200)]
exp/locale/collate: first changes that introduce implementation of tailorings:
- Elements in the array are now sorted as a linked list.  This makes it easier to
  apply tailorings.
- Added code to sort entries by collation elements.
- Added logical reset points.  This is used for tailoring relative to certain
  properties, rather than characters.

NOTE: all code for type entry should now be in order.go.  To keep the diffs for
this CL reasonable, though, the existing code is left in builder.go.  I'll move
this in a separate CL.

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

12 years agosyscall: add PtraceSyscall(pid int, signal int)
Dave Cheney [Fri, 31 Aug 2012 23:17:14 +0000 (09:17 +1000)]
syscall: add PtraceSyscall(pid int, signal int)

Fixes #3525.

PTRACE_SYSCALL behaves like PTRACE_CONT and can deliver
a signal to the process. Ideally PtraceSingleStep should
support the signal argument, but its interface is frozen
by Go1.

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

12 years agoA+C: 0/2 on spelling email addresses correctly
Russ Cox [Fri, 31 Aug 2012 22:10:40 +0000 (18:10 -0400)]
A+C: 0/2 on spelling email addresses correctly

TBR=r
CC=golang-dev
https://golang.org/cl/6497067

12 years agonet/http: added ParseTime function.
Patrick Higgins [Fri, 31 Aug 2012 22:10:16 +0000 (18:10 -0400)]
net/http: added ParseTime function.

Parses a time header value into a time.Time according to rfc2616 sec 3.3.

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

12 years agoencoding/xml: parse comments in DOCTYPE
Shawn Smith [Fri, 31 Aug 2012 22:09:31 +0000 (18:09 -0400)]
encoding/xml: parse comments in DOCTYPE

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

12 years agoA+C: Patrick Higgins, Shawn Smith (individual CLA)
Russ Cox [Fri, 31 Aug 2012 22:07:32 +0000 (18:07 -0400)]
A+C: Patrick Higgins, Shawn Smith (individual CLA)

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

12 years agoruntime: add vdso support for linux/amd64. Fixes issue 1933.
Ivan Krasin [Fri, 31 Aug 2012 22:07:04 +0000 (18:07 -0400)]
runtime: add vdso support for linux/amd64. Fixes issue 1933.

R=iant, imkrasin, krasin, iant, minux.ma, rsc, nigeltao, r, fullung
CC=golang-dev
https://golang.org/cl/6454046

12 years agocmd/gc: fix escape analysis bug with variable capture in loops.
Rémy Oudompheng [Fri, 31 Aug 2012 20:23:37 +0000 (22:23 +0200)]
cmd/gc: fix escape analysis bug with variable capture in loops.

Fixes #3975.

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

12 years agonet/rpc/jsonrpc: handles missing "params" in jsonrpc.
Alexandru Moșoi [Fri, 31 Aug 2012 19:52:27 +0000 (15:52 -0400)]
net/rpc/jsonrpc: handles missing "params" in jsonrpc.

A crash happens in the first request in a connection
if "params" field is missing because c.req.Params is Nil.

Fixes #3848.

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

12 years agotest: restore nigel's bug451 as bug452.
Russ Cox [Fri, 31 Aug 2012 19:43:27 +0000 (15:43 -0400)]
test: restore nigel's bug451 as bug452.

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

12 years agoruntime/pprof: restore articles in type doc comments
Russ Cox [Fri, 31 Aug 2012 17:49:57 +0000 (13:49 -0400)]
runtime/pprof: restore articles in type doc comments

Reverts part of CL 6460082.

If a doc comment describes a type by explaining the
meaning of one instance of the type, a leading article
is fine and makes the text less awkward.

Compare:
// A dog is a kind of animal.
// Dog is a kind of animal.

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

12 years agosrc: Add support for 64-bit version of Plan 9
Akshat Kumar [Fri, 31 Aug 2012 17:21:13 +0000 (13:21 -0400)]
src: Add support for 64-bit version of Plan 9

This set of changes extends the Plan 9 support
to include the AMD64 architecture and should
work on all versions of Plan 9.

R=golang-dev, rminnich, noah.evans, rsc, minux.ma, npe
CC=akskuma, golang-dev, jfflore, noah.evans
https://golang.org/cl/6479052

12 years agocmd/gc: mark broken type declarations as broken.
Daniel Morsing [Fri, 31 Aug 2012 17:02:29 +0000 (13:02 -0400)]
cmd/gc: mark broken type declarations as broken.

This fixes a spurious 'invalid recursive type' error, and stops the compiler from emitting errors on uses of the invalid type.

Fixes #3766.

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

12 years agonet/http: add (*ServeMux).Handler method
Russ Cox [Fri, 31 Aug 2012 16:16:31 +0000 (12:16 -0400)]
net/http: add (*ServeMux).Handler method

The Handler method makes the ServeMux dispatch logic
available to wrappers that enforce additional constraints
on requests.

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

12 years agonet/http: fix inserting of implicit redirects in serve mux
Christian Himpel [Fri, 31 Aug 2012 16:00:01 +0000 (12:00 -0400)]
net/http: fix inserting of implicit redirects in serve mux

In serve mux, if pattern contains a host name, pass only the path to
the redirect handler.

Add tests for serve mux redirections.

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

12 years agocgo/misc/test: burn CPU to improve sleep accuracy
Dave Cheney [Fri, 31 Aug 2012 10:17:59 +0000 (20:17 +1000)]
cgo/misc/test: burn CPU to improve sleep accuracy

Fixes #4008.

Run a background goroutine that wastes CPU to trick the
power management into raising the CPU frequency which,
by side effect, makes sleep more accurate on arm.

=== RUN TestParallelSleep
--- PASS: TestParallelSleep (1.30 seconds)
_cgo_gotypes.go:772:    sleep(1) slept for 1.000458s

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

12 years agoA+C: added Alan Donovan (Google corporate license)
Robert Griesemer [Fri, 31 Aug 2012 01:38:33 +0000 (18:38 -0700)]
A+C: added Alan Donovan (Google corporate license)

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