]> Cypherpunks repositories - gostls13.git/log
gostls13.git
12 years agoencoding/asn1: don't convert UTCTime to UTC.
Adam Langley [Mon, 29 Oct 2012 15:16:05 +0000 (11:16 -0400)]
encoding/asn1: don't convert UTCTime to UTC.

Previously we converted a time to UTC *and* serialized the timezone of
the original time. With this change, we serialize a UTCTime in the
original timezone.

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

12 years agocmd/gc: inlining functions with local variables
Luuk van Dijk [Mon, 29 Oct 2012 12:55:27 +0000 (13:55 +0100)]
cmd/gc: inlining functions with local variables

- make sure dclcontext == PAUTO only in function bodies
- introduce PDISCARD to discard declarations in bodies of repeated imports
- skip printing initializing OAS'es in export mode, assuming they only occur after ODCL's
- remove ODCL and the initializing OAS from inl.c:ishairy
- fix confused use of ->typecheck in typecheckinl: it's about the ->inl, not about the fn.
- debuging aids: print ntype on ONAMEs too and -Emm instead of -Ell.

fixes #2812

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

12 years agocmd/gc: escape analysis to track flow of in to out parameters.
Luuk van Dijk [Mon, 29 Oct 2012 12:38:21 +0000 (13:38 +0100)]
cmd/gc: escape analysis to track flow of in to out parameters.

includes step 0: synthesize outparams, from 6600044
includes step 1,2: give outparams loopdepth 0 and verify unchanged results
         generate esc:$mask tags, but still tie to sink if a param has mask != 0
from 6610054

adds final steps:
- have esccall generate n->escretval, a list of nodes the function results flow to
- use these in esccall and ORETURN/OAS2FUNC/and f(g())
- only tie parameters to sink if tag is absent, otherwise according to mask, tie them to escretval

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

12 years agomisc/vim: fix reimport guard and remove K mapping.
Andrew Radev [Mon, 29 Oct 2012 11:10:59 +0000 (22:10 +1100)]
misc/vim: fix reimport guard and remove K mapping.

The "did_ftplugin" lines were ineffective and the "K" mapping was too
invasive, which is why it was removed.

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

12 years agoA+C: Andrey Radev (individual CLA).
David Symonds [Mon, 29 Oct 2012 11:10:45 +0000 (22:10 +1100)]
A+C: Andrey Radev (individual CLA).

R=golang-dev, bradfitz
CC=andrey.radev, golang-dev
https://golang.org/cl/6775067

12 years agomisc/dashboard/codereview: only accept "NOT LGTM" on the first line of a message.
David Symonds [Mon, 29 Oct 2012 11:03:58 +0000 (22:03 +1100)]
misc/dashboard/codereview: only accept "NOT LGTM" on the first line of a message.

Too many people quote entire emails and put their reply at the top ("top posting"),
so we shouldn't recognise review commands anywhere in the review text.

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

12 years agocmd/5g: introduce componentgen for better registerization.
Rémy Oudompheng [Sun, 28 Oct 2012 19:11:21 +0000 (20:11 +0100)]
cmd/5g: introduce componentgen for better registerization.

It is essentially identical to the version in 6g.

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

12 years agocontainer/list: fix typo
Taj Khattra [Sun, 28 Oct 2012 10:16:50 +0000 (21:16 +1100)]
container/list: fix typo

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

12 years agosort: Fixed a typo in the documentation for SearchStrings.
Patrick Smith [Sat, 27 Oct 2012 23:07:59 +0000 (10:07 +1100)]
sort: Fixed a typo in the documentation for SearchStrings.

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

12 years agosyscall: fix creds_test to reliably close os.File
Ian Lance Taylor [Fri, 26 Oct 2012 17:31:03 +0000 (10:31 -0700)]
syscall: fix creds_test to reliably close os.File

Before this patch the test would close the file descriptor but
not the os.File.  When the os.File was GC'ed, the finalizer
would close the file descriptor again.  That would cause
problems if the same file descriptor were returned by a later
call to open in another test.

On my system:

> GOGC=30 go test
--- FAIL: TestPassFD (0.04 seconds)
passfd_test.go:62:  FileConn: dup: bad file descriptor
FAIL

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

12 years agoencoding/binary: ReadVarint reads a signed number, not unsigned number
Shenghou Ma [Fri, 26 Oct 2012 13:14:34 +0000 (21:14 +0800)]
encoding/binary: ReadVarint reads a signed number, not unsigned number

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

12 years agonet: avoid allocation in setAddr
Dave Cheney [Fri, 26 Oct 2012 08:41:21 +0000 (19:41 +1100)]
net: avoid allocation in setAddr

setAddr was showing up in profiles due to string concatenation construction the os.File name field. netFD.sysfile's Name() is never used, except in dup() so I believe it is safe to avoid this allocation.

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

12 years agocmd/5g: peep.c: reactivate some optimisations
Dave Cheney [Fri, 26 Oct 2012 07:19:10 +0000 (18:19 +1100)]
cmd/5g: peep.c: reactivate some optimisations

Thanks to Minux and Remy for their advice.

The EOR optimisation is applied to a few places in the stdlib.

