]> Cypherpunks repositories - gostls13.git/log
gostls13.git
13 years agovet: check values for named constants as well as literals.
Rob Pike [Wed, 25 Apr 2012 02:14:38 +0000 (12:14 +1000)]
vet: check values for named constants as well as literals.
As in:
        const format = "%s"
        fmt.Printf(format, "hi")
Also fix a couple of bugs by rewriting the routine.

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

13 years agoall: fix errors found by go vet
Rob Pike [Wed, 25 Apr 2012 01:33:27 +0000 (11:33 +1000)]
all: fix errors found by go vet

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

13 years agoexp/html: adjust inTableIM to match spec
Andrew Balholm [Wed, 25 Apr 2012 00:49:27 +0000 (10:49 +1000)]
exp/html: adjust inTableIM to match spec

Don't foster-parent text nodes that consist only of whitespace.
(I implemented this entirely in inTableIM instead of creating an
inTableTextIM, because the sole purpose of inTableTextIM seems to be
to combine character tokens into a string, which our tokenizer does
already.)

Use parseImpliedToken to clarify a couple of cases.

Handle <style>, <script>, <input>, and <form>.

Ignore doctype tokens.

Pass 20 additional tests.

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

13 years agotest: add test for order of evaluation of map index on left of =
Ian Lance Taylor [Tue, 24 Apr 2012 17:17:26 +0000 (10:17 -0700)]
test: add test for order of evaluation of map index on left of =

Gccgo used to get this wrong.

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

13 years agomisc/dist: more gophers for OS X installer
Mikkel Krautz [Tue, 24 Apr 2012 16:24:19 +0000 (09:24 -0700)]
misc/dist: more gophers for OS X installer

Replaces the default OS X installer background
with a more fitting image.

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

13 years agoruntime: fix runtime.Breakpoint for ARM
Shenghou Ma [Tue, 24 Apr 2012 15:19:44 +0000 (23:19 +0800)]
runtime: fix runtime.Breakpoint for ARM

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

13 years agocmd/5g: fix URL typo
Shenghou Ma [Tue, 24 Apr 2012 15:17:16 +0000 (23:17 +0800)]
cmd/5g: fix URL typo

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

13 years agoexp/html: make inBodyIM match spec
Andrew Balholm [Tue, 24 Apr 2012 05:27:48 +0000 (15:27 +1000)]
exp/html: make inBodyIM match spec

This CL corrects the remaining differences that I could find between the
implementation of inBodyIM and the spec:

Handle <rp> and <rt>.

Adjust SVG and MathML attributes.

Reconstruct active formatting elements in the "any other start tag" case.

Pass 7 additional tests.

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

13 years agomime/multipart: report io.EOF correctly on part ending without newlines
Brad Fitzpatrick [Tue, 24 Apr 2012 05:26:48 +0000 (22:26 -0700)]
mime/multipart: report io.EOF correctly on part ending without newlines

If a part ends with "--boundary--", without a final "\r\n",
that's also a graceful EOF, and we should return io.EOF instead
of the fmt-wrapped io.EOF from bufio.Reader.ReadSlice.

I found this bug parsing an image attachment from gmail.
Minimal test case stripped down from the original
gmail-generated attachment included.

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

13 years agopath: document that Clean deletes trailing slashes.
Rob Pike [Tue, 24 Apr 2012 03:17:05 +0000 (13:17 +1000)]
path: document that Clean deletes trailing slashes.

Fixes #3492.

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

13 years agotext/template: improve the error reporting for unexported fields.
Rob Pike [Tue, 24 Apr 2012 03:11:59 +0000 (13:11 +1000)]
text/template: improve the error reporting for unexported fields.
Changes suggested by rsc after last CL.

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

13 years agonet/http: allow clients to disable keep-alive
Gustavo Niemeyer [Tue, 24 Apr 2012 01:00:16 +0000 (22:00 -0300)]
net/http: allow clients to disable keep-alive

Fixes #3540.

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

13 years agonet: fix typo in Listener.File() documentation
Rémy Oudompheng [Mon, 23 Apr 2012 23:27:19 +0000 (01:27 +0200)]
net: fix typo in Listener.File() documentation

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

13 years agotest: test handling of negative float constants
Ian Lance Taylor [Mon, 23 Apr 2012 22:47:34 +0000 (15:47 -0700)]
test: test handling of negative float constants

This used to panic when compiled by gccgo.

Updates #2876.

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

13 years agotime: change float expression to ensure it is an integer
Ian Lance Taylor [Mon, 23 Apr 2012 22:46:54 +0000 (15:46 -0700)]
time: change float expression to ensure it is an integer

When I increased the number of bits that gccgo uses for
untyped floats, the expression 0.52*1e9 was no longer
integral.  This patch fixes that.

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

13 years agomisc/dist: require 10.6 or later for OS X .pkgs
Mikkel Krautz [Mon, 23 Apr 2012 21:56:03 +0000 (14:56 -0700)]
misc/dist: require 10.6 or later for OS X .pkgs

