Currently performance builders crash with:
hg log: unmarshal Mercurial log: XML syntax error on line 4991: illegal character code U+001B
R=adg
CC=golang-codereviews
https://golang.org/cl/110060046
Really two fixes: Don't panic on bad instructions and don't complain about commented out instructions.
LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/110070044
+ regression test.
Fixesgolang/go#8172
Also: return error (not panic) when called with empty input.
LGTM=gri
R=crawshaw, gri
CC=golang-codereviews, jon
https://golang.org/cl/104270043
Also:
- increase sparsity of sets in benchmarks.
- removed TODO in forEach. Subword masks had no benefit.
- minor cleanup.
LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/103470049
Clients such as compilers need this information in order
to correctly link against imported packages.
This also adds support for the condensed import data format
where the priority information is stored as a suffix of the
condensed import data, as well as support for archive files.
LGTM=gri
R=gri
CC=golang-codereviews, iant
https://golang.org/cl/78740043
"PATH" and "path" are one and the same environment variable
on windows. We set PATH variable, while "path" is set to its
original value. Windows might use either for the sub-process.
LGTM=adg
R=golang-codereviews, adg
CC=golang-codereviews
https://golang.org/cl/109980043
Bare init functions omit calls to dependent init functions and the
use of an init guard. They are useful in cases where the client uses
a different calling convention for init functions, or cases where
it is easier for a client to analyze bare init functions.
LGTM=adonovan
R=adonovan
CC=golang-codereviews, iant
https://golang.org/cl/78780043
This reduces solver time by about 40%.
See hvn.go for detailed description.
Also in this CL:
- Update package docs.
- Added various global opt/debug options for maintainer convenience.
- Added logging of phase timing.
- Added stdlib_test, disabled by default, that runs the analysis
on all tests in $GOROOT.
- include types when dumping solution
LGTM=crawshaw
R=crawshaw, dannyb
CC=golang-codereviews
https://golang.org/cl/96650048
New invariant: all user-defined objects have an associated package.
Added a check of this invariant to stdlib_test.
LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/104170043
Previously, statements such as:
type T struct { a, b int }
[...]
x = T{}
x = T{b: 1}
would only affect the aggregate members mentioned in the composite
literal and leave the other members unchanged. This change causes us
to write a zero value to the target in cases where the target is not
already known to hold a zero value and the number of initializers in
the composite literal differs from the number of elements in its type.
Author: Peter Collingbourne. (hg clpatch got confused)
LGTM=pcc
R=pcc
CC=golang-codereviews
https://golang.org/cl/107980045
This fixes an issue where Firefox users can't ctrl-tab out to switch
to other tabs when using the playground.
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/106020043
Godoc depends on this package.
Packages that use unsafe cannot be deployed to App Engine.
Packages that use reflect can.
This package needn't use unsafe, so don't.
LGTM=adonovan, rsc
R=rsc, adonovan
CC=golang-codereviews
https://golang.org/cl/105960043
This is a common source of bugs, particularly for those new to Go. Running this on a corpus of public code flagged 114 instances.
This check may need to be updated once issue 7363 is resolved.
LGTM=r
R=golang-codereviews, r
CC=bradfitz, golang-codereviews
https://golang.org/cl/91010047
Also, define ssa:wrapnilchk intrinsic to check and gracefully
fail when a T method is dynamically invoked via a nil *T receiver.
+ Test.
A follow-up CL will add another intrinsic, ssa:memclr.
+ minor cleanups.
LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/101170044
It is easier for clients to recover from panics if the recover block
is always present. Otherwise, the client has to work around the lack
of a recover block by synthesizing a zero value return.
LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/87210044
Before, Load() would just fail. Now, it gathers all frontend
errors (not just the first go/types error) in PackageInfo.Errors.
There are still cases where Load() can fail hard, e.g. errors in x_test.go
files. That case is trickier to fix and remains a TODO item.
Also, make godoc display all scanner/parser/type errors in the source view.
LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/108940043
In command godoc, set IndexEnabled when the -write_index flag is set.
Previously you would need to (unintuitively) set the -http flag to
achieve this.
In package godoc, set up the FS tree before loading the index, and
then return before starting the index refresh loop. Previously the
index would be loaded and then immediately refreshed, negating the
benefits of the on-disk index.
TBR=bradfitz
R=golang-codereviews
CC=golang-codereviews
https://golang.org/cl/103370046
This removes much of the AST logic out of main.go,
and makes it easier to build custom vet binaries
The trade-off in this change is for flexibility.
There's very little change in the per-check files,
a lot less code in main.go (specifically the AST walking
logic has shrunk), and it makes it much easier to build
custom vet binaries simply by dropping new source files
in the directory.
LGTM=josharian, r
R=r, josharian, kamil.kisiel
CC=golang-codereviews
https://golang.org/cl/83400043
This code was moved to a throttle method on Corpus but I guess it was
never deleted.
LGTM=crawshaw
R=golang-codereviews, crawshaw
CC=golang-codereviews
https://golang.org/cl/102350043
Blocks dominated by "if false" should be retained in the
initial SSA form so they remain visible to subsequent source
code analysis tools.
In any case, true compilers already need a stronger version of
this optimization so they can simplify CFGs such as this:
const x, y = ...
switch x {case y:...}
where a branch is constant but the comparison of constants
does not occur within an expression.
LGTM=gri
R=gri
CC=golang-codereviews, pcc
https://golang.org/cl/101250043
The SSA builder shouldn't be in the business of
interprocedural optimization, especially in the presence of
concurrency.
This causes the instruction count to increase by 0.03%.
LGTM=gri
R=gri, pcc
CC=golang-codereviews
https://golang.org/cl/105020045
It was making the unsound assumption that cgn==nil => v is one
of {Global,Function,Const,Capture} to avoid checking v's type,
which is what it now does. This caused more expensive
constraints to be generated, which is suboptimal though not
wrong exactly.
In one benchmark, this change reduces the number of complex
constraints by about 23% of loads and 53% of stores, and
increases the number of (simple) copy constraints by about 5%.
LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/106940043
Files that import "C" are not valid Go source files and
require preprocessing. Until now, the loader has simply
hard-coded CGO_ENABLED=0 (in effect) which causes go/build to
use build tags select pure Go implementations where they exist
(e.g. in $GOROOT). Where they don't (e.g. arbitrary user
code) this leads to masses of spurious type errors.
(Reported by Guillaume Charmes, private correspondence.)
This change causes the loader to invoke the cgo preprocessor
on such files and to load the preprocessed files instead,
using the original names. This means that the syntax offset
position information is garbage, although thanks to //line
directives, the line numbers at least should be good.
See comment in cgo.go for details.
This CL changes the loader's default behaviour and may make it slower.
CGO_ENABLED=0 enables the old behaviour.
Tested via stdlib_test, which now loads all standard packages
using cgo, and also exercises CGO_ENABLED=0 for "net" and "os/user".
LGTM=gri
R=gri, rsc
CC=golang-codereviews, guillaume.charmes
https://golang.org/cl/86140043
Also:
- extend Parent() to all Values and add to interface:
(Builtin/Const/Global => nil; Function => Enclosing)
- hide Function.Enclosing since it's now redundant wrt Parent()
- make (*Function).String robust for synthetics without pkg object
LGTM=gri
R=gri
CC=golang-codereviews, khr
https://golang.org/cl/87580044