Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(18372)

Issue 8734045: code review 8734045: exp/ssa: various features to facilitate source analysis... (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 12 months ago by adonovan
Modified:
10 years, 12 months ago
Reviewers:
CC:
gri, golang-dev
Visibility:
Public.

Description

exp/ssa: various features to facilitate source analysis tools. NewBuilder now accepts a new extensible Client struct specifying Builder options. (Naming suggestions?) Client embeds a types.Context, permitting Builder clients to control type-checking options such as word width. Builder.{idents,constants.types} fields extracted into (new type) TypeInfo. TypeInfo is embedded by Package. The smaller per-package maps can be retained/discarded with finer granularity (see below). The builder options now include RetainAST, a predicate for whether to retain or discard the type-checked ASTs (Package.Files, now exposed) and type info (Package.TypeInfo) for each package after it is built. The results of type checking are now available to tools atop exp/ssa via these exposed functions: Builder.isType -> TypeInfo.IsType(Expr) Builder.obj -> TypeInfo.ObjectOf(Ident) Builder.exprType -> TypeInfo.TypeOf(Expr) Builder.constants[x] -> TypeInfo.ValueOf(Expr) Builder.isPackageRef -> TypeInfo.isPackageRef(Expr) (Those methods never really belonged happily on Builder.) ssa.CallCommon: - Added StaticCallee method - Added Description method - Embedding in Call/Go/Defer is no longer anonymous, to avoid promotion of inappropriate methods such as Description. - Added explicit Operands methods to Call/Go/Defer. ssa.Member now has a Posn() method. We use (new type) Constant, not Literal, for package-level constants with a name and position. Added source position info to Make{Slice,Map,Chan}, Alloc, Global. Add missing noparens() when handling calls to built-ins. Refactor to avoid "// Subtle" code in compLit(Struct). Added CreatePackageFromArgs utility to handle command-line processing for ssadump and forthcoming tools.

Patch Set 1 #

Patch Set 2 : diff -r 607e36ea774b https://code.google.com/p/go.exp #

Patch Set 3 : diff -r 607e36ea774b https://code.google.com/p/go.exp #

Patch Set 4 : diff -r 607e36ea774b https://code.google.com/p/go.exp #

Patch Set 5 : diff -r 607e36ea774b https://code.google.com/p/go.exp #

Patch Set 6 : code review 8734045: exp/ssa: various features to facilitate source analysis... #

Patch Set 7 : diff -r 607e36ea774b https://code.google.com/p/go.exp #

Patch Set 8 : diff -r 607e36ea774b https://code.google.com/p/go.exp #

Total comments: 10

Patch Set 9 : diff -r 450091856c40 https://code.google.com/p/go.exp #

Unified diffs Side-by-side diffs Delta from patch set Stats (+484 lines, -353 lines) Patch
M ssa/builder.go View 1 2 3 4 5 6 7 8 81 chunks +218 lines, -250 lines 0 comments Download
M ssa/emit.go View 1 6 2 chunks +4 lines, -3 lines 0 comments Download
M ssa/func.go View 1 6 2 chunks +5 lines, -4 lines 0 comments Download
M ssa/importer.go View 1 2 3 4 5 6 7 8 5 chunks +49 lines, -5 lines 0 comments Download
M ssa/interp/interp.go View 1 2 3 6 2 chunks +6 lines, -6 lines 0 comments Download
M ssa/interp/interp_test.go View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M ssa/interp/ops.go View 1 2 3 4 5 6 7 8 4 chunks +6 lines, -3 lines 0 comments Download
M ssa/print.go View 1 2 3 4 5 6 6 chunks +8 lines, -8 lines 0 comments Download
M ssa/promote.go View 1 6 2 chunks +8 lines, -8 lines 0 comments Download
M ssa/ssa.go View 1 2 3 4 5 6 7 8 22 chunks +82 lines, -21 lines 0 comments Download
M ssa/ssadump.go View 1 2 3 4 5 6 7 8 2 chunks +7 lines, -44 lines 0 comments Download
A ssa/typeinfo.go View 1 2 3 4 5 6 7 8 1 chunk +90 lines, -0 lines 0 comments Download

Messages

Total messages: 4
adonovan
Hello gri@golang.org (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://code.google.com/p/go.exp
10 years, 12 months ago (2013-04-23 16:44:43 UTC) #1
gri
LGTM https://codereview.appspot.com/8734045/diff/12003/ssa/builder.go File ssa/builder.go (right): https://codereview.appspot.com/8734045/diff/12003/ssa/builder.go#newcode76 ssa/builder.go:76: type Client struct { Context would be the ...
10 years, 12 months ago (2013-04-23 23:35:15 UTC) #2
adonovan
Thanks! https://codereview.appspot.com/8734045/diff/12003/ssa/builder.go File ssa/builder.go (right): https://codereview.appspot.com/8734045/diff/12003/ssa/builder.go#newcode76 ssa/builder.go:76: type Client struct { On 2013/04/23 23:35:15, gri ...
10 years, 12 months ago (2013-04-24 14:06:29 UTC) #3
adonovan
10 years, 12 months ago (2013-04-24 14:17:51 UTC) #4
*** Submitted as
https://code.google.com/p/go/source/detail?r=4059e8ecc5e2&repo=exp ***

exp/ssa: various features to facilitate source analysis tools.

NewBuilder now accepts a new extensible Client struct
specifying Builder options.  (Naming suggestions?)

Client embeds a types.Context, permitting Builder clients to
control type-checking options such as word width.

Builder.{idents,constants.types} fields extracted into (new
type) TypeInfo.  TypeInfo is embedded by Package.  The smaller
per-package maps can be retained/discarded with finer
granularity (see below).

The builder options now include RetainAST, a predicate for
whether to retain or discard the type-checked ASTs
(Package.Files, now exposed) and type info (Package.TypeInfo)
for each package after it is built.

The results of type checking are now available to tools atop
exp/ssa via these exposed functions:
  Builder.isType        -> TypeInfo.IsType(Expr)
  Builder.obj           -> TypeInfo.ObjectOf(Ident)
  Builder.exprType      -> TypeInfo.TypeOf(Expr)
  Builder.constants[x]  -> TypeInfo.ValueOf(Expr)
  Builder.isPackageRef  -> TypeInfo.isPackageRef(Expr)
(Those methods never really belonged happily on Builder.)

ssa.CallCommon:
- Added StaticCallee method
- Added Description method
- Embedding in Call/Go/Defer is no longer anonymous, to avoid
  promotion of inappropriate methods such as Description.
- Added explicit Operands methods to Call/Go/Defer.

ssa.Member now has a Posn() method.  We use (new type)
Constant, not Literal, for package-level constants with a name
and position.

Added source position info to Make{Slice,Map,Chan}, Alloc, Global.

Add missing noparens() when handling calls to built-ins.

Refactor to avoid "// Subtle" code in compLit(Struct).

Added CreatePackageFromArgs utility to handle command-line
processing for ssadump and forthcoming tools.

R=gri
CC=golang-dev
https://codereview.appspot.com/8734045
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b