This changes the misc/dist program to generate OS X
packages using pkgbuild and productbuild.

The productbuild utility makes it easy to generate
packages with a custom Distribution file.  This allows
us to add an installcheck script that presents a
friendly message to users who are running on an old
version of Mac OS X.

The change also fixes a few issues with the
postinstall script:

 - In-repo version of the script has been made
   executable. Installers generated using the new
   tools couldn't execute it otherwise.

 - It now uses -d for checking for the existence
   of the Xcode specs directory.

 - The call to sudo.bash has been dropped since cov
   and prof aren't bundled with the binary
   distributions.

Fixes #3455.

Tested on 10.5.8, 10.6.0, 10.6.8 and 10.7.3.

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

13 years agocmd/gc: fix addresses escaping through closures called in-place.
Luuk van Dijk [Mon, 23 Apr 2012 19:39:01 +0000 (15:39 -0400)]
cmd/gc: fix addresses escaping through closures called in-place.

Fixes #3545.

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

13 years agonet/http: lex cleanup
Pascal S. de Kloe [Mon, 23 Apr 2012 17:26:10 +0000 (10:26 -0700)]
net/http: lex cleanup

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

13 years agomath: ARM assembly implementation for Abs
Shenghou Ma [Mon, 23 Apr 2012 15:47:36 +0000 (23:47 +0800)]
math: ARM assembly implementation for Abs

Obtained on 700MHz OMAP4460:
benchmark       old ns/op    new ns/op    delta
BenchmarkAbs           61           23  -61.63%

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

13 years agotext/template: detect unexported fields better
Rob Pike [Mon, 23 Apr 2012 05:39:02 +0000 (15:39 +1000)]
text/template: detect unexported fields better
Moves the error detection back into execution, where it used to be,
and improves the error message.
Rolls back most of 6009048, which broke lower-case keys in maps.
If it weren't for maps we could detect this at compile time rather than
execution time.

Fixes #3542.

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

13 years agoreflect: document and test TypeOf(nil)
Rob Pike [Mon, 23 Apr 2012 02:07:02 +0000 (12:07 +1000)]
reflect: document and test TypeOf(nil)
Fixes #3549.

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

13 years agoexp/html: add more cases to inBodyIM
Andrew Balholm [Sun, 22 Apr 2012 06:19:21 +0000 (16:19 +1000)]
exp/html: add more cases to inBodyIM

Don't set framesetOK to false for hidden input elements.

Handle <param>, <source>, <track>, <textarea>, <iframe>, <noembed>,
and <noscript>

Pass 7 additional tests.

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

13 years agostrconv: 2x-4x speed improvement for atof64.
Rémy Oudompheng [Sat, 21 Apr 2012 11:56:51 +0000 (13:56 +0200)]
strconv: 2x-4x speed improvement for atof64.

benchmark                      old ns/op    new ns/op    delta
BenchmarkAtof64Decimal               344           71  -79.22%
BenchmarkAtof64Float                 397           90  -77.15%
BenchmarkAtof64FloatExp              445          241  -45.84%
BenchmarkAtof64Big                   731          324  -55.68%
BenchmarkAtof64RandomBits            761          453  -40.47%
BenchmarkAtof64RandomFloats          690          314  -54.49%

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

13 years agocompress/zlib: minor fixes
Quan Yong Zhai [Sat, 21 Apr 2012 04:34:42 +0000 (14:34 +1000)]
compress/zlib: minor fixes

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

13 years agoruntime: add benchmark for complex128 division
Michael Chaten [Sat, 21 Apr 2012 03:24:41 +0000 (13:24 +1000)]
runtime: add benchmark for complex128 division

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

13 years agonet: fix race between Close and Read
Dave Cheney [Sat, 21 Apr 2012 00:01:32 +0000 (10:01 +1000)]
net: fix race between Close and Read

Fixes #3507.

Applied the suggested fix from rsc. If the connection
is in closing state then errClosing will bubble up to
the caller.

The fix has been applied to udp, ip and unix as well as
their code path include nil'ing c.fd on close. Func
tests are available in the linked issue that verified
the bug existed there as well.

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

13 years agoexp/html: more work on inBodyIM
Andrew Balholm [Fri, 20 Apr 2012 23:20:38 +0000 (09:20 +1000)]
exp/html: more work on inBodyIM

Reorder some cases.
Handle <pre>, <listing>, </form>, </li>, </dd>, </dt>, </h1>, </h2>,
</h3>, </h4>, </h5>, and </h6> tags.

Pass 6 additional tests.

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

13 years agoruntime: disable memory profiler in gc_test
Ian Lance Taylor [Fri, 20 Apr 2012 18:36:06 +0000 (11:36 -0700)]
runtime: disable memory profiler in gc_test

This lets the test pass on PPC64 GNU/Linux, which uses a much
larger page size and thus uses more memory to hold blocks
allocated for memory profiling.

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

13 years agonet/http/httputil: Made reverseproxy test less flaky.
Colby Ranger [Fri, 20 Apr 2012 16:31:23 +0000 (09:31 -0700)]
net/http/httputil: Made reverseproxy test less flaky.

