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

6438 Commits

Author SHA1 Message Date
Rob Pike
3ba0f6daf5 fmt: honor integer radix formats (%d etc.) for pointers
Before, pointers always appeared as 0x1234ABCD. This CL
keeps that as the default for %p and %v, but lets explicit
numeric verbs override the default.
Fixes #3936.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/6441152
2012-08-17 16:12:25 -07:00
Rob Pike
deb53889c2 all: move defers to after error check to avoid nil indirection
Only affects some tests and none seem likely to be problematic, but let's fix them.
Fixes #3971.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/6463060
2012-08-17 11:55:11 -07:00
Joel Sing
1b6557a0cf runtime: fix netbsd/386 stack pointer handling
When manipulating the stack pointer use the UESP register instead
of the ESP register, since the UESP register is the one that gets
restored from the machine context. Fixes broken tests on netbsd/386.

R=golang-dev, minux.ma, r, bsiegert
CC=golang-dev
https://golang.org/cl/6465054
2012-08-17 21:53:02 +10:00
Andrew Balholm
d624f0c922 exp/html: simplify testing code
Now that the parser passes all tests in the test suite,
it is no longer necessary to keep track of which tests
pass and which don't. So remove the testlogs directory
and the code that uses it.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6453124
2012-08-16 09:31:22 +10:00
Robert Griesemer
ace14d01bd text/scanner: report illegal hexadecimal numbers (bug fix)
R=r
CC=golang-dev
https://golang.org/cl/6450136
2012-08-15 11:09:34 -07:00
Joel Sing
2ab18f69a6 os/exec: disable additional file descriptor test on netbsd
This currently fails on NetBSD due to the cloned file descriptors
that result from opening /dev/urandom. Disable the additional checking
until this is investigated and properly fixed.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/6443129
2012-08-16 02:06:21 +10:00
Joel Sing
b60d45f5b8 runtime: disable crash handler test on netbsd
Disable the crash handler test on NetBSD until I can figure out why
it triggers failures in later tests.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/6460090
2012-08-16 02:02:00 +10:00
Joel Sing
858bd05e2d net: implement netbsd sockoptip
Provide sockoptip for NetBSD, based on sockoptip for OpenBSD.

R=golang-dev, rsc, mikioh.mikioh, minux.ma
CC=golang-dev
https://golang.org/cl/6308053
2012-08-16 00:44:20 +10:00
Andrew Balholm
27cb1cbb2e exp/html: skip render and reparse on more tests that build badly-formed parse trees
All of the remaining tests that had as status of PARSE rather than PASS had
good reasons for not passing the render-and-reparse step: the correct parse tree is
badly formed, so when it is rendered out as HTML, the result doesn't parse into the
same tree. So add them to the list of tests where that step is skipped.

Also, I discovered that it is possible to end up with HTML elements (not just text)
inside a raw text element through reparenting. So change the rendering routines to
handle that situation as sensibly as possible (which still isn't very sensible, but
this is HTML5).

R=nigeltao
CC=golang-dev
https://golang.org/cl/6446137
2012-08-15 11:44:25 +10:00
Robert Griesemer
3df0545a8b go/scanner: faster scanning
Optimize some common cases.

benchmark            old ns/op    new ns/op    delta
BenchmarkScanFile       718907       667960   -7.09%

benchmark             old MB/s     new MB/s  speedup
BenchmarkScanFile        23.03        25.51    1.11x

R=r
CC=golang-dev
https://golang.org/cl/6454150
2012-08-14 11:26:30 -07:00
Adam Langley
7fa3b9f7ea exp/proxy: remove package.
This package has moved to go.net.

R=golang-dev, minux.ma, r, dave
CC=golang-dev
https://golang.org/cl/6461056
2012-08-14 13:04:14 -04:00
Andrew Balholm
3ba25e76a7 exp/html: generate replacement for <isindex> correctly
When generating replacement elements for an <isindex> tag, the old
addSyntheticElement method was producing the wrong nesting. Replace
it with parseImpliedToken.

Pass the one remaining test in the test suite.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6453114
2012-08-14 09:53:10 +10:00
Dmitriy Vyukov
6d5eb61ae7 net: remove unused fields
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/6454145
2012-08-14 01:57:24 +04:00
Dmitriy Vyukov
058149f153 runtime/pprof: fix comments
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/6460082
2012-08-14 01:51:42 +04:00
Andrew Balholm
aa9a81b1b0 exp/html: discard tags that are terminated by EOF instead of by '>'
If a tag doesn't have a closing '>', it isn't considered a tag;
it is just ignored and EOF is returned instead.

Pass one additional test in the test suite.

Change tokenizer tests to match correct behavior.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6454131
2012-08-13 12:07:44 +10:00
Robert Griesemer
a9d0ff6ead go/parser: exit early if source file does not contain text
Partial fix for issue 3943.

