build: add few tests with GOMAXPROCS=32 to run.bash
Some class of bugs (data races, runtime bugs) can be found
only with real parallelism.
Note that GOMAXPROCS=32 is somewhat different from go test -cpu=32,
this intentionally uses GOMAXPROCS to stress program bootstrap,
testing code, garbage collections, etc.
Package selection is mostly random.
R=golang-dev, dave, r
CC=golang-dev
https://golang.org/cl/6346070
Rob Pike [Fri, 13 Jul 2012 21:23:51 +0000 (14:23 -0700)]
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.
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.
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.
Rob Pike [Fri, 13 Jul 2012 03:53:17 +0000 (20:53 -0700)]
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.
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.
Adam Langley [Wed, 11 Jul 2012 16:47:12 +0000 (12:47 -0400)]
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
Adam Langley [Tue, 10 Jul 2012 22:23:30 +0000 (18:23 -0400)]
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
David G. Andersen [Sun, 8 Jul 2012 23:16:10 +0000 (09:16 +1000)]
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.
Made the following changes:
- Export errprintf() from all three OS-specific modules
- Added errprintf() to a.h
- Moved errprintf() in windows.c under xprintf(), since they are so similar
- Replaced all instances of xprintf() with errprintf() where a vflag check is done
Fixes #3788.
Shenghou Ma [Thu, 5 Jul 2012 20:52:13 +0000 (16:52 -0400)]
misc/chrome/gophertool: fix manifest
according to http://code.google.com/chrome/extensions/browserAction.html,
it should use "default_popup" instead of "popup".
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
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
David G. Andersen [Tue, 3 Jul 2012 15:16:43 +0000 (08:16 -0700)]
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.
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
Nigel Tao [Mon, 2 Jul 2012 23:09:05 +0000 (09:09 +1000)]
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%
David G. Andersen [Mon, 2 Jul 2012 22:30:00 +0000 (15:30 -0700)]
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.
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
test: enforce 1 proc in the test
otherwise it fails spuriously with "newfunc allocated unexpectedly" message
when run with GOMAXPROCS>1 (other goroutine allocates).
Pieter Droogendijk [Sat, 30 Jun 2012 14:27:05 +0000 (00:27 +1000)]
cmd/dist: Make windows.c's fatal() print to stderr
Generating env.bat using dist env -wp > env.bat failed silently
if case of an error, because the message was redirected to env.bat.
Verbose messages still go to stdout, causing problems, but that's
a seperate change.
Made errprintf() identical to xprintf(), except for the output handle.
Yes, it's duplicate code, but most of the function is unpacking
the argument list and preparing it for WriteFile(), which has to be
done anyway.
Robert Griesemer [Thu, 28 Jun 2012 19:22:24 +0000 (12:22 -0700)]
go spec: clean up section on selectors
- point out difference between selectors and qualified identifiers
- differentiate between illegal selectors and run-time panics
- use "indirect" as opposed to "dereference" consistently
- add extra links
Fixes #3779.
R=r, rsc, iant, ken
CC=golang-dev
https://golang.org/cl/6326059
Pieter Droogendijk [Mon, 25 Jun 2012 21:20:48 +0000 (17:20 -0400)]
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 ..."
Amir Mohammad Saied [Mon, 25 Jun 2012 21:19:08 +0000 (17:19 -0400)]
misc/chrome/gophertool: Support for manifest version 1 is being phased out.
Manifest version 1 was deprecated in Chrome 18, and support will be phased
out according to the schedule available at:
http://code.google.com/chrome/extensions/manifestVersion.html
Micah Stetson [Mon, 25 Jun 2012 20:03:18 +0000 (16:03 -0400)]
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.
Dave Cheney [Mon, 25 Jun 2012 13:01:34 +0000 (23:01 +1000)]
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.