The reverseproxy test depended on the behavior of
runtime.NumGoroutines(), which makes no guarantee when
goroutines are reaped. Instead, modify the flushLoop()
to invoke a callback when it returns, so the exit
from the loop can be tested, instead of the number
of gorountines running.

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

13 years agotest: use testlib in a few more cases (part 2)
Shenghou Ma [Fri, 20 Apr 2012 15:45:43 +0000 (23:45 +0800)]
test: use testlib in a few more cases (part 2)
        Introduced "runoutput" cmd for running generated program

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

13 years agodoc: don't wrap package names in directory listing
Andrew Gerrand [Fri, 20 Apr 2012 14:04:13 +0000 (10:04 -0400)]
doc: don't wrap package names in directory listing

Fixes #3522.

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

13 years agoexp/html: start making inBodyIM match the spec
Andrew Balholm [Fri, 20 Apr 2012 05:48:13 +0000 (15:48 +1000)]
exp/html: start making inBodyIM match the spec

Reorder some start tags.

Improve handling of </body>.
Handle </html>.

Pass 2 additional tests (by handling </html>).

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

13 years agoexp/html: ignore null bytes in text
Andrew Balholm [Fri, 20 Apr 2012 04:25:42 +0000 (14:25 +1000)]
exp/html: ignore null bytes in text

pass one additional test

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

13 years agoexp/html: improve afterHeadIM
Andrew Balholm [Fri, 20 Apr 2012 00:48:10 +0000 (10:48 +1000)]
exp/html: improve afterHeadIM

Clean up the flow of control.
Fix the TODO for handling <html> tags.
Add a case to ignore doctype declarations.

Pass one additional test.

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

13 years agosyscall: cleanly exit all Go procs on Plan 9
Akshat Kumar [Thu, 19 Apr 2012 23:31:26 +0000 (16:31 -0700)]
syscall: cleanly exit all Go procs on Plan 9

syscall.Exit would originally kill only the calling
Go proc, leaving behind other procs in the
same group. This change makes syscall.Exit call
runtime·exit, which due to CL
https://golang.org/cl/5617048
will cleanly exit all the Go procs in the group.

R=golang-dev, rsc, rminnich, remyoudompheng, ality, john
CC=golang-dev, mirtchovski
https://golang.org/cl/6036051

13 years agoexp/html: improve InHeadIM
Andrew Balholm [Thu, 19 Apr 2012 23:08:58 +0000 (09:08 +1000)]
exp/html: improve InHeadIM

Clean up the flow of control, and add a case for doctype tokens (to
ignore them).

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

13 years agonet/http: add example for FileServer to mention StripPrefix
Shenghou Ma [Thu, 19 Apr 2012 16:41:10 +0000 (00:41 +0800)]
net/http: add example for FileServer to mention StripPrefix
        Fixes #3530.

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

13 years agoA+C: add Bjorn Tillenius (Individual CLA)
Brad Fitzpatrick [Thu, 19 Apr 2012 16:23:48 +0000 (09:23 -0700)]
A+C: add Bjorn Tillenius (Individual CLA)

R=golang-dev, kevlar
CC=golang-dev
https://golang.org/cl/6075045

13 years agoA+C: Add Michael Chaten (Individual CLA)
Brad Fitzpatrick [Thu, 19 Apr 2012 16:18:49 +0000 (09:18 -0700)]
A+C: Add Michael Chaten (Individual CLA)

R=golang-dev, kevlar
CC=golang-dev
https://golang.org/cl/6075044

13 years agoexp/html: add parseImpliedToken method to parser
Andrew Balholm [Thu, 19 Apr 2012 01:48:17 +0000 (11:48 +1000)]
exp/html: add parseImpliedToken method to parser

This method will allow us to be explicit about what we're doing when
we insert an implied token, and avoid repeating the logic involved in
multiple places.

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

13 years agodoc/articles/image_draw.html: Change ColorImage to Uniform
Benny Siegert [Thu, 19 Apr 2012 01:04:42 +0000 (11:04 +1000)]
doc/articles/image_draw.html: Change ColorImage to Uniform

Fixes #3474.

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

13 years agonet/http/httputil: Clean up ReverseProxy maxLatencyWriter goroutines.
Colby Ranger [Wed, 18 Apr 2012 18:33:02 +0000 (11:33 -0700)]
net/http/httputil: Clean up ReverseProxy maxLatencyWriter goroutines.

When FlushInterval is specified on ReverseProxy, the ResponseWriter is
wrapped with a maxLatencyWriter that periodically flushes in a
goroutine. That goroutine was not being cleaned up at the end of the
request. This resulted in a panic when Flush() was being called on a
ResponseWriter that was closed.

The code was updated to always send the done message to the flushLoop()
goroutine after copying the body. Futhermore, the code was refactored to
allow the test to verify the maxLatencyWriter behavior.

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

