Robert Griesemer
6770b5cdca
go.tools/go/importer: more cleanups
...
R=adonovan
CC=golang-codereviews
https://golang.org/cl/34660046
2014-01-03 09:12:32 -08:00
Robert Griesemer
10f0067eb1
go.tools/go.types: cleanups
...
Per feedback for CL 37250044.
R=adonovan
CC=golang-codereviews
https://golang.org/cl/47150043
2014-01-02 10:07:48 -08:00
Robert Griesemer
30645c4bc6
go.tools/go/importer: fine-tuning of export format, test against std lib
...
(TBR adonovan)
- provide version string rather than version number (more flexible)
- match naming of tag constants with documentation (forth-coming)
- more formats for constant values (1-byte booleans, short 64bit
values, support for floating point numbers +123p+45)
- more regular format for signatures: always print with type tag;
this permits (future) sharing of identical signatures and possibly
large export data size reduction
- test export and import of all type-checked std library packages
- compare import of all std library packages against corresponding
import of gc-generated export data and verify that the packages
match 100% (except for floating point values which are exact when
coming from go/types, and possibly inexact when coming from gc)
On average, export data generated by the importer is ~28% of the size
of the gc-generated export data for corresponding packages of the std
library:
package size gc size
archive/tar 2945 12030 24%
archive/zip 4122 15796 26%
bufio 1776 6171 28%
bytes 2540 8006 31%
compress/bzip2 146 419 34%
compress/flate 2305 6356 36%
compress/gzip 4262 17917 23%
compress/lzw 336 832 40%
compress/zlib 2503 9814 25%
container/heap 255 527 48%
container/list 653 2971 21%
container/ring 246 707 34%
crypto 368 1015 36%
crypto/aes 219 499 43%
crypto/cipher 809 1875 43%
crypto/des 254 636 39%
crypto/dsa 3324 15609 21%
crypto/ecdsa 3833 18567 20%
crypto/elliptic 3801 17417 21%
crypto/hmac 205 459 44%
crypto/md5 206 413 49%
crypto/rand 3070 15047 20%
crypto/rc4 180 443 40%
crypto/rsa 4205 17941 23%
crypto/sha1 208 414 50%
crypto/sha256 272 555 49%
crypto/sha512 274 555 49%
crypto/subtle 247 1157 21%
crypto/tls 13769 48330 28%
crypto/x509 10716 40556 26%
crypto/x509/pkix 5670 24616 23%
database/sql 4227 15957 26%
database/sql/driver 1239 2806 44%
debug/dwarf 5165 12066 42%
debug/elf 14205 36401 39%
debug/goobj 992 2495 39%
debug/gosym 1808 4798 37%
debug/macho 4560 13173 34%
debug/pe 3694 10530 35%
encoding 261 387 67%
encoding/ascii85 368 1541 23%
encoding/asn1 479 1661 28%
encoding/base32 608 2636 23%
encoding/base64 610 2636 23%
encoding/binary 1006 3591 28%
encoding/csv 2287 8405 27%
encoding/gob 9161 30565 29%
encoding/hex 384 1331 28%
encoding/json 6564 23334 28%
encoding/pem 208 529 39%
encoding/xml 7964 27220 29%
errors 52 277 18%
expvar 955 2978 32%
flag 2475 18028 13%
fmt 1141 3141 36%
go/ast 11595 41019 28%
go/build 3736 13920 26%
go/doc 2647 9523 27%
go/format 1310 5010 26%
go/parser 4346 18525 23%
go/printer 1737 6442 26%
go/scanner 2360 8598 27%
go/token 2290 7599 30%
hash 215 595 36%
hash/adler32 217 391 55%
hash/crc32 399 1475 27%
hash/crc64 324 1327 24%
hash/fnv 338 3964 8%
html 80 253 31%
html/template 7981 37471 21%
image 4270 18894 22%
image/color 845 3154 26%
image/color/palette 121 319 37%
image/draw 947 4807 19%
image/gif 1468 6611 22%
image/jpeg 971 4534 21%
image/png 880 4432 19%
index/suffixarray 3702 13960 26%
io 2049 6117 33%
io/ioutil 2845 12060 23%
log 2416 10241 23%
log/syslog 3102 12208 25%
math 2361 6008 39%
math/big 3648 12250 29%
math/cmplx 473 1542 30%
math/rand 786 2002 39%
mime 180 595 30%
mime/multipart 2761 9338 29%
net 10593 34352 30%
net/http 24542 84065 29%
net/http/cgi 12859 50970 25%
net/http/cookiejar 2845 12429 22%
net/http/fcgi 12331 49111 25%
net/http/httptest 18953 75243 25%
net/http/httputil 13994 54386 25%
net/http/pprof 12153 49039 24%
net/mail 1803 8599 20%
net/rpc 18503 69044 26%
net/rpc/jsonrpc 1063 2737 38%
net/smtp 11775 46821 25%
net/textproto 2684 8678 30%
net/url 767 2886 26%
os 5712 20293 28%
os/exec 4705 18350 25%
os/signal 125 330 37%
os/user 234 720 32%
path 231 770 30%
path/filepath 2236 9721 23%
reflect 4518 13467 33%
regexp 3608 11167 32%
regexp/syntax 2184 5157 42%
runtime 1563 3407 45%
runtime/cgo 36 66 54%
runtime/debug 1714 8010 21%
runtime/pprof 485 1358 35%
runtime/race 38 43 88%
sort 748 2658 28%
strconv 949 2573 36%
strings 1846 6220 29%
sync 712 1970 36%
sync/atomic 1089 2506 43%
syscall 38975 79396 49%
testing 3734 13626 27%
testing/iotest 332 2378 13%
testing/quick 4411 16434 26%
text/scanner 1821 5349 34%
text/tabwriter 1593 4937 32%
text/template 6882 33329 20%
text/template/parse 3946 12760 30%
time 3031 9703 31%
unicode 3148 8676 36%
unicode/utf16 163 760 21%
unicode/utf8 475 1122 42%
total 463641 1644936 28%
R=adonovan
TBR=adonovan
CC=golang-codereviews
https://golang.org/cl/37250044
2013-12-20 16:43:31 -08:00
Robert Griesemer
e405e03b16
go.tools/go/types: complete set of Interface accessors
...
Also: Provide GcCompatibilityMode for printing types
(intended for testing with gc-generated export data
only).
(TBR adonovan)
R=adonovan
TBR=adonovan
CC=golang-codereviews
https://golang.org/cl/44780043
2013-12-20 16:35:31 -08:00
Robert Griesemer
e2acb64f86
go.tools/go/types: submit missed file (fix build)
...
R=adonovan
CC=golang-codereviews
https://golang.org/cl/38130044
2013-12-20 15:51:04 -08:00
Robert Griesemer
d4da60d38f
go.tools/gc/importer: fix struct tags and parameter names
...
R=iant
CC=golang-codereviews
https://golang.org/cl/42280046
2013-12-20 15:17:16 -08:00
Robert Griesemer
4e3127283a
go.tools/go/gcimporter: adjust for new .a file format
...
R=rsc, r
CC=golang-dev
https://golang.org/cl/41510044
2013-12-18 10:53:59 -08:00
Robert Griesemer
53dfbf8a00
go.tools: fix build
...
Missed a couple of places with previous CL.
R=adonovan
TBR=adonovan
CC=golang-dev
https://golang.org/cl/40850046
2013-12-17 16:21:23 -08:00
Robert Griesemer
74d33a9c33
go.tools/go/types: use types.ChanDir instead of ast.ChanDir
...
Clearer code and fewer dependencies on go/ast.
R=adonovan
CC=golang-dev
https://golang.org/cl/43630043
2013-12-17 15:45:01 -08:00
Robert Griesemer
a02c76070b
go/importer: fix build (disable tests that won't run on builders)
...
R=adonovan
TBR=adonovan
CC=golang-dev
https://golang.org/cl/43010043
2013-12-16 14:44:22 -08:00
Robert Griesemer
5eb4fdc120
go.tools/go/importer: simplified exporter/importer
...
By using a simple (graph-based) serialization algorithm
and binary encoding, a significantly more compact export
data format is achieved than what the current compilers
use. Furthermore, the exporter and importer are completely
symmetric algorithms that are compact, and much easier to
change/expand.
R=adonovan
CC=golang-dev
https://golang.org/cl/42960043
2013-12-16 14:28:17 -08:00
Robert Griesemer
91abc02562
go.tools/go/types: print interface methods in sorted order
...
Required for testing code of clients.
R=adonovan
CC=golang-dev
https://golang.org/cl/35940049
2013-12-16 13:53:08 -08:00
Robert Griesemer
3df3227c35
go.tools/go/exact: fix bug introduced with CL 41170043
...
R=adonovan
CC=golang-dev
https://golang.org/cl/37820052
2013-12-12 14:18:40 -08:00
Robert Griesemer
e2828468ff
go.tools/go/exact: serialization support and better unknown handling
...
- fixed various imprecise doc strings
- consistent handling of unknown values
R=adonovan
CC=golang-dev
https://golang.org/cl/41170043
2013-12-12 13:43:00 -08:00
Robert Griesemer
4728c2f3f6
go.tools/go/types: turn off internal debug mode
...
- much improved performance
- enable when testing changes
R=adonovan
CC=golang-dev
https://golang.org/cl/36480049
2013-12-12 13:32:36 -08:00
Robert Griesemer
693727787e
go.tools/go/types/typemap: fix formatting verb
...
(%p is trouble if the interface value is not a pointer)
R=adonovan
CC=golang-dev
https://golang.org/cl/41440043
2013-12-12 12:12:32 -08:00
Alan Donovan
036b7d3489
go.tools/types: skip "imported but not used" check if IgnoreFuncBodies.
...
Obviously in that mode, we can't correctly diagnose such
errors, so we shouldn't attempt it (and emit false positives).
R=gri
CC=golang-dev
https://golang.org/cl/41080043
2013-12-11 21:12:08 -05:00
Robert Griesemer
11cfd4a636
go.toools/go/types: clearer comment (per adonovan)
...
R=adonovan
CC=golang-dev
https://golang.org/cl/40860045
2013-12-11 10:48:17 -08:00
Robert Griesemer
d6902b2ad5
go/tools/go/gcimporter: avoid possible endless loops in case of errors
...
R=adonovan
CC=golang-dev
https://golang.org/cl/39630045
2013-12-09 15:43:31 -08:00
Peter Collingbourne
7dcd8ded7c
go.tools/go/types: handle embedded interfaces in NewInterface
...
R=gri
CC=golang-dev
https://golang.org/cl/39040043
2013-12-09 13:37:24 -08:00
Robert Griesemer
ff84d756df
go.tools/go/types: avoid spurious error in a common case
...
R=adonovan
CC=golang-dev
https://golang.org/cl/36900043
2013-12-03 17:51:54 -08:00
Robert Griesemer
14cf5b0a28
go.tools/go/types: fun with Hilbert: a const arithmetic test
...
This test generates a program that declares the constant
elements of an n*n Hilbert matrix, its inverse, and the
constant elements of the explicit product of the two.
The product should be the identity matrix; that check is
also expressed as a constant expression. Type-checking
verifies that the product is indeed the identity matrix
by asserting the result of the identity check (using the
assert built-in which is available for type-check tests).
The test is run for n = 5. Other values can be tested via
the -H flag, say: go test -run=Hilbert -H=100
The generated program can be written to a file for testing
the constant arithmetic of a compiler: go test -out=test.go
Because of the mathematically precise constant arithmetic
of go/types, this test should always succeed and is only
limited by the size of the matrix. It does run successfully
from n = 0 to values larger than 100.
The Hilbert matrix is famous for being ill-conditioned and
thus exposes arithmetic imprecision very quickly. The gc
compiler only produces a correct result for n = 0 (trivially),
and n = 1 at the moment.
R=adonovan, rsc
CC=golang-dev
https://golang.org/cl/35840043
2013-12-03 13:36:57 -08:00
Robert Griesemer
62a3fc7538
go.tools/go/types: clean up internal iota in all cases
...
R=dsymonds
CC=golang-dev
https://golang.org/cl/33570043
2013-11-26 17:48:47 -08:00
Robert Griesemer
3d343e42d1
go.tools/go/types: constants must have constant types
...
R=adonovan
CC=golang-dev
https://golang.org/cl/33210043
2013-11-26 12:42:52 -08:00
Robert Griesemer
bbf45e5e0c
go.tools/go/types: missing assignment checks when assigning to _
...
R=adonovan, gri
CC=golang-dev
https://golang.org/cl/31340044
2013-11-26 09:34:12 -08:00
Robert Griesemer
b9c2c88573
go.tools/go/types: add Package.SetImports
...
R=adonovan, neelance
CC=golang-dev
https://golang.org/cl/32500043
2013-11-26 09:19:17 -08:00
Richard Musiol
397114a391
go.tools/go/gcimporter: ImportData has no need for *bufio.Reader, can get just io.Reader.
...
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/31620043
2013-11-24 12:48:45 -08:00
Robert Griesemer
8c9bb9c1e3
go.tools/go/types: various cleanups
...
- use unpack also for assignments
- run benchmarks only requested (-b flag)
R=adonovan
CC=golang-dev
https://golang.org/cl/31190044
2013-11-22 20:34:07 -08:00
Robert Griesemer
007f41d43e
go.tools/go/types: more benchmarks, clearer results
...
The benchmarks don't permit clear-cut apples-to-apples
comparisons since they depend on the very source code
they are testing. But they do give an indication of
the approximate performance - as a sanity test.
Using 3 different code bases makes it apparent that
there's some difference in performance per code base;
i.e., the lines/s speed varies pretty strongly. This
may be due to setup costs, or other issues. We should
investigate eventually.
R=adonovan
CC=golang-dev
https://golang.org/cl/30650043
2013-11-21 21:08:29 -08:00
Robert Griesemer
ef434a14da
go.tools/go/types: record correct type for parenthesized x.(T) in comma-ok expressions
...
Fixes golang/go#6796 .
R=adonovan
CC=golang-dev
https://golang.org/cl/30070044
2013-11-21 09:11:57 -08:00
Richard Musiol
88e2928490
go.tools/go/types: Do not throw error on division of complex variables by zero.
...
See http://play.golang.org/p/DrgLKnHaUW
Seems like division of a variable by zero should only throw an error if the variable is an integer.
R=golang-dev, mtj, gri
CC=golang-dev, gri
https://golang.org/cl/29500047
2013-11-20 13:42:30 -08:00
Robert Griesemer
b4286c4c1b
go.tools/go/types: missing checks for select statements
...
Also: Use defer to make sure scopes are always closed
even in case of early exits via bailout (and don't cause
an imbalanced scope error in debug mode).
R=adonovan, gri
CC=golang-dev
https://golang.org/cl/29300043
2013-11-19 13:58:01 -08:00
Robert Griesemer
849643aaaf
go.tools: cleanups (added copyrights to astutil, clearer logic in go/types)
...
R=adonovan
CC=golang-dev
https://golang.org/cl/29110043
2013-11-19 09:07:02 -08:00
Robert Griesemer
df6f0829a2
go.tools/go/types: complete expr and type string functions
...
- consolidate them in (expr|type)string[_test].go
- support for printing all ast.Expr
- fix printing of type: chan (<-chan int) (parentheses)
- more consistent names, comments, and exports
R=adonovan
CC=golang-dev
https://golang.org/cl/28680043
2013-11-18 22:38:48 -08:00
Robert Griesemer
65aa1a4fbe
go.tools/go/types: String method for Initializers
...
Plus a couple of minor fixes.
R=adonovan
CC=golang-dev
https://golang.org/cl/28540043
2013-11-18 11:26:49 -08:00
Robert Griesemer
e785f050b6
go.tools/go/types: add missing checks for short variable declarations
...
Fixes golang/go#6766 .
R=adonovan
CC=golang-dev
https://golang.org/cl/24330044
2013-11-15 14:26:29 -08:00
Robert Griesemer
01f122e48b
go.tools/go/gcimporter: fix build by adjusting test to new print output
...
R=adonovan, bradfitz
CC=golang-dev
https://golang.org/cl/26430049
2013-11-15 11:58:23 -08:00
Alan Donovan
45992044b5
go.tools/go/types: SelectionString: print method with selective package-qualification.
...
R=gri, gri
CC=golang-dev
https://golang.org/cl/26570048
2013-11-15 12:35:03 -05:00
Alan Donovan
0820934407
go.tools/go/types: add TypeString, ObjectString utilities
...
These are variants of Type.String(), Object.String() that
accept a 'from *Package' argument. If provided, package
qualification is omitted when printing named types belonging
to that package.
This is useful for UIs where a package is implied by context
e.g. ssadump disassembly, oracle output.
+ Test.
R=gri, gri, gordon.klaus
CC=golang-dev
https://golang.org/cl/22190048
2013-11-15 09:20:46 -05:00
Robert Griesemer
91e5190eb9
go.tools/go/types: minor cleanups
...
R=adonovan
CC=golang-dev
https://golang.org/cl/26430045
2013-11-14 21:38:04 -08:00
Robert Griesemer
27563ff576
go.tools/go/types: move gcimporter to its own package
...
- fixed a couple of TODOs
- various cleanups along the way
- adjusted clients
Once submitted, clients of go/types that don't explicitly
specify Config.Import will need to add the extra import:
import _ "code.google.com/p/go.tools/go/gcimporter"
to install the default (gc) importer in go/types.
R=adonovan, gri
CC=golang-dev
https://golang.org/cl/26390043
2013-11-14 14:11:43 -08:00
Robert Griesemer
d1184e294e
go.tools/go/types: fix build
...
(I inadvertently submitted a modified file.)
R=adonovan
CC=golang-dev
https://golang.org/cl/22750044
2013-11-13 15:21:38 -08:00
Richard Musiol
cfc002f30b
go.tools/go/types: Do not throw error on division of float variables by zero.
...
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/26040043
2013-11-13 15:16:19 -08:00
Alan Donovan
3f686cae84
go.tools/go/types: print named types with package qualification.
...
Depending on the context, printing only the package name can
be ambiguous or even incorrect since it is valid only within
the environment of a given file's import specs.
(The standard library packages are mostly unique in their last
segment, but this is not the case for proprietary repos.)
R=gri, gri
CC=golang-dev
https://golang.org/cl/26300043
2013-11-13 16:03:41 -05:00
Robert Griesemer
f339918a70
go.tools/go/exact: some factoring, more tests
...
R=adonovan
CC=golang-dev
https://golang.org/cl/25440043
2013-11-12 12:45:43 -08:00
Richard Musiol
a5baa859ae
go.tools/go/exact: Fix for exact.BinaryOp. It was modifying its argument.
...
R=golang-dev, gri, mail
CC=golang-dev
https://golang.org/cl/24570043
2013-11-12 10:06:24 -08:00
Alan Donovan
d8292e2a38
go.tools/go/types: cache method set for pointer-to-named in the Named.
...
This change improves the complete running time of 'ssadump cmd/oracle' by ~20%.
R=gri, gri
CC=golang-dev
https://golang.org/cl/22910045
2013-11-11 17:20:27 -05:00
Robert Griesemer
c798b9cca0
go.tools/go/types: check validity of import paths
...
This check is currently done in go/parser as well but
eventually can be removed from there (after Go 1.2).
R=adonovan
CC=golang-dev
https://golang.org/cl/22240045
2013-11-08 14:14:58 -08:00
Robert Griesemer
7b183d1766
go.tools/go/types, cmd/gotype: fix early bailout
...
Clients must have chance to look at panics they
are raising.
R=adonovan
CC=golang-dev
https://golang.org/cl/23820043
2013-11-08 12:52:57 -08:00
Robert Griesemer
e8fe66cd57
go.tools/go/types: print initialization cycles
...
Also: Always report cycle at first (in source order)
variable in the cycle.
R=adonovan, gri
CC=golang-dev
https://golang.org/cl/23370043
2013-11-08 12:06:10 -08:00