Shenghou Ma [Tue, 30 Oct 2012 15:58:43 +0000 (23:58 +0800)]
cmd/ld: handle weak symbols
compiler_rt introduces a weak and hidden symbol compilerrt_abort_impl
into our pre-linked _all.o object, we have to handle it.
Fixes #4273.
R=iant, rsc, r
CC=golang-dev
https://golang.org/cl/6783050
Nigel Tao [Tue, 30 Oct 2012 00:10:08 +0000 (11:10 +1100)]
image/jpeg: change block from [64]int to [64]int32.
On 6g/linux:
benchmark old ns/op new ns/op delta
BenchmarkFDCT 4606 4241 -7.92%
BenchmarkIDCT 4187 3923 -6.31%
BenchmarkDecodeBaseline 31548643170224 +0.49%
BenchmarkDecodeProgressive 40728124017132 -1.37%
BenchmarkEncode 3940692034596760 -12.21%
Stack requirements before (from 'go tool 6g -S'):
(scan.go:37) TEXT (*decoder).processSOS+0(SB),$1352-32
(writer.go:448) TEXT (*encoder).writeSOS+0(SB),$5344-24
after:
(scan.go:37) TEXT (*decoder).processSOS+0(SB),$1064-32
(writer.go:448) TEXT (*encoder).writeSOS+0(SB),$2520-24
Also, in encoder.writeSOS, re-use the yBlock scratch buffer for Cb and
Cr. This reduces the stack requirement slightly, but also avoids an
unlucky coincidence where a BenchmarkEncode stack split lands between
encoder.writeByte and bufio.Writer.WriteByte, which occurs very often
during Huffman encoding and is otherwise disasterous for the final
benchmark number. FWIW, the yBlock re-use *without* the s/int/int32/
change does not have a noticable effect on the benchmarks.
Pawel Szczur [Mon, 29 Oct 2012 16:56:31 +0000 (17:56 +0100)]
net/http/client.go: fix cookie handling on (*Client) Do()
Fix the problem with no cookie handling when sending
other than GET or HEAD request through
(*Client) Do(*Request) (*Resposne, error).
https://code.google.com/p/go/issues/detail?id=3985
Adds a function (*Client) send(*Request) (*Reponse, error):
- sets cookies from CookieJar to request,
- sends request
- parses a reply cookies and updates CookieJar
Adam Langley [Mon, 29 Oct 2012 15:16:05 +0000 (11:16 -0400)]
encoding/asn1: don't convert UTCTime to UTC.
Previously we converted a time to UTC *and* serialized the timezone of
the original time. With this change, we serialize a UTCTime in the
original timezone.
Luuk van Dijk [Mon, 29 Oct 2012 12:55:27 +0000 (13:55 +0100)]
cmd/gc: inlining functions with local variables
- make sure dclcontext == PAUTO only in function bodies
- introduce PDISCARD to discard declarations in bodies of repeated imports
- skip printing initializing OAS'es in export mode, assuming they only occur after ODCL's
- remove ODCL and the initializing OAS from inl.c:ishairy
- fix confused use of ->typecheck in typecheckinl: it's about the ->inl, not about the fn.
- debuging aids: print ntype on ONAMEs too and -Emm instead of -Ell.
Luuk van Dijk [Mon, 29 Oct 2012 12:38:21 +0000 (13:38 +0100)]
cmd/gc: escape analysis to track flow of in to out parameters.
includes step 0: synthesize outparams, from 6600044
includes step 1,2: give outparams loopdepth 0 and verify unchanged results
generate esc:$mask tags, but still tie to sink if a param has mask != 0
from 6610054
adds final steps:
- have esccall generate n->escretval, a list of nodes the function results flow to
- use these in esccall and ORETURN/OAS2FUNC/and f(g())
- only tie parameters to sink if tag is absent, otherwise according to mask, tie them to escretval
David Symonds [Mon, 29 Oct 2012 11:03:58 +0000 (22:03 +1100)]
misc/dashboard/codereview: only accept "NOT LGTM" on the first line of a message.
Too many people quote entire emails and put their reply at the top ("top posting"),
so we shouldn't recognise review commands anywhere in the review text.
Ian Lance Taylor [Fri, 26 Oct 2012 17:31:03 +0000 (10:31 -0700)]
syscall: fix creds_test to reliably close os.File
Before this patch the test would close the file descriptor but
not the os.File. When the os.File was GC'ed, the finalizer
would close the file descriptor again. That would cause
problems if the same file descriptor were returned by a later
call to open in another test.
On my system:
> GOGC=30 go test
--- FAIL: TestPassFD (0.04 seconds)
passfd_test.go:62: FileConn: dup: bad file descriptor
FAIL
Dave Cheney [Fri, 26 Oct 2012 08:41:21 +0000 (19:41 +1100)]
net: avoid allocation in setAddr
setAddr was showing up in profiles due to string concatenation construction the os.File name field. netFD.sysfile's Name() is never used, except in dup() so I believe it is safe to avoid this allocation.
Marcel van Lohuizen [Thu, 25 Oct 2012 11:02:31 +0000 (13:02 +0200)]
exp/locale/collate: slightly changed collation elements:
- Allow secondary values below the default value in second form. This is
to support before tags for secondary values, as used by Chinese.
- Eliminate collation elements that are guaranteed to be immaterial
after a weight increment.
Luuk van Dijk [Mon, 22 Oct 2012 08:18:17 +0000 (10:18 +0200)]
cmd/gc: escape analysis to track flow of in to out parameters.
includes step 0: synthesize outparams, from 6600044
step 1: give outparams loopdepth 0 and verify unchanged results
step 2: generate esc:$mask tags, but still tie to sink if a param has mask != 0
next step: use in esccall (and ORETURN with implicit OAS2FUNC) to avoid tying to sink
Luuk van Dijk [Mon, 22 Oct 2012 08:01:14 +0000 (10:01 +0200)]
cmd/gc: fix strict tree property for AST for OAS2RECV nodes.
in typecheck and walk, conversion from OAS2RECV to OAS2
and to OSELRECV2 duplicated the ->rlist->n to ->right
thereby destroying the strict tree-ness of the AST (up to
ONAMES) of course. Several recursions in esc.c and inl.c
and probably elsewhere assume nodes of the tree aren't duplicated.
rather than defensively code around this, i'd rather assert
these cases away and fix their cause.
Roger Peppe [Mon, 22 Oct 2012 07:58:27 +0000 (08:58 +0100)]
cmd/go: add join template function.
It's common to use the go list command in shell scripts, but
currently it's awkward to print a string slice from the Package
type in a way that's easily parseable by the shell. For example:
go list -f '{{range .Deps}}{{.}}
{{end}}'
(and even that prints an unwanted new line at the end|).
To make this easier, this CL adds a "join" function to the
format template.
go list -f '{{join .Deps "\n"}}'
R=rsc, dsymonds, minux.ma, remyoudompheng, r
CC=golang-dev
https://golang.org/cl/6680044
Mikio Hara [Sun, 21 Oct 2012 21:17:51 +0000 (17:17 -0400)]
net: add test for Conn, PacketConn and Listener
I just realized that there is no good place for adding
exposed function or method tests because server, unicast
and multicast_test.go do test complicated multiple test
objects, platform behaviros, protocol behaviors and API,
at the same time. Perhaps splitting them into per test
object might be better, so this CL provides tests focused
on API.
Daniel Morsing [Sun, 21 Oct 2012 17:22:51 +0000 (19:22 +0200)]
cmd/gc: Friendlier errors on oversized arrays.
Someone new to the language may not know the connection between ints and arrays, which was the only thing that the previous error told you anything about.
Robert Griesemer [Fri, 19 Oct 2012 17:12:09 +0000 (10:12 -0700)]
go spec: constant divisors must not be zero
Both gc and gccgo always checked this for constant
expressions but the spec only mentions run-time
exceptions.
This CL also requires that constant divisors
must not be zero in non-constant integer expressions:
This is consistent with the spirit of the most
recent changes and it is consistent with constant
expressions. We don't want to specify the effect for
non-integer expressions (f/0.0 where f is a float or
complex number) because there the result f/g is not
further specified if a non-constant g is 0.
Robert Griesemer [Fri, 19 Oct 2012 17:11:06 +0000 (10:11 -0700)]
go spec: define make() restrictions as for index expressions
This is a language change: Until now, the spec required run-
time panics for some of these errors. Note that gc and gccgo
implemented this inconsistently, and that both compilers already
reported compile-time errors in some cases. This change makes
make() behave along the same vein as index expressions.
This addresses the spec aspect of issue 4085.
R=r, rsc, iant, ken
CC=golang-dev
https://golang.org/cl/6725053
Nigel Tao [Fri, 19 Oct 2012 05:32:00 +0000 (16:32 +1100)]
bufio: make Writer.ReadFrom not flush prematurely. For example,
many small writes to a network may be less efficient that a few
large writes.
This fixes net/http's TestClientWrites, broken by 6565056 that
introduced Writer.ReadFrom. That test implicitly assumed that
calling io.Copy on a *bufio.Writer wouldn't write to the
underlying network until the buffer was full.
Robert Griesemer [Wed, 17 Oct 2012 18:08:42 +0000 (11:08 -0700)]
go spec: restrictions for index and slice expressions
At the moment, gc and gccgo report compile-
time errors for certain constant indexes that
are out of bounds. The spec however requests
a run-time panic for out-of-bounds indexes
(http://tip.golang.org/ref/spec#Indexes).
Document the status quo.
Fixes #4231.
R=r, rsc, iant, ken
CC=golang-dev
https://golang.org/cl/6699048
Adam Langley [Wed, 17 Oct 2012 15:19:26 +0000 (11:19 -0400)]
math/big: add 4-bit, fixed window exponentiation.
A 4-bit window is convenient because 4 divides both 32 and 64,
therefore we never have a window spanning words of the exponent.
Additionaly, the benefit of a 5-bit window is only 2.6% at 1024-bits
and 3.3% at 2048-bits.
This code is still not constant time, however.
benchmark old ns/op new ns/op delta
BenchmarkRSA2048Decrypt 1710859011180370 -34.65%
Benchmark3PrimeRSA2048Decrypt 130037207680390 -40.94%
Rob Pike [Wed, 17 Oct 2012 05:00:09 +0000 (16:00 +1100)]
path/filepath: better documentation for WalkFunc
Define the properties of the arguments better. In particular,
explain that the path is (sort of) relative to the argument to
Walk.
Robert Griesemer [Tue, 16 Oct 2012 20:46:27 +0000 (13:46 -0700)]
math/big: fix big.Exp and document better
- always return 1 for y <= 0
- document that the sign of m is ignored
- protect against div-0 panics by treating
m == 0 the same way as m == nil
- added extra tests
Rob Pike [Tue, 16 Oct 2012 00:27:20 +0000 (11:27 +1100)]
spec: more clarification about deferred functions
Proposed new text to make matters clearer. The existing text was
unclear about the state of result parameters when panicking.