Specifically, remove simply where it is claiming that the
code or the action to be carried out is simple, since the
reader might disagree.
R=golang-dev, bradfitz, gri
CC=golang-dev
https://golang.org/cl/5637048
As a convenience to people working on the tools,
leave Makefiles that invoke the go dist tool appropriately.
They are not used during the build.
R=golang-dev, bradfitz, n13m3y3r, gustavo
CC=golang-dev
https://golang.org/cl/5636050
This is the same heuristic that build.ScanDir uses.
It avoids considering 'resource fork' files on OS X;
the resource for x.go is ._x.go.
R=gri
CC=golang-dev
https://golang.org/cl/5616073
Unexports runtime.MemStats and rename MemStatsType to MemStats.
The new accessor requires passing a pointer to a user-allocated
MemStats structure.
Fixes#2572.
R=bradfitz, rsc, bradfitz, gustavo
CC=golang-dev, remy
https://golang.org/cl/5616072
Passing the CGO_CFLAGS to cgo is required to make alternative include
directories work when building a cgo project.
R=rsc
CC=golang-dev
https://golang.org/cl/5635048
Multiplying by the low 32 bits was a bad idea
no matter what, but it was a particularly unfortunate
choice because those bits are 0 for small integer values.
Fixes#2883.
R=ken2
CC=golang-dev
https://golang.org/cl/5634047
Right now, GOTRACEBACK=0 means do not show any stack traces.
Unset means the default behavior (declutter by hiding runtime routines).
This CL makes GOTRACEBACK=2 mean include the runtime routines.
It avoids having to recompile the runtime when you want to see
the runtime in the tracebacks.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5633050
Zip files may actually store symlinks, and that's represented
as a file with unix flag S_IFLNK and with its data containing
the symlink target name.
The other flags are being supported too. Now that the os package
has the full range of flags in a system agnostic manner, there's
no reason to discard that information.
R=golang-dev, adg, rogpeppe
CC=golang-dev
https://golang.org/cl/5624048
- fix documentation for NewBuffer and NewBufferString
- document and implement behavior of Truncate on invalid lengths
Fixes#2837.
R=rsc, adg
CC=golang-dev
https://golang.org/cl/5637044
- eliminate local Error type (a historical artifact)
- fix documentation of CopyN
- fix documentation of WriteString
Fixes#2859.
R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5636046
This fix makes the goFilesPackage helper function print the errors from
package imports and exit similar to how the packagesForBuild function does.
Without this change, when invoking "go build *.go" with, for example,
an old import path, the following stack trace is generated:
panic: runtime error: invalid memory address or nil pointer dereference
goroutine 1 [running]:
go/build.(*Tree).PkgDir(...)
/opt/go/src/pkg/go/build/path.go:52 +0xfb
main.(*builder).action(...)
/opt/go/src/cmd/go/build.go:327 +0xb8
main.(*builder).action(...)
/opt/go/src/cmd/go/build.go:335 +0x208
main.runBuild(...)
/opt/go/src/cmd/go/build.go:129 +0x386
main.main()
/opt/go/src/cmd/go/main.go:126 +0x2d8
Fixes#2865.
R=rsc, dvyukov, r
CC=golang-dev
https://golang.org/cl/5624052
The practice encourages people to think this is the way to
create a bytes.Buffer when new(bytes.Buffer) or
just var buf bytes.Buffer work fine.
(html/token.go was missing the point altogether.)
R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/5637043
Flush stdout before writing to stderr, to avoid
reordering output.
Allow amd64 from uname -m (FreeBSD).
TBR=golang-dev
CC=golang-dev
https://golang.org/cl/5629051
goc2c moves here.
parallel builds like old makefiles (-j4).
add clean command.
add banner command.
implement Go version check.
real argument parsing (same as 6g etc)
Windows changes will be a separate CL.
R=golang-dev, bradfitz, iant
CC=golang-dev
https://golang.org/cl/5622058
Add // +build ignore to mkrunetype.c,
rename runetypebody to be .h since it is #included,
delete old runetypebody tables.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5627043
Thanks to Andrey Mirtchovski for tracking this down.
This was broken by CL 5528077 which removed the InsertSemis
flag from go/scanner - as a result, semicolons are now always
inserted and the respective indexer code checked for the
wrong token.
Replaced the code by a direct identifier test.
R=rsc
CC=golang-dev
https://golang.org/cl/5606065
The go- is redundant now that the directory is required
to be inside $GOROOT. Rob LGTMed the idea.
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5618044
This reduces the overhead necessary to work with OS-specific
file details, hides the implementation of FileStat, and
preserves the implementation-specific nature of Sys.
Expressions such as:
stat.(*os.FileInfo).Sys.(*syscall.Stat_t).Uid
fi1.(*os.FileStat).SameFile(fi2.(*os.FileStat))
Are now spelled as::
stat.Sys().(*syscall.Stat_t).Uid
os.SameFile(fi1, fi2)
R=cw, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/5448079
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
The change to -m is the only one necessary
to close the issue. The others are useful
to know about when debugging but shouldn't
be in the usage message since they may go
away or change at any time.
Fixes#2802.
R=lvd, rsc
CC=golang-dev
https://golang.org/cl/5606046
This patch adds a function to get the current cpu ticks. This is
deemed to be 'sufficiently random' to use to seed fastrand to mitigate
the algorithmic complexity attacks on the hash table implementation.
On AMD64 we use the RDTSC instruction. For 386, this instruction,
while valid, is not recognized by 8a so I've inserted the opcode by
hand. For ARM, this routine is currently stubbed to return a constant
0 value.
Future work: update 8a to recognize RDTSC.
Fixes#2630.
R=rsc
CC=golang-dev
https://golang.org/cl/5606048
- Unified bounary conditions for NFC and NFD and removed some indirections.
This enforces boundaries at the character level, which is typically what
the user expects. (NFD allows a boundary between 'a' and '`', for example,
which may give unexpected results for collation. The current implementation
is already stricter than the standard, so nothing much changes. This change
just formalizes it.
- Moved methods of qcflags to runeInfo.
- Swapped YesC and YesMaybe bits in qcFlags. This is to aid future changes.
- runeInfo return values use named fields in preperation for struct change.
- Replaced some left-over uint32s with rune.
R=r
CC=golang-dev
https://golang.org/cl/5607050
Without this change, fd3 can be collected by the garbage
collector and finalized, which causes the file descriptor to
be closed, which causes the call to os.Open to return 3 rather
than the expected descriptor number.
R=golang-dev, gri, bradfitz, bradfitz, iant
CC=golang-dev
https://golang.org/cl/5607056
The rule is that build directives can be preceded only
by blank lines and other line comments, not /* */ comments.
R=golang-dev, adg, bradfitz
CC=golang-dev
https://golang.org/cl/5619045
This is a minimal API extension, it makes it possible
to implement missing Int functionality externally w/o
compromising efficiency. It is the hope that this will
reduce the number of feature requests going directly
into the big package.
Also: Fixed some naming inconsistencies: The receiver
is only called z when it is also the result.
R=golang-dev, agl
CC=golang-dev
https://golang.org/cl/5607055
This will add the temporary object directory into the lookup
path so that cgo-exported function declarations may be
included from C files.
This was previously applied by CL 5600043, and apparently
removed by mistake on CL 5598045.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5610054
This can happen on Plan 9 if we we're building
with the 32-bit and 64-bit host compilers, one
after the other.
R=rsc
CC=golang-dev
https://golang.org/cl/5599053
Plan 9's tr(1) doesn't accept the C-style escapes
for tab and newline characters. I was going to use
the \xFF hexadecimal escapes but GNU tr(1) doesn't
accept those. It seems octal is the least common
denominator.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5576079
This can drastically reduce the number of system
calls made by programs that repeatedly query the
environment.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5599054
Ignore result of setting SO_BROADCAST.
Disable TestSimpleListenMulticastUDP as
setIPv4MulticastInterface is not implemented.
R=golang-dev, bradfitz, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/5610044
Print all the syntax errors. Fixes issue 2811.
Change Windows binary removal strategy.
This should keep the temporary files closer to
the binaries they are for, which will make it
more likely that the rename is not cross-device
and also make it easier to clean them up.
Fixes#2604 (as much as we can).
The standard build does not use the go command
to install the go command anymore, so issue 2604
is less of a concern than it originally was.
(It uses the go_bootstrap command to install
the go command.)
Buffer 'go list' output.
R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/5604048
Black box test is too time-consuming, as the bug
does not appear until Scan has processed 2 GB of
input in total across multiple calls, so no test.
Thanks to Frederick Mayle for the diagnosis and fix.
Fixes#2809.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5611043
Both are unused and undocumented.
InvalidConnError is also non-idiomatic: a FooError type can
typically describe something, else it would be an ErrFoo
variable.
R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/5609045
Do not treat $GOROOT/src/pkg, $GOROOT/src/cmd,
$GOPATH/src as package directories (only subdirectories
of those can be package directories). Fixes issue 2602.
Accept additional compiler and linker arguments during
cgo from $CGO_CFLAGS and $CGO_LDFLAGS, as the
Makefiles used to do.
Show failed pkg-config output. Fixes issue 2785.
Use different (perhaps better) git commands. Fixes issue 2109.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5605045
The type being unavailable on Windows was the only API
signature difference in the net package.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5608043
Print build errors to stderr during 'go run'.
Stream test output during 'go test' (no args). Fixes issue 2731.
Add go test -i to install test dependencies. Fixes issue 2685.
Fix data race in exitStatus. Fixes issue 2709.
Fix tool paths. Fixes issue 2817.
R=golang-dev, bradfitz, n13m3y3r, r
CC=golang-dev
https://golang.org/cl/5591045
The previous logic was mainly non-working. It only needs to
ensure that the go tool doesn't try to build the standard
library with gccgo.
R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/5580051
- enable AllMethods flag (default: not set)
- fix logic determining which methods to show
- added respective test case in testdata/e.go for AllMethods = false
- added test case set for AllMethods = true
The critical changes/files to look at are:
- testdata/e{0,1,2}.golden: T4.M should only show up as method of T5 in e2.golden
- reader.go: always include top-level methods, and negate former logic for embedded methods
(rewrote as a switch for better comprehensability)
Fixes#2791.
R=rsc, rsc
CC=golang-dev
https://golang.org/cl/5576057
This fixes some test noise in TestStressSurpriseServerCloses when
ulimit -n something low, like 256 on a Mac.
Previously, when the server closed on us and we were expecting more
responses (like we are in that test), we'd read an "Unexpected EOF"
and just forget about the client's net.Conn. Now it's closed,
rather than waiting on the finalizer to release the fd.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5602043
I missed an overflow in contract because I suspected that the prime
elimination would take care of it. It didn't, and I forgot to get back
to the overflow. Because of this, p224Contract may have produced a
non-minimal representation, causing flakey failures ~0.02% of the
time.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5592045
This CL introduces new function ListenMulticastUDP to fix
multicast UDP listening across multiple listeners issue,
to replace old multicast methods JoinGroup and LeaveGroup
on UDPConn.
This CL also enables multicast testing by default.
Fixes#2730.
R=rsc, paul.a.lalonde, fullung, devon.odell
CC=golang-dev
https://golang.org/cl/5562048
We support SSLv3 as a server but not as a client (and we don't want to
support it as a client). This change fixes the error message when
connecting to an SSLv3 server since SSLv3 support on the server side
made mutualVersion accept SSLv3.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5545073
5l -v is for benchmarking various parts of the loader, but this code in
obj.c will clutter the output. I only comment them out, because this is
on par with 8l/6l.
R=golang-dev
CC=golang-dev
https://golang.org/cl/5600046
A go build currently generates around 400MB of test output prior to
cleaning up. With this change we use a maximum of ~15MB.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5588044
Ensure that file descriptors have not already been leaked into our
environment - close any that are open at the start of the
TestExtraFiles test.
Also use the appropriate command for listing open files.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5574062
This patch adds a hash seed to the Hmap struct. Each seed is
initialized by runtime.fastrand1(). This is the first step of a
solution to issue 2630. Fastrand1 still needs to be updated to provide
us with actually random bits.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5599046
The new cross-compiling bin target was breaking
everything but the system where buildscript.sh ran.
TBR=golang-dev
CC=golang-dev
https://golang.org/cl/5598055
Consequently, remove many package Makefiles,
and shorten the few that remain.
gomake becomes 'go tool make'.
Turn off test phases of run.bash that do not work,
flagged with $BROKEN. Future CLs will restore these,
but this seemed like a big enough CL already.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5601057
Add 'go clean'.
Make 'go build' write to pkgname, not a.out.
Make 'go test -c' write to pkgname.test, not test.out.
Make 'go install' write alternate binaries to .../bin/goos_goarch/.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5600048
We weren't properly deleting the various header
files (that were temporarily renamed) if a $CC
for the current $GOARCH didn't exist. And since
the compiler checks the current directory for
headers before any -I arguments, this had the
unfortunate side effect of including the last
generated headers instead of the correct ones.
R=r, rsc
CC=golang-dev
https://golang.org/cl/5581055
Also delete gotest, since it's messy to fix and slated for deletion anyway.
A couple of things outside src can't be tested any more. "go test" will be
fixed and these tests will be re-enabled. They're noisy for now.
Fixes#284.
R=rsc
CC=golang-dev
https://golang.org/cl/5598049
If set, all methods are shown, not just those
of non-exported anonynous fields.
This change will only become functional once
CL 5576057 is submitted.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5599048
This fixes a regression that was made when adding
support for building with gccgo (in d6a14e6fac0c).
External commands (those not from the Go tree) were
being installed to the package directory instead of
the binary directory.
R=golang-dev, rsc, adg, remyoudompheng, rsc
CC=golang-dev
https://golang.org/cl/5564072
This will add the temporary object directory into the lookup
path so that cgo-exported function declarations may be
included from C files.
R=golang-dev, rogpeppe, rsc
CC=golang-dev
https://golang.org/cl/5600043
Cookies recieved in a response to a POST request are stored
in the client's jar like they are for GET requests.
R=golang-dev, rsc
CC=bradfitz, golang-dev
https://golang.org/cl/5576065
fix, vet
yacc is also fixed (it was wrong before)
All that's left is the commands used during compilation
This looks like a huge CL, but it's almost all file renames.
The action is in cmd/go/pkg.go, the Makefiles, and .../doc.go.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5595044
If the argument to go fix isn't a package directory, the message said nothing helpful.
Now it at least says a package couldn't be found.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5577072
1) create go-tool dir in make.bash
2) clean up stale binaries in make.bash
3) add 'tool' command to go
4) convert goyacc->yacc as a first test tool
Since goyacc stands alone, it's a safe trial.
R=rsc
CC=golang-dev
https://golang.org/cl/5576061
They're not portable, and pkg os is supposed to be portable.
Fixes#2562
R=golang-dev, mikioh.mikioh, r, n13m3y3r, rsc
CC=golang-dev
https://golang.org/cl/5574078
Added flag AllMethods: if not set (future default), embedded
methods of exported (and thus visible) embedded fields are not
shown in the final package documentation
The actual change for AllMethods is just in sortedFuncs. All
other changes are simplifications of the existing logic (mostly
deletion of code): Because method conflicts due to embedding
must always be detected, remove any premature elimination of
types and methods. Instead collect all named types and all
methods and do the filtering at the end.
Miscellaneous:
- renamed baseType -> namedType
- streamline logic for recording embedded types
- record embedded types via a map (simpler data structures)
AllMethods is set by default; so the output is unchanged and
the tests pass. The next CL will enable the AllMethods flag
and have adjusted tests (and fix issue 2791).
R=rsc
CC=golang-dev
https://golang.org/cl/5572076
The use of gccgo is triggered by GC=gccgo in environment. It
still needs the standard distribution to behave properly, but
allows using the test, build, run, install subcommands with
gccgo.
R=rsc, iant, fullung
CC=golang-dev, remy
https://golang.org/cl/5562045
+eliminates a possibility of sending a call to Done several times.
+fixes memory leak in case of temporal Write errors.
+fixes data race on Client.shutdown.
+fixes data race on Client.closing.
+fixes comments.
Fixes#2780.
R=r, rsc
CC=golang-dev, mpimenov
https://golang.org/cl/5571063
This solves the ambiguity for "lp.net/project/foo". In these URLs,
"foo" could be a series name registered in Launchpad with its own
branch, and it could also be the name of a directory within the
main project branch one level up.
Solve it by testing if the series branch exists in Launchpad
and if it doesn't moving the root one level up.
R=rsc
CC=golang-dev
https://golang.org/cl/5577058
The new url.URL's parsing can be too canonicalizing for
certain applications. By keeping the original request URI
around, we give applications a gross escape hatch while
keeping the URL package clean and simple for normal uses.
(From a discussion with Gary Burd, Gustavo Niemeyer,
and Russ Cox.)
Fixes#2782
R=golang-dev, rsc, dsymonds
CC=golang-dev
https://golang.org/cl/5580044
It means serious user error that can lead to
hard to debug issues under load, log entry
will not harm.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5574075
The idea is that we add files to the api/ directory which
are sets of promises for the future. Each line in a file
is a stand-alone feature description.
When we do a release, we make sure we haven't broken or changed
any lines from the past (only added them).
We never change old files, only adding new ones. (go-1.1.txt,
etc)
R=dsymonds, adg, r, remyoudompheng, rsc
CC=golang-dev
https://golang.org/cl/5570051
Separating Method from Func made the code only more complicated
without adding much to the useability/readability of the API.
Reverted to where it was, but leaving the new method-specific
fields Orig and Level.
Former clients (godoc) of doc.Method only used the Func fields;
and because Func was embedded, no changes are needed with respect
to the removal of Method.
Changed type of Func.Recv from ast.Expr to string. This was a
long-standing TODO. Also implemented Func.Orig field (another TODO).
No further go/doc API changes are expected for Go 1.
R=rsc, r, r
CC=golang-dev
https://golang.org/cl/5577043
This improves the handling of xml.Unmarshal in
the xmlapi fix by guessing some of the common
types used on it.
This also fixes a bug in the partial typechecker.
In an expression such as f(&a), it'd mark a as
having &T rather than *T.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5572058
Pulling function calls out to happen before the
expression being evaluated was causing illegal
reorderings even without inlining; with inlining
it got worse. This CL adds a separate ordering pass
to move things with a fixed order out of expressions
and into the statement sequence, where they will
not be reordered by walk.
Replaces lvd's CL 5534079.
Fixes#2740.
R=lvd
CC=golang-dev
https://golang.org/cl/5569062
Added a cache to compensate for extra call overhead.
go test -bench=Print marginally faster (in the noise).
R=r
CC=golang-dev
https://golang.org/cl/5574061
The implementation is divided into 4 phases:
1) export filtering of an incoming AST if necessary (exports.go)
2) reading of a possibly filtered AST (reader.go: type reader)
3) method set computation (reader.go)
4) sorting and creation of final documentation (reader.go)
In contrast to the old implementation, the presentation data
(Names, Docs, Decls, etc.) are created immediately upon reading
the respective AST node. Also, all types are collected (embedded
or not) in a uniform way.
Once the entire AST has been processed, all methods and types
have been collected and the method sets for each type can be
computed (phase 3).
To produce the final documentation, the method sets and value
maps are sorted.
There are no API changes. Passes the existing test suite unchanged.
R=rsc, rogpeppe
CC=golang-dev
https://golang.org/cl/5554044
Reimplement the test based on code from adg@golang.org.
The previous version has a race since the file is closed via defer
rather than in the go routine. This meant that the file could be
closed before the go routine has actually received io.EOF. It then
receives EBADF and continues to do zero-byte writes to the pipe.
This addresses an issue seen on FreeBSD and OpenBSD, where the test
passes but exits with a SIGPIPE, resulting in a failure.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5554083
Without this change it's possible to launch godoc,
immediately GET /, and see a directory listing instead of root.html
R=gri
CC=golang-dev
https://golang.org/cl/5575054
work in progress, and we are not ready to freeze its API for Go 1.
Package html still exists, containing just two functions: EscapeString
and UnescapeString.
Both the packages at exp/html and html are "package html". The former
is a superset of the latter.
At some point in the future, the exp/html code will move back into
html, once we have finalized the parser API.
R=rsc, dsymonds
CC=golang-dev
https://golang.org/cl/5571059
Marshaler has a number of open areas that need
further thought (e.g. it doesn't handle attributes,
it's supposed to handle tag names internally but has
no information to do so, etc).
We're removing it now and will bring it back with an
interface that covers these aspects, after Go 1.
Related to issue 2771, but doesn't fix it.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5574057
In order to allow buildscript.sh to generate buildscripts for all
$GOOS/$GOARCH combinations, we have to generate dummy files for cmd/go.
Fixes#2586.
R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/5557050
Also, add an explicit error type when the right hand side is an unexported
function.
R=golang-dev, gri, rogpeppe, agl, rsc
CC=golang-dev
https://golang.org/cl/5564048
Includes gofix module. The only case not covered should be
xml.Unmarshal, since it remains with a similar interface, and
would require introspecting the type of its first argument
better.
Fixes#2626.
R=golang-dev, rsc, gustavo
CC=golang-dev
https://golang.org/cl/5574053
CL 5572043 removed the last uses of this field.
The information is readily available from Type.Decl.
R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/5570049
The bitLen function currently shifts out blocks of 8 bits at a time.
This change replaces this sorta-linear algorithm with a log(N)
one (shift out 16 bits, then 8, then 4, then 2, then 1).
I left the start of it linear at 16 bits at a time so that
the function continues to work with 32 or 64 bit values
without any funkiness.
The algorithm is similar to several of the nlz ("number of
leading zeros") algorithms from "Hacker's Delight" or the
"bit twiddling hacks" pages.
Doesn't make a big difference to the existing benchmarks, but
I'm using the code in a different context that calls bitLen
much more often, so it seemed worthwhile making the existing
codebase faster so that it's a better building block.
Microbenchmark results on a 64-bit Macbook Pro using 6g from weekly.2012-01-20:
benchmark old ns/op new ns/op delta
big.BenchmarkBitLen0 4 6 +50.12%
big.BenchmarkBitLen1 4 6 +33.91%
big.BenchmarkBitLen2 6 6 +3.05%
big.BenchmarkBitLen3 7 6 -19.05%
big.BenchmarkBitLen4 9 6 -30.19%
big.BenchmarkBitLen5 11 6 -42.23%
big.BenchmarkBitLen8 16 6 -61.78%
big.BenchmarkBitLen9 5 6 +18.29%
big.BenchmarkBitLen16 18 7 -60.99%
big.BenchmarkBitLen17 7 6 -4.64%
big.BenchmarkBitLen31 19 7 -62.49%
On an ARM machine (with the previous weekly):
benchmark old ns/op new ns/op delta
big.BenchmarkBitLen0 37 50 +36.56%
big.BenchmarkBitLen1 59 51 -13.69%
big.BenchmarkBitLen2 74 59 -20.40%
big.BenchmarkBitLen3 92 60 -34.89%
big.BenchmarkBitLen4 110 59 -46.09%
big.BenchmarkBitLen5 127 60 -52.68%
big.BenchmarkBitLen8 181 59 -67.24%
big.BenchmarkBitLen9 78 60 -23.05%
big.BenchmarkBitLen16 199 69 -65.13%
big.BenchmarkBitLen17 91 70 -23.17%
big.BenchmarkBitLen31 210 95 -54.43%
R=golang-dev, dave, edsrzf, gri
CC=golang-dev
https://golang.org/cl/5570044