Before:
$ go list -f '{{range .Deps}}{{println $.Name .}}{{end}}' math time
math runtime
math unsafe
time errors
time runtime
time sync
time sync/atomic
time syscall
time unsafe
$
After:
$ go list -f '{{range .Deps}}{{println $.Name .}}{{end}}' math time
math runtime
math unsafe
time errors
time runtime
time sync
time sync/atomic
time syscall
time unsafe
$
R=minux.ma, rsc
CC=golang-dev
https://golang.org/cl/7130052
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
1. note that to use C.free <stdlib.h> must be included
2. can also extract errno from a void C function
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6935045
sizeof(Adr) from 24 bytes down to 20 bytes.
sizeof(Prog) from 84 bytes down to 76 bytes.
5l linking cmd/godoc statistics:
Before:
Maximum resident set size (kbytes): 106668
After:
Maximum resident set size (kbytes): 99412
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/7100059
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
Prog
* Remove the unused Prog* dlink
* note that align is also unused, but removing it does not help due to alignment issues.
Saves 4 bytes, sizeof(Prog): 84 => 80.
Sym
* Align {u,}char fields on word boundaries
Saves 4 bytes, sizeof(Sym): 136 => 132.
Tested on linux/arm and freebsd/arm.
R=minux.ma, remyoudompheng, rsc
CC=golang-dev
https://golang.org/cl/7106050
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
cmd/8g/gsubr.c: unreachable code
cmd/8g/reg.c: overspecifed class
cmd/dist/plan9.c: unused parameter
cmd/gc/fmt.c: stkdelta is now a vlong
cmd/gc/racewalk.c: used but not set
R=golang-dev, seed, rsc
CC=golang-dev
https://golang.org/cl/7067052
The FmtLong flag should only be used with the %D verb
when printing an ATEXT Prog. It was erroneously used
for every Prog except ADATA. This caused a preponderance
of exclamation points, "!!", in the assembly listings.
I also cleaned up the code so that the list.c files look
very similar. Now the real differences are easily spotted
with a simple diff.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7128045
For simplicity, only recognizes expressions of the exact form
"(x << a) | (x >> b)" where x is a variable and a and b are
integer constant expressions that add to x's bit width.
Fixes#4629.
$ cat rotate.c
unsigned int
rotate(unsigned int x)
{
x = (x << 3) | (x >> (sizeof(x) * 8 - 3));
return x;
}
## BEFORE
$ go tool 6c -S rotate.c
(rotate.c:2) TEXT rotate+0(SB),$0-8
(rotate.c:2) MOVL x+0(FP),!!DX
(rotate.c:4) MOVL DX,!!AX
(rotate.c:4) SALL $3,!!AX
(rotate.c:4) MOVL DX,!!CX
(rotate.c:4) SHRL $29,!!CX
(rotate.c:4) ORL CX,!!AX
(rotate.c:5) RET ,!!
(rotate.c:5) RET ,!!
(rotate.c:5) END ,!!
## AFTER
$ go tool 6c -S rotate.c
(rotate.c:2) TEXT rotate+0(SB),$0-8
(rotate.c:4) MOVL x+0(FP),!!AX
(rotate.c:4) ROLL $3,!!AX
(rotate.c:5) RET ,!!
(rotate.c:5) RET ,!!
(rotate.c:5) END ,!!
R=rsc, minux.ma
CC=golang-dev
https://golang.org/cl/7069056
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
The test case of issue 4585 was not passing due to
miscalculation of memequal args, and the previous fix
does not handle padding at the end of a struct.
Handling of padding at end of structs also fixes the case
of [n]T where T is such a padded struct.
Fixes#4585.
(again)
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7133059
Reference the 80386 compiler documentation now that the
documentation for the 68020 is offline.
R=golang-dev, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/7127053
sse2 is a more precise description of the requirement,
and it matches what people will see in, for example
grep sse2 /proc/cpuinfo # linux
sysctl hw.optional.sse2 # os x
R=golang-dev, dsymonds, iant
CC=golang-dev
https://golang.org/cl/7057050
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 peephole optimizer would keep hands off AX and X0 during returns, even though go doesn't return through registers.
R=dave, rsc
CC=golang-dev
https://golang.org/cl/7030046
Changeset f483bfe81114 moved ELF generation to the architecture
independent code and in doing so added a Section* to the Sym
type and an Elf64_Shdr* to the Section type.
This caused the Plan 9 compilers to complain about incompatible
type signatures in the many files that reference the Sym type.
R=rsc, dave
CC=golang-dev
https://golang.org/cl/7057058
Fixes#4186.
Back in the day, before the Go 1.0 release, $GOROOT was mandatory for building from source. Fast forward to now and $GOPATH is mandatory and $GOROOT is optional, and mainly used by those who use the binary distribution in uncommon places.
For example, most novices at least know about `sudo` as they would have used it to install the binary tarball into /usr/local. It is logical they would use the `sudo` hammer to `go get` other Go packages when faced with a permission error talking about the path they just had to use `sudo` on last time.
Even if they had read the documentation and set $GOPATH, go get will not work as expected as `sudo` masks most environment variables.
llucky(~) % ~/go/bin/go env | grep GOPATH
GOPATH="/home/dfc"
lucky(~) % sudo ~/go/bin/go env | grep GOPATH
GOPATH=""
This CL therefore proposes to remove support for using `go get` to download source into $GOROOT.
This CL also proposes an error when GOPATH=$GOROOT, as this is another place where new Go users can get stuck.
Further discussion: https://groups.google.com/d/topic/golang-nuts/VIg3fjHiHRI/discussion
R=rsc, adg, minux.ma
CC=golang-dev
https://golang.org/cl/6941058
The linker split PKGDEF into (prefix, name, def) pairs,
and defines def to begin after a space following the identifier.
This is totally wrong for the following export data:
func "".FunctionName()
var SomethingCompletelyUnrelated int
The linker would parse
name=`"".FunctionName()\n\tvar`
def=`SomethingCompletelyUnrelated int`
since there is no space after FunctionName.
R=minux.ma, rsc
CC=golang-dev
https://golang.org/cl/7068051
Our source no longer needs these flags set to build cleanly using clang.
Tested with
* Ubuntu clang version 3.0-6ubuntu3 (tags/RELEASE_30/final) (based on LLVM 3.0) on i386
* clang version 3.2 (tags/RELEASE_32/final) on amd64 cross compiling all platforms
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7058053
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
A constant node of type uintptr with a nil literal could
happen in two cases: []int(nil)[1:] and
uintptr(unsafe.Pointer(nil)).
Fixes#4614.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7059043
There exists a test case for this condition, but it only runs on unix systems, which neatly dovetails into the code always using ':' as the list separator.
R=adg, iant
CC=golang-dev
https://golang.org/cl/7057052
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
There's no b in race detector.
The new flag matches the one in the go command
(go test -race math).
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/7072043
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
This CL adds a flag parser that matches the semantics of Go's
package flag. It also changes the linkers and compilers to use
the new flag parser.
Command lines that used to work, like
8c -FVw
6c -Dfoo
5g -I/foo/bar
now need to be split into separate arguments:
8c -F -V -w
6c -D foo
5g -I /foo/bar
The new spacing will work with both old and new tools.
The new parser also allows = for arguments, as in
6c -D=foo
5g -I=/foo/bar
but that syntax will not work with the old tools.
In addition to matching standard Go binary flag parsing,
the new flag parser generates more detailed usage messages
and opens the door to long flag names.
The recently added gc flag -= has been renamed -complete.
R=remyoudompheng, daniel.morsing, minux.ma, iant
CC=golang-dev
https://golang.org/cl/7035043
More cleanup in preparation for fixing issue 4069.
This CL replaces the three nearly identical copies of the
asmb ELF code with a single asmbelf function in elf.c.
In addition to the ELF code movement, remove the elfstr
array in favor of a simpler lookup, and identify sections by
name throughout instead of computing fragile indices.
The CL also replaces the three nearly identical copies of the
genasmsym code with a single genasmsym function in lib.c.
The ARM linker still compiles and generates binaries,
but I haven't tested the binaries. They may not work.
R=ken2
CC=golang-dev
https://golang.org/cl/7062047
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
A few USED(xxx) additions and a couple of deletions of variable
initialisations that go unused. One questionable correction,
mirrored in 8l/asm.c, where the result of invocation of a function
shouldn't be used.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6736054
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
A new environment variable GO386 is introduced to choose between
code generation targeting 387 or SSE2. No auto-detection is
performed and the setting defaults to 387 to preserve previous
behaviour.
The patch is a reorganization of CL6549052 by rsc.
Fixes#3912.
R=minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6962043
Unnamed types like structs with embedded fields can have methods.
These methods are generated on-the-fly by the compiler and
it may happen for identical types in different packages.
The linker must accept these multiple definitions.
Fixes#4590.
R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/7030051
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
Before this CL, defining the variable worked fine, but then when
the implicit package-level init func was created, that caused a
name collision and a confusing error about the redeclaration.
Also add a test for issue 3705 (func init() needs body).
Fixes#4517.
R=ken2
CC=golang-dev
https://golang.org/cl/7008045
An error during the compilation can be more precise
than an error at link time.
For 'func init', the error happens always: you can't forward
declare an init func because the name gets mangled.
For other funcs, the error happens only with the special
(and never used by hand) -= flag, which tells 6g the
package is pure go.
The go command now passes -= for pure Go packages.
Fixes#3705.
R=ken2
CC=golang-dev
https://golang.org/cl/6996054
Ordinary variable load was assumed to be not worth saving,
but not if one of the function calls later might change
its value.
Fixes#4313.
R=ken2
CC=golang-dev
https://golang.org/cl/6997047
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
The patch makes the compile user an ordinary package-local
symbol for the name of embedded fields of builtin type.
This is incompatible with the fix delivered for issue 2687
(revision 3c060add43fb) but fixes it in a different way, because
the explicit symbol on the field makes the typechecker able to
find it in lookdot.
Fixes#3552.
R=lvd, rsc, daniel.morsing
CC=golang-dev
https://golang.org/cl/6866047
The typechecking code was doing an extra, unnecessary
indirection.
Fixes#4458.
R=golang-dev, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/6998051
remove zerostack compiler experiment; will do at link time instead
««« original CL description
cmd/gc: add GOEXPERIMENT=zerostack to clear stack on function entry
This is expensive but it might be useful in cases where
people are suffering from false positives during garbage
collection and are willing to trade the CPU time for getting
rid of the false positives.
On the other hand it only eliminates false positives caused
by other function calls, not false positives caused by dead
temporaries stored in the current function call.
The 5g/6g/8g changes were pulled out of the history, from
the last time we needed to do this (to work around a goto bug).
The code in go.h, lex.c, pgen.c is new but tiny.
R=ken2
CC=golang-dev
https://golang.org/cl/6938073
»»»
R=ken2
CC=golang-dev
https://golang.org/cl/7002051
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
A fatal error used to happen when escassign-ing a multiple
function return to a single node. However, the situation
naturally appears when using "go f(g())" or "defer f(g())",
because g() is escassign-ed to sink.
Fixes#4529.
R=golang-dev, lvd, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6920060
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
The OpenBSD ld.so(1) does not currently support PT_TLS and refuses
to load ELF binaries that contain PT_TLS sections. Do not emit PT_TLS
sections - we will handle this appropriately in runtime/cgo instead.
R=golang-dev, minux.ma, iant
CC=golang-dev
https://golang.org/cl/6846064
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
This is expensive but it might be useful in cases where
people are suffering from false positives during garbage
collection and are willing to trade the CPU time for getting
rid of the false positives.
On the other hand it only eliminates false positives caused
by other function calls, not false positives caused by dead
temporaries stored in the current function call.
The 5g/6g/8g changes were pulled out of the history, from
the last time we needed to do this (to work around a goto bug).
The code in go.h, lex.c, pgen.c is new but tiny.
R=ken2
CC=golang-dev
https://golang.org/cl/6938073
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