13 years agoencoding/asn1: allow lengths up to the maximum int value.
Adam Langley [Wed, 18 Apr 2012 17:41:11 +0000 (13:41 -0400)]
encoding/asn1: allow lengths up to the maximum int value.

Previously we capped lengths at 2**24 rather than 2**31.

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

13 years agoexp/html: improve beforeHeadIM
Andrew Balholm [Wed, 18 Apr 2012 12:45:36 +0000 (22:45 +1000)]
exp/html: improve beforeHeadIM

Add a case to ignore doctype tokens.

Clean up the flow of control to more clearly match the spec.

Pass one more test.

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

13 years agoexp/html: adjust beforeHTMLIM to match spec
Andrew Balholm [Wed, 18 Apr 2012 03:26:35 +0000 (13:26 +1000)]
exp/html: adjust beforeHTMLIM to match spec

Add case for doctype tokens (which are ignored).

This CL does not change the status of any tests.

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

13 years agoos/user: simplify test
Brad Fitzpatrick [Wed, 18 Apr 2012 01:46:35 +0000 (18:46 -0700)]
os/user: simplify test

Don't require the home directory to exist. Just check
that it returns something.

Fixes #3531

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

13 years agolib9: fix warning under clang 3.1
Dave Cheney [Tue, 17 Apr 2012 23:57:00 +0000 (09:57 +1000)]
lib9: fix warning under clang 3.1

Fixes #3534.

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

13 years agocodereview: restore help messages
Anthony Martin [Tue, 17 Apr 2012 22:51:05 +0000 (15:51 -0700)]
codereview: restore help messages

Docstrings were not being set for the wrapper
functions returned by the hgcommand decorator.

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

13 years agoexp/html: more comprehensive tests
Andrew Balholm [Tue, 17 Apr 2012 07:17:22 +0000 (17:17 +1000)]
exp/html: more comprehensive tests

Currently, the html package only runs a limited subset of the tests
in the testdata directory. This tends to limit development of the
parser to fixing the bug that causes the first failing test.

This CL gives it the ability to run all the tests and produce a
log showing the status of each test. (It does it when tests are run with
'go test --update-logs') The status is listed as PASS, FAIL, or PARSE
(PARSE means that parsing produced the correct tree, but rendering and
re-parsing does not produce the same tree).

When 'go test' is run without --update-logs, it runs the tests marked
'PASS' in the logs (and the parsing portion of the tests marked 'PARSE').
Thus it will fail if there has been a regression since the last
time the logs were updated.

My goal for this CL is to allow develoment of the html package to
be less test-driven, while still having the advantages of regression
tests. In other words, one can work on any portion of the parser
and quickly see whether he is breaking things or improving them.

Current statistics of the tests:
$ grep ^PASS *.log|wc -l
        1017
$ grep ^PARSE *.log|wc -l
          46
$ grep ^FAIL *.log|wc -l
         181

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

13 years agoflag: update style.
David Symonds [Tue, 17 Apr 2012 06:37:35 +0000 (16:37 +1000)]
flag: update style.

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

13 years agocmd/prof: don't build on Plan 9 for now.
Anthony Martin [Tue, 17 Apr 2012 00:36:36 +0000 (17:36 -0700)]
cmd/prof: don't build on Plan 9 for now.

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

13 years agoos: avoid panic when testing errors on Plan 9
Anthony Martin [Tue, 17 Apr 2012 00:36:02 +0000 (17:36 -0700)]
os: avoid panic when testing errors on Plan 9

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

13 years agosyscall: fix duplicate fd bug for Plan 9
Akshat Kumar [Tue, 17 Apr 2012 00:35:15 +0000 (17:35 -0700)]
syscall: fix duplicate fd bug for Plan 9

This change comes from CL 5536043,
created by Andrey Mirtchovski. His
description follows:

"The plan9 exec child handler does not manage
dup-ed fds from the parent correctly: when a
dup-ed file descriptor appears in the child's fd
list it is closed when first encountered and then
subsequent attempt to dup it later in Pass 2 fails,
resulting in 'fork/exec: fd out of range or not
open'."

R=golang-dev, rminnich, ality
CC=golang-dev, mirtchovski, rsc
https://golang.org/cl/6009046

13 years agoCONTRIBUTORS: add Colby Ranger (Google CLA)
Brad Fitzpatrick [Mon, 16 Apr 2012 17:25:20 +0000 (10:25 -0700)]
CONTRIBUTORS: add Colby Ranger (Google CLA)

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

13 years agodoc/code: mention $GOBIN
Shenghou Ma [Mon, 16 Apr 2012 16:41:27 +0000 (02:41 +1000)]
doc/code: mention $GOBIN

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

13 years agoruntime: update defs for openbsd
Joel Sing [Mon, 16 Apr 2012 16:35:41 +0000 (02:35 +1000)]
runtime: update defs for openbsd

Update runtime defs for openbsd. Add struct __tfork, which will be
needed by an upcoming change.

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

13 years agotime: parse fractional second with single digit
Robert Hencke [Mon, 16 Apr 2012 01:56:37 +0000 (11:56 +1000)]
time: parse fractional second with single digit

