Shenghou Ma [Fri, 12 Oct 2012 05:39:12 +0000 (13:39 +0800)]
cmd/5l: reorder some struct fields to reduce memory consumption
Valgrind Massif result when linking godoc:
On amd64:
old new -/+
mem_heap_B 185844612175358047 -5.7%
mem_heap_extra_B 773404 773137 -0.0%
On 386/ARM:
old new -/+
mem_heap_B 141775701131289941 -7.4%
mem_heap_extra_B 737011 736955 -0.0%
R=golang-dev, r, dave
CC=golang-dev
https://golang.org/cl/6655045
Shenghou Ma [Fri, 12 Oct 2012 05:35:05 +0000 (13:35 +0800)]
cmd/dist: fix superfluous and confusing "binaries ... to be copied or moved" message
Also, to aid debugging cmd/dist, make make.bat support --dist-tool flag.
Note that due to other improvements (faster assembly routines,
better code generation by compiler), these benchmarks now run
up to 37% faster than they used to at the last time measured (1/9/2012).
Minor performance impact for StringPiParallel running in parallel:
Current CL but with Lock/Unlock commented out (removed):
Adam Langley [Thu, 11 Oct 2012 22:25:23 +0000 (18:25 -0400)]
crypto/rsa: fix decryption benchmark.
I was an idiot and was thinking that a small base didn't matter
because the exponentiation would quickly make the number the same size
as the modulus. But, of course, the small base continues to make
multiplications unrealistically cheap throughout the computation.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6649048
Adam Langley [Thu, 11 Oct 2012 19:28:02 +0000 (15:28 -0400)]
crypto/hmac: add Equal function.
It was suggested that it's too easy to use crypto/hmac insecurely and
I think that has some merit. This change adds a Equal function to
make it obvious that MAC values should be compared in constant time.
R=rsc, max
CC=golang-dev
https://golang.org/cl/6632044
Shenghou Ma [Thu, 11 Oct 2012 15:33:57 +0000 (23:33 +0800)]
doc/contribute.html: assorted fixes
0. windows uses all.bat instead of ./all.bash
1. correct expected all.bash output
2. mention you need to use an application specific password
if you're using 2-step verification
3. note you can edit files included in CL by 'hg change NNNN'
or 'hg file'
R=golang-dev, adg, r
CC=golang-dev
https://golang.org/cl/6615060
Dmitriy Vyukov [Wed, 10 Oct 2012 16:49:18 +0000 (20:49 +0400)]
runtime/debug: fix the test
If source are not available, then the stack looks like:
stack_test.go:40: /tmp/gobuilder/linux-amd64-race-72b15c5d6f65/go/src/pkg/runtime/debug/bla-bla-bla/src/pkg/runtime/debug/stack_test.go:15 (0x43fb11)
stack_test.go:40: /tmp/gobuilder/linux-amd64-race-72b15c5d6f65/go/src/pkg/runtime/debug/bla-bla-bla/src/pkg/runtime/debug/stack_test.go:18 (0x43fb7a)
stack_test.go:40: /tmp/gobuilder/linux-amd64-race-72b15c5d6f65/go/src/pkg/runtime/debug/bla-bla-bla/src/pkg/runtime/debug/stack_test.go:37 (0x43fbf4)
stack_test.go:40: /tmp/gobuilder/linux-amd64-race-72b15c5d6f65/go/src/pkg/testing/bla-bla-bla/src/pkg/testing/testing.go:301 (0x43b5ba)
stack_test.go:40: /tmp/gobuilder/linux-amd64-race-72b15c5d6f65/go/src/pkg/runtime/bla-bla-bla/src/pkg/runtime/proc.c:276 (0x410670)
stack_test.go:40:
which is 6 lines.
Dmitriy Vyukov [Wed, 10 Oct 2012 14:09:23 +0000 (18:09 +0400)]
cmd/gc: fix compiler crash during race instrumentation
The compiler is crashing on the following code:
type TypeID int
func (t *TypeID) encodeType(x int) (tt TypeID, err error) {
switch x {
case 0:
return t.encodeType(x * x)
}
return 0, nil
}
The pass marks "return struct" {tt TypeID, err error} as used,
and this causes internal check failure.
I've added the test to:
https://golang.org/cl/6525052/diff/7020/src/pkg/runtime/race/regression_test.go
Rob Pike [Wed, 10 Oct 2012 02:29:50 +0000 (13:29 +1100)]
spec: clarify defer semantics
It's already there but only in the "for instance" and so not
clear enough: deferred functions run after
the result parameters are updated.
Robert Griesemer [Wed, 10 Oct 2012 00:08:09 +0000 (17:08 -0700)]
go/printer: idempotent comment formatting
Also:
- Refactored testing framework to permit easier
idempotency testing.
- Applied gofmt -w src misc
This CL depends on CL 6639044 being applied first.
Formatting is not idempotent for all files: In those
files the comment position has changed (due to missing
precise location information) and/or the comment formatting
cannot/is not aware of independent code re-formatting.
In general it is very hard to make format idempotent when
running it in one pass only. Leaving that aside for now.
Robert Griesemer [Wed, 10 Oct 2012 00:01:28 +0000 (17:01 -0700)]
gofmt: apply gofmt -w -s src misc
Preparation for forthcoming CL 6624051: Will make it
easier to see if/what changes are incurred by it.
The alignment changes in this CL are due to CL 6610051
(fix to alignment heuristic) where it appears that an
old version of gofmt was run (and thus the correct
alignment updates were not done).
Shenghou Ma [Tue, 9 Oct 2012 17:02:49 +0000 (01:02 +0800)]
cmd/5l: generate FreeBSD compatible ELF
1. correctly initialize .plt.got entries (point to the 1st entry)
2. add section .rel.plt (FreeBSD insists PLT relocs to be there)
3. put relocs of .got.plt into .rel.plt
4. set ELFOSABI_FREEBSD in ELF header
Shenghou Ma [Tue, 9 Oct 2012 16:55:48 +0000 (00:55 +0800)]
cmd/ld, cmd/6l, cmd/8l: sort exported dynamic symbols for Darwin
Also corrected cmd/8l's .dynsym handling (differentiate between exported symbols and imported symbols)
Dmitriy Vyukov [Tue, 9 Oct 2012 16:51:58 +0000 (20:51 +0400)]
race: syscall changes
This is a part of a bigger change that adds data race detection feature:
https://golang.org/cl/6456044
The purpose of this patch is to provide coarse-grained synchronization
between all Read() and Write() calls.
Robert Griesemer [Mon, 8 Oct 2012 01:02:19 +0000 (18:02 -0700)]
exp/types/staging: more flexible API, cleanups
- Changed Check signature to take function parameters for
more flexibility: Now a client can interrupt type checking
early (via panic in one the upcalls) once the desired
type information or number of errors is reached. Default
use is still simple.
- Cleaned up main typechecking loops. Now does not neglect
_ declarations anymore.
Robert Griesemer [Mon, 8 Oct 2012 01:00:56 +0000 (18:00 -0700)]
exp/types/staging: test drivers
This code has been reviewed before. The most significant
change is to check_test which now can handle more than
one error at the same error position (due to spurious
errors - should not happen in praxis once error handling
has been fine-tuned). This change makes check_test easier
to use during development.
Rémy Oudompheng [Sun, 7 Oct 2012 15:35:21 +0000 (17:35 +0200)]
cmd/gc: replace "typechecking loop" by nicer errors in some cases.
For issue 3757:
BEFORE: test/fixedbugs/bug463.go:12: typechecking loop involving a
test/fixedbugs/bug463.go:12 a
test/fixedbugs/bug463.go:12 <node DCLCONST>
AFTER: test/fixedbugs/bug463.go:12: constant definition loop
test/fixedbugs/bug463.go:12: a uses a
For issue 3937:
BEFORE: test/fixedbugs/bug464.go:12: typechecking loop involving foo
test/fixedbugs/bug464.go:12 <T>
test/fixedbugs/bug464.go:12 foo
test/fixedbugs/bug464.go:12 <node DCLFUNC>
AFTER: test/fixedbugs/bug464.go:12: foo is not a type
Nigel Tao [Sun, 7 Oct 2012 08:32:28 +0000 (19:32 +1100)]
image/jpeg: move the huffman bit decoder state higher up in the
decoder struct, inside the unmappedzero limit, to eliminate some
TESTB instructions in the inner decoding loop.
benchmark old ns/op new ns/op delta
BenchmarkDecode 29432042746360 -6.69%
R=r, dave
CC=golang-dev
https://golang.org/cl/6625058
Nigel Tao [Sun, 7 Oct 2012 00:32:02 +0000 (11:32 +1100)]
image/jpeg: move the level-shift and clip out of the idct function,
to be consistent with the fdct function, and to ease any future
idct rewrites in assembly.
The BenchmarkIDCT delta is obviously just an accounting change and not
a real saving, but it does give an indication of what proportion of
time was spent in the actual IDCT and what proportion was in shift and
clip. The idct time taken is now comparable to fdct.
The BenchmarkFDCT delta is an estimate of benchmark noise.
benchmark old ns/op new ns/op delta
BenchmarkFDCT 3842 3837 -0.13%
BenchmarkIDCT 5611 3478 -38.01%
BenchmarkDecodeRGBOpaque 29327852929751 -0.10%
Nigel Tao [Sun, 7 Oct 2012 00:30:47 +0000 (11:30 +1100)]
image/jpeg: clean up BenchmarkDecode and BenchmarkEncode to not
refer to opacity. Those references were copy/pasted from the
image/png encoding benchmarks, which cares whether or not the
source image is opaque, but the JPEG encoder does not care.