- pre-poluate typIndex and typList using a predefined list of types
- no need to handle basic types explicitly anymore
- removed basicTag
- go/types: exported UniverseByte and UniverseRune for now
LGTM=adonovan
R=adonovan
CC=cmang, golang-codereviews
https://golang.org/cl/65920044
benchcmp now preserves benchmark order. This restores the original
misc/benchcmp behavior. This also makes the output of benchcmp stable,
and groups together multiple -cpu results.
Magnitude-based sorting is still available via the -mag flag.
It is useful for surfacing items of note (particularly changes
in allocs) when making compiler changes and running broad
benchmarks.
Fixesgolang/go#7259.
LGTM=dave
R=dave, mtj
CC=bradfitz, dvyukov, golang-codereviews
https://golang.org/cl/60840045
If this flag is set, (*Config).Load will not return an
error even if some packages had type errors. Each individual
PackageInfo can be queried for its error state, now exposed as
TypeError.
In addition, each PackageInfo exposes whether it is
"transitively error-free". ssa.Create skips packages without
this flag since it is required for SSA construction.
+ Test.
LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/62000045
Observation: not all alias facts are interesting.
- A channel-peers query also cares about pointers of kind chan.
- An oracle "points-to" query on an expression of kind map
only cares about maps.
- We always care about func, interface and reflect.Value,
since they're needed for sound analysis of dynamic dispatch.
We needn't bother collecting alias information for
uninteresting pointers, and this massively reduces the number
of labels flowing in to the constraint system.
The only constraints that create new labels are addressOf
and offsetAddr; both are now selectively emitted by type.
We compute the set of type kinds to track, based on the
{Indirect,}Query types. (We could enable tracking at an
even finer grain if we want.)
This requires that we can see all the {Indirect,}Query
value types a priori, which is not the case for the PrintCalls
mechanism used in the tests, so I have rewritten the latter
to use {Indirect,}Query instead.
This reduces the solver-phase time for the entire standard
library and tests from >8m to <2m. Similar speedups are
obtained on small and medium-sized programs.
Details:
- shouldTrack inspects the flattened form of a type to see if
it contains fields we must track. It memoizes the result.
- added precondition checks to (*Config).Add{,Indirect}Query.
- added (*ssa.Program).LookupMethod convenience method.
- added Example of how to use the Query mechanism.
- removed code made dead by a recent invariant:
the only pointerlike Const value is nil.
- don't generate constraints for any functions in "reflect".
(we had forgotten to skip synthetic wrappers too).
- write PTA warnings to the log.
- add annotations for more intrinsics.
LGTM=gri, crawshaw
R=crawshaw, gri
CC=golang-codereviews
https://golang.org/cl/62540043
Method Signatures (types.Signatures with a non-nil receiver) behave
like ordinary func Signatures in the hash function/equivalence relation
used by typemap.M, which leads to surprising incomplete traversal
over the type graph if an M is used to remember types already
visited.
This change avoids ever putting method Signatures in a typemap.
% go test -v code.google.com/p/go.tools/go/ssa
now repeatedly shows the exact same number of functions and
instructions.
(We should discuss how to avoid this problem more generally.)
Also:
- recur over the params/results of all the methods of
each type when computing necessary method sets.
- there's no longer any need to treat declarations of unexported
methods as a root for traversal. Added test case.
- enable SourceImports flag in stdlib_test, which was dropped
during a recent refactoring (d'oh).
- doc tweaks
LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/65450043
This CL adds no-op stubs for intrinsics now required by tests:
runtime.Goexit
sync.runtime_Sem{acquire,release}
sync/atomic.AddUint{32,64}
Goexit needs more thought; for now I've disabled the interpreted
tests of the "testing" package to make the build green again.
TBR=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/65480044
Allow builder owners to set CGO_ENABLED to override the logic in cmd/go
LGTM=minux.ma, adg
R=golang-codereviews, minux.ma, adg
CC=golang-codereviews
https://golang.org/cl/63570046
It will save a lot of time for slow builders running on slow SD cards.
LGTM=dave, adg
R=golang-codereviews, dave, adg
CC=golang-codereviews
https://golang.org/cl/63550043
These are the simplest possible descriptions of each command.
They may be fleshed out later.
Fixesgolang/go#7298.
LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/61480044
Don't say the word "fork" (not accurate), and remove the
tab/comment flags that were removed from gofmt.
LGTM=adg
R=golang-codereviews, adg
CC=golang-codereviews
https://golang.org/cl/61410052
- Add math.{Log,Ldexp} to externals
- Test now uses FromArgs
- Scan all initial packages for tests, don't assume Created[0] exists.
(It doesn't if we import a package that has only in-package tests.)
LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/62010044
Previously, each word could be a package import path or a
comma-separated list of *.go file names. Now, if the
first word ends with ".go", all words are assumed to be
Go source files. This makes it impossible to specify
two ad-hoc packages from source files, but no-one needs that.
FromArgs also takes a boolean indicating whether tests
are wanted or not.
Also: ssadump: add -test flag to set that boolean.
For the oracle it's always true.
LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/61470047
Method-set caching is now performed externally using a MethodSetCache (if desired), not by the Types themselves.
This a minor deoptimization due to the extra maps, but avoids a situation in which method-sets are computed and frozen prematurely. (See b/7114)
LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/61430045
Move mutation of program to the final step.
+ 2 assertions;
+ switches.go: comment fix.
LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/61510044
Because goimports also sorts stdlib-vs-external differently
(whereas gofmt just sorts string-wise), we need to put a blank
line between imports of different classes. This happened in
some cases, but not all.
Fixesgolang/go#7132
LGTM=kamil.kisiel
R=golang-codereviews, kamil.kisiel
CC=golang-codereviews
https://golang.org/cl/60870047
Special case for (fake) package builtin: don't associate
any constant, variable, or factory function with a type.
Fixesgolang/go#6645.
LGTM=bgarcia
R=bgarcia, r, bradfitz
CC=golang-codereviews
https://golang.org/cl/54820044
The "static bool" parameter to Implements was confusing; typically we think about interface implementation and type assertion as separate but related concepts, but here they were merged.
LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/58540044
This is intended to replace the awk-based misc/benchcmp.
It mostly matches the existing misc/benchcmp.
Notable changes:
* Written in Go.
* Minor whitespace changes in the output; the tabular nature of the
output is preserved, as is most number formatting and verbiage.
* Comparisons within each section are sorted from highest change to lowest.
* Proper handling of multiple benchmarks with the same name (issue 7016).
* Does not omit benchmark comparisons for which the new value is zero.
* Adds -changed flag to only show benchmarks whose value have changed.
Useful for memory-oriented, large-scale benchmark comparisons.
* Has tests.
* Formats small ns measurements with extra precision.
Updates golang/go#7016.
LGTM=r
R=golang-codereviews, dave, dvyukov, oleku.konko, bradfitz, gobot, r
CC=golang-codereviews
https://golang.org/cl/47980043
- Centralize "visited" check in check.objDecl.
- Assert that object-specific declX functions
are only called with objects that have no
type associated with them, yet.
- Added test case.
Thanks to Richard Musiol (neelance@gmail.com) for
finding the bug and providing an easy test case.
For a discussion of the bug see the issue.
Fixesgolang/go#7245.
TBR=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/59210043
Fix output of packages with multiple files.
Remove extra output when filter is requested.
Fixesgolang/go#7115.
R=bradfitz, adg
CC=golang-codereviews
https://golang.org/cl/52750044
- consistently set underlying types of incoming named types in typInternal
- use underlying() helper function to resolve forward chains
- related consistency cleanups
LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/53870044
This is (a) more efficient and (b) avoids the need for
constant error handling, since buffer writes can't fail.
Also:
- added WriteFunction and WritePackage functions,
similar to types.WriteFoo.
- *Function and *Package now implement io.WriterTo.
LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/57930044
This results in significant improvement to type-checking time:
it reduces by 4% the entire running time of ssa/stdlib_test
(GOMAXPROCS=8, n=7).
LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/57770043