Fixes #3487.

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

13 years agotext/template/parse: fix doc comment
Shenghou Ma [Sun, 15 Apr 2012 13:50:21 +0000 (21:50 +0800)]
text/template/parse: fix doc comment
    Fixes #3529.

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

13 years agostrconv: make malloc tests more reliable
Dave Cheney [Sat, 14 Apr 2012 11:34:08 +0000 (21:34 +1000)]
strconv: make malloc tests more reliable

Fixes #3495.

I adapted fmt.TestCountMallocs to fix the
existing tests. As the resulting tests did not
appear to belong to either itoa or ftoa I moved
them into their own file.

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

13 years agodoc: update Mercurial installation instructions
Andrew Gerrand [Sat, 14 Apr 2012 03:27:11 +0000 (13:27 +1000)]
doc: update Mercurial installation instructions

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

13 years agocmd/6g: restore magic multiply for /=, %=.
Rémy Oudompheng [Fri, 13 Apr 2012 08:12:31 +0000 (10:12 +0200)]
cmd/6g: restore magic multiply for /=, %=.

Also enables turning /= 2 in a right shift.

Part of issue 2230.

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

13 years agodoc/effective_go.html: fixed the Request channel parameter
Jongmin Kim [Fri, 13 Apr 2012 05:22:40 +0000 (15:22 +1000)]
doc/effective_go.html: fixed the Request channel parameter

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

13 years agotime: panic if UnixNano is out of range
Gustavo Niemeyer [Fri, 13 Apr 2012 01:16:31 +0000 (22:16 -0300)]
time: panic if UnixNano is out of range

R=golang-dev, remyoudompheng, dsymonds, gustavo, dchest, r, rsc
CC=golang-dev
https://golang.org/cl/5985059

13 years agofmt: fix crash of %b on huge negative int64
Rob Pike [Thu, 12 Apr 2012 23:28:37 +0000 (09:28 +1000)]
fmt: fix crash of %b on huge negative int64
The buffer had 64 bytes but needs one more for the sign.

Fixes #3510.

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

13 years agocrypto/tls: don't always use the default private key.
Adam Langley [Thu, 12 Apr 2012 16:35:21 +0000 (12:35 -0400)]
crypto/tls: don't always use the default private key.

When SNI based certificate selection is enabled, we previously used
the default private key even if we selected a non-default certificate.

Fixes #3367.

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

13 years agoencoding/pem: ignore spaces and tabs at the end of header lines.
Adam Langley [Thu, 12 Apr 2012 16:33:52 +0000 (12:33 -0400)]
encoding/pem: ignore spaces and tabs at the end of header lines.

Fixes #3502.

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

13 years agoruntime: speedup GC sweep phase (batch free)
Dmitriy Vyukov [Thu, 12 Apr 2012 08:01:24 +0000 (12:01 +0400)]
runtime: speedup GC sweep phase (batch free)

benchmark                             old ns/op    new ns/op    delta
garbage.BenchmarkParser              4370050250   3779668750  -13.51%
garbage.BenchmarkParser-2            3713087000   3628771500   -2.27%
garbage.BenchmarkParser-4            3519755250   3406349750   -3.22%
garbage.BenchmarkParser-8            3386627750   3319144000   -1.99%

garbage.BenchmarkTree                 493585529    408102411  -17.32%
garbage.BenchmarkTree-2               500487176    402285176  -19.62%
garbage.BenchmarkTree-4               473238882    361484058  -23.61%
garbage.BenchmarkTree-8               486977823    368334823  -24.36%

garbage.BenchmarkTree2                 31446600     31203200   -0.77%
garbage.BenchmarkTree2-2               21469000     21077900   -1.82%
garbage.BenchmarkTree2-4               11007600     10899100   -0.99%
garbage.BenchmarkTree2-8                7692400      7032600   -8.58%

garbage.BenchmarkParserPause          241863263    163249450  -32.50%
garbage.BenchmarkParserPause-2        120135418    112981575   -5.95%
garbage.BenchmarkParserPause-4         83411552     64580700  -22.58%
garbage.BenchmarkParserPause-8         51870697     42207244  -18.63%

garbage.BenchmarkTreePause             20940474     13147011  -37.22%
garbage.BenchmarkTreePause-2           20115124     11146715  -44.59%
garbage.BenchmarkTreePause-4           17217584      7486327  -56.52%
garbage.BenchmarkTreePause-8           18258845      7400871  -59.47%

garbage.BenchmarkTree2Pause           174067190    172674190   -0.80%
garbage.BenchmarkTree2Pause-2         131175809    130615761   -0.43%
garbage.BenchmarkTree2Pause-4          95406666     93972047   -1.50%
garbage.BenchmarkTree2Pause-8          86056095     85334952   -0.84%

garbage.BenchmarkParserLastPause      329932000    324790000   -1.56%
garbage.BenchmarkParserLastPause-2    209383000    210456000   +0.51%
garbage.BenchmarkParserLastPause-4    113981000    112921000   -0.93%
garbage.BenchmarkParserLastPause-8     77967000     76625000   -1.72%

