Marcel van Lohuizen [Fri, 24 Aug 2012 13:56:07 +0000 (15:56 +0200)]
exp/locale/collate: add code to ignore tests with (unpaired) surrogates.
In the regtest data, surrogates are assigned primary weights based on
the surrogate code point value. Go now converts surrogates to FFFD, however,
meaning that the primary weight is based on this code point instead.
This change drops tests with surrogates and lets the tests pass.
Julien Schmidt [Fri, 24 Aug 2012 02:29:47 +0000 (19:29 -0700)]
database/sql: stop reuse of bad connections
The second parameter for sql.putConn() (err) is always nil. As a result bad
connections are reused, even if the driver returns an driver.ErrBadConn.
Unsing a pointer to err instead achievs the desired behavior.
See http://code.google.com/p/go/issues/detail?id=3777 for more details.
Fixes #3777.
Shenghou Ma [Thu, 23 Aug 2012 06:35:26 +0000 (14:35 +0800)]
cmd/6g: fix float32/64->uint64 conversion
CVTSS2SQ's rounding mode is controlled by the RC field of MXCSR;
as we specifically need truncate semantic, we should use CVTTSS2SQ.
Fixes #3804.
R=rsc, r
CC=golang-dev
https://golang.org/cl/6352079
Nigel Tao [Thu, 23 Aug 2012 06:17:22 +0000 (16:17 +1000)]
cmd/8g: roll back the small integer constant optimizations introduced
in 13416:67c0b8c8fb29 "faster code, mainly for rotate" [1]. The codegen
can run out of registers if there are too many small-int arithmetic ops.
An alternative approach is to copy 6g's sbop/abop codegen to 8g, but
this change is less risky.
Carlos Castillo [Thu, 23 Aug 2012 03:49:16 +0000 (20:49 -0700)]
time: add YearDay method for time.Time structs
YearDay provides the day in the year represented by a given time.Time
object. This value is normally computed as part of other date calculations,
but not exported.
Joel Sing [Wed, 22 Aug 2012 12:23:56 +0000 (22:23 +1000)]
cmd/go: fix cgo linking on netbsd
NetBSD's built-in linker script for 'ld -r' does not provide a
SEARCH_DIR. As a result libgcc.a is not found when -lgcc is used.
Work around this by determining the path to libgcc (by invoking
gcc with the -print-libgcc-file-name option) and explicitly
referencing the resulting library.
Shenghou Ma [Mon, 20 Aug 2012 16:34:06 +0000 (00:34 +0800)]
cmd/ld: skip R_*_NONE relocations, fix Linux/386 build again
The last fix was wrong w.r.t C's operator precedence,
and it also failed to really skip the NONE relocation.
The offending R_386_NONE relocation is a absolute
relocation in section .eh_frame.
Marcel van Lohuizen [Mon, 20 Aug 2012 08:56:41 +0000 (10:56 +0200)]
exp/locale/collate/build: fixed bug that was exposed by experimenting
with table changes.
NOTE: there is no test for this, but 1) the code has now the same
control flow as scan in exp/locale/collate/contract.go, which is
tested and 2) Builder verifies the generated table so bugs in this
code are quickly and easily found (which is how this bug was discovered).
Marcel van Lohuizen [Mon, 20 Aug 2012 08:56:19 +0000 (10:56 +0200)]
exp/locale/collate: let regtest generate its own collation table.
The main table will need to get a slightly different collation table as the one
used by regtest, as the regtest is based on the standard UCA DUCET, while
the locale-specific tables are all based on a CLDR root table.
This change allows changing the table without affecting the regression test.
Mikkel Krautz [Sat, 18 Aug 2012 22:50:33 +0000 (15:50 -0700)]
crypto/tls: explicitly require ExtKeyUsageClientAuth for client certs
If we aren't explicit about the KeyUsages, the verifier
will treat the certificate as a server certificate and require
it to have a ExtKeyUsageServerAuth key usage.
Alex Brainman [Sat, 18 Aug 2012 07:03:32 +0000 (17:03 +1000)]
pprof: make it work on windows again
- pprof is a perl script, so go command should invoke
perl instead of trying to run pprof directly;
- pprof should use "go tool nm" unconditionally on windows,
no one else can extract symbols from Go program;
- pprof should use "go tool nm" instead of "6nm".
Fixes #3879.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6445082
Rob Pike [Fri, 17 Aug 2012 23:12:25 +0000 (16:12 -0700)]
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.
Rob Pike [Fri, 17 Aug 2012 18:55:11 +0000 (11:55 -0700)]
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.
Joel Sing [Fri, 17 Aug 2012 11:53:02 +0000 (21:53 +1000)]
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.
Shenghou Ma [Thu, 16 Aug 2012 19:42:34 +0000 (03:42 +0800)]
cmd/go: new cgo build procedure
This CL adds a step to the build procedure for cgo programs. It uses 'ld -r'
to combine all gcc compiled object file and generate a relocatable object file
for our ld. Additionally, this linking step will combine some static linking
gcc library into the relocatable object file, so that we can use libgcc,
libmingwex and libmingw32 without problem.
Fixes #3261.
Fixes #1741.
Added a testcase for linking in libgcc.
TODO:
1. still need to fix the INDIRECT_SYMBOL_LOCAL problem on Darwin/386.
2. still need to enable the libgcc test on Linux/ARM, because 5l can't deal
with thumb libgcc.
Andrew Balholm [Wed, 15 Aug 2012 23:31:22 +0000 (09:31 +1000)]
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.
Joel Sing [Wed, 15 Aug 2012 16:06:21 +0000 (02:06 +1000)]
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.
Andrew Balholm [Wed, 15 Aug 2012 01:44:25 +0000 (11:44 +1000)]
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).
Andrew Balholm [Mon, 13 Aug 2012 23:53:10 +0000 (09:53 +1000)]
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.
Andrew Balholm [Thu, 9 Aug 2012 23:34:10 +0000 (09:34 +1000)]
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.
Rob Pike [Thu, 9 Aug 2012 03:02:19 +0000 (20:02 -0700)]
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.
Shenghou Ma [Thu, 9 Aug 2012 00:47:43 +0000 (08:47 +0800)]
cmd/5l: add PT_PAX_FLAGS ELF header
Although I don't use PAX enabled ARM kernels, PAX
does have support for ARM, so we're better off add
PT_PAX_FLAGS now in case people use PAX kernels.
Rob Pike [Wed, 8 Aug 2012 21:01:23 +0000 (14:01 -0700)]
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.
Robert Griesemer [Wed, 8 Aug 2012 00:45:58 +0000 (17:45 -0700)]
godoc: make id attributes unique
Some browsers (e.g. IE9) ignore the case of 'id' attributes
which can lead to conflicts. Prefix non-generated 'id's with
"pkg-" to make them different from any generated attribute.
Also: Added missing entry for "Other packages" to top-level
index.
Nigel Tao [Tue, 7 Aug 2012 23:57:09 +0000 (09:57 +1000)]
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);
Shenghou Ma [Tue, 7 Aug 2012 15:45:50 +0000 (23:45 +0800)]
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
Shenghou Ma [Tue, 7 Aug 2012 01:57:14 +0000 (09:57 +0800)]
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).
Shenghou Ma [Tue, 7 Aug 2012 01:38:35 +0000 (09:38 +0800)]
misc/cgo/{life,stdio}, test/run.go: use test/run.go to do the cgo tests
Enhances test/run.go to support testing other directories
Will enable stdio tests on Windows in a follow-up CL.