// hash/crc32/crc32.go
func update(crc uint32, tab *Table, p []byte) uint32 {
crc = ^crc
for _, v := range p {
         crc = tab[byte(crc)^v] ^ (crc >> 8)
}
return ^crc
}

before:

--- prog list "update" ---
0164 (/home/dfc/go/src/pkg/hash/crc32/crc32.go:101) TEXT        update+0(SB),$12-24
0165 (/home/dfc/go/src/pkg/hash/crc32/crc32.go:101) MOVW        tab+4(FP),R8
0166 (/home/dfc/go/src/pkg/hash/crc32/crc32.go:102) MOVW        crc+0(FP),R0
0167 (/home/dfc/go/src/pkg/hash/crc32/crc32.go:102) EOR         $-1,R0,R5
0168 (/home/dfc/go/src/pkg/hash/crc32/crc32.go:103) MOVW        p+8(FP),R0
0169 (/home/dfc/go/src/pkg/hash/crc32/crc32.go:103) MOVW        R0,autotmp_0019+-12(SP)

after:

--- prog list "update" ---
0164 (/home/dfc/go/src/pkg/hash/crc32/crc32.go:101) TEXT        update+0(SB),$12-24
0165 (/home/dfc/go/src/pkg/hash/crc32/crc32.go:101) MOVW        tab+4(FP),R8
0166 (/home/dfc/go/src/pkg/hash/crc32/crc32.go:102) MOVW        crc+0(FP),R0
0167 (/home/dfc/go/src/pkg/hash/crc32/crc32.go:102) MVN         R0,R5
0168 (/home/dfc/go/src/pkg/hash/crc32/crc32.go:103) MOVW        p+8(FP),R0
0169 (/home/dfc/go/src/pkg/hash/crc32/crc32.go:103) MOVW        R0,autotmp_0019+-12(SP)