garbage.BenchmarkTreeLastPause         29752000     18444000  -38.01%
garbage.BenchmarkTreeLastPause-2       24274000     14766000  -39.17%
garbage.BenchmarkTreeLastPause-4       19565000      8726000  -55.40%
garbage.BenchmarkTreeLastPause-8       21956000     10530000  -52.04%

garbage.BenchmarkTree2LastPause       314411000    311945000   -0.78%
garbage.BenchmarkTree2LastPause-2     214641000    210836000   -1.77%
garbage.BenchmarkTree2LastPause-4     110024000    108943000   -0.98%
garbage.BenchmarkTree2LastPause-8      76873000     70263000   -8.60%

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

13 years agoruntime: add lock-free stack
Dmitriy Vyukov [Thu, 12 Apr 2012 07:49:25 +0000 (11:49 +0400)]
runtime: add lock-free stack
This is factored out part of the:
https://golang.org/cl/5279048/
(parallel GC)

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

13 years agotext/template: catch unexported fields during parse
Rob Pike [Thu, 12 Apr 2012 05:57:09 +0000 (15:57 +1000)]
text/template: catch unexported fields during parse
It's a common error to reference unexported field names in templates,
especially for newcomers. This catches the error at parse time rather than
execute time so the rare few who check errors will notice right away.

These were always an error, so the net behavior is unchanged.
Should break no existing code, just identify the error earlier.

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

13 years agomisc/dashboard: cope with removed Package fields.
David Symonds [Wed, 11 Apr 2012 23:55:37 +0000 (09:55 +1000)]
misc/dashboard: cope with removed Package fields.

adg removed some now-unwanted fields in Package a while ago,
but there are still datastore entities with those fields,
so we must explicitly check for ErrFieldMismatch and ignore it.

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

13 years agohtml, exp/html: escape ' and " as &#39; and &#34;, since IE8 and
Nigel Tao [Wed, 11 Apr 2012 23:35:43 +0000 (09:35 +1000)]
html, exp/html: escape ' and " as &#39; and &#34;, since IE8 and
below do not support &apos;.

This makes package html consistent with package text/template's
HTMLEscape function.

Fixes #3489.

R=rsc, mikesamuel, dsymonds
CC=golang-dev
https://golang.org/cl/5992071

13 years agocrypto/rsa: fix Verify for multi-prime keys.
Adam Langley [Wed, 11 Apr 2012 16:57:38 +0000 (12:57 -0400)]
crypto/rsa: fix Verify for multi-prime keys.

The least common multiple is not totient/gcd.

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

13 years agocrypto/tls: update how we create testing scripts.
Adam Langley [Wed, 11 Apr 2012 16:55:57 +0000 (12:55 -0400)]
crypto/tls: update how we create testing scripts.

crypto/tls is tested, in part, by replaying recorded TLS connections
and checking that the bytes sent by the Go code haven't changed.

Previously we used GnuTLS's debug output and extracted the bytes of
the TLS connection using a Python script. That wasn't great, and I
think GnuTLS removed that level of debugging in a more current
release.

This change records the connection with Go code and adds a test for
ECDHE-AES clients generating using this method.

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

13 years agoexp/norm: exposed runeInfo type in API.
Marcel van Lohuizen [Wed, 11 Apr 2012 14:47:53 +0000 (16:47 +0200)]
exp/norm: exposed runeInfo type in API.
For completeness, we also expose the Canonical Combining Class of a rune.
This does not increase the data size.

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

13 years agoruntime: add interface microbenchmarks
Dave Cheney [Wed, 11 Apr 2012 12:45:44 +0000 (22:45 +1000)]
runtime: add interface microbenchmarks

2011 Mac Mini, Core i5 @ 2.3Ghz

BenchmarkConvT2E        50000000                40.4 ns/op
BenchmarkConvT2EBig     20000000               107 ns/op
BenchmarkConvT2I        100000000               28.9 ns/op
BenchmarkConvI2E        500000000                5.93 ns/op
BenchmarkConvI2I        100000000               19.0 ns/op
BenchmarkAssertE2T      100000000               14.1 ns/op
BenchmarkAssertE2TBig   100000000               17.8 ns/op
BenchmarkAssertE2I      100000000               21.3 ns/op
BenchmarkAssertI2T      100000000               14.3 ns/op
BenchmarkAssertI2I      100000000               20.8 ns/op
BenchmarkAssertI2E      500000000                5.58 ns/op

Pandaboard, 2 x Omap4 @ 1.2Ghz

BenchmarkConvT2E        10000000               215 ns/op
BenchmarkConvT2EBig      1000000              3697 ns/op
BenchmarkConvT2I         5000000               666 ns/op
BenchmarkConvI2E        50000000                42.4 ns/op
BenchmarkConvI2I         5000000               489 ns/op
BenchmarkAssertE2T      20000000                90.0 ns/op
BenchmarkAssertE2TBig   20000000                91.6 ns/op
BenchmarkAssertE2I       5000000               515 ns/op
BenchmarkAssertI2T      20000000               124 ns/op
BenchmarkAssertI2I       5000000               517 ns/op
BenchmarkAssertI2E      50000000                47.2 ns/op
BenchmarkAssertE2E      50000000                42.7 ns/op

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

