Range access functions are already available in TSan library
but were not yet used.
Time for go test -race -short:
Before:
compress/flate 24.244s
exp/norm >200s
go/printer 78.268s
After:
compress/flate 17.760s
exp/norm 5.537s
go/printer 5.738s
Fixes#4250.
R=dvyukov, golang-dev, fullung
CC=golang-dev
https://golang.org/cl/7229044
Roll back CL making primitive type unmarshal faster,
because it broke the Unmarshal of malformed data.
Add benchmarks for unmarshal of primitive types.
Update #3949.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7228061
We explicitly spill all parameters to the frame during initial
SSA construction. (Later passes will remove spills.)
We now properly handle local Allocs escaping via Captures.
Also: allocate BasicBlock.Succs inline.
R=iant, iant
CC=golang-dev
https://golang.org/cl/7231050
Useful for debugging of runtime bugs.
+ Do not print "stack segment boundary" unless GOTRACEBACK>1.
+ Do not traceback system goroutines unless GOTRACEBACK>1.
R=rsc, minux.ma
CC=golang-dev
https://golang.org/cl/7098050
Otherwise it's impossible to know how much data from the
json.Decoder's underlying Reader was actually consumed.
The old fix from golang.org/issue/1955 just added docs. This
provides an actual mechanism.
Update #1955
R=golang-dev, adg, rsc
CC=golang-dev
https://golang.org/cl/7181053
Add 'math/big' to blacklist of packages that use shift
operations as yet unsupported by go/types.
(The failure was masked due to local bugfixes in my client.)
R=rsc, bradfitz, bradfitz
CC=golang-dev
https://golang.org/cl/7220057
This CL includes the implementation of Literal, all the
Value.String and Instruction.String methods, the sanity
checker, and other misc utilities.
R=gri, iant, iant
CC=golang-dev
https://golang.org/cl/7199052
Added tests, using input data from strconv.ParseFloat.
Thanks to rsc for most of the test code.
math/big could use some good package-level documentation.
R=remyoudompheng, rsc
CC=golang-dev
https://golang.org/cl/6930059
Mark candidate spans one GC pass earlier.
Move scavenger's code out from mgc0 and constrain it into mheap (where it belongs).
R=rsc, dvyukov, minux.ma
CC=golang-dev
https://golang.org/cl/7002049
This is for SPARC64, a 64-bit processor that uses all 64-bits
of virtual addresses. The idea is to use the low order 3 bits
to at least get a small ABA counter. That should work since
pointers are aligned. The idea is for SPARC64 to set CNT_MASK
== 7, PTR_BITS == 0, PTR_MASK == 0xffffffffffffff8.
Also add uintptr casts to avoid GCC warnings. The gccgo
runtime code is compiled with GCC, and GCC warns when casting
between a pointer and a type of a different size.
R=dvyukov
CC=golang-dev
https://golang.org/cl/7225043
It is now possible to run "go test -cpu=1,2,4 std"
successfully.
Fixes#3185.
R=golang-dev, dave, minux.ma, bradfitz
CC=golang-dev
https://golang.org/cl/7196052
net/http currently assumes that the response to a HEAD request
will always have a Content-Length header. This is incorrect.
RFC2616 says: "The HEAD method is identical to GET except that
the server MUST NOT return a message-body in the response. The
metainformation contained in the HTTP headers in response to a
HEAD request SHOULD be identical to the information sent in
response to a GET request. This method can be used for
obtaining metainformation about the entity implied by the
request without transferring the entity-body itself. This
method is often used for testing hypertext links for validity,
accessibility, and recent modification."
This means that three cases are possible: a Content-Length
header, a Transfer-Encoding header or neither. In the wild the
following sites exhibit these behaviours (curl -I):
HEAD on http://www.google.co.uk/ has Transfer-Encoding: chunked
HEAD on http://www.bbc.co.uk/ has Content-Length: 45247
HEAD on http://edition.cnn.com/ has neither header
This patch does not remove the ErrMissingContentLength error
for compatibility reasons, but it is no longer used.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7182045
This function is absolutely critical for clients such as
exp/ssa, and too complex for clients to duplicate.
As with CL 7200046, gri expressed in the doc below [gophers
only] before going on leave that he intended to expose such a
predicate, though his wording suggests as an interface method
of Type rather than a standalone function. (My preference is
for binary methods to be standalone; see "On Binary Methods",
Kim Bruce, 1995). In any case if he wishes to move it that's
easily accommodated by clients.
https://docs.google.com/a/google.com/document/d/1-DQ4fxlMDs9cYtnkKhAAehX6MArjOQyJsRXp-6kiJLA/edit#heading=h.k3bwja7xony9
R=iant, gri, iant
CC=golang-dev
https://golang.org/cl/7203051
On Windows, crypto/x509 passes through to Windows's CryptoAPI
to verify certificate chains. This method can't produce a
SystemRootsError, so make sure we always skip the test on
Windows.
This is needed because testVerify is called in both
TestGoVerify and TestSystemVerify on Windows - one is for
testing the Go verifier, the other one is for testing the
CryptoAPI verifier. The orignal CL tried to sidestep
this issue by setting systemSkip to true, but that only
affected TestSystemVerify.
R=golang-dev, agl, snaury, minux.ma
CC=golang-dev
https://golang.org/cl/7185043
further to how (I believe) it will end up being.
It is nicer to separate search from sorting functionality. Collation needs tables that
are not needed by search and vice-versa. The common functionality is separated out
in the Weigher interface. As this interface is very low-level, it will be moved to
a sub package (colltab) in a next CL.
The types that will move to this package are Weigher, Elem, and Level. The addition
of Elem allows for removing some of the duplicate code between collate and collate/build.
This CL also introduces some stubs for a higher-level API for options. The default
proposed options are quite complex and require the user to have a decent understanding
of Unicode collation. The new options hide a lot of the complexity.
R=rsc
CC=golang-dev
https://golang.org/cl/7058051
Fixes the fork-exec/wait race condition for ForkExec
as well, by making it use startProcess. This makes the
comment for StartProcess consistent as well.
Further, the passing of Waitmsg data in startProcess
and WaitProcess is protected against possible forks
from outside of ForkExec and StartProcess, which might
cause interference with the Await call.
R=rsc, rminnich, npe, ality
CC=golang-dev
https://golang.org/cl/7128059
BenchmarkString before:
11990 ns/op 1621 B/op 73 allocs/op
Using bytes.Buffer:
8774 ns/op 1994 B/op 40 allocs/op
I also tried making a version of escape() that writes directly to the
bytes.Buffer, but it only saved 1 alloc/op and increased CPU time by
about 10%. Didn't seem worth the extra code path.
R=bradfitz
CC=golang-dev
https://golang.org/cl/7182050
Parse("file:///foo") previously returned a URL with Scheme "file"
and Path "///foo". Now it returns a URL with Path "/foo",
such that
&URL{Scheme: "file", Path: "/foo"}.String() == "file:///foo"
This means that parsing and stringifying the URL "file:/foo"
returns "file:///foo", technically a regression but one that only
affects a corner case.
Fixes#4189.
R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/7135051
This proposal adds two methods to *testing.T, Skip(string) and Skipf(format, args...). The intent is to replace the existing log and return idiom which currently has 97 cases in the standard library. A simple example of Skip would be:
func TestSomethingLong(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode.")
// not reached
}
... time consuming work
}
Additionally tests can be skipped anywhere a *testing.T is present. An example adapted from the go.crypto/ssh/test package would be:
// setup performs some before test action and returns a func()
// which should be defered by the caller for cleanup.
func setup(t *testing.T) func() {
...
cmd := exec.Command("sshd", "-f", configfile, "-i")
if err := cmd.Run(); err != nil {
t.Skipf("could not execute mock ssh server: %v", err)
}
...
return func() {
// stop subprocess and cleanup
}
}
func TestDialMockServer(t *testing.T) {
cleanup := setup(t)
defer cleanup()
...
}
In verbose mode tests that are skipped are now reported as a SKIP, rather than PASS.
Link to discussion: https://groups.google.com/d/topic/golang-nuts/BqorNARzt4U/discussion
R=adg, rsc, r, n13m3y3r
CC=golang-dev, minux.ma
https://golang.org/cl/6501094
Go 1.0 behavior was to create an UnmarshalFieldError when a json value name matched an unexported field name. This error will no longer be created and the field will be skipped instead.
Fixes#4660.
R=adg, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/7139049
All packages place testdata in a specific directory with the name
"testdata". The mime and strconv packages have been updated to use
the same convention.
mime: Move "mime/test.types" to "mime/testdata/test.types". Update test
code accordingly.
strconv: Move "strconv/testfp.txt" to "strconv/testdata/testfp.txt".
Update test code accordingly.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7098072
This fixes the incorrect unix timestamp of the standard time and adds
an example for (Time) Format to clarify how timezones work in format strings.
Fixes#4364.
R=golang-dev, remyoudompheng, kevlar, rsc
CC=golang-dev
https://golang.org/cl/7069046
Offsets for return values from seek were miscalculated
and a translation from 32-bit code for error handling
was incorrect.
R=rsc, rminnich, npe
CC=golang-dev
https://golang.org/cl/7181045
Previously, Go TLS servers always took the client's preferences into
account when selecting a ciphersuite. This change adds the option of
using the server's preferences, which can be expressed by setting
tls.Config.CipherSuites.
This mirrors Apache's SSLHonorCipherOrder directive.
R=golang-dev, nightlyone, bradfitz, ality
CC=golang-dev
https://golang.org/cl/7163043
Currently it's summed to mark phase.
The change makes it easier to diagnose long stop-the-world phases.
R=golang-dev, bradfitz, dave
CC=golang-dev
https://golang.org/cl/7182043
so that the user don't need to decipher something like this:
template: main:1: expected %!s(parse.itemType=14) in end; got "|"
now they get this:
template: main:1: unexpected "|" in end
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7128054
I messed this up from the beginning. The receiver isn't a pointer so
setting Err is useless. In order to maintain the API, just remove the
superfluous code.
Fixes#4657.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7161043
Fortunately we have never seen the panic on sockaddrToTCP
in the past year.
««« original CL description
net: panic if sockaddrToTCP returns nil incorrectly
Part of diagnosing the selfConnect bug
TBR=dsymonds
R=golang-dev
CC=golang-dev
https://golang.org/cl/5687057
»»»
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7137063
If the scanned block has no typeinfo the garbage collector will attempt
to get the actual type of the block.
R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/7093045
On Plan 9, only the parent of a given process can enter its wait
queue. When a Go program tries to fork-exec a child process
and subsequently waits for it to finish, the goroutines doing
these two tasks do not necessarily tie themselves to the same
(or any single) OS thread. In the case that the fork and the wait
system calls happen on different OS threads (say, due to a
goroutine being rescheduled somewhere along the way), the
wait() will either return an error or end up waiting for a
completely different child than was intended.
This change forces the fork and wait syscalls to happen in the
same goroutine and ties that goroutine to its OS thread until
the child exits. The PID of the child is recorded upon fork and
exit, and de-queued once the child's wait message has been read.
The Wait API, then, is translated into a synthetic implementation
that simply waits for the requested PID to show up in the queue
and then reads the associated stats.
R=rsc, rminnich, npe, mirtchovski, ality
CC=golang-dev
https://golang.org/cl/6545051
Decode as much as possible of a Huffman symbol in a single table
lookup (much like the zlib implementation), filling more bits
(conservatively, so we don't consume past the end of the stream)
when the code prefix indicates more bits are needed. This
results in about a 50% performance gain in speed benchmarks.
The following set is benchcmp done on a retina MacBook Pro:
benchmark old MB/s new MB/s speedup
BenchmarkDecodeDigitsSpeed1e4 28.41 42.79 1.51x
BenchmarkDecodeDigitsSpeed1e5 30.18 47.62 1.58x
BenchmarkDecodeDigitsSpeed1e6 30.81 48.14 1.56x
BenchmarkDecodeDigitsDefault1e4 30.28 44.61 1.47x
BenchmarkDecodeDigitsDefault1e5 32.18 51.94 1.61x
BenchmarkDecodeDigitsDefault1e6 35.57 53.28 1.50x
BenchmarkDecodeDigitsCompress1e4 30.39 44.83 1.48x
BenchmarkDecodeDigitsCompress1e5 33.05 51.64 1.56x
BenchmarkDecodeDigitsCompress1e6 35.69 53.04 1.49x
BenchmarkDecodeTwainSpeed1e4 25.90 43.04 1.66x
BenchmarkDecodeTwainSpeed1e5 29.97 48.19 1.61x
BenchmarkDecodeTwainSpeed1e6 31.36 49.43 1.58x
BenchmarkDecodeTwainDefault1e4 28.79 45.02 1.56x
BenchmarkDecodeTwainDefault1e5 37.12 55.65 1.50x
BenchmarkDecodeTwainDefault1e6 39.28 58.16 1.48x
BenchmarkDecodeTwainCompress1e4 28.64 44.90 1.57x
BenchmarkDecodeTwainCompress1e5 37.40 55.98 1.50x
BenchmarkDecodeTwainCompress1e6 39.35 58.06 1.48x
R=rsc, dave, minux.ma, bradfitz, nigeltao
CC=golang-dev
https://golang.org/cl/6872063
Calling it will show memory allocation statistics for that
single benchmark (if -test.benchmem is not provided)
R=golang-dev, rsc, kevlar, bradfitz
CC=golang-dev
https://golang.org/cl/7027046
I think that the parser is complete enough to take that warning out.
It passes the test suite.
There may be incompatible API changes, but being in the exp directory
is warning enough for that.
R=nigeltao
CC=golang-dev
https://golang.org/cl/7131050
We need to wait for the handler to actually finish running,
not almost be done running.
This was always a bug, but now that handler output is buffered
it shows up easily on GOMAXPROCS >1 systems.
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7109043
- always set the Pkg field in QualifiedIdents
- call Context.Ident for all identifiers in the AST that denote
a types.Object (bug fix)
- added test that Context.Ident is called for all such identifiers
R=adonovan
CC=golang-dev
https://golang.org/cl/7101054
Completely removed *ast.Objects from being exposed by the
types API. *ast.Objects are still required internally for
resolution, but now the door is open for an internal-only
rewrite of identifier resolution entirely at type-check
time. Once that is done, ASTs can be type-checked whether
they have been created via the go/parser or otherwise,
and type-checking does not require *ast.Object or scope
invariants to be maintained externally.
R=adonovan
CC=golang-dev
https://golang.org/cl/7096048
Also undo revision a5b96b602690 used to workaround the bug.
Fixes#4643.
R=rsc, golang-dev, dave, minux.ma, lucio.dere, bradfitz
CC=golang-dev
https://golang.org/cl/7090043
The existing type checker was relying on augmenting ast.Object
fields (empty interfaces) for its purposes. While this worked
for some time now, it has become increasingly brittle. Also,
the need for package information for Fields and Methods would
have required a new field in each ast.Object. Rather than making
them bigger and the code even more subtle, in this CL we are moving
away from ast.Objects.
The types packge now defines its own objects for different
language entities (Const, Var, TypeName, Func), and they
implement the types.Object interface. Imported packages
create a Package object which holds the exported entities
in a types.Scope of types.Objects.
For type-checking, the current package is still using ast.Objects
to make this transition manageable. In a next step, the type-
checker will also use types.Objects instead, which opens the door
door to resolving ASTs entirely by the type checker. As a result,
the AST and type checker become less entangled, and ASTs can be
manipulated "by hand" or programmatically w/o having to worry
about scope and object invariants that are very hard to maintain.
(As a consequence, a future parser can do less work, and a
future AST will not need to define objects and scopes anymore.
Also, object resolution which is now split across the parser,
the ast, (ast.NewPackage), and even the type checker (for composite
literal keys) can be done in a single place which will be simpler
and more efficient.)
Change details:
- Check now takes a []*ast.File instead of a map[string]*ast.File.
It's easier to handle (I deleted code at all use sites) and does
not suffer from undefined order (which is a pain for testing).
- ast.Object.Data is now a *types.Package rather then an *ast.Scope
if the object is a package (obj.Kind == ast.Pkg). Eventually this
will go away altogether.
- Instead of an ast.Importer, Check now uses a types.Importer
(which returns a *types.Package).
- types.NamedType has two object fields (Obj Object and obj *ast.Object);
eventually there will be only Obj. The *ast.Object is needed during
this transition since a NamedType may refer to either an imported
(using types.Object) or locally defined (using *ast.Object) type.
- ast.NewPackage is not used anymore - there's a local copy for
package-level resolution of imports.
- struct fields now take the package origin into account.
- The GcImporter is now returning a *types.Package. It cannot be
used with ast.NewPackage anymore. If that functionality is still
used, a copy of the old GcImporter should be made locally (note
that GcImporter was part of exp/types and it's API was not frozen).
- dot-imports are not handled for the time being (this will come back).
R=adonovan
CC=golang-dev
https://golang.org/cl/7058060
This introduces a buffer between writing from a handler and
writing chunks. Further, it delays writing the header until
the first full chunk is ready. In the case where the first
full chunk is also the final chunk (for small responses), that
means we can also compute a Content-Length, which is a nice
side effect for certain benchmarks.
Fixes#2357
R=golang-dev, dave, minux.ma, rsc, adg, balasanjay
CC=golang-dev
https://golang.org/cl/6964043
The old code made it impossible to implement a reverse proxy
with anything less than 4k write granularity to the backends.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7060059
ratio isn't 1x1.
Fixes#4259.
The test data was generated by
cjpeg -quality 50 -sample 2x2 video-005.gray.pgm > video-005.gray.q50.2x2.jpeg
cjpeg -quality 50 -sample 2x2 -progressive video-005.gray.pgm > video-005.gray.q50.2x2.progressive.jpeg
similarly to video-005.gray.q50.* from
http://code.google.com/p/go/source/detail?r=51f26e36ba98
the key difference being the "-sample 2x2".
R=rsc
CC=golang-dev
https://golang.org/cl/7069045
bytes.Equal is simpler to read and should also be faster because
of short-circuiting and assembly implementations.
Change generated automatically using:
gofmt -r 'bytes.Compare(a, b) == 0 -> bytes.Equal(a, b)'
gofmt -r 'bytes.Compare(a, b) != 0 -> !bytes.Equal(a, b)'
R=golang-dev, dave, adg, rsc
CC=golang-dev
https://golang.org/cl/7038051
Closures are incredibly expensive on linux/arm due to
repetitive flush of instruction cache.
go test -short on ODROID-X:
Before:
ok exp/gotype 17.091s
ok go/types 2.225s
After:
ok exp/gotype 7.193s
ok go/types 1.143s
R=dave, minux.ma, rsc
CC=golang-dev, remy
https://golang.org/cl/7062045
The Plan 9 symbol table format defines big-endian symbol values
for portability, but we want to be able to generate an ELF object file
and let the host linker link it, as part of the solution to issue 4069.
The symbol table itself, since it is loaded into memory at run time,
must be filled in by the final host linker, using relocation directives
to set the symbol values. On a little-endian machine, the linker will
only fill in little-endian values during relocation, so we are forced
to use little-endian symbol values.
To preserve most of the original portability of the symbol table
format, we make the table itself say whether it uses big- or
little-endian values. If the table begins with the magic sequence
fe ff ff ff 00 00
then the actual table begins after those six bytes and contains
little-endian symbol values. Otherwise, the table is in the original
format and contains big-endian symbol values. The magic sequence
looks like an "end of table" entry (the fifth byte is zero), so legacy
readers will see a little-endian table as an empty table.
All the gc architectures are little-endian today, so the practical
effect of this CL is to make all the generated tables little-endian,
but if a big-endian system comes along, ld will not generate
the magic sequence, and the various readers will fall back to the
original big-endian interpretation.
R=ken2
CC=golang-dev
https://golang.org/cl/7066043
RFC5424 specifies a version number (currently 1) after the facility and
severity in a syslog message (e.g. <7>1 TIMESTAMP ...). This causes
rsyslog to fail to parse syslog message because the rest of the message
is not fully compliant with RFC5424.
For the widest compatibility, drop the version (messages are in the
RFC3164 BSD syslog format (e.g. <7>TIMESTAMP ...). Have tested this with
syslog-ng, rsyslog and syslogd.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7036050
TimeoutHandler was changed from "ns int64" to "dt time.Duration" on
Nov 30, 2011, but the godoc still refers to "ns".
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7031050
* Extended deadline to 30 seconds
* Added logging of the duration of each package import
* Fail the test immediately if directories cannot be read
R=gri, minux.ma
CC=golang-dev
https://golang.org/cl/7030055
It already did so for its sibling, *strings.Reader, as well as *bytes.Buffer.
R=edsrzf, dave, adg, kevlar, remyoudompheng, adg, rsc
CC=golang-dev
https://golang.org/cl/7031045
Add a check for this case and don't try to follow the anonymous
type's non-existent fields.
Fixes#4474.
R=rsc
CC=golang-dev
https://golang.org/cl/6945065
Request.URL had no documentation before and some people were expecting all fields to be populated.
Fixes#3805.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7008046
sysarch requires arguments to be passed on the stack, not in registers.
Credit to Shenghou Ma (minux) for the fix.
R=minux.ma, devon.odell
CC=golang-dev
https://golang.org/cl/7037043
Under FreeBSD-CURRENT on arm, cgo enabled binaries segfault. Disable cgo support for the moment so we can have a freebsd/arm builder on the dashboard.
R=minux.ma, rsc, iant
CC=golang-dev
https://golang.org/cl/7031044
Allows encoding and decoding of maps with key of string kind, not just string type.
Fixes#3519.
R=rsc, dave
CC=golang-dev
https://golang.org/cl/6943047
Used to then die on a nil pointer situation. Most Linux standard setups are rather
restrictive regarding the default amount of lockable memory.
R=minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6997049
While half of all numbers don't have their most-significant bit set,
this is becoming increasingly impermissible for RSA moduli. In an
attempt to exclude weak keys, several bits of software either do, or
will, enforce that RSA moduli are >= 1024-bits.
However, Go often generates 1023-bit RSA moduli which this software
would then reject.
This change causes crypto/rsa to regenerate the primes in the event
that the result is shorter than requested.
It also alters crypto/rand in order to remove the performance impact
of this:
The most important change to crypto/rand is that it will now set the
top two bits in a generated prime (OpenSSL does the same thing).
Multiplying two n/2 bit numbers, where each have the top two bits set,
will always result in an n-bit product. (The effectively makes the
crypto/rsa change moot, but that seems too fragile to depend on.)
Also this change adds code to crypto/rand to rapidly eliminate some
obviously composite numbers and reduce the number of Miller-Rabin
tests needed to generate a prime.
R=rsc, minux.ma
CC=golang-dev
https://golang.org/cl/7002050
- introduced type Method for methods
- renamed StructField -> Field
- removed ObjList
- methods are not sorted anymore in interfaces (for now)
R=adonovan
CC=golang-dev
https://golang.org/cl/7023043
This is a just a file move with no other changes
besides the manual import path adjustments in these
two files:
src/pkg/exp/gotype/gotype.go
src/pkg/exp/gotype/gotype_test.go
Note: The go/types API continues to be subject to
possibly significant changes until Go 1.1. Do not
rely on it being stable at this point.
R=adonovan
CC=golang-dev
https://golang.org/cl/7013049
The parser/resolver cannot accurately resolve
composite literal keys that are identifiers;
it needs type information.
Instead, try to resolve them but leave final
judgement to the type checker.
R=adonovan
CC=golang-dev
https://golang.org/cl/6994047
These files are identical, so probably pre date // +build.
With a little work, fd_darwin could be merged as well.
R=mikioh.mikioh, jsing, devon.odell, lucio.dere, minux.ma
CC=golang-dev
https://golang.org/cl/7004053
The new garbage collector (CL 6114046) may find the fake *[]byte value
and interpret its contents as bytes rather than as potential pointers.
This may lead the garbage collector to free memory blocks that
shouldn't be freed.
R=dvyukov, rsc, dave, minux.ma, remyoudompheng, iant
CC=golang-dev
https://golang.org/cl/7000059
Proper local system log semantics still need to be
created for Plan 9. In the meantime, the test suite
(viz., exp/gotype) expects there to be some Go
source for each import path. Thus, here is a stub,
equivalent to syslog_windows, for this purpose.
R=golang-dev, rsc, alex.brainman
CC=golang-dev
https://golang.org/cl/7000062
- added Context type for configuration of type checker
- type check all function and method bodies
- (partial) fixes to shift hinting (still not complete)
- revamped test harness - does not rely on specific position
representation anymore, just a standard (compiler) error
message
- lots of bug fixes
R=adonovan, rsc
CC=golang-dev
https://golang.org/cl/6948071
Motivations:
- Simpler UI. Previous API proved a bit awkward for practical purposes.
- Iter is often used in cases where one want to be able to bail out early.
The old implementaton had too much look-ahead to be efficient.
Disadvantages:
- ASCII performance is bad. This is unavoidable for tiny iterations.
Example is included to show how to work around this.
Description:
Iter now iterates per boundary/segment. It returns a slice of bytes that
either points to the input bytes, the internal decomposition strings,
or the small internal buffer that each iterator has. In many cases, copying
bytes is avoided.
The method Seek was added to support jumping around the input without
having to reinitialize.
Details:
- Table adjustments: some decompositions exist of multiple segments.
Decompositions that are of this type are now marked so that Iter can
handle them separately.
- The old iterator had a different next function for different normal forms
that was assigned to a function pointer called by Next.
The new iterator uses this mechanism to switch between different modes
for handling different type of input as well. This greatly improves
performance for Hangul and ASCII. It is also used for multi-segment
decompositions.
- input is now a struct of sting and []byte, instead of an interface.
This simplifies optimizing the ASCII case.
R=rsc
CC=golang-dev
https://golang.org/cl/6873072
the need to decompose characters for the majority of cases. This considerably
speeds up collation while increasing the table size minimally.
To detect non-normalized strings, rather than relying on exp/norm, the table
now includes CCC information. The inclusion of this information does not
increase table size.
DETAILS
- Raw collation elements are now a struct that includes the CCC, rather
than a slice of ints.
- Builder now ensures that NFD and NFC counterparts are included in the table.
This also fixes a bug for Korean which is responsible for most of the growth
of the table size.
- As there is no more normalization step, code should now handle both strings
and byte slices as input. Introduced source type to facilitate this.
NOTES
- This change does not handle normalization correctly entirely for contractions.
This causes a few failures with the regtest. table_test.go contains a few
uncommented tests that can be enabled once this is fixed. The easiest is to
fix this once we have the new norm.Iter.
- Removed a test cases in table_test that covers cases that are now guaranteed
to not exist.
R=rsc, mpvl
CC=golang-dev
https://golang.org/cl/6971044
Currently it silently "succeeds" saying that it run 0 tests
if there are compilations errors.
With this change it fails and outputs the compilation error.
R=golang-dev, remyoudompheng
CC=golang-dev
https://golang.org/cl/7002058
NO_PROXY="example.com" should match "foo.example.com", just
the same as NO_PROXY=".example.com". This is what curl and
Python do.
Fixes#4574
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7005049
When we release memory to the OS, if the OS doesn't want us
to release it (for example, because the program executed
mlockall(MCL_FUTURE)), madvise will fail. Ignore the failure
instead of crashing.
Fixes#3435.
R=ken2
CC=golang-dev
https://golang.org/cl/6998052
Any flag.Value that has an IsBoolFlag method that returns true
will be treated as a bool flag type during parsing.
Fixes#4262.
R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/6944064
When using subexpressions ($1) as replacements, when they either don't exist or values weren't found causes a panic.
This patch ensures that the match location isn't -1, to prevent out of bounds errors.
Fixes#3816.
R=franciscossouza, rsc
CC=golang-dev
https://golang.org/cl/6931049
EDE2 is a rare DES mode that can be implemented with crypto/des, but
it's somewhat non-obvious so this CL adds an example of doing so.
Fixes#3537.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6721056
Fixes#3559.
This makes Marshal handle fields marked ",any" instead of ignoring
them. That makes Marshal more symmetrical with Unmarshal, which seems
to have been a design goal.
Note some test cases were changed, because this patch changes
marshalling behavior. I think the previous behavior was buggy, but
there's still a backward-compatibility question to consider.
R=rsc
CC=golang-dev, n13m3y3r
https://golang.org/cl/6938068
This disables checks for limited address space
and unlimited stack. They are not required for Go.
Fixes#4577.
R=golang-dev, iant
CC=golang-dev, kamil.kisiel, minux.ma
https://golang.org/cl/7003045
This guarantees that powers of two return exact answers.
We could do a multiprecision approximation for the
rest of the answer too, but this seems like it should be
good enough.
Fixes#4567.
R=golang-dev, iant, remyoudompheng
CC=golang-dev
https://golang.org/cl/6943074
Enable cgo on OpenBSD.
The OpenBSD ld.so(1) does not currently support PT_TLS sections. Work
around this by fixing up the TCB that has been provided by librthread
and reallocating a TCB with additional space for TLS. Also provide a
wrapper for pthread_create, allowing zeroed TLS to be allocated for
threads created externally to Go.
Joint work with Shenghou Ma (minux).
Requires change 6846064.
Fixes#3205.
R=golang-dev, minux.ma, iant, rsc, iant
CC=golang-dev
https://golang.org/cl/6853059
Fixes#4345.
Benchmarks are promising,
benchmark old ns/op new ns/op delta
BenchmarkPrint 14716391 14747131 +0.21%
benchmark old ns/op new ns/op delta
BenchmarkParse 8846219 8809343 -0.42%
benchmark old MB/s new MB/s speedup
BenchmarkParse 6.61 6.64 1.00x
Also includes additional tests to improve token.FileSet coverage.
R=dvyukov, gri
CC=golang-dev
https://golang.org/cl/6968044
Fixes#4481.
hello-world-core.gz was generated with a simple hello world c program and core dumped as suggested in the issue.
Also: add support for gz compressed test fixtures.
R=minux.ma, rsc, iant
CC=golang-dev
https://golang.org/cl/6936058
Details:
- fixed variadic parameter passing and calls of the form f(g())
- fixed implementation of ^x for unsigned constants x
- fixed assignability of untyped booleans
- resolved a few TODOs, various minor fixes
- enabled many more tests (only 6 std packages don't typecheck)
R=rsc
CC=golang-dev
https://golang.org/cl/6930053
reader.Read() can return both 0,nil and len(buf),err.
To be safe, we use io.ReadFull instead of doing reader.Read directly.
Fixes#3472.
R=bradfitz, rsc, ality
CC=golang-dev
https://golang.org/cl/6285050
This decreases the amount of system calls during the
first call to Getenv. Calling Environ will still read
in all environment variables and populate the cache.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6939048
With this change the runtime can now read GOMAXPROCS, GOGC, etc.
I'm not quite sure how we missed this.
R=seed, lucio.dere, rsc
CC=golang-dev
https://golang.org/cl/6935062
The code:
func main() {
v := make([]int64, 10)
i := 1
_ = v[(i*4)/3]
}
crashes compiler with:
Program received signal SIGSEGV, Segmentation fault.
0x000000000043c274 in walkexpr (np=0x7fffffffc9b8, init=0x0) at src/cmd/gc/walk.c:587
587 *init = concat(*init, n->ninit);
(gdb) bt
#0 0x000000000043c274 in walkexpr (np=0x7fffffffc9b8, init=0x0) at src/cmd/gc/walk.c:587
#1 0x0000000000432d15 in copyexpr (n=0x7ffff7f69a48, t=<optimized out>, init=0x0) at src/cmd/gc/subr.c:2020
#2 0x000000000043f281 in walkdiv (init=0x0, np=0x7fffffffca70) at src/cmd/gc/walk.c:2901
#3 walkexpr (np=0x7ffff7f69760, init=0x0) at src/cmd/gc/walk.c:956
#4 0x000000000043d801 in walkexpr (np=0x7ffff7f69bc0, init=0x0) at src/cmd/gc/walk.c:988
#5 0x000000000043cc9b in walkexpr (np=0x7ffff7f69d38, init=0x0) at src/cmd/gc/walk.c:1068
#6 0x000000000043c50b in walkexpr (np=0x7ffff7f69f50, init=0x0) at src/cmd/gc/walk.c:879
#7 0x000000000043c50b in walkexpr (np=0x7ffff7f6a0c8, init=0x0) at src/cmd/gc/walk.c:879
#8 0x0000000000440a53 in walkexprlist (l=0x7ffff7f6a0c8, init=0x0) at src/cmd/gc/walk.c:357
#9 0x000000000043d0bf in walkexpr (np=0x7fffffffd318, init=0x0) at src/cmd/gc/walk.c:566
#10 0x00000000004402bf in vmkcall (fn=<optimized out>, t=0x0, init=0x0, va=0x7fffffffd368) at src/cmd/gc/walk.c:2275
#11 0x000000000044059a in mkcall (name=<optimized out>, t=0x0, init=0x0) at src/cmd/gc/walk.c:2287
#12 0x000000000042862b in callinstr (np=0x7fffffffd4c8, init=0x7fffffffd568, wr=0, skip=<optimized out>) at src/cmd/gc/racewalk.c:478
#13 0x00000000004288b7 in racewalknode (np=0x7ffff7f68108, init=0x7fffffffd568, wr=0, skip=0) at src/cmd/gc/racewalk.c:287
#14 0x0000000000428781 in racewalknode (np=0x7ffff7f65840, init=0x7fffffffd568, wr=0, skip=0) at src/cmd/gc/racewalk.c:302
#15 0x0000000000428abd in racewalklist (l=0x7ffff7f65840, init=0x0) at src/cmd/gc/racewalk.c:97
#16 0x0000000000428d0b in racewalk (fn=0x7ffff7f5f010) at src/cmd/gc/racewalk.c:63
#17 0x0000000000402b9c in compile (fn=0x7ffff7f5f010) at src/cmd/6g/../gc/pgen.c:67
#18 0x0000000000419f86 in funccompile (n=0x7ffff7f5f010, isclosure=0) at src/cmd/gc/dcl.c:1414
#19 0x0000000000424161 in p9main (argc=<optimized out>, argv=<optimized out>) at src/cmd/gc/lex.c:431
#20 0x0000000000401739 in main (argc=<optimized out>, argv=<optimized out>) at src/lib9/main.c:35
The problem is nil init passed to mkcall().
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6940045
Add a Hello method that allows clients to set the server sent in the EHLO/HELO exchange; the default remains localhost.
Based on CL 5555045 by rsc.
Fixes#4219.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6946057
Details:
- This CL is the conceptual skeleton of code found in CL 6114046
- The garbage collector uses struct Obj to specify memory blocks
- scanblock() is putting found memory blocks into an intermediate buffer
(xbuf) before adding/flushing them to the main work buffer (wbuf)
- The main loop in scanblock() is replaced with a skeleton code that
in the future will be able to recognize the type of objects and
thus will improve the garbage collector's precision.
For now, all objects are simply sequences of pointers so
the precision of the garbage collector remains unchanged.
- The code plugs .gcdata and .gcbss sections into the garbage collector.
scanblock() in this CL is unable to make any use of this.
R=rsc, dvyukov, remyoudompheng
CC=dave, golang-dev, minux.ma
https://golang.org/cl/6856121
This CL breaks Go 1 API compatibility but it doesn't matter because
previous ListenUnixgram doesn't work in any use cases, oops.
The public API change is:
-pkg net, func ListenUnixgram(string, *UnixAddr) (*UDPConn, error)
+pkg net, func ListenUnixgram(string, *UnixAddr) (*UnixConn, error)
Fixes#3875.
R=rsc, golang-dev, dave
CC=golang-dev
https://golang.org/cl/6937059
Tests that here should be automatic retries if a database
driver's connection returns ErrBadConn on Begin. See
"TestTxErrBadConn" in sql_test.go
R=golang-dev
CC=golang-dev
https://golang.org/cl/6942050
This includes GORACE history_size and log_path flags.
R=golang-dev, bradfitz, rsc, remyoudompheng, minux.ma
CC=golang-dev
https://golang.org/cl/6947046
I've been writing some code which involves syncing files (like
rsync) and it became apparent that under Linux I could read
modification times (os.Lstat) with nanosecond precision but
only write them with microsecond precision. This difference
in precision is rather annoying when trying to discover
whether files need syncing or not!
I've patched syscall and os to increases the accuracy of of
os.Chtimes for Linux and Windows. This involved exposing the
utimensat system call under Linux and a bit of extra code
under Windows. I decided not to expose the "at" bit of the
system call as it is impossible to replicate under Windows, so
the patch adds syscall.Utimens() to all architectures along
with a ImplementsUtimens flag.
If the utimensat syscall isn't available (utimensat was added
to Linux in 2.6.22, Released, 8 July 2007) then it silently
falls back to the microsecond accuracy version it uses now.
The improved accuracy for Windows should be good for all
versions of Windows.
Unfortunately Darwin doesn't seem to have a utimensat system
call that I could find so I couldn't implement it there. The
BSDs do, but since they share their syscall implementation
with Darwin I couldn't figure out how to define a syscall for
*BSD and not Darwin. I've left this as a TODO in the code.
In the process I implemented the missing methods for Timespec
under Windows which I needed which just happened to round out
the Timespec API for all platforms!
------------------------------------------------------------
Test code: http://play.golang.org/p/1xnGuYOi4b
Linux Before (1000 ns precision)
$ ./utimetest.linux.before z
Setting mtime 1344937903123456789: 2012-08-14 10:51:43.123456789 +0100 BST
Reading mtime 1344937903123457000: 2012-08-14 10:51:43.123457 +0100 BST
Linux After (1 ns precision)
$ ./utimetest.linux.after z
Setting mtime 1344937903123456789: 2012-08-14 10:51:43.123456789 +0100 BST
Reading mtime 1344937903123456789: 2012-08-14 10:51:43.123456789 +0100 BST
Windows Before (1000 ns precision)
X:\>utimetest.windows.before.exe c:\Test.txt
Setting mtime 1344937903123456789: 2012-08-14 10:51:43.123456789 +0100 GMTDT
Reading mtime 1344937903123456000: 2012-08-14 10:51:43.123456 +0100 GMTDT
Windows After (100 ns precision)
X:\>utimetest.windows.after.exe c:\Test.txt
Setting mtime 1344937903123456789: 2012-08-14 10:51:43.123456789 +0100 GMTDT
Reading mtime 1344937903123456700: 2012-08-14 10:51:43.1234567 +0100 GMTDT
R=golang-dev, alex.brainman, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/6905057
TestDialTimeoutFDLeak will fail when system state somaxconn is
greater than expected fixed value.
Fixes#4384 (again).
R=fullung, dave, rsc
CC=golang-dev
https://golang.org/cl/6873069
Fixes#4467.
The syslog tests can fail if the timeout fires before the data arrives at the mock server. Moving the timeout onto the goroutine that is calling ReadFrom() and always processing the data returned before handling the error should improve the reliability of the test.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6920047
The code that was commented out was for the old regexp package.
In the new one the errors and the space of valid regexps are different.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6873063
Implementation is mostly identical to passing a non-negative int64 to
SetInt64, and calling Int64 with a non-negative value in the *Int.
Fixes#4389.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6929048
Also, implement a global OPTIONS * handler, like Apache.
Permit sending "*" requests to handlers, but not path-based
(ServeMux) handlers. That means people can go out of their
way to support SSDP or SIP or whatever, but most users will be
unaffected.
See RFC 2616 Section 5.1.2 (Request-URI)
See RFC 2616 Section 9.2 (OPTIONS)
Fixes#3692
R=rsc
CC=golang-dev
https://golang.org/cl/6868095
Can happen in both request and response.
Also use it in one place that wasn't.
Fixes#3997.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6903057
New in Go 1 will be nanosecond precision in the result of time.Now on Linux.
This will break code that stores time in external formats at microsecond
precision, reads it back, and expects to get exactly the same time.
Code like that can be fixed by using time.Now().Round(time.Microsecond)
instead of time.Now() in those contexts.
R=golang-dev, bradfitz, iant, remyoudompheng
CC=golang-dev
https://golang.org/cl/6903050
This changes the output of
rand.Seed(0)
perm := rand.Perm(100)
When giving the same seeds to Go 1.0 and Go 1.1 programs
I would like them to generate the same random numbers.
««« original CL description
math/rand: remove noop iteration in Perm
The first iteration always do `m[0], m[0] = m[0], m[0]`, because
`rand.Intn(1)` is 0.
fun note: IIRC in TAOCP version of this algorithm, `i` goes
backward (n-1->1), meaning that the "already" shuffled part of the
array is never altered betweens iterations, while in the current
implementation the "not-yet" shuffled part of the array is
conserved between iterations.
R=golang-dev
CC=golang-dev
https://golang.org/cl/6845121
»»»
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6905049
gotype can now handle much of the standard library.
- marked packages which have type checker issues
- this CL depends on CL 6846131
R=rsc
CC=golang-dev
https://golang.org/cl/6850130
Also:
- better handling of type assertions
- implemented built-in error type
- first cut at handling variadic function signatures
- several bug fixes
R=rsc, rogpeppe
CC=golang-dev
https://golang.org/cl/6846131
Per the curl man page, the http_proxy configuration can be
of the form:
[protocol://]<host>[:port]
And we had a test that <ip>:<port> worked, but if
the host began with a letter, url.Parse parsed the hostname
as the scheme instead, confusing ProxyFromEnvironment.
R=golang-dev
CC=golang-dev
https://golang.org/cl/6875060
Using append simplifies the code and makes it work if
the initial capacity of the slice is smaller than the
number of items pushed.
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/6869060
The first iteration always do `m[0], m[0] = m[0], m[0]`, because
`rand.Intn(1)` is 0.
fun note: IIRC in TAOCP version of this algorithm, `i` goes
backward (n-1->1), meaning that the "already" shuffled part of the
array is never altered betweens iterations, while in the current
implementation the "not-yet" shuffled part of the array is
conserved between iterations.
R=golang-dev
CC=golang-dev
https://golang.org/cl/6845121
64bit atomics are broken on 32bit systems. This is issue 599.
linux/arm builders all broke with this change, I am concerned that the other 32bit builders are silently impacted.
««« original CL description
net: fix data races on deadline vars
Fixes#4434.
R=mikioh.mikioh, bradfitz, dvyukov, alex.brainman
CC=golang-dev
https://golang.org/cl/6855110
»»»
R=rsc, mikioh.mikioh, dvyukov, minux.ma
CC=golang-dev
https://golang.org/cl/6852105
When a race happens inside of runtime (chan, slice, etc),
currently reports contain only user file:line.
If the line contains a complex expression,
it's difficult to figure out where the race exactly.
This change adds one more top frame with exact
runtime function (e.g. runtime.chansend, runtime.mapaccess).
R=golang-dev
CC=golang-dev
https://golang.org/cl/6851125
RFC 2616: "The 204 response MUST NOT include a message-body,
and thus is always terminated by the first empty line after
the header fields."
Previously we'd trigger chunked encoding by default on
responses, and then when finishing the request we'd write the
chunk trailers, which counted as a message-body.
Fixes#4454
R=golang-dev
CC=golang-dev
https://golang.org/cl/6782139
More lenient parsing with better error recovery.
It's easier for the type check to pick up the slack.
R=iant
CC=golang-dev
https://golang.org/cl/6856108
Test creates 2 tcp connections for put and get. Make sure
these are closed properly after test is over, otherwise
server hangs waiting for connection to be closed.
R=golang-dev, bradfitz, dave
CC=golang-dev
https://golang.org/cl/6842109
Update #4434.
The proposal attempts to reduce the number of places where fd,{r,w}deadline is checked and updated in preparation for issue 4434. In doing so the deadline logic is simplified by letting the pollster return errTimeout from netFD.Wait{Read,Write} as part of the wakeup logic.
The behaviour of setting n = 0 has been restored to match rev 2a55e349097f, which was the previous change to fd_unix.go before CL 6851096.
R=jsing, bradfitz, mikioh.mikioh, rsc
CC=fullung, golang-dev
https://golang.org/cl/6850110
A fix similar to CL 6859043 was effective in resolving the intermittent failure.
Fixes#4423.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6854102
This CL continues with introducing IPv6 scoped addressing capability
into the net package.
Update #4234.
R=rsc
CC=golang-dev
https://golang.org/cl/6842053
Package format is a utility package that takes care of
parsing, sorting of imports, and formatting of .go source
using the canonical gofmt formatting parameters.
Use go/format in various clients instead of the lower-level components.
R=r, bradfitz, dave, rogpeppe, rsc
CC=golang-dev
https://golang.org/cl/6852075
Garbage collection code (to be merged later) is calling functions
which have many local variables. This increases the probability that
the stack capacity won't be big enough to hold the local variables.
So, start gc() on a bigger stack to eliminate a potentially large number
of calls to runtime·morestack().
R=rsc, remyoudompheng, dsymonds, minux.ma, iant, iant
CC=golang-dev
https://golang.org/cl/6846044
The syslog implementation was not correctly implementing the
traditional syslog format because it had a confused notion of
'priority'. syslog priority is not a single number but is, in
fact, the combination of a facility number and a severity. The
previous Go syslog implementation had a single Priority that
appeared to be the syslog severity and no way of setting the
facility. That meant that all syslog messages from Go
programs appeared to have a facility of 0 (LOG_KERN) which
meant they all appeared to come from the kernel.
Also, the 'prefix' was in fact the syslog tag (changed the
internal name for clarity as the term tag is more widely used)
and the timestamp and hostname values were missing from
messages.
With this change syslog messages are generated in the correct
format with facility and severity combined into a priority,
the timestamp in RFC3339 format, the hostname, the tag (with
the PID in [] appened) and the message.
The format is now:
<PRI>1 TIMESTAMP HOSTNAME TAG[PID]: MSG
The TIMESTAMP, HOSTNAME and PID fields are filled in
automatically by the package. The TAG and the MSG are supplied
by the user. This is what rsyslogd calls TraditionalFormat and
should be compatible with multiple systems.
R=rsc, jgc, 0xjnml, mikioh.mikioh, bradfitz
CC=golang-dev
https://golang.org/cl/6782118
This CL defines the API. Implementation will come in follow-up CLs.
Update #1960.
R=bradfitz, dr.volker.dobler, rsc
CC=golang-dev
https://golang.org/cl/6849092
It's better to use IsValid() then checking a (possibly
partially set up) position against NoPos directly.
R=dsymonds
CC=golang-dev
https://golang.org/cl/6855099
Thanks to Dustin Sallings for exposing the most frustrating
bug ever, and for providing repro cases (which formed the
basis of the new tests in this CL), and to Dave Cheney and
Dmitry Vyukov for help debugging and fixing.
This CL depends on submited pollster CLs ffd1e075c260 (Unix)
and 14b544194509 (Windows), as well as unsubmitted 6852085.
Some operating systems (OpenBSD, NetBSD, ?) may still require
more pollster work, fixing races (Issue 4434 and
http://goo.gl/JXB6W).
Tested on linux-amd64 and darwin-amd64, both with GOMAXPROCS 1
and 4 (all combinations of which previously failed differently)
Fixes#4191
Update #4434 (related fallout from this bug)
R=dave, bradfitz, dsallings, rsc, fullung
CC=golang-dev
https://golang.org/cl/6851061