After 5l has done its work,

        crc = ^crc
   3d710:       e59d0014        ldr     r0, [sp, #20]
   3d714:       e3e0b000        mvn     fp, #0
   3d718:       e020500b        eor     r5, r0, fp

becomes

        crc = ^crc
   3d710:       e59d0014        ldr     r0, [sp, #20]
   3d714:       e1e05000        mvn     r5, r0

The MOVB optimisation has a small impact on the stdlib, in strconv
and gzip.

// GZIP (RFC 1952) is little-endian, unlike ZLIB (RFC 1950).
func put2(p []byte, v uint16) {
        p[0] = uint8(v >> 0)
        p[1] = uint8(v >> 8)
}

before:

--- prog list "put2" ---
1369 (/home/dfc/go/src/pkg/compress/gzip/gzip.go:76) TEXT       put2+0(SB),$0-16
1370 (/home/dfc/go/src/pkg/compress/gzip/gzip.go:76) MOVHU      v+12(FP),R4
1371 (/home/dfc/go/src/pkg/compress/gzip/gzip.go:77) MOVHU      R4,R0
1372 (/home/dfc/go/src/pkg/compress/gzip/gzip.go:77) MOVHU      R0,R0
1373 (/home/dfc/go/src/pkg/compress/gzip/gzip.go:77) MOVBU      R0,R1
1374 (/home/dfc/go/src/pkg/compress/gzip/gzip.go:77) MOVBU      R1,R3
1375 (/home/dfc/go/src/pkg/compress/gzip/gzip.go:77) MOVW       $p+0(FP),R1

after:

--- prog list "put2" ---
1369 (/home/dfc/go/src/pkg/compress/gzip/gzip.go:76) TEXT       put2+0(SB),$0-16
1370 (/home/dfc/go/src/pkg/compress/gzip/gzip.go:76) MOVHU      v+12(FP),R4
1371 (/home/dfc/go/src/pkg/compress/gzip/gzip.go:77) MOVHU      R4,R0
1372 (/home/dfc/go/src/pkg/compress/gzip/gzip.go:77) MOVBU      R0,R1
1373 (/home/dfc/go/src/pkg/compress/gzip/gzip.go:77) MOVBU      R1,R3
1374 (/home/dfc/go/src/pkg/compress/gzip/gzip.go:77) MOVW       $p+0(FP),R1

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

12 years agoreflect: stop thinking that MaxFloat32 overflows float32.
Rémy Oudompheng [Fri, 26 Oct 2012 06:39:36 +0000 (08:39 +0200)]
reflect: stop thinking that MaxFloat32 overflows float32.

Fixes #4282.

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

12 years agoruntime: switch to 64-bit goroutine ids
Dmitriy Vyukov [Fri, 26 Oct 2012 06:13:06 +0000 (10:13 +0400)]
runtime: switch to 64-bit goroutine ids
Fixes #4275.

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

12 years agocmd/6g: fix crash in cgen_bmul.
Rémy Oudompheng [Thu, 25 Oct 2012 22:29:44 +0000 (00:29 +0200)]
cmd/6g: fix crash in cgen_bmul.

Used to print:
../test/torture.go:116: internal compiler error: bad width: 0463 (../test/torture.go:116) MOVB    ,BX (0, 8)

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

12 years agoexp/locale/collate: slightly changed collation elements:
Marcel van Lohuizen [Thu, 25 Oct 2012 11:02:31 +0000 (13:02 +0200)]
exp/locale/collate: slightly changed collation elements:
- Allow secondary values below the default value in second form. This is
  to support before tags for secondary values, as used by Chinese.
- Eliminate collation elements that are guaranteed to be immaterial
  after a weight increment.

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

12 years agosyscall: implement (*PtraceRegs).PC() and SetPC()
Shenghou Ma [Thu, 25 Oct 2012 05:41:04 +0000 (13:41 +0800)]
syscall: implement (*PtraceRegs).PC() and SetPC()

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

12 years agodoc: remove misplaced articles from references page
Andrew Gerrand [Thu, 25 Oct 2012 00:05:42 +0000 (11:05 +1100)]
doc: remove misplaced articles from references page

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

12 years agoexp/locale/collate/build: fixed problem where blocks for first byte need
Marcel van Lohuizen [Wed, 24 Oct 2012 09:41:05 +0000 (11:41 +0200)]
exp/locale/collate/build: fixed problem where blocks for first byte need
different indexes for values and index blocks. Fixes many regressions.

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

12 years agoexp/locale/collate: clarification in comments on use of returned value.
Marcel van Lohuizen [Wed, 24 Oct 2012 09:40:32 +0000 (11:40 +0200)]
exp/locale/collate: clarification in comments on use of returned value.

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

12 years agoexp/locale/collate/tools/colcmp: add locale to output of regression failure.
Marcel van Lohuizen [Wed, 24 Oct 2012 09:28:18 +0000 (11:28 +0200)]
exp/locale/collate/tools/colcmp: add locale to output of regression failure.

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

12 years agocmd/gc, cmd/ld: use go.weak instead of weak as the weak symbol prefix
Russ Cox [Tue, 23 Oct 2012 15:16:08 +0000 (11:16 -0400)]
cmd/gc, cmd/ld: use go.weak instead of weak as the weak symbol prefix

Also defend our symbol prefixes (now just "go" and "type")
from use as import paths.

Fixes #4257.

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

12 years agoruntime, runtime/race: add missing if(raceenabled), update package docs of pkg race
Shenghou Ma [Mon, 22 Oct 2012 18:33:51 +0000 (02:33 +0800)]
runtime, runtime/race: add missing if(raceenabled), update package docs of pkg race

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

12 years agoexp/type/staging: implemented recent spec changes
Robert Griesemer [Mon, 22 Oct 2012 18:28:21 +0000 (11:28 -0700)]
exp/type/staging: implemented recent spec changes

Also:
- type-checking receivers
- get rid of some multiple errors at the same position

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

12 years agocmd/gc: Mark use of builtin functions as calls.
Daniel Morsing [Mon, 22 Oct 2012 17:14:30 +0000 (19:14 +0200)]
cmd/gc: Mark use of builtin functions as calls.

Fixes #4097.

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

12 years agocmd/5l, cmd/6l, cmd/8l: put floating point numbers in .rodata section
Shenghou Ma [Mon, 22 Oct 2012 16:59:53 +0000 (00:59 +0800)]
cmd/5l, cmd/6l, cmd/8l: put floating point numbers in .rodata section

R=golang-dev, rsc
CC=0xe2.0x9a.0x9b, golang-dev
https://golang.org/cl/6742063

12 years agocmd/gc: escape analysis to track flow of in to out parameters.
Luuk van Dijk [Mon, 22 Oct 2012 08:18:17 +0000 (10:18 +0200)]
cmd/gc: escape analysis to track flow of in to out parameters.

includes step 0: synthesize outparams, from 6600044
step 1: give outparams loopdepth 0 and verify unchanged results
step 2: generate esc:$mask tags, but still tie to sink if a param has mask != 0
next step: use in esccall (and ORETURN with implicit OAS2FUNC) to avoid tying to sink

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

12 years agocmd/gc: track parameter flow, step 0: synthesize name nodes for anonymous PPARAMOUTs...
Luuk van Dijk [Mon, 22 Oct 2012 08:09:52 +0000 (10:09 +0200)]
cmd/gc: track parameter flow, step 0: synthesize name nodes for anonymous PPARAMOUTs without breaking anything.

further work on parameter flow tracking for escape analysis depends on this.

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

12 years agocmd/gc: fix strict tree property for AST for OAS2RECV nodes.
Luuk van Dijk [Mon, 22 Oct 2012 08:01:14 +0000 (10:01 +0200)]
cmd/gc: fix strict tree property for AST for OAS2RECV nodes.

in typecheck and walk, conversion from OAS2RECV to OAS2
and to OSELRECV2 duplicated the ->rlist->n to ->right
thereby destroying the strict tree-ness of the AST (up to
ONAMES) of course.  Several recursions in esc.c and inl.c
and probably elsewhere assume nodes of the tree aren't duplicated.
rather than defensively code around this, i'd rather assert
these cases away and fix their cause.

(this was tripped in 6741044)

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

12 years agocmd/go: add join template function.
Roger Peppe [Mon, 22 Oct 2012 07:58:27 +0000 (08:58 +0100)]
cmd/go: add join template function.

It's common to use the go list command in shell scripts, but
currently it's awkward to print a string slice from the Package
type in a way that's easily parseable by the shell.  For example:

        go list -f '{{range .Deps}}{{.}}
        {{end}}'

(and even that prints an unwanted new line at the end|).

To make this easier, this CL adds a "join" function to the
format template.

        go list -f '{{join .Deps "\n"}}'

R=rsc, dsymonds, minux.ma, remyoudompheng, r
CC=golang-dev
https://golang.org/cl/6680044

12 years agocmd/gc: fix inlining bug for composite literals in if statements.
Rémy Oudompheng [Mon, 22 Oct 2012 06:38:23 +0000 (08:38 +0200)]
cmd/gc: fix inlining bug for composite literals in if statements.

Fixes #4230.

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

12 years agolib9, cmd/dist, cmd/5l: embed GOARM into cmd/5l and auto detect GOARM
Shenghou Ma [Mon, 22 Oct 2012 06:26:36 +0000 (14:26 +0800)]
lib9, cmd/dist, cmd/5l: embed GOARM into cmd/5l and auto detect GOARM

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

12 years agoos: fix documentation typos: s/an array/a slice/.
Nigel Tao [Mon, 22 Oct 2012 05:26:47 +0000 (16:26 +1100)]
os: fix documentation typos: s/an array/a slice/.

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

12 years agoencoding/xml: expand allowed entity names
Patrick Smith [Mon, 22 Oct 2012 00:33:24 +0000 (20:33 -0400)]
encoding/xml: expand allowed entity names

Previously, multi-byte characters were not allowed. Also certain single-byte
characters, such as '-', were disallowed.
Fixes #3813.

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

12 years agoruntime: sizeclass in MSpan should be int32.
Jingcheng Zhang [Mon, 22 Oct 2012 00:32:43 +0000 (20:32 -0400)]
runtime: sizeclass in MSpan should be int32.

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

12 years agoA+C: Jingcheng Zhang and Patrick Smith (individual CLA x2)
Russ Cox [Mon, 22 Oct 2012 00:32:35 +0000 (20:32 -0400)]
A+C: Jingcheng Zhang and Patrick Smith (individual CLA x2)

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

12 years agogo/build: document the behavior of multiple build constraints.
Nigel Tao [Mon, 22 Oct 2012 00:15:17 +0000 (11:15 +1100)]
go/build: document the behavior of multiple build constraints.

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

12 years agoA+C: Richard Eric Gavaletz (individual CLA)
Andrew Gerrand [Sun, 21 Oct 2012 22:21:57 +0000 (09:21 +1100)]
A+C: Richard Eric Gavaletz (individual CLA)

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

12 years agoruntime: store types of allocated objects
Jan Ziak [Sun, 21 Oct 2012 21:41:32 +0000 (17:41 -0400)]
runtime: store types of allocated objects

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

12 years agonet: add test for Conn, PacketConn and Listener
Mikio Hara [Sun, 21 Oct 2012 21:17:51 +0000 (17:17 -0400)]
net: add test for Conn, PacketConn and Listener

I just realized that there is no good place for adding
exposed function or method tests because server, unicast
and multicast_test.go do test complicated multiple test
objects, platform behaviros, protocol behaviors and API,
at the same time. Perhaps splitting them into per test
object might be better, so this CL provides tests focused
on API.

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

12 years agocmd/gc: rebuild builtin.c
Russ Cox [Sun, 21 Oct 2012 21:15:56 +0000 (17:15 -0400)]
cmd/gc: rebuild builtin.c

Was not in sync with runtime.go, but the diffs
didn't really matter, so nothing broke.

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

12 years agobuild: u.h for plan9 arm
Lucio De Re [Sun, 21 Oct 2012 21:04:07 +0000 (17:04 -0400)]
build: u.h for plan9 arm

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

12 years agoreflect: make Index and Slice accept strings
Evan Shaw [Sun, 21 Oct 2012 21:02:10 +0000 (17:02 -0400)]
reflect: make Index and Slice accept strings

Fixes #3284.

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

12 years agocmd/gc: fix confusing error when using variable as type.
Daniel Morsing [Sun, 21 Oct 2012 18:50:31 +0000 (20:50 +0200)]
cmd/gc: fix confusing error when using variable as type.

Fixes #3783.

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

12 years agocmd/gc: Friendlier errors on oversized arrays.
Daniel Morsing [Sun, 21 Oct 2012 17:22:51 +0000 (19:22 +0200)]
cmd/gc: Friendlier errors on oversized arrays.

Someone new to the language may not know the connection between ints and arrays, which was the only thing that the previous error told you anything about.

Fixes #4256.

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

12 years agoruntime: update docs for MemStats.PauseNs
Shenghou Ma [Sun, 21 Oct 2012 17:08:13 +0000 (01:08 +0800)]
runtime: update docs for MemStats.PauseNs
   PauseNs is a circular buffer of recent pause times, and the
most recent one is at [((NumGC-1)+256)%256].

   Also fix comments cross-linking the Go and C definition of
various structs.

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

12 years agogophertool: fix links
Shenghou Ma [Sun, 21 Oct 2012 17:05:21 +0000 (01:05 +0800)]
gophertool: fix links

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

12 years agoA+C: add Willem van der Schyff (Individual CLA).
Adam Langley [Sun, 21 Oct 2012 03:20:17 +0000 (14:20 +1100)]
A+C: add Willem van der Schyff (Individual CLA).

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

12 years agocmd/go: make package list order predicable
Shenghou Ma [Sat, 20 Oct 2012 09:25:13 +0000 (17:25 +0800)]
cmd/go: make package list order predicable
also add a cleanup phase to cmd/go/test.bash.

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

12 years agocodereview: protect against read-only upstream repository
Shenghou Ma [Sat, 20 Oct 2012 09:23:48 +0000 (17:23 +0800)]
codereview: protect against read-only upstream repository

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

12 years agoruntime: ~3.7x speed up of div/mod on ARM
Shenghou Ma [Sat, 20 Oct 2012 08:40:19 +0000 (16:40 +0800)]
runtime: ~3.7x speed up of div/mod on ARM
benchmark                      old ns/op    new ns/op    delta
BenchmarkUint32Div7                  281           75  -73.06%
BenchmarkUint32Div37                 281           75  -73.02%
BenchmarkUint32Div123                281           75  -73.02%
BenchmarkUint32Div763                280           75  -72.89%
BenchmarkUint32Div1247               280           75  -72.93%
BenchmarkUint32Div9305               281           75  -73.02%
BenchmarkUint32Div13307              281           75  -73.06%
BenchmarkUint32Div52513              281           75  -72.99%
BenchmarkUint32Div60978747           281           63  -77.33%
BenchmarkUint32Div106956295          280           63  -77.21%
BenchmarkUint32Mod7                  280           77  -72.21%
BenchmarkUint32Mod37                 280           77  -72.18%
BenchmarkUint32Mod123                280           77  -72.25%
BenchmarkUint32Mod763                280           77  -72.18%
BenchmarkUint32Mod1247               280           77  -72.21%
BenchmarkUint32Mod9305               280           77  -72.21%
BenchmarkUint32Mod13307              280           77  -72.25%
BenchmarkUint32Mod52513              280           77  -72.18%
BenchmarkUint32Mod60978747           280           63  -77.25%
BenchmarkUint32Mod106956295          280           63  -77.21%

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

12 years agobufio: remove a little unnecessary indirection in tests.
Nigel Tao [Sat, 20 Oct 2012 02:02:29 +0000 (13:02 +1100)]
bufio: remove a little unnecessary indirection in tests.

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

12 years agogo spec: constant divisors must not be zero
Robert Griesemer [Fri, 19 Oct 2012 17:12:09 +0000 (10:12 -0700)]
go spec: constant divisors must not be zero

Both gc and gccgo always checked this for constant
expressions but the spec only mentions run-time
exceptions.

This CL also requires that constant divisors
must not be zero in non-constant integer expressions:
This is consistent with the spirit of the most
recent changes and it is consistent with constant
expressions. We don't want to specify the effect for
non-integer expressions (f/0.0 where f is a float or
complex number) because there the result f/g is not
further specified if a non-constant g is 0.

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

12 years agogo spec: define make() restrictions as for index expressions
Robert Griesemer [Fri, 19 Oct 2012 17:11:06 +0000 (10:11 -0700)]
go spec: define make() restrictions as for index expressions

This is a language change: Until now, the spec required run-
time panics for some of these errors. Note that gc and gccgo
implemented this inconsistently, and that both compilers already
reported compile-time errors in some cases. This change makes
make() behave along the same vein as index expressions.

This addresses the spec aspect of issue 4085.

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

12 years agounsafe: fix a typo
Oling Cat [Fri, 19 Oct 2012 05:35:15 +0000 (16:35 +1100)]
unsafe: fix a typo

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

12 years agobufio: make Writer.ReadFrom not flush prematurely. For example,
Nigel Tao [Fri, 19 Oct 2012 05:32:00 +0000 (16:32 +1100)]
bufio: make Writer.ReadFrom not flush prematurely. For example,
many small writes to a network may be less efficient that a few
large writes.

This fixes net/http's TestClientWrites, broken by 6565056 that
introduced Writer.ReadFrom. That test implicitly assumed that
calling io.Copy on a *bufio.Writer wouldn't write to the
underlying network until the buffer was full.

R=dsymonds
CC=bradfitz, golang-dev, mchaten, mikioh.mikioh
https://golang.org/cl/6743044

12 years agobufio: Implement io.ReaderFrom for (*Writer).
Michael Chaten [Fri, 19 Oct 2012 00:22:51 +0000 (11:22 +1100)]
bufio: Implement io.ReaderFrom for (*Writer).

This is part 2 of 2 for issue 4028.

benchmark                        old ns/op    new ns/op    delta
BenchmarkWriterCopyOptimal           53293        28326  -46.85%
BenchmarkWriterCopyUnoptimal         53757        30537  -43.19%
BenchmarkWriterCopyNoReadFrom        53192        36642  -31.11%

Fixes #4028.

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

12 years agoruntime: update comment for the "extern register" variables g and m.
Nigel Tao [Fri, 19 Oct 2012 00:02:32 +0000 (11:02 +1100)]
runtime: update comment for the "extern register" variables g and m.

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

12 years agoimage/draw: fast-path for 4:4:0 chroma subsampled sources.
Nigel Tao [Thu, 18 Oct 2012 23:55:41 +0000 (10:55 +1100)]
image/draw: fast-path for 4:4:0 chroma subsampled sources.

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

12 years agoencoding/xml: correctly escape newline, carriage return, and tab
Ian Lance Taylor [Thu, 18 Oct 2012 20:40:45 +0000 (13:40 -0700)]
encoding/xml: correctly escape newline, carriage return, and tab

The generated encodings are those from
http://www.w3.org/TR/2000/WD-xml-c14n-20000119.html#charescaping

The change to the decoder ensures that we turn 
 in the
input into \r, not \n.

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

12 years agoimage/jpeg: make TestDCT faster.
Rémy Oudompheng [Thu, 18 Oct 2012 19:28:04 +0000 (21:28 +0200)]
image/jpeg: make TestDCT faster.

The value of cosines are cached in a global array
instead of being recomputed each time.
The test was terribly slow on arm.

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

12 years agonet: add LookupNS(domain string)
Stephen McQuay [Thu, 18 Oct 2012 06:39:04 +0000 (15:39 +0900)]
net: add LookupNS(domain string)
Fixes #4224.

R=golang-dev, dave, minux.ma, mikioh.mikioh, alex.brainman, rsc, herbert.fischer
CC=golang-dev
https://golang.org/cl/6675043

12 years agoA+C: Stephen McQuay (Individual CLA)
Mikio Hara [Thu, 18 Oct 2012 06:37:53 +0000 (15:37 +0900)]
A+C: Stephen McQuay (Individual CLA)

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

12 years agoexp/html: update package docs and add an example; a node's children is
Nigel Tao [Wed, 17 Oct 2012 23:25:50 +0000 (10:25 +1100)]
exp/html: update package docs and add an example; a node's children is
a linked list, not a slice.

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

12 years agodoc/codewalk/markov: fix the highlight range of the step "The NewChain constructor...
Oling Cat [Wed, 17 Oct 2012 21:12:44 +0000 (08:12 +1100)]
doc/codewalk/markov: fix the highlight range of the step "The NewChain constructor function".

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

12 years agocmd/gc: don't squash complex literals when inlining.
Rémy Oudompheng [Wed, 17 Oct 2012 18:33:44 +0000 (20:33 +0200)]
cmd/gc: don't squash complex literals when inlining.

Since this patch changes the way complex literals are written
in export data, there are a few other glitches.

Fixes #4159.

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

12 years agocrypto/cipher: panic on invalid IV length
Shane Hansen [Wed, 17 Oct 2012 18:29:00 +0000 (14:29 -0400)]
crypto/cipher: panic on invalid IV length

Give better user feedback when invalid IV is used
to construct a cipher.

Fixes #3411

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

12 years agoA+C: add Shane Hansen (Individual CLA)
Adam Langley [Wed, 17 Oct 2012 18:21:58 +0000 (14:21 -0400)]
A+C: add Shane Hansen (Individual CLA)

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

12 years agogo spec: restrictions for index and slice expressions
Robert Griesemer [Wed, 17 Oct 2012 18:08:42 +0000 (11:08 -0700)]
go spec: restrictions for index and slice expressions

At the moment, gc and gccgo report compile-
time errors for certain constant indexes that
are out of bounds. The spec however requests
a run-time panic for out-of-bounds indexes
(http://tip.golang.org/ref/spec#Indexes).

Document the status quo.

Fixes #4231.

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

12 years agocmd/go: Dedup package arguments before building.
Daniel Morsing [Wed, 17 Oct 2012 15:23:47 +0000 (17:23 +0200)]
cmd/go: Dedup package arguments before building.

Fixes #4104.

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

12 years agomath/big: add 4-bit, fixed window exponentiation.
Adam Langley [Wed, 17 Oct 2012 15:19:26 +0000 (11:19 -0400)]
math/big: add 4-bit, fixed window exponentiation.

A 4-bit window is convenient because 4 divides both 32 and 64,
therefore we never have a window spanning words of the exponent.
Additionaly, the benefit of a 5-bit window is only 2.6% at 1024-bits
and 3.3% at 2048-bits.

This code is still not constant time, however.

benchmark                        old ns/op    new ns/op    delta
BenchmarkRSA2048Decrypt           17108590     11180370  -34.65%
Benchmark3PrimeRSA2048Decrypt     13003720      7680390  -40.94%

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

12 years agosync/atomic: FreeBSD/ARM support
Shenghou Ma [Wed, 17 Oct 2012 06:27:58 +0000 (14:27 +0800)]
sync/atomic: FreeBSD/ARM support
only supports ARMv6K and newer ARM cores.

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

12 years agopath/filepath: better documentation for WalkFunc
Rob Pike [Wed, 17 Oct 2012 05:00:09 +0000 (16:00 +1100)]
path/filepath: better documentation for WalkFunc
Define the properties of the arguments better. In particular,
explain that the path is (sort of) relative to the argument to
Walk.

Fixes #4119.

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

12 years agonet: return error from pollster rather than panicing
Dave Cheney [Tue, 16 Oct 2012 22:41:00 +0000 (09:41 +1100)]
net: return error from pollster rather than panicing

Fixes #3590.

R=bradfitz, mikioh.mikioh, iant, bsiegert
CC=golang-dev
https://golang.org/cl/6684054

12 years agomath/big: fix big.Exp and document better
Robert Griesemer [Tue, 16 Oct 2012 20:46:27 +0000 (13:46 -0700)]
math/big: fix big.Exp and document better

- always return 1 for y <= 0
- document that the sign of m is ignored
- protect against div-0 panics by treating
  m == 0 the same way as m == nil
- added extra tests

Fixes #4239.

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

12 years agocrypto/tls: make closeNotify a warning alert.
Adam Langley [Tue, 16 Oct 2012 19:40:37 +0000 (15:40 -0400)]
crypto/tls: make closeNotify a warning alert.

The RFC doesn't actually have an opinion on whether this is a fatal or
warning level alert, but common practice suggests that it should be a
warning.

This involves rebasing most of the tests.

Fixes #3413.

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

12 years agoexp/types/staging: index and slice type checks
Robert Griesemer [Tue, 16 Oct 2012 17:20:03 +0000 (10:20 -0700)]
exp/types/staging: index and slice type checks

Also: handle assignments to the blank identifier.

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

12 years agoruntime: fix spurious deadlock crashes
Dmitriy Vyukov [Tue, 16 Oct 2012 10:41:32 +0000 (14:41 +0400)]
runtime: fix spurious deadlock crashes
Fixes #4243.

R=golang-dev, iant
CC=golang-dev, sebastien.paolacci
https://golang.org/cl/6682050

12 years agodoc: NetBSD is fully supported now
Shenghou Ma [Tue, 16 Oct 2012 08:02:56 +0000 (16:02 +0800)]
doc: NetBSD is fully supported now

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

12 years agomisc/dist: support packaging for NetBSD
Shenghou Ma [Tue, 16 Oct 2012 07:53:17 +0000 (15:53 +0800)]
misc/dist: support packaging for NetBSD

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

12 years agodoc/godoc.js: put focus on div#page when necessary
Shenghou Ma [Tue, 16 Oct 2012 06:28:18 +0000 (14:28 +0800)]
doc/godoc.js: put focus on div#page when necessary
so that keyboard navigation events are sent to div#page.

        Fixes #4233.

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

12 years agocmd/5g, cmd/6g, cmd/8g: fix out of registers.
Rémy Oudompheng [Tue, 16 Oct 2012 05:22:33 +0000 (07:22 +0200)]
cmd/5g, cmd/6g, cmd/8g: fix out of registers.

This patch is enough to fix compilation of
exp/types tests but only passes a stripped down
version of the appripriate torture test.

Update #4207.

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

12 years agopprof: filter out runtime.settype and fix --svg mode to produce valid XML
Brad Fitzpatrick [Tue, 16 Oct 2012 03:49:15 +0000 (20:49 -0700)]
pprof: filter out runtime.settype and fix --svg mode to produce valid XML

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

12 years agobuilder: label the race builder as "race"
Brad Fitzpatrick [Tue, 16 Oct 2012 03:30:41 +0000 (20:30 -0700)]
builder: label the race builder as "race"

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

12 years agospec: more clarification about deferred functions
Rob Pike [Tue, 16 Oct 2012 00:27:20 +0000 (11:27 +1100)]
spec: more clarification about deferred functions
Proposed new text to make matters clearer. The existing text was
unclear about the state of result parameters when panicking.

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

12 years agoruntime: add missing if(raceenabled)
Dmitriy Vyukov [Mon, 15 Oct 2012 09:54:31 +0000 (13:54 +0400)]
runtime: add missing if(raceenabled)

R=0xe2.0x9a.0x9b, minux.ma, iant, dave
CC=golang-dev
https://golang.org/cl/6654052

12 years agoimage/jpeg: re-organize the processSOS code.
Nigel Tao [Mon, 15 Oct 2012 02:28:30 +0000 (13:28 +1100)]
image/jpeg: re-organize the processSOS code.

This is a straight copy/paste, and the deletion of a TODO. There are
no other changes.

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

12 years agoimage/jpeg: decode progressive JPEGs.
Nigel Tao [Mon, 15 Oct 2012 00:21:20 +0000 (11:21 +1100)]
image/jpeg: decode progressive JPEGs.

To be clear, this supports decoding the bytes on the wire into an
in-memory image. There is no API change: jpeg.Decode will still not
return until the entire image is decoded.

The code is obviously more complicated, and costs around 10% in
performance on baseline JPEGs. The processSOS code could be cleaned up a
bit, and maybe some of that loss can be reclaimed, but I'll leave that
for follow-up CLs, to keep the diff for this one as small as possible.

Before:
BenchmarkDecode     1000    2855637 ns/op   21.64 MB/s
After:
BenchmarkDecodeBaseline      500    3178960 ns/op   19.44 MB/s
BenchmarkDecodeProgressive      500    4082640 ns/op   15.14 MB/s

Fixes #3976.

The test data was generated by:
# Create intermediate files; cjpeg on Ubuntu 10.04 can't read PNG.
convert video-001.png video-001.bmp
convert video-005.gray.png video-005.gray.pgm
# Create new test files.
cjpeg -quality 100 -sample 1x1,1x1,1x1 -progressive video-001.bmp > video-001.progressive.jpeg
cjpeg -quality 50 -sample 2x2,1x1,1x1 video-001.bmp > video-001.q50.420.jpeg
cjpeg -quality 50 -sample 2x1,1x1,1x1 video-001.bmp > video-001.q50.422.jpeg
cjpeg -quality 50 -sample 1x1,1x1,1x1 video-001.bmp > video-001.q50.444.jpeg
cjpeg -quality 50 -sample 2x2,1x1,1x1 -progressive video-001.bmp > video-001.q50.420.progressive.jpeg
cjpeg -quality 50 -sample 2x1,1x1,1x1 -progressive video-001.bmp > video-001.q50.422.progressive.jpeg
cjpeg -quality 50 -sample 1x1,1x1,1x1 -progressive video-001.bmp > video-001.q50.444.progressive.jpeg
cjpeg -quality 50 video-005.gray.pgm > video-005.gray.q50.jpeg
cjpeg -quality 50 -progressive video-005.gray.pgm > video-005.gray.q50.progressive.jpeg
# Delete intermediate files.
rm video-001.bmp video-005.gray.pgm

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

12 years agotime: accept numbers larger than 2^32 in ParseDuration.
David Symonds [Sun, 14 Oct 2012 20:50:13 +0000 (07:50 +1100)]
time: accept numbers larger than 2^32 in ParseDuration.

Fixes #3374.

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

12 years agoio/ioutil: use pathname instead of name in docs to avoid confusion
Shenghou Ma [Sat, 13 Oct 2012 11:05:22 +0000 (19:05 +0800)]
io/ioutil: use pathname instead of name in docs to avoid confusion
caller of ioutil.TempFile() can use f.Name() to get "pathname"
of the temporary file, instead of just the "name" of the file.

Also remove an out-of-date comment about random number state.

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

12 years agocompress/bzip2: use io.ByteReader instead of internal interface
Anthony Martin [Fri, 12 Oct 2012 21:09:24 +0000 (14:09 -0700)]
compress/bzip2: use io.ByteReader instead of internal interface

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

12 years agoruntime: FreeBSD/ARM support
Shenghou Ma [Fri, 12 Oct 2012 15:19:39 +0000 (23:19 +0800)]
runtime: FreeBSD/ARM support

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

12 years agodoc: remove ExpressivenessOfGo.pdf
Shenghou Ma [Fri, 12 Oct 2012 10:50:41 +0000 (18:50 +0800)]
doc: remove ExpressivenessOfGo.pdf
        It has been moved to go.talks/2010/ExpressivenessOfGo-2010.pdf
        URL: http://talks.golang.org/2010/ExpressivenessOfGo-2010.pdf

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

12 years agosyscall: FreeBSD/ARM support
Shenghou Ma [Fri, 12 Oct 2012 08:26:42 +0000 (16:26 +0800)]
syscall: FreeBSD/ARM support

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

12 years agocmd/5l: reorder some struct fields to reduce memory consumption
Shenghou Ma [Fri, 12 Oct 2012 05:39:12 +0000 (13:39 +0800)]
cmd/5l: reorder some struct fields to reduce memory consumption
Valgrind Massif result when linking godoc:
On amd64:
                    old          new         -/+
mem_heap_B       185844612    175358047    -5.7%
mem_heap_extra_B    773404       773137    -0.0%

On 386/ARM:
                    old          new         -/+
mem_heap_B       141775701    131289941    -7.4%
mem_heap_extra_B    737011       736955    -0.0%

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

12 years agocmd/dist: fix superfluous and confusing "binaries ... to be copied or moved" message
Shenghou Ma [Fri, 12 Oct 2012 05:35:05 +0000 (13:35 +0800)]
cmd/dist: fix superfluous and confusing "binaries ... to be copied or moved" message
Also, to aid debugging cmd/dist, make make.bat support --dist-tool flag.

Fixes #3100.

R=alex.brainman
CC=golang-dev
https://golang.org/cl/6637061

12 years agofmt: document some undocumented details
Rob Pike [Fri, 12 Oct 2012 05:16:55 +0000 (16:16 +1100)]
fmt: document some undocumented details
Better explanation of width for floating-point values.
Explain that scanning does not handle %#q etc.

Fixes #4202.
Fixes #4206.

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

12 years agobytes, strings: add (*Reader).WriteTo
Evan Shaw [Fri, 12 Oct 2012 03:43:50 +0000 (14:43 +1100)]
bytes, strings: add (*Reader).WriteTo

Fixes #4031.

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

12 years agotime: delete erroneous word from documentation.
Rob Pike [Fri, 12 Oct 2012 00:00:00 +0000 (11:00 +1100)]
time: delete erroneous word from documentation.
Fixes #4236.

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