13 years agoruntime: update openbsd thread related syscalls to match kernel
Joel Sing [Wed, 11 Apr 2012 12:02:08 +0000 (22:02 +1000)]
runtime: update openbsd thread related syscalls to match kernel

Update the threxit and thrsleep syscalls to match the ABI of the
OpenBSD 5.1 kernel. These changes are backwards compatible with
older kernels.

Fixes #3311.

R=golang-dev, rsc, devon.odell
CC=golang-dev
https://golang.org/cl/5777079

13 years agodoc: fix minor typo in Go 1 release notes
Dave Cheney [Wed, 11 Apr 2012 00:59:03 +0000 (10:59 +1000)]
doc: fix minor typo in Go 1 release notes

Fixes #3478.

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

13 years ago5l, runtime: remove softfloat emulation code when not used
Shenghou Ma [Tue, 10 Apr 2012 20:11:27 +0000 (04:11 +0800)]
5l, runtime: remove softfloat emulation code when not used
This leads to ~30kB improvement on code size for ARM machines with VFP/NEON.
Example: go test -c math
       GOARM=5  GOARM=6
  Old: 1884200  1839144
  New: 1884165  1805245
  -:        35    33899

R=rsc, bradfitz, dave, kai.backman
CC=golang-dev
https://golang.org/cl/5975060

13 years ago5a, 5l: add PLD (preload data) instruction
Shenghou Ma [Tue, 10 Apr 2012 20:09:04 +0000 (04:09 +0800)]
5a, 5l: add PLD (preload data) instruction
        Supported in ARMv5TE and above, excluding ARMv5TExP.
        For CL 5990066.

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

13 years agohash: more efficient memory allocation
Pascal S. de Kloe [Tue, 10 Apr 2012 19:15:39 +0000 (15:15 -0400)]
hash: more efficient memory allocation

Feed append the complete content at once.

BenchmarkAdler32KB       1000000              2534 ns/op         404.05 MB/s
BenchmarkCrc32KB          500000              4757 ns/op         215.26 MB/s
BenchmarkCrc64KB          500000              4769 ns/op         214.70 MB/s
BenchmarkFnv32KB         1000000              2417 ns/op         423.64 MB/s
BenchmarkFnv32aKB        1000000              2408 ns/op         425.23 MB/s
BenchmarkFnv64KB          500000              4262 ns/op         240.21 MB/s
BenchmarkFnv64aKB         500000              4234 ns/op         241.83 MB/s

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

13 years agoruntime: fix floating point exception on Plan 9
Akshat Kumar [Tue, 10 Apr 2012 19:14:10 +0000 (15:14 -0400)]
runtime: fix floating point exception on Plan 9

Change 5660047 moved an FLDCW instruction
that disables invalid operand traps into
runtime·asminit, which is called from
runtime·mstart. Thus, runtime·check is being
called prior to setting the appropriate control bits,
which on any QNaN comparison will cause Plan 9
to take an invalid operand trap. This change loads
the control bits (for Plan 9) prior to runtime·check.
Ideally, this should be done before the QNaN checks
on any system, but possibly other kernels simply
don't ever trap on invalid operands.

R=golang-dev, rminnich
CC=golang-dev, john, rsc
https://golang.org/cl/5939045

13 years agoA+C: Akshat Kumar (individual CLA)
Russ Cox [Tue, 10 Apr 2012 19:14:04 +0000 (15:14 -0400)]
A+C: Akshat Kumar (individual CLA)

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

13 years agoruntime: unregister the SIGILL handler after ARM EABI test
Quan Yong Zhai [Tue, 10 Apr 2012 19:05:22 +0000 (15:05 -0400)]
runtime: unregister the SIGILL handler after ARM EABI test
Part of issue 3381

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

13 years ago6c, 6g, 6l: add MOVQL to make truncation explicit
Russ Cox [Tue, 10 Apr 2012 16:51:59 +0000 (12:51 -0400)]
6c, 6g, 6l: add MOVQL to make truncation explicit

Without an explicit signal for a truncation, copy propagation
will sometimes propagate a 32-bit truncation and end up
overwriting uses of the original 64-bit value.

The case that arose in practice is in C but I believe
that the same could plausibly happen in Go.
The main reason we didn't run into the same in Go
is that I (perhaps incorrectly?) drop MOVL AX, AX
during gins, so the truncation was never generated, so
it didn't confuse the optimizer.

Fixes #1315.
Fixes #3488.

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

13 years agocmd/6c: fix probable code gen bug
Russ Cox [Tue, 10 Apr 2012 16:51:36 +0000 (12:51 -0400)]
cmd/6c: fix probable code gen bug

