1
0
mirror of https://github.com/golang/go synced 2024-11-07 15:36:23 -07:00
Commit Graph

599 Commits

Author SHA1 Message Date
Russ Cox
5785dc19d7 godoc: redirect bogus /doc/spec links to /ref/spec
It was not enough to make /ref/spec work (which it now does),
because some of the docs on golang.org (in particular golang.org/doc)
are pulled from tip, and tip links to /doc/spec now.
Make those "too new" links work by redirecting /doc/spec
back to /ref/spec for now.

TBR=adg
CC=golang-dev
https://golang.org/cl/14348043
2013-10-03 13:41:38 -04:00
Russ Cox
c11b695c55 go.tools/godoc: remove Go 1.2 redirects
They are breaking golang.org
(try loading golang.org/ref/spec).

TBR=adg
CC=golang-dev
https://golang.org/cl/14165044
2013-10-03 13:16:17 -04:00
Andrew Gerrand
dcad628c68 go.tools/cmd/blog: handle "/blog/" redirect properly
The redirect.PrefixHandler redirects "/foo/" to "/foo", which is what
we want in most cases ("/cl/", "/change/", etc) but not here.
So wrap it with a handler that handles "/blog/" explictly.

R=dsymonds
CC=golang-dev
https://golang.org/cl/14326043
2013-10-03 18:10:57 +10:00
Andrew Gerrand
228e3cbbaa go.tools/blog: remove playground package import
This is the responsibility of the godoc or blog binary,
not the blog package.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/14323043
2013-10-03 15:07:29 +10:00
Andrew Gerrand
3a3a765782 go.tools/cmd/godoc: fix app engine version; update build script and readme
R=golang-dev, dsymonds, bradfitz
CC=golang-dev
https://golang.org/cl/12897045
2013-10-03 14:29:16 +10:00
Russ Cox
1d95d02fef go.tools/cmd/godoc: point at doc.ToHTML documentation for formatting rules
Fixes golang/go#5429.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/14292043
2013-10-02 22:08:24 -04:00
Robert Griesemer
b9b3bed16e go.tools/go/types: fix build (gc export format changed)
Revision f280b8a485fd of the std library changed the
gc export format: anonymous fields may be qualified
with a package.

R=rsc
TBR=rsc
CC=golang-dev
https://golang.org/cl/14312043
2013-10-02 16:53:34 -07:00
Chris Manghane
63365376db go.tools/dashboard: Don't keep unversioned directories in gcc copy.
`svn update` would fail if the updated files were in the gcc/libgo or gcc/go/gofrontend because unrevisioned versions of those files had been inserted in the last build of gcc.

R=adg, adg
CC=golang-dev
https://golang.org/cl/14299043
2013-10-02 15:56:27 -07:00
Chris Manghane
691b055ea6 go.tools/dashboard: Make sure links to commits and logs are dashboard specific.
R=adg
CC=golang-dev
https://golang.org/cl/14297043
2013-10-02 15:55:44 -07:00
Andrew Gerrand
401293d22c go.tools/godoc: provide an explicit mux to register redirects
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/14199043
2013-10-02 13:13:34 +10:00
Robert Griesemer
a32c2633d0 go.tools/go/types: complete checking of append built-in
R=adonovan
CC=golang-dev
https://golang.org/cl/14238043
2013-10-01 18:14:15 -07:00
Caine Tighe
d7d04a24e8 present/code.go: remove residual file from an hg merge.
R=adg
CC=golang-dev
https://golang.org/cl/14043043
2013-10-02 11:02:33 +10:00
Alan Donovan
2bd0ec31c0 go.tools/oracle: fix minor but confusing bug in test driver.
Since rev 4c5f46cc7b9d, error messages no longer contain
"file:line:col: " prefixes, so applying stripLocation to them
is incorrect.

Also: add rationale comment to callgraph2.go test.

R=crawshaw
CC=golang-dev
https://golang.org/cl/13888044
2013-10-01 10:17:26 -04:00
Alan Donovan
ae060fe849 go.tools/pointer: make os.Args point to something.
Since the Go runtime treats it specially, so must the pointer analysis.

Details:
- Combine object.{val,typ} fields into 'data interface{}'.
  It may now hold a string, describing an instrinsically
  allocated object such as the command-line args.
- extend Label accordingly; add Label.ReflectType() accessor.

Also: document pointer analysis algorithm classification.

R=crawshaw
CC=golang-dev
https://golang.org/cl/14156043
2013-10-01 09:46:33 -04:00
Andrew Gerrand
d20f86cc8e go.tools/godoc: move redirect helpers to new package
Update golang/go#6512

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/14193043
2013-10-01 16:32:13 +10:00
Robert Griesemer
35e395da09 go.tools/go/types: more flexible error checking
- permit ERROR markers to be in full or line comments
- don't require ""s in /* ERROR "foo" */
- enable more std tests
- some minor cleanups