R=r
CC=golang-dev
https://golang.org/cl/6458115
2012-08-11 21:06:40 -07:00
Rob Pike
2253f67157 text/template/parse: fix bug handling /*/
Incorrect syntax for comment was erroneously accepted.
Fixes #3919.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6453105
2012-08-09 19:24:46 -07:00
Shenghou Ma
4f308edc86 runtime: use sched_getaffinity for runtime.NumCPU() on Linux
Fixes #3921.

R=iant
CC=golang-dev
https://golang.org/cl/6448132
2012-08-10 10:05:26 +08:00
Andrew Balholm
c5038c8593 exp/html: ignore self-closing flag except in SVG and MathML
In HTML content, having a self-closing tag is a parse error unless
the tag would be self-closing anyway (like <img>). The only place a
self-closing tag actually makes a difference is in XML-based foreign
content.

Pass 1 additional test.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6450109
2012-08-10 09:34:10 +10:00
Rémy Oudompheng
f087764abc go/build: correct shouldBuild bug reading whole contents of file.
It was caused by bytes.TrimSpace being able to return a nil
slice.

Fixes #3914.

R=golang-dev, r
CC=golang-dev, remy
https://golang.org/cl/6458091
2012-08-09 23:22:51 +02:00
Robert Griesemer
0f2529317f exp/types: add more import tests
Also simplified parsing of interface
types since they can only contain
methods (and no embedded interfaces)
in the export data.

R=rsc
CC=golang-dev
https://golang.org/cl/6446084
2012-08-09 11:55:00 -07:00
Shenghou Ma
20bf1a94e1 testing: add Verbose() to expose whether -test.v is set
Fixes #3350.

R=golang-dev, adg, r, fullung
CC=golang-dev
https://golang.org/cl/6445092
2012-08-09 23:41:09 +08:00
Rob Pike
18c378c259 text/template: add 'nil' as a keyword in the language
The keyword reprents an untyped nil and is useful for
passing nil values to methods and functions. The
nil will be promoted to the appropriate type when
used; if a type cannot be assigned, an error results.

R=rsc, dsymonds
CC=golang-dev
https://golang.org/cl/6459056
2012-08-08 20:02:19 -07:00
Andrew Balholm
22e918f5d6 exp/html: ignore </html> in afterBodyIM when parsing a fragment
Pass 1 additional test.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6454124
2012-08-09 10:19:25 +10:00
Andrew Balholm
e4a50195c3 exp/html: when ignoring <textarea> tag, switch tokenizer out of raw text mode
Pass 1 additional test.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6459060
2012-08-09 09:43:10 +10:00
Charles L. Dorian
a5c4e0fa2a math: update definition of NaN in assembly language files
R=rsc, minux.ma, golang-dev, nigeltao
CC=golang-dev
https://golang.org/cl/6461047
2012-08-09 09:40:05 +10:00
Rob Pike
c48b77b1b5 all: make Unicode surrogate halves illegal as UTF-8
Surrogate halves are part of UTF-16 and should never appear in UTF-8.
(The rune that two combined halves represent in UTF-16 should
be encoded directly.)

Encoding: encode as RuneError.
Decoding: convert to RuneError, consume one byte.

This requires changing:
        package unicode/utf8
        runtime for range over string
Also added utf8.ValidRune and fixed bug in utf.RuneLen.

Fixes #3927.

R=golang-dev, rsc, bsiegert
CC=golang-dev
https://golang.org/cl/6458099
2012-08-08 14:01:23 -07:00
Andrew Gerrand
4939b7b065 io: amend ReaderFrom doc as per r's comment
R=r
CC=golang-dev
https://golang.org/cl/6458097
2012-08-08 15:41:47 +10:00
Yves Junqueira
4230dd4c6c crypto/rand: Example for Read.
R=adg, remyoudompheng, rsc, r
CC=golang-dev
https://golang.org/cl/6457085
2012-08-08 12:04:54 +10:00
Andrew Balholm
fca45719a4 exp/html: foster-parent text correctly
If a table contained whitespace, text nodes would not get foster parented
correctly.

Pass 1 additional test.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6459054
2012-08-08 10:00:57 +10:00
Nigel Tao
5f7bec693d image/jpeg: send a correct Start Of Scan (SOS) header.
Section B.2.3 of http://www.w3.org/Graphics/JPEG/itu-t81.pdf discusses
the End of spectral selection (Se) byte.

Apparently many JPEG decoders ignore the Se byte (or let it through
with a warning), but some configurations reject them. For example,
http://download.blender.org/source/chest/blender_2.03_tree/jpeg/jcmaster.c
has these lines:

if (Ss != 0 || Se != DCTSIZE2-1 || Ah != 0 || Al != 0)
  ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);

Fixes #3916.

R=r
CC=golang-dev
https://golang.org/cl/6459052
2012-08-08 09:57:09 +10:00
Shenghou Ma
0157c72d13 runtime: inline several float64 routines to speed up complex128 division
Depends on CL 6197045.

Result obtained on Core i7 620M, Darwin/amd64:
benchmark                       old ns/op    new ns/op    delta
BenchmarkComplex128DivNormal           57           28  -50.78%
BenchmarkComplex128DivNisNaN           49           15  -68.90%
BenchmarkComplex128DivDisNaN           49           15  -67.88%
BenchmarkComplex128DivNisInf           40           12  -68.50%
BenchmarkComplex128DivDisInf           33           13  -61.06%

Result obtained on Core i7 620M, Darwin/386:
benchmark                       old ns/op    new ns/op    delta
BenchmarkComplex128DivNormal           89           50  -44.05%
BenchmarkComplex128DivNisNaN          307          802  +161.24%
BenchmarkComplex128DivDisNaN          309          788  +155.02%
BenchmarkComplex128DivNisInf          278          237  -14.75%
BenchmarkComplex128DivDisInf           46           22  -52.46%

Result obtained on 700MHz OMAP4460, Linux/ARM:
benchmark                       old ns/op    new ns/op    delta
BenchmarkComplex128DivNormal         1557          465  -70.13%
BenchmarkComplex128DivNisNaN         1443          220  -84.75%
BenchmarkComplex128DivDisNaN         1481          218  -85.28%
BenchmarkComplex128DivNisInf          952          216  -77.31%
BenchmarkComplex128DivDisInf          861          231  -73.17%

The 386 version has a performance regression, but as we have
decided to use SSE2 instead of x87 FPU for 386 too (issue 3912),
I won't address this issue.

R=dsymonds, mchaten, iant, dave, mtj, rsc, r
CC=golang-dev
https://golang.org/cl/6024045
2012-08-07 23:45:50 +08:00
Brad Fitzpatrick
c8423f9002 io: document ReaderFrom and WriterTo
Fixes #3711

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6445083
2012-08-07 16:10:10 +10:00
Yves Junqueira
b3caa2ba3c text/template: fix range example.
R=r
CC=adg, gobot, golang-dev
https://golang.org/cl/6449096
2012-08-06 20:40:43 -07:00
Andrew Balholm
5530a426ef exp/html: correctly handle <title> after </head>
The <title> element was getting removed from the stack of open elements,
when its parent, the <head> element should have been removed instead.

Pass 2 additional tests.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6449101
2012-08-07 13:36:08 +10:00
Alex Brainman
0bfa31e961 net/http: disable TestServeFileFromCWD test on windows
This is an attempt to fix windows build. Will restore
once we know what the problem is.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6461046
2012-08-07 13:19:49 +10:00
Shenghou Ma
6e9506a7b4 math, runtime: use a NaN that matches gcc's
our old choice is not working properly at least on VFPv2 in
ARM1136JF-S (it's not preserved across float64->float32 conversions).

        Fixes #3745.

R=dave, rsc
CC=golang-dev
https://golang.org/cl/6344078
2012-08-07 09:57:14 +08:00
Shenghou Ma
41645847b4 runtime: remove unnecessary ROUND in alg.c
Introduced in CL 6452046.

R=golang-dev, nigeltao, dave
CC=golang-dev
https://golang.org/cl/6459051
2012-08-07 09:49:56 +08:00
Andrew Balholm
2276ab92c1 exp/html: fix foster-parenting when elements are implicitly closed
When an element (like <nobr> or <p>) was implicitly closed by another
start tag, it would keep foster parenting from working because
the check for what was on top of the stack of open elements was
in the wrong place.

Move the check to addChild.

Pass 2 additional tests.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6460045
2012-08-07 09:35:09 +10:00
Russ Cox
e1cf7d6fb6 net: fix spurious EADDRNOTAVAIL errors
R=golang-dev, fullung
CC=golang-dev
https://golang.org/cl/6443085
2012-08-06 16:32:00 -04:00
Alexey Borzenkov
8b5d4c3c03 syscall: fix plan9 build broken by CL 6458050
R=golang-dev, rsc
CC=golang-dev, r, yarikos
https://golang.org/cl/6454104
2012-08-06 16:24:08 -04:00
Brad Fitzpatrick
2d2866ee84 net: fix TCPListener file leak to child processes
Hold ForkLock during dup of fd + cloexec in the net pkg,
per the locking policy documented in syscall/exec_unix.go.

R=golang-dev, dsymonds, adg
CC=golang-dev
https://golang.org/cl/6457080
2012-08-06 14:12:23 +10:00
Alexey Borzenkov
a108369c83 syscall: return EINVAL when string arguments have NUL characters
Since NUL usually terminates strings in underlying syscalls, allowing
it when converting string arguments is a security risk, especially
when dealing with filenames. For example, a program might reason that
filename like "/root/..\x00/" is a subdirectory or "/root/" and allow
access to it, while underlying syscall will treat "\x00" as an end of
that string and the actual filename will be "/root/..", which might
be unexpected. Returning EINVAL when string arguments have NUL in
them makes sure this attack vector is unusable.

R=golang-dev, r, bradfitz, fullung, rsc, minux.ma
CC=golang-dev
https://golang.org/cl/6458050
2012-08-05 17:24:32 -04:00
Benny Siegert
8efb70f92e syscall: add some new syscall numbers from NetBSD-current
R=golang-dev
CC=golang-dev
https://golang.org/cl/6454100
2012-08-05 17:02:41 -04:00
Rémy Oudompheng
77f3e189d2 runtime: faster string equality.
benchmark                                old ns/op    new ns/op    delta
BenchmarkCompareStringEqual                     51           35  -30.20%
BenchmarkCompareStringIdentical                 51            7  -85.71%
BenchmarkCompareStringSameLength                25           18  -28.29%
BenchmarkCompareStringDifferentLength            2            2   +1.46%

R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/6450092
2012-08-05 21:35:41 +02:00
Russ Cox
ea392b8849 bufio: discourage use of ReadLine
Too many people use it without reading what it does.
Those people want ReadBytes or ReadString.

Fixes #3906.

R=golang-dev, iant, r
CC=golang-dev
https://golang.org/cl/6442087
2012-08-05 14:32:09 -04:00
Rémy Oudompheng
ff03482fd6 strconv: speedup AppendFloat/FormatFloat.
The improvement is obtained by eliminating the zero
initialization of a large structure that is only
needed when the fast path fails.

Also add a missing roundtrip test for float32s.

benchmark                              old ns/op    new ns/op    delta
BenchmarkAppendFloatDecimal                  301          180  -40.20%
BenchmarkAppendFloat                         486          388  -20.16%
BenchmarkAppendFloatExp                      492          383  -22.15%
BenchmarkAppendFloatNegExp                   478          370  -22.59%
BenchmarkAppendFloatBig                      650          541  -16.77%
BenchmarkAppendFloat32Integer                308          180  -41.56%
BenchmarkAppendFloat32ExactFraction          449          333  -25.84%
BenchmarkAppendFloat32Point                  494          390  -21.05%
BenchmarkAppendFloat32Exp                    488          387  -20.70%
BenchmarkAppendFloat32NegExp                 488          378  -22.54%

R=r, rsc
CC=golang-dev, remy
https://golang.org/cl/6346081
2012-08-05 20:30:13 +02:00
Andrew Balholm
74db9d298b exp/html: don't treat SVG <title> like HTML <title>
The content of an HTML <title> element is RCDATA, but the content of an SVG
<title> element is parsed as tags. Now the parser doesn't go into RCDATA
mode in foreign content.

Pass 4 additional tests.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6448111
2012-08-05 22:32:35 +10:00
Ian Lance Taylor
6fa38e5e0a cmd/go, go/build, misc/swig: add SWIG support to Go tool
R=adg, rsc, franciscossouza, seb.binet, gen.battle
CC=golang-dev
https://golang.org/cl/5845071
2012-08-03 18:08:43 -07:00
Michał Derkacz
dee5adcf74 5a, 5l, math: Add support for ABSD, ABSF floating point instructions.
R=golang-dev, dave, rsc, minux.ma
CC=golang-dev
https://golang.org/cl/6225051
2012-08-03 16:15:11 -04:00
Adam Langley
728f191319 crypto/elliptic: explicitly handle P+P, ∞+P and P+∞
These aren't needed for scalar multiplication, but since we export a
generic Add function we should handle it.

This change also corrects two bugs in p224Contract that it turned up.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6458076
2012-08-03 15:42:14 -04:00
Mike Rosset
cf06750372 debug/elf: Add support for getting DynTag string table values.
R=rsc
CC=golang-dev
https://golang.org/cl/6430064
2012-08-03 14:46:20 -04:00
Robert Griesemer
f3a45d4695 go/build: tiny cleanup
R=rsc
CC=golang-dev
https://golang.org/cl/6453083
2012-08-03 10:45:02 -07:00
Adam Langley
e107742080 crypto/tls: remove flakey tests
This removes some (non-short only) tests that involved connections to
the outside world and thus were flakey. This does remove some test
coverage of the root fetchers on non-Windows platforms, but the right
place for that is crypto/x509.

R=golang-dev, krautz, rsc
CC=golang-dev
https://golang.org/cl/6455085
2012-08-03 13:28:05 -04:00
Adam Langley
bbb5f1bffb crypto/x509: support ECDSA keys when generating certificates.
We already support reading ECDSA certificates and this change adds
write support.

R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/6422046
2012-08-03 10:37:30 -04:00
Marcel van Lohuizen
89d40b911c exp/locale/collate: changed API of Builder to be more convenient
for dealing with CLDR files:
- Add now taxes a list of indexes of colelems that are variables. Checking and
  handling is now done by the Builder.  VariableTop is now also properly generated
  using the Build method.
- Introduced separate Builder, called Tailoring, for creating tailorings of root
  table.  This clearly separates the functionality for building a table based on
  weights (the allkeys* files) versus tables based on LDML XML files.
- Tailorings are now added by two calls instead of one: SetAnchor and Insert.
  This more closely reflects the structure of LDML side and simplifies the
  implementation of both the client and library side.  It also preserves
  some information that is otherwise hard to recover for the Builder.
- Allow the LDML XML element extend to be passed to Insert.  This simplifies
  both client and library implementation.

R=r
CC=golang-dev
https://golang.org/cl/6454061
2012-08-03 09:01:21 +02:00
Alex Brainman
b9b29ce2ba os: test that IsExist and IsNotExist handle PathError and LinkError
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6442080
2012-08-03 14:25:35 +10:00
Robert Griesemer
c12a63f7d3 go/scanner: fix minor typo
R=r
CC=golang-dev
https://golang.org/cl/6442076
2012-08-02 17:10:41 -07:00
Robert Griesemer
593c51cff1 go/ast: ast.Print must not crash with unexported fields
Don't print unexported struct fields; their values are
not accessible via reflection.

Fixes #3898.

Also:
- added support for arrays
- print empty maps, arrays, slices, structs on one line
  for a denser output
- added respective test cases

R=r
CC=golang-dev
https://golang.org/cl/6454089
2012-08-02 17:05:51 -07:00
Andrew Balholm
2f39a33b6a exp/html: in parse tests, discard only one trailing newline
Pass 2 additional tests.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6454090
2012-08-03 09:31:45 +10:00
Nigel Tao
1916db786f html: make the low-level tokenizer also skip end-tag attributes.
R=andybalholm
CC=golang-dev
https://golang.org/cl/6453071
2012-08-03 09:29:16 +10:00
Rémy Oudompheng
37d7500f8d exp/types: set non-embedded method type during GcImport.
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/6445068
2012-08-02 16:24:09 -07:00
Robert Griesemer
a4ac339f43 exp/types: enable cycle checks again
Process a package's object in a reproducible
order (rather then in map order) so that we
get error messages in reproducible order.

R=r
CC=golang-dev
https://golang.org/cl/6449076
2012-08-01 16:37:06 -07:00
Andrew Balholm
dbbfbcc4a1 exp/html: implement escaping and double-escaping in scripts
The text inside <script> tags is not ordinary raw text; there are all sorts
of other complications. This CL implements those complications.

Pass 76 additional tests.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6443070
2012-08-01 14:45:35 +10:00
Shenghou Ma
e07958f7df runtime: round return value address in runtime.equal
Fixes #3866.

R=rsc, r, nigeltao
CC=golang-dev
https://golang.org/cl/6452046
2012-07-31 23:02:46 -04:00
Alex Brainman
f2b8f6b451 os: Rename error to fit IsExist
Fixes #3828.

R=golang-dev, iant, rsc
CC=golang-dev
https://golang.org/cl/6420056
2012-08-01 12:55:04 +10:00
Robert Griesemer
152279f203 exp/types: Replace String method with TypeString function
This is more in sync with the rest of the package;
for instance, we have functions (not methods) to
deref or find the underlying type of a Type.

In the process use a single bytes.Buffer to create
the string representation for a type rather than
the (occasional) string concatenation.

R=r
CC=golang-dev
https://golang.org/cl/6458057
2012-07-31 19:30:18 -07:00
Robert Griesemer
dcb6f59811 exp/types: implement Type.String methods for testing/debugging
Also:
- replaced existing test with a more comprehensive test
- fixed bug in map type creation

R=r
CC=golang-dev
https://golang.org/cl/6450072
2012-07-31 17:09:12 -07:00
Andrew Balholm
9f3b00579e exp/html: tokenize attributes of end tags
If an end tag has an attribute that is a quoted string containing '>',
the tokenizer would end the tag prematurely. Now it reads the attributes
on end tags just as it does on start tags, but the high-level interface
still doesn't return them, because their presence is a parse error.

Pass 1 additional test.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6457060
2012-08-01 09:35:02 +10:00
Nigel Tao
695024b8fa image/png: tRNS chunk is *non*-alpha-premultiplied.
R=r
CC=golang-dev
https://golang.org/cl/6446062
2012-08-01 09:20:44 +10:00
Mikio Hara
4e7f765b12 net: disable IPv6 multicast tests unless external IPv6 connection is present
R=rsc
CC=golang-dev
https://golang.org/cl/6398052
2012-07-31 20:58:35 +09:00
Bobby Powers
7520f0b4aa httputil: accumulate X-Forwarded-For header info
If the X-Forwarded-For header already exists on a request, we
should append our client's IP to it after a comma+space instead
of overwriting it.

Fixes #3846.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6448053
2012-07-31 08:38:49 +10:00
Rob Pike
ad058cacfb text/template/parse/lex.go: fix typo
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6448081
2012-07-30 15:23:36 -07:00
Han-Wen Nienhuys
36fe436cba pkg/syscall: unexport Prlimit.
This syscall was inadvertently exported when fixing
Getrlimit/Setrlimit on 32-bit platforms.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/6458051
2012-07-31 08:21:24 +10:00
Rob Pike
20d9fd3ae1 text/template/parse: fix data race
The situation only affects diagnostics but is easy to fix.
When computing lineNumber, use the position of the last item
returned by nextItem rather than the current state of the lexer.
This is internal only and does not affect the API.

Fixes #3886.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/6445061
2012-07-30 15:11:20 -07:00
Rob Pike
4783ad82da regexp: fix glitch in doc for FindReaderIndex
Fixes #3878.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6457054
2012-07-30 12:46:50 -07:00
Brad Fitzpatrick
538b2122f1 net/http: don't allow zero byte in FileServer paths
Should probably be fixed in the syscall package, either
additional or instead of this CL.

Fixes #3842

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6442061
2012-07-30 13:57:30 +10:00
Brad Fitzpatrick
f8c6514a1c net/http: don't modify Request Method's case
This fixes a data race (usually just harmlessly updating
"GET" to "GET"), but also follows RFC 2616 Sec 5.1.1 which
says that the request method is case-sensitive.

Fixes #3881

R=golang-dev, rsc, dsymonds
CC=golang-dev
https://golang.org/cl/6446063
2012-07-30 10:05:24 +10:00
Russ Cox
7aa60d998a syscall: apply comment from Mikioh
This comment was suggested in CL 6456045
but never got applied.

R=mikioh, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/6447056
2012-07-29 19:50:23 -04:00
Alexey Borzenkov
5197fa8040 syscall: workaround accept() bug on Darwin
Darwin kernels have a bug in accept() where error result from
an internal call is not checked and socket is accepted instead
of ECONNABORTED error. However, such sockets have no sockaddr,
which results in EAFNOSUPPORT error from anyToSockaddr, making
Go http servers running on Mac OS X easily susceptible to
denial of service from simple port scans with nmap.
Fixes #3849.

R=golang-dev, adg, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/6456045
2012-07-30 09:02:24 +10:00
Benny Siegert
b4402a49b6 runtime/cgo: fix netbsd build
Copy over freebsd.c to netbsd.c.

Fixes #3823.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6398045
2012-07-29 18:51:06 -04:00
Han-Wen Nienhuys
4dc85d67cd syscall: don't clobber source files if mksyscall.pl fails.
R=golang-dev, minux.ma, r, rsc
CC=golang-dev
https://golang.org/cl/6353069
2012-07-29 17:59:14 -04:00
Andrew Balholm
eff32f573b exp/html: replace NUL with U+FFFD in text in foreign content
Pass 5 additional tests.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6452055
2012-07-29 16:29:49 +10:00
Marcel van Lohuizen
601045e87a exp/locale/collate: changed trie in first step towards support for multiple locales.
- Allow handles into the trie for different locales.  Multiple tables share the same
  try to allow for reuse of blocks.
- Significantly improved memory footprint and reduced allocations of trieNodes.
  This speeds up generation by about 30% and allows keeping trieNodes around
  for multiple locales during generation.
- Renamed print method to fprint.

R=r
CC=golang-dev
https://golang.org/cl/6408052
2012-07-28 18:44:14 +02:00
Rob Pike
48ca3f288c flag: fix bug in handling of booleans on error
Fixes #3869.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6448072
2012-07-27 16:13:29 -07:00
Shenghou Ma
88e858ac80 log/syslog: don't append \n if there is one
pkg log already appends a linefeed to the log message,
so log/syslog doesn't need to append another.

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/6441048
2012-07-27 14:22:27 -04:00
Alex Brainman
9c8ae6ca34 os: move epipecheck from file_posix.go and into file_unix.go to fix windows build
R=golang-dev
CC=golang-dev
https://golang.org/cl/6450058
2012-07-27 22:21:33 +10:00
Dmitriy Vyukov
ab9ccedefe os: fix data race in epipecheck()
Fixes #3860.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6443051
2012-07-27 15:05:13 +04:00
Andrew Balholm
a1f340fa1a exp/html: parse CDATA sections in foreign content
Also convert NUL to U+FFFD in comments.

Pass 23 additional tests.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6446055
2012-07-27 16:05:25 +10:00
Ian Lance Taylor
b9e051e82d runtime: ignore signal 33 == SIGSETXID on GNU/Linux
When a cgo program calls setuid, setgid, etc., the GNU/Linux
pthread library sends signal SIGSETXID to each thread to tell
it to update its UID info.  If Go is permitted to intercept
the default SIGSETXID signal handler, the program will hang.

This patch tells the runtime package to not try to intercept
SIGSETXID on GNU/Linux.  This will be odd if a Go program
wants to try to use that signal, but it means that cgo
programs that call setuid, etc., won't hang.

Fixes #3871.

R=rsc, r, minux.ma, bradfitz
CC=golang-dev
https://golang.org/cl/6455050
2012-07-26 22:46:20 -07:00
Robert Griesemer
a7c74d52dc go/printer: don't crash if ast.FuncType.Params is nil
The go/ast comment for FuncType.Params says that the field may be nil.
Make sure the printer accepts such a value. The go/parser always sets
the field (to provide parenthesis position information), but a program
creating a Go AST from scatch may not.

Added corresponding test case.

Fixes #3870.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6448060
2012-07-26 17:09:11 -07:00
Andrew Balholm
55f0c8b2cd exp/html: replace NUL bytes in plaintext, raw text, and RCDATA
If NUL bytes occur inside certain elements, convert them to U+FFFD
replacement character.

Pass 1 additional test.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6452047
2012-07-27 09:27:10 +10:00
Andrew Wilkins
d399b681a4 exp/types: process ast.Fun in checkObj; fix variadic function building
Fixed creation of Func's, taking IsVariadic from parameter list rather
than results.

Updated checkObj to process ast.Fun objects.

R=gri
CC=golang-dev
https://golang.org/cl/6402046
2012-07-26 11:47:46 -07:00
Andrew Balholm
899be50991 exp/html: don't insert empty text nodes
Pass 1 additional test.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6443048
2012-07-26 10:32:24 +10:00
Brad Fitzpatrick
9b1412701f testing: allow concurrent use of T and B
Notably, allow concurrent logging and failing.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6453045
2012-07-25 10:17:27 -07:00
Andrew Balholm
4d22519678 exp/html: allow frameset if body contains whitespace
If the body of an HTML document contains text, the <frameset> tag is
ignored. But not if the text is only whitespace.

Pass 4 additional tests.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6442043
2012-07-25 12:09:58 +10:00
David Symonds
3e980e24c1 encoding/gob: test for type registration name.
R=r
CC=golang-dev
https://golang.org/cl/6435044
2012-07-25 09:31:27 +10:00
Mikio Hara
c1f2ec384f net: fix comment
RemoteAddr returns not only UDPAddr but IPAddr.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/6401054
2012-07-24 21:57:18 +09:00
Rob Pike
ce274339a1 text/template: fix bug in map indexing
If the key is not present, return value of the type of the element
not the type of the key. Also fix a test that should have caught this case.

Fixes #3850.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6405078
2012-07-23 16:19:12 -07:00
Rob Pike
7b73251d3d encoding/gob: revert 6348067, which broke compatibility
Add commentary to explain better what's going on, but the
code change is a simple one-line reversal to the previous
form.

R=rsc
CC=golang-dev
https://golang.org/cl/6428072
2012-07-23 13:34:46 -07:00
Andrew Balholm
f979528ce6 exp/html: special handling for entities in attributes
Don't unescape entities in attributes when they don't end with
a semicolon and they are followed by '=', a letter, or a digit.

Pass 6 more tests from the WebKit test suite, plus one that was
commented out in token_test.go.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6405073
2012-07-23 12:39:58 +10:00
Patrick Mylund Nielsen
614cb3b8dd encoding/binary: fix typo: ReadVarint returns an int64, not a uint64.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6432062
2012-07-22 10:26:32 +10:00
Mikio Hara
3a112a8112 net: remove unnecessary newline in testing.Logf from tests
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6434043
2012-07-22 01:49:58 +09:00
Mikio Hara
d380a97750 net: fix file descriptor leak on FileListener, FileConn and FilePacketConn
R=golang-dev, dave, r
CC=golang-dev
https://golang.org/cl/6430062
2012-07-22 01:48:15 +09:00
Gustavo Niemeyer
c0efcac6a9 bytes: make Join return a new buffer on len(a) == 1
Fixes #3844.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6432054
2012-07-20 16:04:22 -03:00
Mikio Hara
7bf8355dc7 net: fix typo
R=golang-dev, bsiegert, r
CC=golang-dev
https://golang.org/cl/6428050
2012-07-20 08:32:25 +09:00
Rob Pike
fc360f2381 unicode/utf8: reject out-of-range runes.
Surrogates are still admitted, but I have sent mail to golang-dev on that topic.

Fixes #3785.

R=golang-dev, rogpeppe, iant
CC=golang-dev
https://golang.org/cl/6398049
2012-07-19 11:58:14 -07:00
Rob Pike
55ff3f7076 sync: mention that WaitGroup.Add panics
Fixes #3839.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6428053
2012-07-19 11:55:03 -07:00
Brad Fitzpatrick
dfd7f18130 net/http: revert back to (and test) Go 1 CheckRedirect behavior
If a Client's CheckRedirect function returns an error, we
again return both a non-nil *Response and a non-nil error.

Fixes #3795

R=golang-dev, n13m3y3r
CC=golang-dev
https://golang.org/cl/6429044
2012-07-18 13:48:39 -07:00
Rémy Oudompheng
dd78f745c4 testing: fix memory blowup when formatting many lines.
Fixes #3830.

R=golang-dev, r
CC=golang-dev, remy
https://golang.org/cl/6373047
2012-07-17 07:56:25 +02:00
Nigel Tao
da4eef402d compress/flate: fix panic when nlit is out of bounds.
Fixes #3815.

R=r
CC=golang-dev
https://golang.org/cl/6352109
2012-07-16 12:01:18 +10:00
Benny Siegert
e726197858 os: add missing full stop in comment
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6399047
2012-07-15 09:48:31 -07:00
Rob Pike
bbe601789c encoding/gob: disable fuzz tests unless command-line flag is set
They can generate huge amounts of memory, causing failure on
small machines. Also they can be very slow. So slow that one test
was commented out! We uncomment it and use a flag.

Fixes #3742.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6373044
2012-07-13 14:23:51 -07:00
Marcel van Lohuizen
882b6ef454 exp/locale/collate: This CL includes the following changes:
- Changed the representation of colElem to support a few cases
  for some languages not supported by the current format.
- Changed offsets for implicit primary values. This makes the
  values both easier to read and debug (last 4 nibbles are identical to
  implicit primary value) and also results in better packing.
- Fixed bug in weight conversion code that did not pop up yet by
  sheer luck.
Note that tables.go also includes changes to the contraction trie
from CL 6346092.

R=r, mpvl
CC=golang-dev
https://golang.org/cl/6392060
2012-07-13 11:38:22 +02:00
Marcel van Lohuizen
adc19ac5e3 exp/locale/collate: adjusted contraction trie to support Myanmar (Burmese),
which has a rather large contraction table. The value of the next state
offset now starts after the current block, instead of before.  This is
slightly less efficient (on extra addition per state change), but gives
some extra range for the offsets.
Also introduced constants for final (0) and noIndex (0xFF).
tables.go is updated in a separate CL.

R=r
CC=golang-dev
https://golang.org/cl/6346092
2012-07-13 11:38:00 +02:00
Rob Pike
37519d950d encoding/gob: reduce decoder memory
Gob decoding reads a whole message into memory and then
copies it into a bytes.Buffer. For large messages this wastes
an entire copy of the message. In this CL, we use a staging
buffer to avoid the large temporary.

Update #2539
RSS drops to 775MB from 1GB.
Active memory drops to 858317048 from 1027878136,
essentially the size of one copy of the input file.

R=dsymonds, nigeltao
CC=golang-dev
https://golang.org/cl/6392057
2012-07-12 20:53:17 -07:00
Rob Pike
1255a6302d bytes.Buffer: export the Grow method
Allows a client to pre-allocate buffer space that is known to be necessary,
avoiding expensive reallocations.

R=gri, gri, adg
CC=golang-dev
https://golang.org/cl/6392061
2012-07-12 20:52:19 -07:00
Robert Griesemer
6a135a0894 mat/big: more optimal Karatsuba threshold
benchmark           old ns/op    new ns/op    delta
BenchmarkHilbert      6253043      6267289   +0.23%
BenchmarkMul         45355940     39490633  -12.93%

R=r
CC=golang-dev
https://golang.org/cl/6355104
2012-07-12 14:19:09 -07:00
Robert Griesemer
98ca655919 math/big: minor performance tuning
Reuse temporary slice to avoid extra allocations
(originally done correctly by remyoudompheng@gmail.com
in https://golang.org/cl/6345075/).

benchmark           old ns/op    new ns/op    delta
BenchmarkHilbert      6252790      6262304   +0.15%
BenchmarkMul         45827438     45301002   -1.15%

R=r
CC=golang-dev
https://golang.org/cl/6346097
2012-07-12 14:12:50 -07:00
Rob Pike
1fa32d21a9 encoding/gob: fix check for short input in slice decode
R=golang-dev, dsymonds, r, nigeltao
CC=golang-dev
https://golang.org/cl/6374059
2012-07-12 10:23:54 -07:00
Rémy Oudompheng
ac12131649 math/big: correct quadratic space complexity in Mul.
The previous implementation used to have a O(n) recursion
depth for unbalanced inputs. A test is added to check that a
reasonable amount of bytes is allocated in this case.

Fixes #3807.

R=golang-dev, dsymonds, gri
CC=golang-dev, remy
https://golang.org/cl/6345075
2012-07-12 10:18:24 -07:00
Brad Fitzpatrick
8a2a5013c9 net/http: fix Transport race(s) with high GOMAXPROCS
Also adds a new test for GOMAXPROCS=16 explicitly, which now passes
reliably in a stress loop like:

$ go test -c
$ (while ./http.test -test.v -test.run=Concurrency; do echo pass; done ) 2>&1 | tee foo; less foo

(It used to fail very quickly and reliably on at least Linux/amd64)

Fixes #3793

R=golang-dev, adg, r
CC=golang-dev
https://golang.org/cl/6347061
2012-07-11 16:40:44 -07:00
Adam Langley
93ea79ee7e crypto/rsa: left-pad PKCS#1 v1.5 outputs.
OpenSSL requires that RSA signatures be exactly the same byte-length
as the modulus. Currently it'll reject ~1/256 of our signatures: those
that end up a byte shorter.

Fixes #3796.

R=golang-dev, edsrzf, r
CC=golang-dev
https://golang.org/cl/6352093
2012-07-11 12:47:12 -04:00
Adam Langley
eeffa738a9 encoding/asn1: promote untyped strings to UTF8 as needed.
Previously, strings that didn't have an explicit ASN.1 string type
were taken to be ASN.1 PrintableStrings. This resulted in an error if
a unrepresentable charactor was included.

For compatibility reasons, I'm too afraid to switch the default string
type to UTF8String, but this patch causes untyped strings to become
UTF8Strings if they contain a charactor that's not valid in a
PrintableString.

Fixes #3791.

R=golang-dev, bradfitz, r, r
CC=golang-dev
https://golang.org/cl/6348074
2012-07-10 18:23:30 -04:00
Adam Langley
685a61df7e crypto/x509: exempt broken Entrust certificate from checks.
Entrust have issued a root certificate that's not marked as valid for
signing certificates.

This results in Go programs failing to validate certificates that
chain up to this root (i.e. gateway.push.apple.com:2195).

Although this is clearly a mistake on Entrust's part, it seems that we
will have to bodge around it.

R=golang-dev, dave, r
CC=golang-dev
https://golang.org/cl/6346064
2012-07-10 15:57:51 -04:00
Rémy Oudompheng
d6147d8102 strconv: extend Grisu3 algorithm to float32.
Also improve extfloat.Normalize to obtain a modest performance
gain in parsing, and add a shortcut path for exact integers.

benchmark                              old ns/op    new ns/op    delta
BenchmarkAtof64Decimal                        73           73   -0.54%
BenchmarkAtof64Float                          91           91   -0.54%
BenchmarkAtof64FloatExp                      198          180   -9.09%
BenchmarkAtof64Big                           307          308   +0.33%

BenchmarkAtof32Decimal                        72           72   +0.42%
BenchmarkAtof32Float                          83           83   -0.72%
BenchmarkAtof32FloatExp                      212          186  -12.26%
BenchmarkAtof32Random                        262          250   -4.58%

BenchmarkAppendFloatDecimal                  474          305  -35.65%
BenchmarkAppendFloat                         497          489   -1.61%
BenchmarkAppendFloatExp                      493          483   -2.03%
BenchmarkAppendFloatNegExp                   481          481   +0.00%
BenchmarkAppendFloatBig                      667          652   -2.25%

BenchmarkAppendFloat32Integer                338          307   -9.17%
BenchmarkAppendFloat32ExactFraction          364          439  +20.60%
BenchmarkAppendFloat32Point                 1299          490  -62.28%
BenchmarkAppendFloat32Exp                   2593          489  -81.14%
BenchmarkAppendFloat32NegExp                5116          481  -90.60%

R=rsc, r
CC=golang-dev, remy
https://golang.org/cl/6303087
2012-07-10 07:44:23 +02:00
David G. Andersen
106dd3c93f syscall/freebsd: remove Sendfile from unimplemented list
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/6343084
2012-07-09 09:37:56 -07:00
David G. Andersen
e66d29cdcf pkg: Removing duplicated words ("of of", etc.), mostly from comments.
Ran 'double.pl' on the pkg tree to identify doubled words.
One change to an error string return in x509;  the rest are in comments.
Thanks to Matt Jibson for the idea.

R=golang-dev, bsiegert
CC=golang-dev
https://golang.org/cl/6344089
2012-07-09 09:16:10 +10:00
Matthew William Jibson
f83a47cbb9 doc: various "the the" and other typos
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6355076
2012-07-08 11:57:04 +10:00
Dmitriy Vyukov
a54f920bfe runtime: move panic/defer/recover-related stuff to a separate file
Move panic/defer/recover-related stuff from proc.c/runtime.c to a new file panic.c.
No semantic changes.
proc.c is 1800+ LOC and is a bit difficult to work with.

R=golang-dev, dave, r
CC=golang-dev
https://golang.org/cl/6343071
2012-07-04 14:52:51 +04:00
Robert Griesemer
6044dbdf1b reflect: reflect.Zero results are neither addressable nor settable
This could be deduced from "The Laws of Reflection" but it seems
worthwhile highlighting it.

R=r
CC=golang-dev
https://golang.org/cl/6350073
2012-07-03 16:06:24 -07:00
Rémy Oudompheng
1a0a09dafe math/rand: avoid use of math.Pow in tests.
The use of math.Pow for mere squaring can be extremely
slow on soft-float ARM. Even on systems with hardware
floating-point, a speedup in test duration is observed.

On amd64
Before: ok      math/rand       2.009s
After:  ok      math/rand       0.340s

Fixes #3740.

R=dave, golang-dev, r, r
CC=golang-dev
https://golang.org/cl/6348061
2012-07-04 00:38:01 +02:00
Brad Fitzpatrick
55cc1ff721 net/http: clean up fs tests a bit
And fix some govet-caught format arg issues.

R=r
CC=golang-dev
https://golang.org/cl/6354068
2012-07-03 10:17:55 -07:00
Rob Pike
b04bf3882b encoding/gob: fix bug in Register
The old code added a star but did not indirect the reflect.Type.

R=bradfitz
CC=golang-dev
https://golang.org/cl/6348067
2012-07-03 10:05:27 -07:00
David G. Andersen
7b6541a593 syscall: fix FreeBSD 386 sendfile
The previous version was not handling an off_t (64 bit)
parameter on 32 bit i386 systems.  This patch splits sendfile
into two implementations in their respective arch-specific files.
Tested on FreeBSD amd64 and i386.

R=bradfitz
CC=golang-dev
https://golang.org/cl/6356048
2012-07-03 08:16:43 -07:00
Dmitriy Vyukov
a0c688331f runtime: refactor proc.c
1. Rename 'g' and 'm' local vars to 'gp' and 'mp' (convention already used in some functions)
'g' and 'm' are global vars that mean current goroutine and current machine,
when they are shadowed by local vars, it's confusing, no ability to debug log both, etc.
2. White-space shuffling.
No semantic changes.
In preparation to bigger changes.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/6355061
2012-07-03 12:54:13 +04:00
Han-Wen Nienhuys
8b7d39e7b6 syscall: use 32 bits structure for Getrlimit/Setrlimit on 386/ARM.
Fixes #2492

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/6295073
2012-07-02 22:57:32 -07:00
Nigel Tao
18e86644a3 cmd/gc: cache itab lookup in convT2I.
There may be further savings if convT2I can avoid the function call
if the cache is good and T is uintptr-shaped, a la convT2E, but that
will be a follow-up CL.

src/pkg/runtime:
benchmark                  old ns/op    new ns/op    delta
BenchmarkConvT2ISmall             43           15  -64.01%
BenchmarkConvT2IUintptr           45           14  -67.48%
BenchmarkConvT2ILarge            130          101  -22.31%

test/bench/go1:
benchmark                 old ns/op    new ns/op    delta
BenchmarkBinaryTree17    8588997000   8499058000   -1.05%
BenchmarkFannkuch11      5300392000   5358093000   +1.09%
BenchmarkGobDecode         30295580     31040190   +2.46%
BenchmarkGobEncode         18102070     17675650   -2.36%
BenchmarkGzip             774191400    771591400   -0.34%
BenchmarkGunzip           245915100    247464100   +0.63%
BenchmarkJSONEncode       123577000    121423050   -1.74%
BenchmarkJSONDecode       451969800    596256200  +31.92%
BenchmarkMandelbrot200     10060050     10072880   +0.13%
BenchmarkParse             10989840     11037710   +0.44%
BenchmarkRevcomp         1782666000   1716864000   -3.69%
BenchmarkTemplate         798286600    723234400   -9.40%

R=rsc, bradfitz, go.peter.90, daniel.morsing, dave, uriel
CC=golang-dev
https://golang.org/cl/6337058
2012-07-03 09:09:05 +10:00
David G. Andersen
917f764382 math/big: Remove unnecessary test from nat.go multiplication
The switch at the beginning of the function already ensures n > 1,
so testing for n < 2 is redundant.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/6350051
2012-07-02 15:30:00 -07:00
Dmitriy Vyukov
21de1ab359 reflect: set GOMAXPROCS=1 in the malloc test
Occasionally I see:
--- FAIL: TestAllocations-15 (0.00 seconds)
        all_test.go:1575: 6 mallocs after 100 iterations
Tested:
$ go test -cpu=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 reflect

R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/6354063
2012-07-02 20:55:08 +04:00
Dmitriy Vyukov
804e562a62 net/http: fix comment
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6348062
2012-07-02 20:10:31 +04:00
Shenghou Ma
435a001d68 image: fix doc typo
Fixes #3789.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6357058
2012-07-01 23:12:42 -04:00
Dmitriy Vyukov
ed516df4e4 runtime: add freemcache() function
It will be required for scheduler that maintains
GOMAXPROCS MCache's.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6350062
2012-07-01 13:10:01 +04:00
Brad Fitzpatrick
f06b12f0c7 net/http: ignore malicious or dumb Range requests
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6356050
2012-06-30 12:26:06 -07:00
Alex Brainman
c644a4ddfe path/filepath: avoid allocation in Clean of cleaned path even on windows (fix build)
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6344049
2012-06-30 22:08:53 +10:00
Brad Fitzpatrick
fa6f9b4a3e net/http: support multiple byte ranges in ServeContent
Fixes #3784

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6351052
2012-06-29 07:44:04 -07:00
Andrey Mirtchovski
4c3dc1ba74 net/http: Fix a verb-tense mismatch and a typo in documentation.
R=bradfitz
CC=golang-dev
https://golang.org/cl/6357049
2012-06-28 15:18:35 -07:00
Robert Griesemer
72a2abf8ad go/parser: minor internal cleanups
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6356046
2012-06-28 12:22:47 -07:00
Han-Wen Nienhuys
8907f94a51 path/filepath: add test case for rooted ".."
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6350047
2012-06-28 09:46:44 -07:00
Joe Poirier
8357dc9015 syscall: add missing argument type
And update implementation location comment.

R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/6352046
2012-06-27 18:21:48 -05:00
Mathieu Lonjaret
b6cc39d0dd image/jpeg: support for reading 4:4:0 subsampling.
Updates #2362.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6326057
2012-06-27 14:37:17 -07:00
Russ Cox
71643b2fdb runtime: fix string optimization
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6354048
2012-06-27 17:32:41 -04:00
Russ Cox
8744d35dd3 runtime: avoid allocation for "" + x + ""
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6359043
2012-06-27 17:06:49 -04:00
Russ Cox
f009fefd79 net: fix build (FreeBSD sendfile)
TBR=bradfitz
CC=golang-dev
https://golang.org/cl/6358043
2012-06-27 17:02:39 -04:00
Russ Cox
9525372e31 path/filepath: avoid allocation in Clean of cleaned path
Alternative to https://golang.org/cl/6330044.

Fixes #3681.

R=golang-dev, r, hanwen, iant
CC=golang-dev
https://golang.org/cl/6335056
2012-06-27 16:52:36 -04:00
Dmitriy Vyukov
5a5e698c8f runtime: add goroutine creation benchmark
Current results on 2 core darwin/amd64:
BenchmarkGoroutineChain		351 ns/op
BenchmarkGoroutineChain-2	3840 ns/op
BenchmarkGoroutineChain-4	4040 ns/op
BenchmarkConcGoroutineChain	350 ns/op
BenchmarkConcGoroutineChain-2	875 ns/op
BenchmarkConcGoroutineChain-4	2027 ns/op

R=r, rsc
CC=golang-dev
https://golang.org/cl/6332054
2012-06-27 21:57:49 +04:00
Russ Cox
596762e9a1 syscall: fix build
I missed the API change in the last FreeBSD CL, but the tool caught it.

TBR=bradfitz
CC=golang-dev
https://golang.org/cl/6331063
2012-06-25 20:45:18 -04:00
Patrick Mylund Nielsen
abb3c0618b net/http: provide access to POST-only form values
Fixes #3630.

R=rsc
CC=bradfitz, dsymonds, golang-dev, rodrigo.moraes
https://golang.org/cl/6210067
2012-06-25 20:41:46 -04:00
L Campbell
a9a8d7b544 syscall, net: sendfile for FreeBSD
R=golang-dev, rsc, bradfitz, devon.odell
CC=golang-dev
https://golang.org/cl/6221054
2012-06-25 20:26:19 -04:00
Rob Pike
a308be5fa8 fmt: set p.field before nil check
Fixes #3752.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6331062
2012-06-25 16:48:20 -07:00
Dave Cheney
d1537809ba runtime: add arm soft division and modulo benchmarks
arm soft div and mod performance plays an important part
in runtime performance.

The currently implementation is very stable, but we believe
we can best it. This benchmark provides a reference point.

linux/arm omap4 pandaboard

BenchmarkUint32Div7     10000000               298 ns/op
BenchmarkUint32Div37    10000000               298 ns/op
BenchmarkUint32Div123   10000000               298 ns/op
BenchmarkUint32Div763   10000000               298 ns/op
BenchmarkUint32Div1247  10000000               299 ns/op
BenchmarkUint32Div9305  10000000               298 ns/op
BenchmarkUint32Div13307 10000000               298 ns/op
BenchmarkUint32Div52513 10000000               298 ns/op
BenchmarkUint32Div60978747      10000000               298 ns/op
BenchmarkUint32Div106956295     10000000               297 ns/op
BenchmarkUint32Mod7     10000000               280 ns/op
BenchmarkUint32Mod37    10000000               280 ns/op
BenchmarkUint32Mod123   10000000               280 ns/op
BenchmarkUint32Mod763   10000000               280 ns/op
BenchmarkUint32Mod1247  10000000               280 ns/op
BenchmarkUint32Mod9305  10000000               280 ns/op
BenchmarkUint32Mod13307 10000000               280 ns/op
BenchmarkUint32Mod52513 10000000               280 ns/op
BenchmarkUint32Mod60978747      10000000               280 ns/op
BenchmarkUint32Mod106956295     10000000               280 ns/op

R=minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6258067
2012-06-26 08:58:00 +10:00
Jonathan Gold
b7bb1e32d8 encoding/json: add Number type
Number represents the actual JSON text,
preserving the precision and
formatting of the original input.

R=rsc, iant
CC=golang-dev
https://golang.org/cl/6202068
2012-06-25 17:36:09 -04:00
Michael Stapelberg
dfbd42e4f8 net: fix lookup of AAAA-only hosts without cgo
Fixes #3762.

R=rsc
CC=golang-dev
https://golang.org/cl/6303106
2012-06-25 17:32:39 -04:00
Pieter Droogendijk
baaa08eab0 go/build: fix doc typo
go/build section "Build Constraints", first paragraph said:
  "... they must be appear near the top of the file ..."
fixed to:
  "... they must appear near the top of the file ..."

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6329060
2012-06-25 17:20:48 -04:00
Thomas Alan Copeland
c08ff027c4 encoding/base32, encoding/base64: removed unneeded break label
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6305086
2012-06-25 17:18:50 -04:00
Micah Stetson
51ff2ef409 encoding/json: simplify (*decodeState).indirect
Removes an incorrect code comment and some superfluous variables.

The comment I removed says that struct fields which implement
Unmarshaler must be pointers, even if they're in an addressable
struct. That's not the case, and there's already a test in decode_test.go
that demonstrates as much.

Encoding/json has quite a few assignments of reflect.Values to extra
variables – things like "iv := v" when there's no need to make a copy. I
think these are left over from a previous version of the reflect API. If they
aren't wanted, I wouldn't mind going through the package and getting
rid of the rest of them.

R=rsc
CC=golang-dev
https://golang.org/cl/6318047
2012-06-25 16:03:18 -04:00
Jan Ziak
32a0cbb881 encoding/csv, encoding/xml: report write errors
Fixes #3773.

R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/6327053
2012-06-25 16:00:35 -04:00
Robert Griesemer
277e7e57ca go/ast: minor comment maps API change
This is a new, not yet committed API.

- Changed NewCommentMap to be independent of
  *File nodes and more symmetric with the
  Filter and Comments methods.

- Implemented Update method for use in
  AST modifications.

- Implemented String method for debugging

R=rsc
CC=golang-dev
https://golang.org/cl/6303086
2012-06-25 11:27:54 -07:00
Jan Ziak
b3382ec9e9 exp/inotify: prevent data race
Fixes #3713.

R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/6331055
2012-06-25 14:08:09 -04:00
Brad Fitzpatrick
5e75337c4e net/http: speed up Header.WriteSubset
A few performance improvements, but without the stack sorting
change to avoid allocating, which is instead waiting on better
escape analysis.

R=rsc
CC=golang-dev
https://golang.org/cl/6265047
2012-06-25 08:54:36 -07:00
Dave Cheney
3a50bc1a24 runtime: remove memset/memclr shim
This CL resolves https://golang.org/cl/6300043/#msg3
by renaming memset_arm.s to memclr_arm.s and merging the function
of the same name from asm_arm.s.

R=minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6336054
2012-06-25 23:01:34 +10:00
Dmitriy Vyukov
902911bcff runtime: fix potential GC deadlock
The issue seems to not be triggered right now,
but I've seen the deadlock after some other legal
modifications to runtime.
So I think we are safer this way.

R=rsc, r
CC=golang-dev
https://golang.org/cl/6339051
2012-06-25 11:08:09 +04:00
Russ Cox
bca01cd0bf runtime: detect hash map collision problems
This can only happen if the hash function we're using is getting
far more than it's fair share of collisions, but that has happened
to us repeatedly as we've expanded the allowed use cases for
hash tables (issue 1544, issue 2609, issue 2630, issue 2883, issue 3695).
Maybe this will help the next time we try something new.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6306083
2012-06-24 19:47:50 -04:00
Charles L. Dorian
35c3afdb62 math: improve Atan, Asin and Acos accuracy
pkg/math/all_test.go tests Atan (and therefore Asin and Acos) to a
relative accuracy of 4e-16, but the test vector misses values where
the old algorithm was in error by more than that. For example:

x            newError   oldError
0.414215746  1.41e-16  -4.24e-16
0.414216076  1.41e-16  -4.24e-16
0.414217632  1.41e-16  -4.24e-16
0.414218770  1.41e-16  -4.24e-16
0.414225466  0         -5.65e-16
0.414226244  1.41e-16  -4.24e-16
0.414228756  0         -5.65e-16
0.414235089  0         -5.65e-16
0.414237070  0         -5.65e-16

R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/6302093
2012-06-24 19:39:07 -04:00
Han-Wen Nienhuys
d36c095da9 os: make POSIX StartProcess work with chroot again.
Skip directory check in startProcess in the presence of
SysProcAttr.

Fixes #3649.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6297083
2012-06-24 19:34:06 -04:00
Jan Ziak
f5f3c3fe09 exp/inotify: prevent data race during testing
Fixes #3714.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6341047
2012-06-24 19:22:48 -04:00
Dave Cheney
e34079bb59 runtime: avoid r9/r10 during memmove
Fixes #3718.

Requires CL 6300043.

R=rsc, minux.ma, extraterrestrial.neighbour
CC=golang-dev
https://golang.org/cl/6305100
2012-06-25 08:28:30 +10:00
Dave Cheney
07826038c3 runtime: avoid r9/r10 during memset
Partially fixes issue 3718.

R=golang-dev, rsc, minux.ma
CC=golang-dev
https://golang.org/cl/6300043
2012-06-25 07:59:50 +10:00
David Symonds
c123c6c3f6 flag: fix indexing doc.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6341046
2012-06-24 12:23:51 -07:00
Brad Fitzpatrick
93b7d1bf1e net/http: fix doc inaccuracy and typo; tighten test
Note url.Error wrapping, and s/issue/issuing/.

Fixes #3724

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6294093
2012-06-24 10:41:12 -07:00
Shenghou Ma
a033e36766 runtime: fix struct Sigaction for Linux/386
We need to use kernel headers to generate defs_linux_$GOARCH.h

R=golang-dev, dave, alex.brainman, iant
CC=golang-dev
https://golang.org/cl/6296091
2012-06-24 01:41:17 +08:00
David G. Andersen
e2f2929d85 net/rpc: fix typo in documentation, clarify semantics of error return
Several of my students were confused by trying to use both the error
return and a reply return, so I figured it was worth explicitly clarifying
that returning an error overrides the reply.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6327051
2012-06-22 15:07:22 -07:00
David G. Andersen
75344d3d5b encoding/json: fix minor typo in documentation for Marshal
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6325053
2012-06-22 14:43:41 -07:00
Adam Langley
7f689864d8 crypto/x509: add extended key usage support.
Flame motivated me to get around to adding extended key usage support
so that code signing certificates can't be used for TLS server
authentication and vice versa.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6304065
2012-06-20 16:18:56 -04:00
Marcel van Lohuizen
77b1378c3e exp/locale/collate: added regression test for collate package
based on UCA test files.

R=r
CC=golang-dev
https://golang.org/cl/6216056
2012-06-19 11:34:56 -07:00
Shenghou Ma
d4c4f4d2c4 runtime: fix struct Sigaction for Linux/ARM
if we were to use sizeof(sa.sa_mask) instead of 8 as the last argument
        to rt_sigaction, we would have already fixed this bug, so also updated
        Linux/386 and Linux/amd64 files to use that; also test the return value
        of rt_sigaction.

R=dave, rsc
CC=golang-dev
https://golang.org/cl/6297087
2012-06-20 01:17:03 +08:00
Brad Fitzpatrick
a5aa91b9a2 net/http: make client await response concurrently with writing request
If the server replies with an HTTP response before we're done
writing our body (for instance "401 Unauthorized" response), we
were previously ignoring that, since we returned our write
error ("broken pipe", etc) before ever reading the response.
Now we read and write at the same time.

Fixes #3595

R=rsc, adg
CC=golang-dev
https://golang.org/cl/6238043
2012-06-19 09:20:41 -07:00
Brad Fitzpatrick
e1d9fcd267 net/http: clarify client return values in docs
Also, fixes one violation found during testing where both
response and error could be non-nil when a CheckRedirect test
failed.  This is arguably a minor API (behavior, not
signature) change, but it wasn't documented either way and was
inconsistent & non-Go like.  Any code depending on the old
behavior was wrong anyway.

R=adg, rsc
CC=golang-dev
https://golang.org/cl/6307088
2012-06-19 09:10:14 -07:00
Robert Griesemer
ca2ae27dd0 go/ast: multiple "blank" imports are permitted
R=rsc, dsymonds
CC=golang-dev
https://golang.org/cl/6303099
2012-06-18 21:56:41 -07:00
Marcel van Lohuizen
9c9754409d bytes: fixed typo.
R=r
CC=golang-dev
https://golang.org/cl/6301096
2012-06-18 17:43:05 -07:00
Brad Fitzpatrick
61809cd182 net/url: sort keys in Encode; don't enumerate map randomly
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6303098
2012-06-18 12:54:36 -07:00
Robert Griesemer
417a7f80d2 go/ast: Walk: do not walk comment list
A comment to that effect was introduced
with rev d332f4b9cef5 but the respective
code wasn't deleted.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6304086
2012-06-15 16:55:15 -07:00
Nigel Tao
834edc4257 exp/html/atom: add some more atoms.
R=r, dsymonds
CC=golang-dev
https://golang.org/cl/6298085
2012-06-15 15:39:25 +10:00
Shenghou Ma
9852614291 exp/types: clean up objects after test
Fixes #3739.

R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/6295083
2012-06-15 02:52:18 +08:00
Shenghou Ma
a11e74daf7 crypto/elliptic: fix doc typo
Fixes #3735.

R=golang-dev, agl
CC=golang-dev
https://golang.org/cl/6301083
2012-06-14 22:43:15 +08:00
Nigel Tao
8f84328fdc cmd/gc: inline convT2E when T is uintptr-shaped.
GOARCH=amd64 benchmarks

src/pkg/runtime
benchmark                  old ns/op    new ns/op    delta
BenchmarkConvT2ESmall             10           10   +1.00%
BenchmarkConvT2EUintptr            9            0  -92.07%
BenchmarkConvT2EBig               74           74   -0.27%
BenchmarkConvT2I                  27           26   -3.62%
BenchmarkConvI2E                   4            4   -7.05%
BenchmarkConvI2I                  20           19   -2.99%

test/bench/go1
benchmark                 old ns/op    new ns/op    delta
BenchmarkBinaryTree17    5930908000   5937260000   +0.11%
BenchmarkFannkuch11      3927057000   3933556000   +0.17%
BenchmarkGobDecode         21998090     21870620   -0.58%
BenchmarkGobEncode         12725310     12734480   +0.07%
BenchmarkGzip             567617600    567892800   +0.05%
BenchmarkGunzip           178284100    178706900   +0.24%
BenchmarkJSONEncode        87693550     86794300   -1.03%
BenchmarkJSONDecode       314212600    324115000   +3.15%
BenchmarkMandelbrot200      7016640      7073766   +0.81%
BenchmarkParse              7852100      7892085   +0.51%
BenchmarkRevcomp         1285663000   1286147000   +0.04%
BenchmarkTemplate         566823800    567606200   +0.14%

I'm not entirely sure why the JSON* numbers have changed, but
eyeballing the profile suggests that it could be spending less
and more time in runtime.{new,old}stack, so it could simply be
stack-split boundary noise.

R=rsc, dave, bsiegert, dsymonds
CC=golang-dev
https://golang.org/cl/6280049
2012-06-14 10:43:20 +10:00
Rob Pike
733ee91786 encoding/gob: don't cache broken encoding engines.
Fixes a situation where a nested bad type would still
permit the outer type to install a working engine, leading
to inconsistent behavior.

Fixes #3273.

R=bsiegert, rsc
CC=golang-dev
https://golang.org/cl/6294067
2012-06-13 15:55:43 -07:00
Brad Fitzpatrick
45969825b5 net/http: use index.html modtime (not directory) for If-Modified-Since
Thanks to Håvid Falch for finding the problem.

Fixes #3414

R=r, rsc
CC=golang-dev
https://golang.org/cl/6300081
2012-06-13 14:53:05 -07:00
Rémy Oudompheng
5468d16467 strconv: extend fast parsing algorithm to ParseFloat(s, 32)
benchmark                  old ns/op    new ns/op    delta
BenchmarkAtof32Decimal           215           73  -65.72%
BenchmarkAtof32Float             233           83  -64.21%
BenchmarkAtof32FloatExp         3351          209  -93.76%
BenchmarkAtof32Random           1939          260  -86.59%

R=rsc
CC=golang-dev, remy
https://golang.org/cl/6294071
2012-06-13 23:52:00 +02:00
Robert Griesemer
10b88888f6 math/big: correctly test for positive inputs in Int.GCD
Also: better GCD tests.

R=rsc
CC=golang-dev
https://golang.org/cl/6295076
2012-06-13 13:54:36 -07:00