This is a pointer being copied; MOVL can't possibly be right.

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

13 years agocmd/8c: fix store to complex uint64 ptr
Russ Cox [Tue, 10 Apr 2012 14:45:58 +0000 (10:45 -0400)]
cmd/8c: fix store to complex uint64 ptr

Assignment of a computed uint64 value to an
address derived with a function call was executing
the call after computing the value, which trashed
the value (held in registers).

long long *f(void) { return 0; }
void g(int x, int y) {
        *f() = (long long)x | (long long)y<<32;
}

Before:

(x.c:3) TEXT g+0(SB),(gok(71))
...
(x.c:4) ORL AX,DX
(x.c:4) ORL CX,BX
(x.c:4) CALL ,f+0(SB)
(x.c:4) MOVL DX,(AX)
(x.c:4) MOVL BX,4(AX)

After:
(x.c:3) TEXT g+0(SB),(gok(71))
(x.c:4) CALL ,f+0(SB)
...
(x.c:4) ORL CX,BX
(x.c:4) ORL DX,BP
(x.c:4) MOVL BX,(AX)
(x.c:4) MOVL BP,4(AX)

Fixes #3501.

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

13 years agosyscall: support Getpid() on Windows
Shenghou Ma [Tue, 10 Apr 2012 14:34:31 +0000 (22:34 +0800)]
syscall: support Getpid() on Windows
        Fixes #3379.

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

13 years agocmd/api: allow addition of API
Shenghou Ma [Tue, 10 Apr 2012 14:12:09 +0000 (22:12 +0800)]
cmd/api: allow addition of API

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

13 years ago8a, 8l: add PREFETCH instructions
Russ Cox [Tue, 10 Apr 2012 14:09:27 +0000 (10:09 -0400)]
8a, 8l: add PREFETCH instructions

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

13 years ago6a, 6l: add PREFETCH instructions
Russ Cox [Tue, 10 Apr 2012 14:09:09 +0000 (10:09 -0400)]
6a, 6l: add PREFETCH instructions

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

13 years agoruntime: block signals during thread creation on openbsd
Joel Sing [Tue, 10 Apr 2012 11:57:05 +0000 (21:57 +1000)]
runtime: block signals during thread creation on openbsd

Block signals during thread creation, otherwise the new thread can
receive a signal prior to initialisation completing.

Fixes #3102.

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

13 years agotest/bench/shootout: update timing.log to Go 1
Rob Pike [Tue, 10 Apr 2012 06:46:06 +0000 (16:46 +1000)]
test/bench/shootout: update timing.log to Go 1

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

13 years agoos: fix IsPermission on windows
Alex Brainman [Tue, 10 Apr 2012 00:07:29 +0000 (10:07 +1000)]
os: fix IsPermission on windows

Fixes #3482.

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

13 years agoruntime.Callers: make documentation match code
Rob Pike [Mon, 9 Apr 2012 23:47:57 +0000 (09:47 +1000)]
runtime.Callers: make documentation match code
It is a bug that Caller and Callers disagree about the offset of the skip
parameter. Document the bug.

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

13 years agocmd/dist: don't fail when Mercurial is a batch file on Windows
Alexey Borzenkov [Mon, 9 Apr 2012 19:39:59 +0000 (15:39 -0400)]
cmd/dist: don't fail when Mercurial is a batch file on Windows

On windows Mercurial installed with easy_install typically creates
an hg.bat batch file in Python Scripts directory, which cannot be used
with CreateProcess unless full path is specified. Work around by
launching hg via cmd.exe /c.

Additionally, fix a rare FormatMessageW crash.

Fixes #3093.

R=golang-dev, rsc, alex.brainman, aram, jdpoirier, mattn.jp
CC=golang-dev
https://golang.org/cl/5937043

13 years agocmd/yacc: spring cleaning for units.y
Benny Siegert [Mon, 9 Apr 2012 19:04:59 +0000 (15:04 -0400)]
cmd/yacc: spring cleaning for units.y

* sort imports
* use runtime.GOROOT
* fix some typos

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

13 years agodebug/gosym: in test, use temp binary name in /tmp, and clean up.
Brad Fitzpatrick [Mon, 9 Apr 2012 18:19:52 +0000 (11:19 -0700)]
debug/gosym: in test, use temp binary name in /tmp, and clean up.

This fixes all.bash on shared machines.

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

13 years agodoc/code: update newmath.Sqrt test case to make sure test succeed
Shenghou Ma [Mon, 9 Apr 2012 17:55:51 +0000 (01:55 +0800)]
doc/code: update newmath.Sqrt test case to make sure test succeed
        Fixes #3445.

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

13 years agodoc/go_spec: fix a typo
Shenghou Ma [Mon, 9 Apr 2012 17:50:46 +0000 (01:50 +0800)]
doc/go_spec: fix a typo

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

13 years agobuild: run.bash no longer accepts --no-banner
Shenghou Ma [Mon, 9 Apr 2012 17:49:49 +0000 (01:49 +0800)]
build: run.bash no longer accepts --no-banner

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