R=adonovan
CC=golang-dev
https://golang.org/cl/14169044
2013-09-30 21:47:05 -07:00
Andrew Gerrand
f8e922be8e go.tools/godoc/static: make this the canonical source for playground JS
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/14184043
2013-10-01 12:11:47 +10:00
Andrew Gerrand
04d74c081e go.tools: sync play.js from go.talks
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/14177043
2013-10-01 11:20:35 +10:00
Andrew Gerrand
c635598ddf go.tools: sync play.js with go.talks
R=golang-dev
CC=golang-dev
https://golang.org/cl/14167044
2013-10-01 10:43:07 +10:00
Robert Griesemer
c92471fb85 go.tools/go/types: improved error messages for invalid labels
In general, if a break or continue label is not found, we don't
know if a correspondingly named label was not declared, was declared
but is not visible, or will be declared (and won't be visible).
Complain about "invalid" rather than "not declared" label.

Added more tests.

R=adonovan
CC=golang-dev
https://golang.org/cl/14149043
2013-09-30 14:03:33 -07:00
Robert Griesemer
49904d9a2c go.tools/cmd/gotype: use go/types identifier resolution
R=adonovan
CC=golang-dev
https://golang.org/cl/14146043
2013-09-30 12:59:02 -07:00
Robert Griesemer
3daa579643 go.tools/go/types: implement label checks
R=adonovan
CC=golang-dev
https://golang.org/cl/14036046
2013-09-30 11:05:30 -07:00
Alan Donovan
06c4192423 go.tools/pointer: minor API simplifications.
Details:
- Warnings are reported as values in Result, not a callback in Config.
- remove TODO to eliminate Print callback.  It's better than the alternative.
- remove unused Config.root field.
- hang Result off analysis object (impl. detail)
- reword TODO.

R=crawshaw
CC=golang-dev
https://golang.org/cl/14128043
2013-09-30 12:39:54 -04:00
Robert Griesemer
0730d79f0f go.tools/go/types: check unlabeled break, continue statements
This CL temporarily removes some preliminary label checks.
They will be implemented completely in a subsequent CL.

R=adonovan
CC=golang-dev
https://golang.org/cl/14055043
2013-09-27 13:43:11 -07:00
Robert Griesemer
27b698bc2a go.tools/go/types: x.f is addressable if x is addressable or x.f contains an indirection
Fixes golang/go#6487.

R=adonovan
CC=golang-dev
https://golang.org/cl/14047043
2013-09-27 09:33:00 -07:00
Alan Donovan
5b55a71008 go.tools/pointer: strength reduction during constraint generation.
Motivation: simple constraints---copy and addr---are more
amenable to pre-solver optimizations (forthcoming) than
complex constraints: load, store, and all others.

In code such as the following:

         t0 = new struct { x, y int }
         t1 = &t0.y
         t2 = *t1

there's no need for the full generality of a (complex)
load constraint for t2=*t1 since t1 can only point to t0.y.
All we need is a (simple) copy constraint t2 = (t0.y)
where (t0.y) is the object node label for that field.

For all "addressable" SSA instructions, we tabulate
whether their points-to set is necessarily a singleton.  For
some (e.g. Alloc, MakeSlice, etc) this is always true by
design.  For others (e.g. FieldAddr) it depends on their
operands.

We exploit this information when generating constraints:
all load-form and store-form constraints are reduced to copy
constraints if the pointer's PTS is a singleton.
Similarly all FieldAddr (y=&x.f) and IndexAddr (y=&x[0])
constraints are reduced to offset addition, for singleton
operands.

Here's the constraint mix when running on the oracle itself.
The total number of constraints is unchanged but the fraction
that are complex has gone down to 21% from 53%.

                before    after
--simple--
 addr		20682     46949
 copy        	61454     91211
--complex--
 offsetAddr  	41621     15325
 load        	18769     12925
 store       	30758     6908
 invoke      	758       760
 typeAssert  	1688      1689
total           175832    175869

Also:
- Add Pointer.Context() for local variables,
  since we now plumb cgnodes throughout. Nice.
- Refactor all load-form (load, receive, lookup) and
  store-form (Store, send, MapUpdate) constraints to use
  genLoad and genStore.
- Log counts of constraints by type.
- valNodes split into localval and globalval maps;
  localval is purged after each function.
- analogous maps localobj[v] and globalobj[v] hold sole label
  for pts(v), if singleton.
- fnObj map subsumed by globalobj.
- make{Function/Global/Constant} inlined into objectValue.
  Much cleaner.

R=crawshaw
CC=golang-dev
https://golang.org/cl/13979043
2013-09-27 11:33:01 -04:00
Robert Griesemer
ca3d62b66d go.tools/go/types: fix incorrect argument to fmt.Printf
(found by r using the vet tool)

R=adonovan
CC=golang-dev
https://golang.org/cl/14013043
2013-09-26 20:34:35 -07:00
Andrew Gerrand
0ebdd2c316 go.tools/cmd/html2article: move command from go.blog repository
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/14009043
2013-09-27 10:40:53 +10:00
Andrew Gerrand
88be67fd25 go.tools/present: add -edit and -numbers flags to .code/.play
Also update style.css to hide outline of editable text areas and apply
correct styles to line numbers in non-playground snippets.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13946043
2013-09-27 09:46:08 +10:00
Russ Cox
577fe73c91 go.tools/go/types: fix build for Go 1.1 users
Fixes golang/go#6485.

R=gri
CC=golang-dev
https://golang.org/cl/13901045
2013-09-26 12:45:44 -04:00
Alan Donovan
d7287a0289 go.tool.pointer: fix regression in pointer.cgraph.Root().
The previous CL made the assumption that Root is the first
node, which is false for programs that import "reflect".
Reverted to the previous way: an explicit root field.

Added regression test (callgraph2) via oracle.

R=crawshaw
TBR=crawshaw
CC=golang-dev
https://golang.org/cl/13967043
2013-09-26 09:31:39 -04:00
Nathan John Youngman
cb07517a77 go.tools/cover: validate flags with appropriate error messages
Fixes golang/go#6444.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13956043
2013-09-26 18:11:03 +10:00
Alan Donovan
785cfaa938 go.tools/pointer: use new callgraph API.
Also: pointer.Analyze now returns a pointer.Result object,
containing the callgraph and the results of ssa.Value queries.

The oracle has been updated to use the new call and pointer APIs.

R=crawshaw, gri
CC=golang-dev
https://golang.org/cl/13915043
2013-09-25 17:17:42 -04:00
Alan Donovan
3a4c0462d8 go.tools/oracle: change -mode argument into subcommand.
e.g. "oracle callgraph <package>"

Also: simplified error handling.
Eliminated oracle.errorf because it prepends "file:line:col: "
to the error message so the main function can't safely prepend "Error: ".
The position wasn't interesting though: it was just -pos, more or less.

R=crawshaw, dominik.honnef, r
CC=golang-dev
https://golang.org/cl/13864044
2013-09-25 14:34:39 -04:00
Alan Donovan
39779f52c3 go.tools/call: a callgraph API.
This package provides a simple abstraction of a call graph,
capable of representing context sensitive and insensitive
graphs.  It also provides some basic utilities and algorithms.

This simplifies clients such as the oracle, and makes similar
clients (e.g. an offline version of the oracle) easier to write.

R=crawshaw, gri
CC=golang-dev
https://golang.org/cl/13901044
2013-09-25 14:16:35 -04:00
Robert Griesemer
a6c151c04d go.tools/go/types: (panic(0)) (parenthesized) is a terminating statement
R=adonovan
CC=golang-dev
https://golang.org/cl/13913043
2013-09-25 10:19:24 -07:00
Robert Griesemer
9d1c551b43 go.tools/go/types: check 3-index slice expressions
R=adonovan
CC=golang-dev
https://golang.org/cl/13881043
2013-09-25 10:15:40 -07:00
Chris Manghane
b25f3012f3 go.tools/dashboard/builder: only download gcc once for gccgo buildTool.
Downloading the GCC repo takes a lot of time and everything works fine if we just store it in the buildRoot and reuse it.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/13583045
2013-09-24 16:08:25 -07:00
Robert Griesemer
dfaa5cc0c1 go.tools/go/types: test case for issue 6413
Fixes golang/go#6413.

R=adonovan
CC=golang-dev
https://golang.org/cl/13840047
2013-09-24 12:51:45 -07:00
Robert Griesemer
bce88d26ea go.tools/go/types: improved operand printing in error messages
Also:
- removed operand.val hack for built-in encoding; added id field
- minor cleanups

R=adonovan
CC=golang-dev
https://golang.org/cl/13840046
2013-09-24 12:22:04 -07:00
Alan Donovan
37f76edde8 go.tools/oracle: support -format=xml (for Eclipse)
This CL is mostly a renaming s/json/serial/, abstracting the
oracle package away from any particular data syntax.  (The
encoding/* machinery is very clean; clearly I should have
structured it this way from the outset.)

Supporting XML then becomes a one-liner in cmd/oracle/main.go.

Also: call MarshalIndent(), not Marshall() then Indent().

R=crawshaw
CC=golang-dev
https://golang.org/cl/13858046
2013-09-24 15:08:14 -04:00
Nathan John Youngman
84cae5a52d go.tools/cover: clean up usage information
R=golang-dev, r, minux.ma
CC=golang-dev
https://golang.org/cl/13532052
2013-09-24 17:27:26 +10:00
Chris Manghane
1d41279086 go.tools/dashboard: fix Repo creation in buildSubRepo to have valid Master repo.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/13568047
2013-09-23 17:18:31 -07:00
Chris Manghane
7bcc81e644 go.tools/dashboard: add gccgo build dashboard.
This change adds a new build dashboard url to the existing appengine app: $dashurl/gccgo/ which will show the build status of gccgo.
* Added Dashboard struct with exported Name, Rel(ative)Path, and Packages fields.
* Added Dashboard Context method that returns an appengine context with a namespace corresponding to the dashboard's name.
* Modified HandlerFuncs to use Dashboard's Context method for all appengine requests.
* Modified ui template to show different title/header for separate dashboard and added dashboard tab.

R=adg
CC=golang-dev
https://golang.org/cl/13753043
2013-09-23 17:06:49 -07:00
Robert Griesemer
0e6d095d11 go.tools/go/types: better error messages for invald expression statements
Also: removed some dynamic print formats.

R=adonovan
CC=golang-dev
https://golang.org/cl/13849043
2013-09-23 15:39:11 -07:00
Alan Donovan
318b83e376 go.tools/ssa: SSA fixes for *types.Builtin becoming an object (CL 13813043)
R=gri
CC=golang-dev
https://golang.org/cl/13848043
2013-09-23 18:18:35 -04:00
Robert Griesemer
a05da76c7b go.tools/go/types: represent built-ins as Objects (rather than types)
This change affects the API: Func objects now always have a *Signature
as type (never a *Builtin). Instead, built-ins now appear as *Builtin
objects. Only the built-in name is exposed, other fields are now private
to go/types.

Several bugs are fixed:
- correctly checking for built-ins permitted in statement context
- expression statements that are calls are not type-checked twice anymore
- go/defer statements report call types and provide good error messages now

This CL will briefly break the build until CL 13848043 is submitted.

R=adonovan
CC=golang-dev
https://golang.org/cl/13813043
2013-09-23 15:14:17 -07:00
Alan Donovan
3371b79a96 go.tools/pointer: reflect, part 2: channels.
(reflect.Value).Send
        (reflect.Value).TrySend
        (reflect.Value).Recv
        (reflect.Value).TryRecv
        (reflect.Type).ChanOf
        (reflect.Type).In
        (reflect.Type).Out
        reflect.Indirect
        reflect.MakeChan

Also:
- specialize genInvoke when the receiver is a reflect.Type under the
  assumption that there's only one possible concrete type.  This
  makes all reflect.Type operations context-sensitive since the calls
  are no longer dynamic.
- Rename all variables to match the actual parameter names used in
  the reflect API.
- Add pointer.Config.Reflection flag
  (exposed in oracle as --reflect, default false) to enable reflection.
  It currently adds about 20% running time.  I'll make it true after
  the presolver is implemented.
- Simplified worklist datatype and solver main loop slightly
  (~10% speed improvement).
- Use addLabel() utility to add a label to a PTS.

(Working on my 3 yr old 2x2GHz+4GB Mac vs 8x4GHz+24GB workstation,
one really notices the cost of pointer analysis.
Note to self: time to implement presolver.)

R=crawshaw
CC=golang-dev
https://golang.org/cl/13242062
2013-09-23 16:13:01 -04:00
Alan Donovan
25a0cc4bfd go.tools/oracle: refactor Oracle API to allow repeated queries on same scope.
The existing standalone Query function builds an importer, ssa.Program, oracle,
and query position, executes the query and returns the result.
For clients (such as Frederik Zipp's web-based github.com/fzipp/pythia tool)
that wish to load the program once and make several queries, we now expose
these as separate operations too.  Here's a client, in pseudocode:

        o := oracle.New(...)
        for ... {
                qpos := o.ParseQueryPos(...)
                res := o.Query(mode, qpos)
                print result
        }

NB: this is a slight deoptimisation in the one-shot case since we have to
build the entire SSA program with debug info, not just the query package,
since we now don't know the query package at that time.

The 'exact' param to ParseQueryPos needs more thought since its
ideal value is a function of the query mode.  This will do for now.

Details:
- expose Oracle type, New() func and Query() method.
- expose QueryPos type and ParseQueryPos func.
- improved package doc comment.
- un-exposed the "needs" bits.
- added test.

R=crawshaw
CC=frederik.zipp, golang-dev
https://golang.org/cl/13810043
2013-09-23 15:02:18 -04:00
Andrew Gerrand
eb130cb481 go.tools/cmd/cover: add content-type meta tag to HTML output
Fixes golang/go#6435.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13822045
2013-09-23 13:57:03 +10:00