| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
- src/runtime/internal/sys/zgoarch_386.go
- src/runtime/internal/sys/zgoarch_amd64.go
- src/runtime/internal/sys/zgoarch_arm.go
- src/runtime/internal/sys/zgoarch_arm64.go
- src/runtime/internal/sys/zgoarch_arm64be.go
- src/runtime/internal/sys/zgoarch_armbe.go
- src/runtime/internal/sys/zgoarch_mips.go
- src/runtime/internal/sys/zgoarch_mips64.go
- src/runtime/internal/sys/zgoarch_mips64le.go
- src/runtime/internal/sys/zgoarch_mips64p32.go
- src/runtime/internal/sys/zgoarch_mips64p32le.go
- src/runtime/internal/sys/zgoarch_mipsle.go
- src/runtime/internal/sys/zgoarch_ppc.go
- src/runtime/internal/sys/zgoarch_ppc64.go
- src/runtime/internal/sys/zgoarch_ppc64le.go
- src/runtime/internal/sys/zgoarch_riscv.go
- src/runtime/internal/sys/zgoarch_riscv64.go
- src/runtime/internal/sys/zgoarch_s390.go
- src/runtime/internal/sys/zgoarch_s390x.go
- src/runtime/internal/sys/zgoarch_sparc.go
- src/runtime/internal/sys/zgoarch_sparc64.go
- src/runtime/internal/sys/zgoarch_wasm.go
On dev.typeparams, CL 328336 moved these files to internal/goarch;
whereas on master, CL 333909 reserved GOARCH=loong64. For this CL,
I resolved the conflict by simply running "go generate internal/goarch".
Merge List:
+ 2021-07-19 c8f4e6152d spec: correct example comment in Conversions from slice to array
+ 2021-07-19 1d91551b73 time: correct typo in documentation for UnixMicro
+ 2021-07-19 404127c30f cmd/compile: fix off-by-one error in traceback argument counting
+ 2021-07-19 6298cfe672 cmd/compile: fix typo in fatal message of builtinCall
+ 2021-07-19 49402bee36 cmd/{compile,link}: fix bug in map.zero handling
+ 2021-07-18 a66190ecee test/bench/go1: fix size for RegexpMatchMedium_32
+ 2021-07-18 650fc2117a text/scanner: use Go convention in Position doc comment
+ 2021-07-16 aa4e0f528e net/http: correct capitalization in cancelTimeBody comment
+ 2021-07-15 0941dbca6a testing: clarify in docs that TestMain is advanced
+ 2021-07-15 69728ead87 cmd/go: update error messages in tests to match CL 332573
+ 2021-07-15 c1cc9f9c3d cmd/compile: fix lookup package of redeclared dot import symbol
+ 2021-07-15 21a04e3335 doc/go1.17: mention GOARCH=loong64
+ 2021-07-14 2b00a54baf go/build, runtime/internal/sys: reserve GOARCH=loong64
+ 2021-07-14 60ddf42b46 cmd/go: change link in error message from /wiki to /doc.
+ 2021-07-13 d8f348a589 cmd/go: remove a duplicated word from 'go help mod graph'
+ 2021-07-12 a98589711d crypto/tls: test key type when casting
+ 2021-07-12 cfbd73ba33 doc/go1.17: editing pass over the "Compiler" section
+ 2021-07-09 ab4085ce84 runtime/pprof: call runtime.GC twice in memory profile test
Change-Id: I1490a4c7e4c560659c21a4eb67d243f35d1f908e
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
In CL 326211 a change was made to switch "go.map.zero" symbols from
non-pkg DUPOK symbols to hashed symbols. The intent of this change was
ensure that in cases where there are multiple competing go.map.zero
symbols feeding into a link, the largest map.zero symbol is selected.
The change was buggy, however, and resulted in duplicate symbols in
the final binary (see bug cited below for details). This duplication
was relatively benign for linux/ELF, but causes duplicate definition
errors on Windows.
This patch switches "go.map.zero" symbols back from hashed symbols to
non-pkg DUPOK symbols, and updates the relevant code in the loader to
ensure that we do the right thing when there are multiple competing
DUPOK symbols with different sizes.
Fixes #47185.
Change-Id: I8aeb910c65827f5380144d07646006ba553c9251
Reviewed-on: https://go-review.googlesource.com/c/go/+/334930
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This CL implements a few improvements to SSA devirtualization to make
it simpler and more general:
1. Change reflectdata.ITabAddr to now immediately generate the wrapper
functions and write out the itab symbol data. Previously, these were
each handled by separate phases later on.
2. Removes the hack in typecheck where we marked itabs that we
expected to need later. Instead, the calls to ITabAddr in walk now
handle generating the wrappers.
3. Changes the SSA interface call devirtualization algorithm to just
use the itab symbol data (namely, its relocations) to figure out what
pointer is available in memory at the given offset. This decouples it
somewhat from reflectdata.
Change-Id: I8fe06922af8f8a1e7c93f5aff2b60ff59b8e7114
Reviewed-on: https://go-review.googlesource.com/c/go/+/327871
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
|
|\ \
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Two non-conflict changes included because they're needed for all.bash:
1. Bump internal/goversion.Version to 18. This will happen eventually
anyway (dev.typeparams will not be merged back to Go 1.17), and is
needed for cmd/api to allow new API additions.
2. Add fixedbugs/issue46725.go (new test added on master) to the list
of known failures for -G=3. This test exercises a bug that was fixed
in typecheck, but -G=3 mode has duplicated that code and will need to
be fixed as well. That's outside of the scope of a merge.
Conflicts:
- src/runtime/traceback.go
Nearby lines were removed on both master and dev.typeparams.
Merge List:
+ 2021-06-14 fdab5be159 doc/go1.17: further revise OpenBSD release notes
+ 2021-06-14 326ea438bb cmd/compile: rewrite a, b = f() to use temporaries when type not identical
+ 2021-06-14 3249b645c9 cmd/compile: factor out rewrite multi-valued f()
+ 2021-06-13 14305bf0b9 misc/cgo: generate Windows import libraries for clang
+ 2021-06-13 24cff0f044 cmd/go, misc/cgo: skip test if no .edata
+ 2021-06-13 67b1b6a2e3 cmd/compile: allow ir.OSLICE2ARRPTR in mayCall
+ 2021-06-12 1ed0d129e9 runtime: testprogcgo: don't call exported Go functions directly from Go
+ 2021-06-12 9d46ee5ac4 reflect: handle stack-to-register translation in callMethod
+ 2021-06-11 e552a6d312 cmd/go: remove hint when no module is suggested
+ 2021-06-11 16b5d766d8 syscall: do not load native libraries on non-native powershell on arm
+ 2021-06-11 77aa209b38 runtime: loop on EINTR in macOS sigNoteSleep
+ 2021-06-11 e2dc6dd5c9 doc/go1.17: clean up formatting of gofmt section
+ 2021-06-11 2f1128461d cmd/go: match Windows paths in TestScript/mod_invalid_version
+ 2021-06-11 2721da2608 doc/go1.17: fix formatting near httptest
+ 2021-06-10 770f1de8c5 net/http: remove test-only private key from production binaries
+ 2021-06-10 8d11b1d117 cmd/go: report the imports of CompiledGoFiles in ImportMap
+ 2021-06-10 dc00dc6c6b crypto/tls: let HTTP/1.1 clients connect to servers with NextProtos "h2"
+ 2021-06-09 27f83723e9 api: promote next to go1.17
+ 2021-06-09 182157c81a doc/go1.17: remove lingering TODO
+ 2021-06-09 a5bc060b42 doc/go1.17: document strconv changes for Go 1.17
+ 2021-06-09 1402b27d46 strconv: document parsing of leading +/-
+ 2021-06-09 df35ade067 doc/go1.17: document //go:build lines
+ 2021-06-09 e4e7807d24 net/http: add AllowQuerySemicolons
+ 2021-06-09 ec3026d032 doc/go1.17: remove TODO for ports section
+ 2021-06-09 e6dda19888 net/url: reject query values with semicolons
+ 2021-06-09 139e935d3c math/big: comment division
+ 2021-06-09 aa5540cd82 cmd/compile: make map.zero symbol content-addressable
+ 2021-06-09 07ca28d529 cmd/link: fix bug in -strictdups checking of BSS symbols
+ 2021-06-08 bcecae2af6 doc/go1.17: mention new possibility of type conversion panicking
+ 2021-06-08 63dcab2e91 doc/go1.17: mention new vet checks sigchanyzer and stdmethods.
+ 2021-06-08 6551763a60 doc/go1.17: mention block profile bias fix
+ 2021-06-08 cb80937bf6 Revert "doc/go1.17: mention block profile bias fix"
+ 2021-06-08 d3e3d03666 net: reject leading zeros in IP address parsers
+ 2021-06-08 da4a640141 doc/go1.17: revise OpenBSD release notes
+ 2021-06-08 689f4c7415 doc/go1.17: mention block profile bias fix
+ 2021-06-08 9afe071c60 doc/go1.17: remove TODO for Tools section
+ 2021-06-08 f753d7223e doc/go1.17: resolve TODO for cmd/cover
+ 2021-06-08 9498b0155d cmd/go: in Go 1.17+ modules, add indirect go.mod dependencies separately from direct ones
+ 2021-06-08 949f00cebe doc/go1.17: add release notes for crypto packages
+ 2021-06-08 0fb3e2c184 doc/go1.17: add a release note for the '-compat' flag to 'go mod tidy'
+ 2021-06-08 2169deb352 cmd/compile: use t.AllMethods when sorting typesByString
+ 2021-06-08 c20bcb6488 runtime: remove out-of-date comments about frame skipping
+ 2021-06-07 39c39ae52f doc: document Go 1.17 language changes
+ 2021-06-07 dc8b558951 cmd/dist: pass -Wno-lto-type-mismatch in swig_callback_lto
+ 2021-06-07 909dd5e010 strconv: ParseFloat: always return ErrSyntax for bad syntax
Change-Id: Iffdf379d0275bbd12d50149ce38634773ced481d
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The compiler machinery that generates "map.zero" symbols marks them as
RODATA and DUPOK, which is problematic when a given application has
multiple map zero symbols (from different packages) with varying
sizes: the dupok path in the loader assumes that if two symbols have
the same name, it is safe to pick any of the versions. In the case of
map.zero, the link needs to select the largest symbol, not an
arbitrary sym.
To fix this problem, mark map.zero symbols as content-addressable,
since the loader's content addressability processing path already
supports selection of the larger symbol in cases where there are dups.
Fixes #46653.
Change-Id: Iabd2feef01d448670ba795c7eaddc48c191ea276
Reviewed-on: https://go-review.googlesource.com/c/go/+/326211
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This CL reorganizes export writing in preparation for unified IR:
1. It moves dumpexport into noder as noder.WriteExports so that it can
be extended to include unified IR's export data.
2. Adds an "extensions" flag to typecheck.WriteExports to control
whether the compiler-only extension data (e.g., function bodies and
linker symbol info) is included in the exports.
3. It moves the gc.exporter type into typecheck and renames it to
"crawler". The type originated as the implementation of
the (pre-iexport) binary exporter, but since the removal of bexport
it's been relegated to simply crawling the exported functions/bodies
graph to identify which inline bodies need to be included.
4. It changes inline.Inline_Flood into the method crawler.markInlBody.
Inline_Flood doesn't actually have anything to do with the rest of
inlining; its current name and location are just historical quirks.
Passes toolstash -cmp.
Change-Id: I6445e2de9d3ce500a3aded5a8e20b09f46d23dbc
Reviewed-on: https://go-review.googlesource.com/c/go/+/325212
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Trust: Matthew Dempsky <mdempsky@google.com>
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently, when the runtime printing a stack track (at panic, or
when runtime.Stack is called), it prints the function arguments
as words in memory. With a register-based calling convention,
the layout of argument area of the memory changes, so the
printing also needs to change. In particular, the memory order
and the syntax order of the arguments may differ. To address
that, this CL lets the compiler to emit some metadata about the
memory layout of the arguments, and the runtime will use this
information to print arguments in syntax order.
Previously we print the memory contents of the results along with
the arguments. The results are likely uninitialized when the
traceback is taken, so that information is rarely useful. Also,
with a register-based calling convention the results may not
have corresponding locations in memory. This CL changes it to not
print results.
Previously the runtime simply prints the memory contents as
pointer-sized words. With a register-based calling convention,
as the layout changes, arguments that were packed in one word
may no longer be in one word. Also, as the spill slots are not
always initialized, it is possible that some part of a word
contains useful informationwhile the rest contains garbage.
Instead of letting the runtime recreating the ABI0 layout and
print them as words, we now print each component separately.
Aggregate-typed argument/component is surrounded by "{}".
For example, for a function
F(int, [3]byte, byte) int
when called as F(1, [3]byte{2, 3, 4}, 5), it used to print
F(0x1, 0x5040302, 0xXXXXXXXX) // assuming little endian, 0xXXXXXXXX is uninitilized result
Now prints
F(0x1, {0x2, 0x3, 0x4}, 0x5).
Note: the liveness tracking of the spill splots has not been
implemented in this CL. Currently the runtime just assumes all
the slots are live and print them all.
Increase binary sizes by ~1.5%.
old new
hello (println) 1171328 1187712 (+1.4%)
hello (fmt) 1877024 1901600 (+1.3%)
cmd/compile 22326928 22662800 (+1.5%)
cmd/go 13505024 13726208 (+1.6%)
Updates #40724.
Change-Id: I351e0bf497f99bdbb3f91df2fb17e3c2c5c316dc
Reviewed-on: https://go-review.googlesource.com/c/go/+/304470
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
|
|
|
|
|
|
|
|
|
| |
Change-Id: Idbbb4cb7127b93afa34a8aa18bbdaad1f206ab6a
Reviewed-on: https://go-review.googlesource.com/c/go/+/308090
Trust: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Move DWARF generation for global variables from the linker to the
compiler. This effectively parallelizes this part of DWARF generation,
speeds up the linker minutely, and gives us a slightly more rational
implementation (there was really no compelling reason to do DWARF gen
for globals in the linker).
Change-Id: I0c1c98d3a647258697e90eb91d1d8a9f6f7f376a
Reviewed-on: https://go-review.googlesource.com/c/go/+/295011
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These symbols are implementation details and don't correspond to Go
source symbols, so directly create them as linker symbols and get rid
of their pseudo packages.
Passes toolstash -cmp w/ -gcflags=all=-abiwrap.
Change-Id: I2e97374c21f3e909f6d350f15e7a5ed3574cadf4
Reviewed-on: https://go-review.googlesource.com/c/go/+/284372
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Trust: Matthew Dempsky <mdempsky@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
recent renames
Went in a semi-automated way through the clearest renames of functions,
and updated comments and error messages where it made sense.
Change-Id: Ied8e152b562b705da7f52f715991a77dab60da35
Reviewed-on: https://go-review.googlesource.com/c/go/+/284216
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I misread the FIXME comment in InitLSym the first time. It's referring
to how InitLSym is supposed to be called exactly once per
function (see function documentation), but this is evidently not
actually the case currently in GOEXPERIMENT=regabi mode.
So just move the NeedFuncSym call below the GOEXPERIMENT=regabi
workaround.
Also, to fix the linux-arm64-{aws,packet} builders, move the call to
reflectdata.WriteFuncSyms() to after the second batch of functions are
compiled. This is necessary to make sure we catch all the funcsyms
that can be added by late function compilation.
Change-Id: I6d6396d48e2ee29c1fb007fa2b99e065b36375db
Reviewed-on: https://go-review.googlesource.com/c/go/+/283552
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Trust: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The compiler currently has two modes for compilation: one where it
compiles each function as it sees them, and another where it enqueues
them all into a work queue. A subsequent CL is going to reorder
function compilation to ensure that functions are always compiled
before any non-trivial function literals they enclose, and this will
be easier if we always use the compile work queue.
Also, fewer compilation modes makes things simpler to reason about.
Change-Id: Ie090e81f7476c49486296f2b90911fa0a466a5dd
Reviewed-on: https://go-review.googlesource.com/c/go/+/283313
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These aren't part of the Node interface anymore, so no need to keep
them around.
Passes toolstash -cmp.
[git-generate]
cd src/cmd/compile/internal/ir
: Fix one off case that causes trouble for rf.
sed -i -e 's/n.SetClass(ir.PAUTO)/n.Class_ = ir.PAUTO/' ../ssa/export_test.go
pkgs=$(go list . ../...)
rf '
ex '"$(echo $pkgs)"' {
var n *Name
var c Class
n.Class() -> n.Class_
n.SetClass(c) -> n.Class_ = c
}
rm Name.Class
rm Name.SetClass
mv Name.Class_ Name.Class
'
Change-Id: Ifb304bf4691a8c455456aabd8aa77178d4a49500
Reviewed-on: https://go-review.googlesource.com/c/go/+/281294
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
[git-generate]
cd src/cmd/compile/internal/ir
pkgs=$(grep -l -w Name ../*/*.go | xargs dirname | sort -u | grep -v '/ir$')
rf '
ex . '"$(echo $pkgs)"' {
var n *Name
n.Name() -> n
}
'
Change-Id: I6bfce6417a6dba833d2f652ae212a32c11bc5ef6
Reviewed-on: https://go-review.googlesource.com/c/go/+/280972
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This largely gets rid of the remaining direct Linksym calls, hopefully
enough to discourage people from following bad existing practice until
Sym.Linksym can be removed entirely.
Passes toolstash -cmp.
Change-Id: I5d8f8f703ace7256538fc79648891ede0d879dc2
Reviewed-on: https://go-review.googlesource.com/c/go/+/280641
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Passes toolstash -cmp.
[git-generate]
cd src/cmd/compile/internal/gc
pkgs=$(grep -l -w Linksym ../*/*.go | xargs dirname | grep -v '/gc$' | sort -u)
rf '
ex . '"$(echo $pkgs)"' {
import "cmd/compile/internal/ir"
import "cmd/compile/internal/reflectdata"
import "cmd/compile/internal/staticdata"
import "cmd/compile/internal/types"
avoid reflectdata.TypeLinksym
avoid reflectdata.TypeLinksymLookup
avoid reflectdata.TypeLinksymPrefix
avoid staticdata.FuncLinksym
var f *ir.Func
var n *ir.Name
var s string
var t *types.Type
f.Sym().Linksym() -> f.Linksym()
n.Sym().Linksym() -> n.Linksym()
reflectdata.TypeSym(t).Linksym() -> reflectdata.TypeLinksym(t)
reflectdata.TypeSymPrefix(s, t).Linksym() -> reflectdata.TypeLinksymPrefix(s, t)
staticdata.FuncSym(n.Sym()).Linksym() -> staticdata.FuncLinksym(n)
types.TypeSymLookup(s).Linksym() -> reflectdata.TypeLinksymLookup(s)
}
'
Change-Id: I7a3ae1dcd61bcdf4a29f708ff12f7f80c2b280c6
Reviewed-on: https://go-review.googlesource.com/c/go/+/280640
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Syms are meant to be just interned (pkg, name) tuples, and are a
purely abstract, Go-language concept. As such, associating them with
linker symbols (a low-level, implementation-oriented detail) is
inappropriate.
There's still work to be done before linker symbols can be directly
attached to their appropriate, higher-level objects instead. But in
the mean-time, we can at least add helper functions and discourage
folks from using Sym.Linksym directly. The next CL will mechanically
rewrite code to use these helpers where possible.
Passes toolstash -cmp.
Change-Id: I413bd1c80bce056304f9a7343526bd153f2b9c7d
Reviewed-on: https://go-review.googlesource.com/c/go/+/280639
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
[git-generate]
cd src/cmd/compile/internal/gc
rf '
# Late addition to package ir.
mv closuredebugruntimecheck ClosureDebugRuntimeCheck
mv hasemptycvars IsTrivialClosure
mv ClosureDebugRuntimeCheck IsTrivialClosure func.go
mv func.go cmd/compile/internal/ir
# Late addition to package reflectdata.
mv markTypeUsedInInterface MarkTypeUsedInInterface
mv markUsedIfaceMethod MarkUsedIfaceMethod
mv MarkTypeUsedInInterface MarkUsedIfaceMethod reflect.go
mv reflect.go cmd/compile/internal/reflectdata
# Late addition to package staticdata.
mv litsym InitConst
mv InitConst data.go
mv data.go cmd/compile/internal/staticdata
# Extract staticinit out of walk into its own package.
mv InitEntry InitPlan InitSchedule InitSchedule.append InitSchedule.staticInit \
InitSchedule.tryStaticInit InitSchedule.staticcopy \
InitSchedule.staticassign InitSchedule.initplan InitSchedule.addvalue \
statuniqgen staticname stataddr anySideEffects getlit isvaluelit \
sched.go
mv InitSchedule.initplans InitSchedule.Plans
mv InitSchedule.inittemps InitSchedule.Temps
mv InitSchedule.out InitSchedule.Out
mv InitSchedule.staticInit InitSchedule.StaticInit
mv InitSchedule.staticassign InitSchedule.StaticAssign
mv InitSchedule Schedule
mv InitPlan Plan
mv InitEntry Entry
mv anySideEffects AnySideEffects
mv staticname StaticName
mv stataddr StaticLoc
mv sched.go cmd/compile/internal/staticinit
# Export API and unexport non-API.
mv transformclosure Closure
mv walk Walk
mv Order orderState
mv swt.go switch.go
mv racewalk.go race.go
mv closure.go order.go range.go select.go switch.go race.go \
sinit.go subr.go walk.go \
cmd/compile/internal/walk
'
: # Update format test.
cd ../../
go install cmd/compile/... cmd/internal/archive
go test -u || go test -u
rm -rf ../../../pkg/darwin_amd64/cmd
Change-Id: I11c7a45f74d4a9e963da15c080e1018caaa99c05
Reviewed-on: https://go-review.googlesource.com/c/go/+/279478
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
[git-generate]
cd src/cmd/compile/internal/gc
rf '
# Inline and remove ngotype.
ex {
import "cmd/compile/internal/ir"
import "cmd/compile/internal/reflectdata"
var n ir.Node
ngotype(n) -> reflectdata.TypeSym(n.Type())
}
rm ngotype
mv recordFlags RecordFlags
mv recordPackageName RecordPackageName
mv RecordFlags RecordPackageName dwarf.go
mv debuginfo Info
mv genAbstractFunc AbstractFunc
mv scope.go scope_test.go dwarf.go dwinl.go cmd/compile/internal/dwarfgen
'
Change-Id: I31fa982900dbba2066ca4c7a706af922e5481c70
Reviewed-on: https://go-review.googlesource.com/c/go/+/279477
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
[git-generate]
cd src/cmd/compile/internal/gc
rf '
ex {
import "cmd/compile/internal/base"
thearch.LinkArch.Name -> base.Ctxt.Arch.Name
}
# Move out of reflect.go a few functions that should stay.
mv addsignats obj.go
mv deferstruct ssa.go
# Export reflectdata API.
mv zerosize ZeroSize
mv hmap MapType
mv bmap MapBucketType
mv hiter MapIterType
mv addsignat NeedRuntimeType
mv typename TypePtr
mv typenamesym TypeSym
mv typesymprefix TypeSymPrefix
mv itabsym ITabSym
mv tracksym TrackSym
mv zeroaddr ZeroAddr
mv itabname ITabAddr
mv ifaceMethodOffset InterfaceMethodOffset
mv peekitabs CompileITabs
mv addptabs CollectPTabs
mv algtype AlgType
mv dtypesym WriteType
mv dumpbasictypes WriteBasicTypes
mv dumpimportstrings WriteImportStrings
mv dumpsignats WriteRuntimeTypes
mv dumptabs WriteTabs
mv eqinterface EqInterface
mv eqstring EqString
mv GCProg gcProg
mv EqCanPanic eqCanPanic
mv IsRegularMemory isRegularMemory
mv Sig typeSig
mv hashmem alg.go
mv CollectPTabs genwrapper ZeroSize reflect.go
mv alg.go reflect.go cmd/compile/internal/reflectdata
'
Change-Id: Iaae9da9e9fad5f772f5216004823ccff2ea8f139
Reviewed-on: https://go-review.googlesource.com/c/go/+/279475
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
[git-generate]
cd src/cmd/compile/internal/gc
rf '
# Export API and move to its own files.
mv addrsym InitAddr
mv pfuncsym InitFunc
mv slicesym InitSlice
mv slicebytes InitSliceBytes
mv stringsym StringSym
mv funcsym FuncSym
mv makefuncsym NeedFuncSym
mv dumpfuncsyms WriteFuncSyms
mv InitAddr InitFunc InitSlice InitSliceBytes stringSymPrefix \
StringSym fileStringSym slicedataGen slicedata dstringdata \
funcsyms FuncSym NeedFuncSym WriteFuncSyms \
data.go
mv initEmbed WriteEmbed
mv dumpembeds obj.go
mv data.go embed.go cmd/compile/internal/staticdata
'
Change-Id: I209c5e597c8acfa29a48527695a9ddc1e9ea8e6a
Reviewed-on: https://go-review.googlesource.com/c/go/+/279474
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
[git-generate]
cd src/cmd/compile/internal/gc
rf '
mv ArhdrSize HeaderSize
mv arsize ReadHeader
mv formathdr FormatHeader
mv HeaderSize ReadHeader FormatHeader archive.go
mv archive.go cmd/internal/archive
mv makePos main.go
mv checkDotImports CheckDotImports
mv parseFiles ParseFiles
mv Pragma pragmas
mv PragmaEmbed pragmaEmbed
mv PragmaPos pragmaPos
mv FuncPragmas funcPragmas
mv TypePragmas typePragmas
mv fakeRecv noder.funcLit renameinitgen renameinit oldname varEmbed noder.go
mv isDriveLetter islocalname findpkg myheight importfile \
reservedimports isbadimport \
pkgnotused \
mkpackage clearImports \
CheckDotImports dotImports importDot \
importName \
import.go
mv noder _noder
mv import.go lex.go lex_test.go noder.go cmd/compile/internal/noder
'
cd ../noder
rf '
mv _noder noder
'
Change-Id: Iac2b856f7b86143c666d818e4b7c5b261cf387d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/279473
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Object file writing routines are used not just at the end
of the compilation but also during static data layout in walk.
Split them into their own package.
[git-generate]
cd src/cmd/compile/internal/gc
rf '
# Move bit vector to new package bitvec
mv bvec.n bvec.N
mv bvec.b bvec.B
mv bvec BitVec
mv bvalloc New
mv bvbulkalloc NewBulk
mv bulkBvec.next bulkBvec.Next
mv bulkBvec Bulk
mv H0 h0
mv Hp hp
# Leave bvecSet and bitmap hashes behind - not needed as broadly.
mv bvecSet.extractUniqe bvecSet.extractUnique
mv h0 bvecSet bvecSet.grow bvecSet.add \
bvecSet.extractUnique hashbitmap bvset.go
mv bv.go cmd/compile/internal/bitvec
ex . ../arm ../arm64 ../mips ../mips64 ../ppc64 ../s390x ../riscv64 {
import "cmd/internal/obj"
var a *obj.Addr
var i int64
Addrconst(a, i) -> a.SetConst(i)
var p, to *obj.Prog
Patch(p, to) -> p.To.SetTarget(to)
}
rm Addrconst Patch
# Move object-writing API to new package objw
mv duint8 Objw_Uint8
mv duint16 Objw_Uint16
mv duint32 Objw_Uint32
mv duintptr Objw_Uintptr
mv duintxx Objw_UintN
mv dsymptr Objw_SymPtr
mv dsymptrOff Objw_SymPtrOff
mv dsymptrWeakOff Objw_SymPtrWeakOff
mv ggloblsym Objw_Global
mv dbvec Objw_BitVec
mv newProgs NewProgs
mv Progs.clearp Progs.Clear
mv Progs.settext Progs.SetText
mv Progs.next Progs.Next
mv Progs.pc Progs.PC
mv Progs.pos Progs.Pos
mv Progs.curfn Progs.CurFunc
mv Progs.progcache Progs.Cache
mv Progs.cacheidx Progs.CacheIndex
mv Progs.nextLive Progs.NextLive
mv Progs.prevLive Progs.PrevLive
mv Progs.Appendpp Progs.Append
mv LivenessIndex.stackMapIndex LivenessIndex.StackMapIndex
mv LivenessIndex.isUnsafePoint LivenessIndex.IsUnsafePoint
mv Objw_Uint8 Objw_Uint16 Objw_Uint32 Objw_Uintptr Objw_UintN \
Objw_SymPtr Objw_SymPtrOff Objw_SymPtrWeakOff Objw_Global \
Objw_BitVec \
objw.go
mv sharedProgArray NewProgs Progs \
LivenessIndex StackMapDontCare \
LivenessDontCare LivenessIndex.StackMapValid \
Progs.NewProg Progs.Flush Progs.Free Progs.Prog Progs.Clear Progs.Append Progs.SetText \
prog.go
mv prog.go objw.go cmd/compile/internal/objw
# Move ggloblnod to obj with the rest of the non-objw higher-level writing.
mv ggloblnod obj.go
'
cd ../objw
rf '
mv Objw_Uint8 Uint8
mv Objw_Uint16 Uint16
mv Objw_Uint32 Uint32
mv Objw_Uintptr Uintptr
mv Objw_UintN UintN
mv Objw_SymPtr SymPtr
mv Objw_SymPtrOff SymPtrOff
mv Objw_SymPtrWeakOff SymPtrWeakOff
mv Objw_Global Global
mv Objw_BitVec BitVec
'
Change-Id: I2b87085aa788564fb322e9c55bddd73347b4d5fd
Reviewed-on: https://go-review.googlesource.com/c/go/+/279310
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit splits the typechecking logic into its own package,
the first of a sequence of CLs to break package gc into more
manageable units.
[git-generate]
cd src/cmd/compile/internal/gc
rf '
# The binary import/export has to be part of typechecking,
# because we load inlined function bodies lazily, but "exporter"
# should not be. Move that out of bexport.go.
mv exporter exporter.markObject exporter.markType export.go
# Use the typechecking helpers, so that the calls left behind
# in package gc do not need access to ctxExpr etc.
ex {
import "cmd/compile/internal/ir"
# TODO(rsc): Should not be necessary.
avoid TypecheckExpr
avoid TypecheckStmt
avoid TypecheckExprs
avoid TypecheckStmts
avoid TypecheckAssignExpr
avoid TypecheckCallee
var n ir.Node
var ns []ir.Node
typecheck(n, ctxExpr) -> TypecheckExpr(n)
typecheck(n, ctxStmt) -> TypecheckStmt(n)
typecheckslice(ns, ctxExpr) -> TypecheckExprs(ns)
typecheckslice(ns, ctxStmt) -> TypecheckStmts(ns)
typecheck(n, ctxExpr|ctxAssign) -> TypecheckAssignExpr(n)
typecheck(n, ctxExpr|ctxCallee) -> TypecheckCallee(n)
}
# Move some typechecking API to typecheck.
mv syslook LookupRuntime
mv substArgTypes SubstArgTypes
mv LookupRuntime SubstArgTypes syms.go
mv conv Conv
mv convnop ConvNop
mv Conv ConvNop typecheck.go
mv colasdefn AssignDefn
mv colasname assignableName
mv Target target.go
mv initname autoexport exportsym dcl.go
mv exportsym Export
# Export API to be called from outside typecheck.
# The ones with "Typecheck" prefixes will be renamed later to drop the prefix.
mv adddot AddImplicitDots
mv assignconv AssignConv
mv expandmeth CalcMethods
mv capturevarscomplete CaptureVarsComplete
mv checkMapKeys CheckMapKeys
mv checkreturn CheckReturn
mv dclcontext DeclContext
mv dclfunc DeclFunc
mv declare Declare
mv dotImportRefs DotImportRefs
mv declImporter DeclImporter
mv variter DeclVars
mv defaultlit DefaultLit
mv evalConst EvalConst
mv expandInline ImportBody
mv finishUniverse declareUniverse
mv funcbody FinishFuncBody
mv funchdr StartFuncBody
mv indexconst IndexConst
mv initTodo InitTodoFunc
mv lookup Lookup
mv resolve Resolve
mv lookupN LookupNum
mv nodAddr NodAddr
mv nodAddrAt NodAddrAt
mv nodnil NodNil
mv origBoolConst OrigBool
mv origConst OrigConst
mv origIntConst OrigInt
mv redeclare Redeclared
mv tostruct NewStructType
mv functype NewFuncType
mv methodfunc NewMethodType
mv structargs NewFuncParams
mv temp Temp
mv tempAt TempAt
mv typecheckok TypecheckAllowed
mv typecheck _typecheck # make room for typecheck pkg
mv typecheckinl TypecheckImportedBody
mv typecheckFunc TypecheckFunc
mv iimport ReadImports
mv iexport WriteExports
mv sysfunc LookupRuntimeFunc
mv sysvar LookupRuntimeVar
# Move function constructors to typecheck.
mv mkdotargslice MakeDotArgs
mv fixVariadicCall FixVariadicCall
mv closureType ClosureType
mv partialCallType PartialCallType
mv capturevars CaptureVars
mv MakeDotArgs FixVariadicCall ClosureType PartialCallType CaptureVars typecheckclosure func.go
mv autolabel AutoLabel
mv AutoLabel syms.go
mv Dlist dlist
mv Symlink symlink
mv \
AssignDefn assignableName \
AssignConv \
CaptureVarsComplete \
DeclContext \
DeclFunc \
DeclImporter \
DeclVars \
Declare \
DotImportRefs \
Export \
InitTodoFunc \
Lookup \
LookupNum \
LookupRuntimeFunc \
LookupRuntimeVar \
NewFuncParams \
NewName \
NodAddr \
NodAddrAt \
NodNil \
Redeclared \
StartFuncBody \
FinishFuncBody \
TypecheckImportedBody \
AddImplicitDots \
CalcMethods \
CheckFuncStack \
NewFuncType \
NewMethodType \
NewStructType \
TypecheckAllowed \
Temp \
TempAt \
adddot1 \
dotlist \
addmethod \
assignconvfn \
assignop \
autotmpname \
autoexport \
bexport.go \
checkdupfields \
checkembeddedtype \
closurename \
convertop \
declare_typegen \
decldepth \
dlist \
dotpath \
expand0 \
expand1 \
expandDecl \
fakeRecvField \
fnpkg \
funcStack \
funcStackEnt \
funcarg \
funcarg2 \
funcargs \
funcargs2 \
globClosgen \
ifacelookdot \
implements \
importalias \
importconst \
importfunc \
importobj \
importsym \
importtype \
importvar \
inimport \
initname \
isptrto \
loadsys \
lookdot0 \
lookdot1 \
makepartialcall \
okfor \
okforlen \
operandType \
slist \
symlink \
tointerface \
typeSet \
typeSet.add \
typeSetEntry \
typecheckExprSwitch \
typecheckTypeSwitch \
typecheckpartialcall \
typecheckrange \
typecheckrangeExpr \
typecheckselect \
typecheckswitch \
vargen \
builtin.go \
builtin_test.go \
const.go \
func.go \
iexport.go \
iimport.go \
mapfile_mmap.go \
syms.go \
target.go \
typecheck.go \
unsafe.go \
universe.go \
cmd/compile/internal/typecheck
'
rm gen.go types.go types_acc.go
sed -i '' 's/package gc/package typecheck/' mapfile_read.go mkbuiltin.go
mv mapfile_read.go ../typecheck # not part of default build
mv mkbuiltin.go ../typecheck # package main helper
mv builtin ../typecheck
cd ../typecheck
mv dcl.go dcl1.go
mv typecheck.go typecheck1.go
mv universe.go universe1.go
rf '
# Sweep some small files into larger ones.
# "mv sym... file1.go file.go" (after the mv file1.go file.go above)
# lets us insert sym... at the top of file.go.
mv okfor okforeq universe1.go universe.go
mv DeclContext vargen dcl1.go Temp TempAt autotmpname NewMethodType dcl.go
mv InitTodoFunc inimport decldepth TypecheckAllowed typecheck1.go typecheck.go
mv inl.go closure.go func.go
mv range.go select.go swt.go stmt.go
mv Lookup loadsys LookupRuntimeFunc LookupRuntimeVar syms.go
mv unsafe.go const.go
mv TypecheckAssignExpr AssignExpr
mv TypecheckExpr Expr
mv TypecheckStmt Stmt
mv TypecheckExprs Exprs
mv TypecheckStmts Stmts
mv TypecheckCall Call
mv TypecheckCallee Callee
mv _typecheck check
mv TypecheckFunc Func
mv TypecheckFuncBody FuncBody
mv TypecheckImports AllImportedBodies
mv TypecheckImportedBody ImportedBody
mv TypecheckInit Init
mv TypecheckPackage Package
'
rm gen.go go.go init.go main.go reflect.go
Change-Id: Iea6a7aaf6407d690670ec58aeb36cc0b280f80b0
Reviewed-on: https://go-review.googlesource.com/c/go/+/279236
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
[generated]
To break up package gc, we need to put these calculations somewhere
lower in the import graph, either an existing or new package. Package types
already needs this code and is using hacks to get it without an import cycle.
We can remove the hacks and set up for the new package gc by moving the
code into package types itself.
[git-generate]
cd src/cmd/compile/internal/gc
rf '
# Remove old import cycle hacks in gc.
rm TypecheckInit:/types.Widthptr =/-0,/types.Dowidth =/+0 \
../ssa/export_test.go:/types.Dowidth =/-+
ex {
import "cmd/compile/internal/types"
types.Widthptr -> Widthptr
types.Dowidth -> dowidth
}
# Disable CalcSize in tests instead of base.Fatalf
sub dowidth:/base.Fatalf\("dowidth without betypeinit"\)/ \
// Assume this is a test. \
return
# Move size calculation into cmd/compile/internal/types
mv Widthptr PtrSize
mv Widthreg RegSize
mv slicePtrOffset SlicePtrOffset
mv sliceLenOffset SliceLenOffset
mv sliceCapOffset SliceCapOffset
mv sizeofSlice SliceSize
mv sizeofString StringSize
mv skipDowidthForTracing SkipSizeForTracing
mv dowidth CalcSize
mv checkwidth CheckSize
mv widstruct calcStructOffset
mv sizeCalculationDisabled CalcSizeDisabled
mv defercheckwidth DeferCheckSize
mv resumecheckwidth ResumeCheckSize
mv typeptrdata PtrDataSize
mv \
PtrSize RegSize SlicePtrOffset SkipSizeForTracing typePos align.go PtrDataSize \
size.go
mv size.go cmd/compile/internal/types
'
: # Remove old import cycle hacks in types.
cd ../types
rf '
ex {
Widthptr -> PtrSize
Dowidth -> CalcSize
}
rm Widthptr Dowidth
'
Change-Id: Ib96cdc6bda2617235480c29392ea5cfb20f60cd8
Reviewed-on: https://go-review.googlesource.com/c/go/+/279234
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
[git-generate]
cd src/cmd/compile/internal/gc
sed -i '' 's/TestBuiltin.*/& t.Skip("mkbuiltin needs fixing")/' builtin_test.go
gofmt -w builtin_test.go
rf '
# Inline a few little-used constructors to avoid bringing them.
ex {
import "cmd/compile/internal/base"
import "cmd/compile/internal/ir"
import "cmd/compile/internal/types"
import "cmd/internal/src"
var typ *types.Type
var sym *types.Sym
var str string
symfield(sym, typ) -> ir.NewField(base.Pos, sym, nil, typ)
anonfield(typ) -> ir.NewField(base.Pos, nil, nil, typ)
namedfield(str, typ) -> ir.NewField(base.Pos, lookup(str), nil, typ)
var cp *ir.CallPartExpr
callpartMethod(cp) -> cp.Method
var n ir.Node
callpartMethod(n) -> n.(*ir.CallPartExpr).Method
var ns []ir.Node
liststmt(ns) -> ir.NewBlockStmt(src.NoXPos, ns)
}
rm symfield anonfield namedfield liststmt callpartMethod
mv maxStackVarSize MaxStackVarSize
mv maxImplicitStackVarSize MaxImplicitStackVarSize
mv smallArrayBytes MaxSmallArraySize
mv MaxStackVarSize cfg.go
mv nodbool NewBool
mv nodintconst NewInt
mv nodstr NewString
mv NewBool NewInt NewString const.go
mv Mpprec ConstPrec
mv bigFloatVal BigFloat
mv doesoverflow ConstOverflow
mv isGoConst IsConstNode
mv smallintconst IsSmallIntConst
mv isZero IsZero
mv islvalue IsAssignable
mv staticValue StaticValue
mv samesafeexpr SameSafeExpr
mv checkPtr ShouldCheckPtr
mv isReflectHeaderDataField IsReflectHeaderDataField
mv paramNnames ParamNames
mv methodSym MethodSym
mv methodSymSuffix MethodSymSuffix
mv methodExprFunc MethodExprFunc
mv methodExprName MethodExprName
mv IsZero IsAssignable StaticValue staticValue1 reassigned \
IsIntrinsicCall \
SameSafeExpr ShouldCheckPtr IsReflectHeaderDataField \
ParamNames MethodSym MethodSymSuffix \
MethodExprName MethodExprFunc \
expr.go
mv Curfn CurFunc
mv funcsymname FuncSymName
mv newFuncNameAt NewFuncNameAt
mv setNodeNameFunc MarkFunc
mv CurFunc FuncSymName NewFuncNameAt MarkFunc func.go
mv isParamStackCopy IsParamStackCopy
mv isParamHeapCopy IsParamHeapCopy
mv nodfp RegFP
mv IsParamStackCopy IsParamHeapCopy RegFP name.go
mv hasUniquePos HasUniquePos
mv setlineno SetPos
mv initExpr InitExpr
mv hasNamedResults HasNamedResults
mv outervalue OuterValue
mv HasNamedResults HasUniquePos SetPos InitExpr OuterValue EscNever node.go
mv visitBottomUp VisitFuncsBottomUp # scc.go
mv cfg.go \
NewBool NewInt NewString \ # parts of const.go
ConstPrec BigFloat ConstOverflow IsConstNode IsSmallIntConst \
expr.go func.go name.go node.go scc.go \
cmd/compile/internal/ir
'
Change-Id: I13402c5a2cedbf78d993a1eae2940718f23ac166
Reviewed-on: https://go-review.googlesource.com/c/go/+/279421
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are a handful of pre-computed magic symbols known by
package gc, and we need a place to store them.
If we keep them together, the need for type *ir.Name means that
package ir is the lowest package in the import hierarchy that they
can go in. And package ir needs gopkg for methodSymSuffix
(in a later CL), so they can't go any higher either, at least not all together.
So package ir it is.
Rather than dump them all into the top-level package ir
namespace, however, we introduce global structs, Syms, Pkgs, and Names,
and make the known symbols, packages, and names fields of those.
[git-generate]
cd src/cmd/compile/internal/gc
rf '
add go.go:$ \
// Names holds known names. \
var Names struct{} \
\
// Syms holds known symbols. \
var Syms struct {} \
\
// Pkgs holds known packages. \
var Pkgs struct {} \
mv staticuint64s Names.Staticuint64s
mv zerobase Names.Zerobase
mv assertE2I Syms.AssertE2I
mv assertE2I2 Syms.AssertE2I2
mv assertI2I Syms.AssertI2I
mv assertI2I2 Syms.AssertI2I2
mv deferproc Syms.Deferproc
mv deferprocStack Syms.DeferprocStack
mv Deferreturn Syms.Deferreturn
mv Duffcopy Syms.Duffcopy
mv Duffzero Syms.Duffzero
mv gcWriteBarrier Syms.GCWriteBarrier
mv goschedguarded Syms.Goschedguarded
mv growslice Syms.Growslice
mv msanread Syms.Msanread
mv msanwrite Syms.Msanwrite
mv msanmove Syms.Msanmove
mv newobject Syms.Newobject
mv newproc Syms.Newproc
mv panicdivide Syms.Panicdivide
mv panicshift Syms.Panicshift
mv panicdottypeE Syms.PanicdottypeE
mv panicdottypeI Syms.PanicdottypeI
mv panicnildottype Syms.Panicnildottype
mv panicoverflow Syms.Panicoverflow
mv raceread Syms.Raceread
mv racereadrange Syms.Racereadrange
mv racewrite Syms.Racewrite
mv racewriterange Syms.Racewriterange
mv SigPanic Syms.SigPanic
mv typedmemclr Syms.Typedmemclr
mv typedmemmove Syms.Typedmemmove
mv Udiv Syms.Udiv
mv writeBarrier Syms.WriteBarrier
mv zerobaseSym Syms.Zerobase
mv arm64HasATOMICS Syms.ARM64HasATOMICS
mv armHasVFPv4 Syms.ARMHasVFPv4
mv x86HasFMA Syms.X86HasFMA
mv x86HasPOPCNT Syms.X86HasPOPCNT
mv x86HasSSE41 Syms.X86HasSSE41
mv WasmDiv Syms.WasmDiv
mv WasmMove Syms.WasmMove
mv WasmZero Syms.WasmZero
mv WasmTruncS Syms.WasmTruncS
mv WasmTruncU Syms.WasmTruncU
mv gopkg Pkgs.Go
mv itabpkg Pkgs.Itab
mv itablinkpkg Pkgs.Itablink
mv mappkg Pkgs.Map
mv msanpkg Pkgs.Msan
mv racepkg Pkgs.Race
mv Runtimepkg Pkgs.Runtime
mv trackpkg Pkgs.Track
mv unsafepkg Pkgs.Unsafe
mv Names Syms Pkgs symtab.go
mv symtab.go cmd/compile/internal/ir
'
Change-Id: Ic143862148569a3bcde8e70b26d75421aa2d00f3
Reviewed-on: https://go-review.googlesource.com/c/go/+/279235
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
[git-generate]
cd src/cmd/compile/internal/gc
rf '
# Type hash (formatting).
mv typehash TypeHash
mv TypeHash fmt.go
# Method sorting.
mv methcmp MethodsByName
mv MethodsByName MethodsByName.Len MethodsByName.Swap \
MethodsByName.Less sort.go
# Move version check into types.
# A little surprising, but its keyed off the types.Pkg.
ex {
import "cmd/compile/internal/types"
var p *types.Pkg
var major, minor int
langSupported(major, minor, p) -> AllowsGoVersion(p, major, minor)
}
rm langSupported
mv checkLang ParseLangFlag
mv lang langWant AllowsGoVersion ParseLangFlag \
parseLang currentLang goVersionRE goversion.go
mv testdclstack CheckDclstack
mv CheckDclstack scope.go
mv algtype1 AlgType
mv isComplex IsComplex
mv isFloat IsFloat
mv isInt IsInt
mv issimple IsSimple
mv okforcmp IsOrdered
mv floatForComplex FloatForComplex
mv complexForFloat ComplexForFloat
mv isdirectiface IsDirectIface
mv isifacemethod IsInterfaceMethod
mv isMethodApplicable IsMethodApplicable
mv ispaddedfield IsPaddedField
mv isRuntimePkg IsRuntimePkg
mv isReflectPkg IsReflectPkg
mv methtype ReceiverBaseType
mv typesymname TypeSymName
mv typesym TypeSym
mv typeLookup TypeSymLookup
mv IsAlias IsDotAlias
mv isreflexive IsReflexive
mv simtype SimType
# The type1.go here is to avoid an undiagnosed bug in rf
# that does not get the follow-up typechecking right if we
# move directly to type.go during the mv into package types below.
mv \
IsInt IsOrdered IsReflexive \
IsDirectIface IsInterfaceMethod IsMethodApplicable IsPaddedField \
IsRuntimePkg IsReflectPkg ReceiverBaseType \
FloatForComplex ComplexForFloat \
TypeSym TypeSymLookup TypeSymName \
typepkg SimType \
type1.go
# The alg1.go here is because we are only moving part of alg.go.
mv typeHasNoAlg TypeHasNoAlg
mv AlgKind ANOEQ AlgType TypeHasNoAlg IsComparable IncomparableField IsPaddedField alg1.go
mv IsDotAlias pkg.go
mv alg1.go algkind_string.go fmt.go goversion.go pkg.go \
CheckDclstack \ # scope.go
sort.go type1.go \
cmd/compile/internal/types
'
cd ../types
rf '
mv IsDclstackValid isDclstackValid
mv alg1.go alg.go
mv type1.go type.go
'
Change-Id: I8bd53b21c7bdd1770e1b525de32f136833e84c9d
Reviewed-on: https://go-review.googlesource.com/c/go/+/279307
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Now that the generic graph structure methods - Left, Right, and so on -
have been removed from the Node interface, each implementation's uses
can be replaced with direct field access, using more specific names,
and the methods themselves can be deleted.
Passes buildall w/ toolstash -cmp.
[git-generate]
cd src/cmd/compile/internal/ir
rf '
mv Func.iota Func.Iota_
mv Name.fn Name.Func_
'
cd ../gc
rf '
ex . ../ir {
import "cmd/compile/internal/ir"
import "cmd/compile/internal/types"
var ns ir.Nodes
var b bool
var i64 int64
var n ir.Node
var op ir.Op
var sym *types.Sym
var class ir.Class
var decl *ir.Decl
decl.Left() -> decl.X
decl.SetLeft(n) -> decl.X = n
var asl *ir.AssignListStmt
asl.List() -> asl.Lhs
asl.PtrList() -> &asl.Lhs
asl.SetList(ns) -> asl.Lhs = ns
asl.Rlist() -> asl.Rhs
asl.PtrRlist() -> &asl.Rhs
asl.SetRlist(ns) -> asl.Rhs = ns
asl.Colas() -> asl.Def
asl.SetColas(b) -> asl.Def = b
var as *ir.AssignStmt
as.Left() -> as.X
as.SetLeft(n) -> as.X = n
as.Right() -> as.Y
as.SetRight(n) -> as.Y = n
as.Colas() -> as.Def
as.SetColas(b) -> as.Def = b
var ao *ir.AssignOpStmt
ao.Left() -> ao.X
ao.SetLeft(n) -> ao.X = n
ao.Right() -> ao.Y
ao.SetRight(n) -> ao.Y = n
ao.SubOp() -> ao.AsOp
ao.SetSubOp(op) -> ao.AsOp = op
ao.Implicit() -> ao.IncDec
ao.SetImplicit(b) -> ao.IncDec = b
var bl *ir.BlockStmt
bl.List() -> bl.List_
bl.PtrList() -> &bl.List_
bl.SetList(ns) -> bl.List_ = ns
var br *ir.BranchStmt
br.Sym() -> br.Label
br.SetSym(sym) -> br.Label = sym
var cas *ir.CaseStmt
cas.List() -> cas.List_
cas.PtrList() -> &cas.List_
cas.SetList(ns) -> cas.List_ = ns
cas.Body() -> cas.Body_
cas.PtrBody() -> &cas.Body_
cas.SetBody(ns) -> cas.Body_ = ns
cas.Rlist() -> cas.Vars
cas.PtrRlist() -> &cas.Vars
cas.SetRlist(ns) -> cas.Vars = ns
cas.Left() -> cas.Comm
cas.SetLeft(n) -> cas.Comm = n
var fr *ir.ForStmt
fr.Sym() -> fr.Label
fr.SetSym(sym) -> fr.Label = sym
fr.Left() -> fr.Cond
fr.SetLeft(n) -> fr.Cond = n
fr.Right() -> fr.Post
fr.SetRight(n) -> fr.Post = n
fr.Body() -> fr.Body_
fr.PtrBody() -> &fr.Body_
fr.SetBody(ns) -> fr.Body_ = ns
fr.List() -> fr.Late
fr.PtrList() -> &fr.Late
fr.SetList(ns) -> fr.Late = ns
fr.HasBreak() -> fr.HasBreak_
fr.SetHasBreak(b) -> fr.HasBreak_ = b
var gs *ir.GoDeferStmt
gs.Left() -> gs.Call
gs.SetLeft(n) -> gs.Call = n
var ifs *ir.IfStmt
ifs.Left() -> ifs.Cond
ifs.SetLeft(n) -> ifs.Cond = n
ifs.Body() -> ifs.Body_
ifs.PtrBody() -> &ifs.Body_
ifs.SetBody(ns) -> ifs.Body_ = ns
ifs.Rlist() -> ifs.Else
ifs.PtrRlist() -> &ifs.Else
ifs.SetRlist(ns) -> ifs.Else = ns
ifs.Likely() -> ifs.Likely_
ifs.SetLikely(b) -> ifs.Likely_ = b
var im *ir.InlineMarkStmt
im.Offset() -> im.Index
im.SetOffset(i64) -> im.Index = i64
var lab *ir.LabelStmt
lab.Sym() -> lab.Label
lab.SetSym(sym) -> lab.Label = sym
var rng *ir.RangeStmt
rng.Sym() -> rng.Label
rng.SetSym(sym) -> rng.Label = sym
rng.Right() -> rng.X
rng.SetRight(n) -> rng.X = n
rng.Body() -> rng.Body_
rng.PtrBody() -> &rng.Body_
rng.SetBody(ns) -> rng.Body_ = ns
rng.List() -> rng.Vars
rng.PtrList() -> &rng.Vars
rng.SetList(ns) -> rng.Vars = ns
rng.HasBreak() -> rng.HasBreak_
rng.SetHasBreak(b) -> rng.HasBreak_ = b
rng.Colas() -> rng.Def
rng.SetColas(b) -> rng.Def = b
var ret *ir.ReturnStmt
ret.List() -> ret.Results
ret.PtrList() -> &ret.Results
ret.SetList(ns) -> ret.Results = ns
var sel *ir.SelectStmt
sel.List() -> sel.Cases
sel.PtrList() -> &sel.Cases
sel.SetList(ns) -> sel.Cases = ns
sel.Sym() -> sel.Label
sel.SetSym(sym) -> sel.Label = sym
sel.HasBreak() -> sel.HasBreak_
sel.SetHasBreak(b) -> sel.HasBreak_ = b
sel.Body() -> sel.Compiled
sel.PtrBody() -> &sel.Compiled
sel.SetBody(ns) -> sel.Compiled = ns
var send *ir.SendStmt
send.Left() -> send.Chan
send.SetLeft(n) -> send.Chan = n
send.Right() -> send.Value
send.SetRight(n) -> send.Value = n
var sw *ir.SwitchStmt
sw.Left() -> sw.Tag
sw.SetLeft(n) -> sw.Tag = n
sw.List() -> sw.Cases
sw.PtrList() -> &sw.Cases
sw.SetList(ns) -> sw.Cases = ns
sw.Body() -> sw.Compiled
sw.PtrBody() -> &sw.Compiled
sw.SetBody(ns) -> sw.Compiled = ns
sw.Sym() -> sw.Label
sw.SetSym(sym) -> sw.Label = sym
sw.HasBreak() -> sw.HasBreak_
sw.SetHasBreak(b) -> sw.HasBreak_ = b
var tg *ir.TypeSwitchGuard
tg.Left() -> tg.Tag
tg.SetLeft(nil) -> tg.Tag = nil
tg.SetLeft(n) -> tg.Tag = n.(*ir.Ident)
tg.Right() -> tg.X
tg.SetRight(n) -> tg.X = n
var adds *ir.AddStringExpr
adds.List() -> adds.List_
adds.PtrList() -> &adds.List_
adds.SetList(ns) -> adds.List_ = ns
var addr *ir.AddrExpr
addr.Left() -> addr.X
addr.SetLeft(n) -> addr.X = n
addr.Right() -> addr.Alloc
addr.SetRight(n) -> addr.Alloc = n
var bin *ir.BinaryExpr
bin.Left() -> bin.X
bin.SetLeft(n) -> bin.X = n
bin.Right() -> bin.Y
bin.SetRight(n) -> bin.Y = n
var log *ir.LogicalExpr
log.Left() -> log.X
log.SetLeft(n) -> log.X = n
log.Right() -> log.Y
log.SetRight(n) -> log.Y = n
var call *ir.CallExpr
call.Left() -> call.X
call.SetLeft(n) -> call.X = n
call.List() -> call.Args
call.PtrList() -> &call.Args
call.SetList(ns) -> call.Args = ns
call.Rlist() -> call.Rargs
call.PtrRlist() -> &call.Rargs
call.SetRlist(ns) -> call.Rargs = ns
call.IsDDD() -> call.DDD
call.SetIsDDD(b) -> call.DDD = b
call.NoInline() -> call.NoInline_
call.SetNoInline(b) -> call.NoInline_ = b
call.Body() -> call.Body_
call.PtrBody() -> &call.Body_
call.SetBody(ns) -> call.Body_ = ns
var cp *ir.CallPartExpr
cp.Func() -> cp.Func_
cp.Left() -> cp.X
cp.SetLeft(n) -> cp.X = n
cp.Sym() -> cp.Method.Sym
var clo *ir.ClosureExpr
clo.Func() -> clo.Func_
var cr *ir.ClosureReadExpr
cr.Offset() -> cr.Offset_
var cl *ir.CompLitExpr
cl.Right() -> cl.Ntype
cl.SetRight(nil) -> cl.Ntype = nil
cl.SetRight(n) -> cl.Ntype = ir.Node(n).(ir.Ntype)
cl.List() -> cl.List_
cl.PtrList() -> &cl.List_
cl.SetList(ns) -> cl.List_ = ns
var conv *ir.ConvExpr
conv.Left() -> conv.X
conv.SetLeft(n) -> conv.X = n
var ix *ir.IndexExpr
ix.Left() -> ix.X
ix.SetLeft(n) -> ix.X = n
ix.Right() -> ix.Index
ix.SetRight(n) -> ix.Index = n
ix.IndexMapLValue() -> ix.Assigned
ix.SetIndexMapLValue(b) -> ix.Assigned = b
var kv *ir.KeyExpr
kv.Left() -> kv.Key
kv.SetLeft(n) -> kv.Key = n
kv.Right() -> kv.Value
kv.SetRight(n) -> kv.Value = n
var sk *ir.StructKeyExpr
sk.Sym() -> sk.Field
sk.SetSym(sym) -> sk.Field = sym
sk.Left() -> sk.Value
sk.SetLeft(n) -> sk.Value = n
sk.Offset() -> sk.Offset_
sk.SetOffset(i64) -> sk.Offset_ = i64
var ic *ir.InlinedCallExpr
ic.Body() -> ic.Body_
ic.PtrBody() -> &ic.Body_
ic.SetBody(ns) -> ic.Body_ = ns
ic.Rlist() -> ic.ReturnVars
ic.PtrRlist() -> &ic.ReturnVars
ic.SetRlist(ns) -> ic.ReturnVars = ns
var mak *ir.MakeExpr
mak.Left() -> mak.Len
mak.SetLeft(n) -> mak.Len = n
mak.Right() -> mak.Cap
mak.SetRight(n) -> mak.Cap = n
var par *ir.ParenExpr
par.Left() -> par.X
par.SetLeft(n) -> par.X = n
var res *ir.ResultExpr
res.Offset() -> res.Offset_
res.SetOffset(i64) -> res.Offset_ = i64
var dot *ir.SelectorExpr
dot.Left() -> dot.X
dot.SetLeft(n) -> dot.X = n
dot.Sym() -> dot.Sel
dot.SetSym(sym) -> dot.Sel = sym
dot.Offset() -> dot.Offset_
dot.SetOffset(i64) -> dot.Offset_ = i64
var sl *ir.SliceExpr
sl.Left() -> sl.X
sl.SetLeft(n) -> sl.X = n
sl.List() -> sl.List_
sl.PtrList() -> &sl.List_
sl.SetList(ns) -> sl.List_ = ns
var sh *ir.SliceHeaderExpr
sh.Left() -> sh.Ptr
sh.SetLeft(n) -> sh.Ptr = n
sh.List() -> sh.LenCap_
sh.PtrList() -> &sh.LenCap_
sh.SetList(ns) -> sh.LenCap_ = ns
var st *ir.StarExpr
st.Left() -> st.X
st.SetLeft(n) -> st.X = n
var ta *ir.TypeAssertExpr
ta.Left() -> ta.X
ta.SetLeft(n) -> ta.X = n
ta.Right() -> ta.Ntype
ta.SetRight(n) -> ta.Ntype = n
ta.List() -> ta.Itab
ta.PtrList() -> &ta.Itab
ta.SetList(ns) -> ta.Itab = ns
var u *ir.UnaryExpr
u.Left() -> u.X
u.SetLeft(n) -> u.X = n
var fn *ir.Func
fn.Body() -> fn.Body_
fn.PtrBody() -> &fn.Body_
fn.SetBody(ns) -> fn.Body_ = ns
fn.Iota() -> fn.Iota_
fn.SetIota(i64) -> fn.Iota_ = i64
fn.Func() -> fn
var nam *ir.Name
nam.SubOp() -> nam.BuiltinOp
nam.SetSubOp(op) -> nam.BuiltinOp = op
nam.Class() -> nam.Class_
nam.SetClass(class) -> nam.Class_ = class
nam.Func() -> nam.Func_
nam.Offset() -> nam.Offset_
nam.SetOffset(i64) -> nam.Offset_ = i64
}
ex . ../ir {
import "cmd/compile/internal/ir"
var n ir.Nodes
(&n).Append -> n.Append
(&n).AppendNodes -> n.AppendNodes
(&n).MoveNodes -> n.MoveNodes
(&n).Prepend -> n.Prepend
(&n).Set -> n.Set
(&n).Set1 -> n.Set1
(&n).Set2 -> n.Set2
(&n).Set3 -> n.Set3
var ntype ir.Ntype
ir.Node(ntype).(ir.Ntype) -> ntype
}
'
cd ../ir
rf '
rm \
Decl.Left Decl.SetLeft \
AssignListStmt.List AssignListStmt.PtrList AssignListStmt.SetList \
AssignListStmt.Rlist AssignListStmt.PtrRlist AssignListStmt.SetRlist \
AssignListStmt.Colas AssignListStmt.SetColas \
AssignStmt.Left AssignStmt.SetLeft \
AssignStmt.Right AssignStmt.SetRight \
AssignStmt.Colas AssignStmt.SetColas \
AssignOpStmt.Left AssignOpStmt.SetLeft \
AssignOpStmt.Right AssignOpStmt.SetRight \
AssignOpStmt.SubOp AssignOpStmt.SetSubOp \
AssignOpStmt.Implicit AssignOpStmt.SetImplicit \
BlockStmt.List BlockStmt.PtrList BlockStmt.SetList \
BranchStmt.SetSym \
CaseStmt.List CaseStmt.PtrList CaseStmt.SetList \
CaseStmt.Body CaseStmt.PtrBody CaseStmt.SetBody \
CaseStmt.Rlist CaseStmt.PtrRlist CaseStmt.SetRlist \
CaseStmt.Left CaseStmt.SetLeft \
ForStmt.Left ForStmt.SetLeft \
ForStmt.Right ForStmt.SetRight \
ForStmt.Body ForStmt.PtrBody ForStmt.SetBody \
ForStmt.List ForStmt.PtrList ForStmt.SetList \
ForStmt.HasBreak ForStmt.SetHasBreak \
ForStmt.Sym ForStmt.SetSym \
GoDeferStmt.Left GoDeferStmt.SetLeft \
IfStmt.Left IfStmt.SetLeft \
IfStmt.Body IfStmt.PtrBody IfStmt.SetBody \
IfStmt.Rlist IfStmt.PtrRlist IfStmt.SetRlist \
IfStmt.Likely IfStmt.SetLikely \
LabelStmt.SetSym \
RangeStmt.Right RangeStmt.SetRight \
RangeStmt.Body RangeStmt.PtrBody RangeStmt.SetBody \
RangeStmt.List RangeStmt.PtrList RangeStmt.SetList \
RangeStmt.HasBreak RangeStmt.SetHasBreak \
RangeStmt.Colas RangeStmt.SetColas \
RangeStmt.Sym RangeStmt.SetSym \
ReturnStmt.List ReturnStmt.PtrList ReturnStmt.SetList \
SelectStmt.List SelectStmt.PtrList SelectStmt.SetList \
SelectStmt.HasBreak SelectStmt.SetHasBreak \
SelectStmt.Body SelectStmt.PtrBody SelectStmt.SetBody \
SelectStmt.Sym SelectStmt.SetSym \
SendStmt.Left SendStmt.SetLeft \
SendStmt.Right SendStmt.SetRight \
SwitchStmt.Left SwitchStmt.SetLeft \
SwitchStmt.List SwitchStmt.PtrList SwitchStmt.SetList \
SwitchStmt.Body SwitchStmt.PtrBody SwitchStmt.SetBody \
SwitchStmt.HasBreak SwitchStmt.SetHasBreak \
SwitchStmt.Sym SwitchStmt.SetSym \
TypeSwitchGuard.Left TypeSwitchGuard.SetLeft \
TypeSwitchGuard.Right TypeSwitchGuard.SetRight \
AddStringExpr.List AddStringExpr.PtrList AddStringExpr.SetList \
AddrExpr.Left AddrExpr.SetLeft \
AddrExpr.Right AddrExpr.SetRight \
BinaryExpr.Left BinaryExpr.SetLeft \
BinaryExpr.Right BinaryExpr.SetRight \
LogicalExpr.Left LogicalExpr.SetLeft \
LogicalExpr.Right LogicalExpr.SetRight \
CallExpr.Left CallExpr.SetLeft \
CallExpr.List CallExpr.PtrList CallExpr.SetList \
CallExpr.Rlist CallExpr.PtrRlist CallExpr.SetRlist \
CallExpr.NoInline CallExpr.SetNoInline \
CallExpr.Body CallExpr.PtrBody CallExpr.SetBody \
CallExpr.IsDDD CallExpr.SetIsDDD \
CallPartExpr.Left CallPartExpr.SetLeft \
ClosureReadExpr.Offset \
ClosureReadExpr.Type \ # provided by miniExpr already
CompLitExpr.Right CompLitExpr.SetRight \
CompLitExpr.List CompLitExpr.PtrList CompLitExpr.SetList \
ConvExpr.Left ConvExpr.SetLeft \
IndexExpr.Left IndexExpr.SetLeft \
IndexExpr.Right IndexExpr.SetRight \
IndexExpr.IndexMapLValue IndexExpr.SetIndexMapLValue \
KeyExpr.Left KeyExpr.SetLeft \
KeyExpr.Right KeyExpr.SetRight \
StructKeyExpr.Left StructKeyExpr.SetLeft \
StructKeyExpr.Offset StructKeyExpr.SetOffset \
StructKeyExpr.SetSym \
InlinedCallExpr.Body InlinedCallExpr.PtrBody InlinedCallExpr.SetBody \
InlinedCallExpr.Rlist InlinedCallExpr.PtrRlist InlinedCallExpr.SetRlist \
MakeExpr.Left MakeExpr.SetLeft \
MakeExpr.Right MakeExpr.SetRight \
MethodExpr.Left MethodExpr.SetLeft \
MethodExpr.Right MethodExpr.SetRight \
MethodExpr.Offset MethodExpr.SetOffset \
MethodExpr.Class MethodExpr.SetClass \
ParenExpr.Left ParenExpr.SetLeft \
ResultExpr.Offset ResultExpr.SetOffset \
ReturnStmt.IsDDD \
SelectorExpr.Left SelectorExpr.SetLeft \
SelectorExpr.Offset SelectorExpr.SetOffset \
SelectorExpr.SetSym \
SliceExpr.Left SliceExpr.SetLeft \
SliceExpr.List SliceExpr.PtrList SliceExpr.SetList \
SliceHeaderExpr.Left SliceHeaderExpr.SetLeft \
SliceHeaderExpr.List SliceHeaderExpr.PtrList SliceHeaderExpr.SetList \
StarExpr.Left StarExpr.SetLeft \
TypeAssertExpr.Left TypeAssertExpr.SetLeft \
TypeAssertExpr.Right TypeAssertExpr.SetRight \
TypeAssertExpr.List TypeAssertExpr.PtrList TypeAssertExpr.SetList \
UnaryExpr.Left UnaryExpr.SetLeft \
Func.Body Func.PtrBody Func.SetBody \
Func.Iota Func.SetIota \
CallPartExpr.Func ClosureExpr.Func Func.Func Name.Func \
mv BlockStmt.List_ BlockStmt.List
mv CaseStmt.List_ CaseStmt.List
mv CaseStmt.Body_ CaseStmt.Body
mv ForStmt.Body_ ForStmt.Body
mv ForStmt.HasBreak_ ForStmt.HasBreak
mv Func.Iota_ Func.Iota
mv IfStmt.Body_ IfStmt.Body
mv IfStmt.Likely_ IfStmt.Likely
mv RangeStmt.Body_ RangeStmt.Body
mv RangeStmt.HasBreak_ RangeStmt.HasBreak
mv SelectStmt.HasBreak_ SelectStmt.HasBreak
mv SwitchStmt.HasBreak_ SwitchStmt.HasBreak
mv AddStringExpr.List_ AddStringExpr.List
mv CallExpr.NoInline_ CallExpr.NoInline
mv CallExpr.Body_ CallExpr.Body # TODO what is this?
mv CallExpr.DDD CallExpr.IsDDD
mv ClosureReadExpr.Offset_ ClosureReadExpr.Offset
mv CompLitExpr.List_ CompLitExpr.List
mv StructKeyExpr.Offset_ StructKeyExpr.Offset
mv InlinedCallExpr.Body_ InlinedCallExpr.Body
mv ResultExpr.Offset_ ResultExpr.Offset
mv SelectorExpr.Offset_ SelectorExpr.Offset
mv SliceExpr.List_ SliceExpr.List
mv SliceHeaderExpr.LenCap_ SliceHeaderExpr.LenCap
mv Func.Body_ Func.Body
mv CallPartExpr.Func_ CallPartExpr.Func
mv ClosureExpr.Func_ ClosureExpr.Func
mv Name.Func_ Name.Func
'
Change-Id: Ia2ee59649674f83eb123e63fda7a7781cf91cc56
Reviewed-on: https://go-review.googlesource.com/c/go/+/277935
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Misc cleanup for splitting package gc: API tweaks
and boundary adjustments.
The change in ir.NewBlockStmt makes it a drop-in
replacement for liststmt.
Change-Id: I9455fe8ccae7d71fe8ccf390ac96672389bf4f3d
Reviewed-on: https://go-review.googlesource.com/c/go/+/279305
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are various global variables tracking the state of the
compilation. Collect them in a single global struct instead.
The struct definition is in package ir, but the struct itself is
still in package gc. It may eventually be threaded through the
code, but in the short term will end up in package typecheck.
Change-Id: I019db07aaedaed2c9b67dd45a4e138dc6028e54c
Reviewed-on: https://go-review.googlesource.com/c/go/+/279297
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For globals, Name.Offset is used as a way to address a field within
a global during static initialization. This CL replaces that use with
a separate NameOffsetExpr (ONAMEOFFSET) node.
For locals, Name.Offset is the stack frame offset. This CL calls it
that (FrameOffset, SetFrameOffset).
Now there is no longer any use of Name.Offset or Name.SetOffset.
And now that copies of Names are not being made to change their
offsets, we can lock down use of ir.Copy on Names. The only
remaining uses are during inlining and in handling generic system
functions. At both those times you do want to create a new name
and that can be made explicit by calling the new CloneName method
instead. ir.Copy on a name now panics.
Passes buildall w/ toolstash -cmp.
Change-Id: I0b0a25b9d93aeff7cf4e4025ac53faec7dc8603b
Reviewed-on: https://go-review.googlesource.com/c/go/+/278914
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
An automated rewrite will add concrete type assertions after
a test of n.Op(), when n can be safely type-asserted
(meaning, n is not reassigned a different type, n is not reassigned
and then used outside the scope of the type assertion,
and so on).
This sequence of CLs handles the code that the automated
rewrite does not: adding specific types to function arguments,
adjusting code not to call n.Left() etc when n may have multiple
representations, and so on.
This CL focuses on sinit.go.
Passes buildall w/ toolstash -cmp.
Change-Id: I3e9458e69a7a9b3f2fe139382bf961bc4473cc42
Reviewed-on: https://go-review.googlesource.com/c/go/+/277928
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Move the printing of types.Type and types.Sym out of ir
into package types, where it properly belongs. This wasn't
done originally (when the code was in gc) because the Type
and Sym printing was a bit tangled up with the Node printing.
But now they are untangled and can move into the correct
package.
This CL is automatically generated.
A followup CL will clean up a little bit more by hand.
Passes buildall w/ toolstash -cmp.
[git-generate]
cd src/cmd/compile/internal/ir
rf '
mv FmtMode fmtMode
mv FErr fmtGo
mv FDbg fmtDebug
mv FTypeId fmtTypeID
mv FTypeIdName fmtTypeIDName
mv methodSymName SymMethodName
mv BuiltinPkg LocalPkg BlankSym OrigSym NumImport \
fmtMode fmtGo symFormat sconv sconv2 symfmt SymMethodName \
BasicTypeNames fmtBufferPool InstallTypeFormats typeFormat tconv tconv2 fldconv FmtConst \
typefmt.go
mv typefmt.go cmd/compile/internal/types
'
cd ../types
mv typefmt.go fmt.go
Change-Id: I6f3fd818323733ab8446f00594937c1628760b27
Reviewed-on: https://go-review.googlesource.com/c/go/+/275779
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The next CL adds ConstExpr, which is a more memory efficient
representation for constant expressions than Name. However, currently
a bunch of Val helper methods are defined on Name. This CL changes
them into standalone functions that work with any Node.Val
implementation.
There's also an existing standalone function named Int64Val, which
takes a Type argument to specify what type of integer is expected. So
to avoid collisions, this CL renames it to IntVal.
Passes buildall w/ toolstash -cmp.
[git-generate]
cd src/cmd/compile/internal/ir
rf 'mv Int64Val IntVal'
sed -i -E -e 's/\(n \*Name\) (CanInt64|((I|Ui)nt64|Bool|String)Val)\(/\1(n Node/' name.go
cd ../gc
rf '
ex {
import "cmd/compile/internal/ir"
var n ir.Node
n.CanInt64() -> ir.CanInt64(n)
n.Int64Val() -> ir.Int64Val(n)
n.Uint64Val() -> ir.Uint64Val(n)
n.BoolVal() -> ir.BoolVal(n)
n.StringVal() -> ir.StringVal(n)
}
'
cd ../ir
rf '
mv CanInt64 Int64Val Uint64Val BoolVal StringVal val.go
rm Node.CanInt64 Node.Int64Val Node.Uint64Val Node.BoolVal Node.StringVal
'
Change-Id: I003140bda1690d770fd608bdd087e6d4ff00fb1f
Reviewed-on: https://go-review.googlesource.com/c/go/+/275032
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Just clearing away some scaffolding artifacts from previous
refactorings.
[git-generate]
cd src/cmd/compile/internal/gc
rf '
ex {
import "cmd/compile/internal/ir"
import "cmd/compile/internal/types"
var n *ir.Name; n.Name() -> n
var f *ir.Func; f.Func() -> f
var o types.Object
ir.AsNode(o).Sym() -> o.Sym()
ir.AsNode(o).Type() -> o.Type()
ir.AsNode(o).(*ir.Name) -> o.(*ir.Name)
ir.AsNode(o).(*ir.Func) -> o.(*ir.Func)
var x ir.Node
ir.AsNode(o) != x -> o != x
}
'
Change-Id: I946ec344bd7ee274900a392da53b95308ceaade4
Reviewed-on: https://go-review.googlesource.com/c/go/+/274592
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Passes toolstash/buildall.
[git-generate]
cd src/cmd/compile/internal/ssa
rf '
ex . ../ir ../gc {
import "cmd/compile/internal/types"
var t *types.Type
t.Etype -> t.Kind()
t.Sym -> t.GetSym()
t.Orig -> t.Underlying()
}
'
cd ../types
rf '
mv EType Kind
mv IRNode Object
mv Type.Etype Type.kind
mv Type.Sym Type.sym
mv Type.Orig Type.underlying
mv Type.Cache Type.cache
mv Type.GetSym Type.Sym
mv Bytetype ByteType
mv Runetype RuneType
mv Errortype ErrorType
'
cd ../gc
sed -i 's/Bytetype/ByteType/; s/Runetype/RuneType/' mkbuiltin.go
git codereview gofmt
go install cmd/compile/internal/...
go test cmd/compile -u || go test cmd/compile
Change-Id: Ibecb2d7100d3318a49238eb4a78d70acb49eedca
Reviewed-on: https://go-review.googlesource.com/c/go/+/274437
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Now that we have specific types for ONAME and ODCLFUNC nodes
(*Name and *Func), use them throughout the compiler to be more
precise about what data is being operated on.
This is a somewhat large CL, but once you start applying the types
in a few places, you end up needing to apply them to many other
places to keep everything type-checking. A lot of code also melts
away as types are added.
Passes buildall w/ toolstash -cmp.
Change-Id: I21dd9b945d701c470332bac5394fca744a5b232d
Reviewed-on: https://go-review.googlesource.com/c/go/+/274097
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The plan is to introduce a Node interface that replaces the old *Node pointer-to-struct.
The previous CL defined an interface INode modeling a *Node.
This CL:
- Changes all references outside internal/ir to use INode,
along with many references inside internal/ir as well.
- Renames Node to node.
- Renames INode to Node
So now ir.Node is an interface implemented by *ir.node, which is otherwise inaccessible,
and the code outside package ir is now (clearly) using only the interface.
The usual rule is never to redefine an existing name with a new meaning,
so that old code that hasn't been updated gets a "unknown name" error
instead of more mysterious errors or silent misbehavior. That rule would
caution against replacing Node-the-struct with Node-the-interface,
as in this CL, because code that says *Node would now be using a pointer
to an interface. But this CL is being landed at the same time as another that
moves Node from gc to ir. So the net effect is to replace *gc.Node with ir.Node,
which does follow the rule: any lingering references to gc.Node will be told
it's gone, not silently start using pointers to interfaces. So the rule is followed
by the CL sequence, just not this specific CL.
Overall, the loss of inlining caused by using interfaces cuts the compiler speed
by about 6%, a not insignificant amount. However, as we convert the representation
to concrete structs that are not the giant Node over the next weeks, that speed
should come back as more of the compiler starts operating directly on concrete types
and the memory taken up by the graph of Nodes drops due to the more precise
structs. Honestly, I was expecting worse.
% benchstat bench.old bench.new
name old time/op new time/op delta
Template 168ms ± 4% 182ms ± 2% +8.34% (p=0.000 n=9+9)
Unicode 72.2ms ±10% 82.5ms ± 6% +14.38% (p=0.000 n=9+9)
GoTypes 563ms ± 8% 598ms ± 2% +6.14% (p=0.006 n=9+9)
Compiler 2.89s ± 4% 3.04s ± 2% +5.37% (p=0.000 n=10+9)
SSA 6.45s ± 4% 7.25s ± 5% +12.41% (p=0.000 n=9+10)
Flate 105ms ± 2% 115ms ± 1% +9.66% (p=0.000 n=10+8)
GoParser 144ms ±10% 152ms ± 2% +5.79% (p=0.011 n=9+8)
Reflect 345ms ± 9% 370ms ± 4% +7.28% (p=0.001 n=10+9)
Tar 149ms ± 9% 161ms ± 5% +8.05% (p=0.001 n=10+9)
XML 190ms ± 3% 209ms ± 2% +9.54% (p=0.000 n=9+8)
LinkCompiler 327ms ± 2% 325ms ± 2% ~ (p=0.382 n=8+8)
ExternalLinkCompiler 1.77s ± 4% 1.73s ± 6% ~ (p=0.113 n=9+10)
LinkWithoutDebugCompiler 214ms ± 4% 211ms ± 2% ~ (p=0.360 n=10+8)
StdCmd 14.8s ± 3% 15.9s ± 1% +6.98% (p=0.000 n=10+9)
[Geo mean] 480ms 510ms +6.31%
name old user-time/op new user-time/op delta
Template 223ms ± 3% 237ms ± 3% +6.16% (p=0.000 n=9+10)
Unicode 103ms ± 6% 113ms ± 3% +9.53% (p=0.000 n=9+9)
GoTypes 758ms ± 8% 800ms ± 2% +5.55% (p=0.003 n=10+9)
Compiler 3.95s ± 2% 4.12s ± 2% +4.34% (p=0.000 n=10+9)
SSA 9.43s ± 1% 9.74s ± 4% +3.25% (p=0.000 n=8+10)
Flate 132ms ± 2% 141ms ± 2% +6.89% (p=0.000 n=9+9)
GoParser 177ms ± 9% 183ms ± 4% ~ (p=0.050 n=9+9)
Reflect 467ms ±10% 495ms ± 7% +6.17% (p=0.029 n=10+10)
Tar 183ms ± 9% 197ms ± 5% +7.92% (p=0.001 n=10+10)
XML 249ms ± 5% 268ms ± 4% +7.82% (p=0.000 n=10+9)
LinkCompiler 544ms ± 5% 544ms ± 6% ~ (p=0.863 n=9+9)
ExternalLinkCompiler 1.79s ± 4% 1.75s ± 6% ~ (p=0.075 n=10+10)
LinkWithoutDebugCompiler 248ms ± 6% 246ms ± 2% ~ (p=0.965 n=10+8)
[Geo mean] 483ms 504ms +4.41%
[git-generate]
cd src/cmd/compile/internal/ir
: # We need to do the conversion in multiple steps, so we introduce
: # a temporary type alias that will start out meaning the pointer-to-struct
: # and then change to mean the interface.
rf '
mv Node OldNode
add node.go \
type Node = *OldNode
'
: # It should work to do this ex in ir, but it misses test files, due to a bug in rf.
: # Run the command in gc to handle gc's tests, and then again in ssa for ssa's tests.
cd ../gc
rf '
ex . ../arm ../riscv64 ../arm64 ../mips64 ../ppc64 ../mips ../wasm {
import "cmd/compile/internal/ir"
*ir.OldNode -> ir.Node
}
'
cd ../ssa
rf '
ex {
import "cmd/compile/internal/ir"
*ir.OldNode -> ir.Node
}
'
: # Back in ir, finish conversion clumsily with sed,
: # because type checking and circular aliases do not mix.
cd ../ir
sed -i '' '
/type Node = \*OldNode/d
s/\*OldNode/Node/g
s/^func (n Node)/func (n *OldNode)/
s/OldNode/node/g
s/type INode interface/type Node interface/
s/var _ INode = (Node)(nil)/var _ Node = (*node)(nil)/
' *.go
gofmt -w *.go
sed -i '' '
s/{Func{}, 136, 248}/{Func{}, 152, 280}/
s/{Name{}, 32, 56}/{Name{}, 44, 80}/
s/{Param{}, 24, 48}/{Param{}, 44, 88}/
s/{node{}, 76, 128}/{node{}, 88, 152}/
' sizeof_test.go
cd ../ssa
sed -i '' '
s/{LocalSlot{}, 28, 40}/{LocalSlot{}, 32, 48}/
' sizeof_test.go
cd ../gc
sed -i '' 's/\*ir.Node/ir.Node/' mkbuiltin.go
cd ../../../..
go install std cmd
cd cmd/compile
go test -u || go test -u
Change-Id: I196bbe3b648e4701662e4a2bada40bf155e2a553
Reviewed-on: https://go-review.googlesource.com/c/go/+/272935
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
interface)
The pointer hack was nice and saved a word, but it's untenable
in a world where nodes are themselves interfaces with different
underlying types. Bite the bullet and use an interface to hold the
Node when in types.Sym and types.Type.
This has the nice benefit of removing AsTypesNode entirely.
AsNode is still useful because of its nil handling.
Change-Id: I298cba9ff788b956ee287283bec78010e8b601e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/272933
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Now that we have all the getters and setters defined, use them
and unexport all the actual Node fields. This is the next step
toward replacing Node with an interface.
[git-generate]
cd src/cmd/compile/internal/gc
rf '
ex . ../ir ../ssa {
import "cmd/compile/internal/ir"
import "cmd/compile/internal/types"
import "cmd/internal/src"
var n, x *ir.Node
var op ir.Op
var t *types.Type
var f *ir.Func
var m *ir.Name
var s *types.Sym
var p src.XPos
var i int64
var e uint16
var nodes ir.Nodes
n.Op = op -> n.SetOp(op)
n.Left = x -> n.SetLeft(x)
n.Right = x -> n.SetRight(x)
n.Orig = x -> n.SetOrig(x)
n.Type = t -> n.SetType(t)
n.Func = f -> n.SetFunc(f)
n.Name = m -> n.SetName(m)
n.Sym = s -> n.SetSym(s)
n.Pos = p -> n.SetPos(p)
n.Xoffset = i -> n.SetXoffset(i)
n.Esc = e -> n.SetEsc(e)
n.Ninit.Append -> n.PtrNinit().Append
n.Ninit.AppendNodes -> n.PtrNinit().AppendNodes
n.Ninit.MoveNodes -> n.PtrNinit().MoveNodes
n.Ninit.Prepend -> n.PtrNinit().Prepend
n.Ninit.Set -> n.PtrNinit().Set
n.Ninit.Set1 -> n.PtrNinit().Set1
n.Ninit.Set2 -> n.PtrNinit().Set2
n.Ninit.Set3 -> n.PtrNinit().Set3
&n.Ninit -> n.PtrNinit()
n.Ninit = nodes -> n.SetNinit(nodes)
n.Nbody.Append -> n.PtrNbody().Append
n.Nbody.AppendNodes -> n.PtrNbody().AppendNodes
n.Nbody.MoveNodes -> n.PtrNbody().MoveNodes
n.Nbody.Prepend -> n.PtrNbody().Prepend
n.Nbody.Set -> n.PtrNbody().Set
n.Nbody.Set1 -> n.PtrNbody().Set1
n.Nbody.Set2 -> n.PtrNbody().Set2
n.Nbody.Set3 -> n.PtrNbody().Set3
&n.Nbody -> n.PtrNbody()
n.Nbody = nodes -> n.SetNbody(nodes)
n.List.Append -> n.PtrList().Append
n.List.AppendNodes -> n.PtrList().AppendNodes
n.List.MoveNodes -> n.PtrList().MoveNodes
n.List.Prepend -> n.PtrList().Prepend
n.List.Set -> n.PtrList().Set
n.List.Set1 -> n.PtrList().Set1
n.List.Set2 -> n.PtrList().Set2
n.List.Set3 -> n.PtrList().Set3
&n.List -> n.PtrList()
n.List = nodes -> n.SetList(nodes)
n.Rlist.Append -> n.PtrRlist().Append
n.Rlist.AppendNodes -> n.PtrRlist().AppendNodes
n.Rlist.MoveNodes -> n.PtrRlist().MoveNodes
n.Rlist.Prepend -> n.PtrRlist().Prepend
n.Rlist.Set -> n.PtrRlist().Set
n.Rlist.Set1 -> n.PtrRlist().Set1
n.Rlist.Set2 -> n.PtrRlist().Set2
n.Rlist.Set3 -> n.PtrRlist().Set3
&n.Rlist -> n.PtrRlist()
n.Rlist = nodes -> n.SetRlist(nodes)
}
ex . ../ir ../ssa {
import "cmd/compile/internal/ir"
var n *ir.Node
n.Op -> n.GetOp()
n.Left -> n.GetLeft()
n.Right -> n.GetRight()
n.Orig -> n.GetOrig()
n.Type -> n.GetType()
n.Func -> n.GetFunc()
n.Name -> n.GetName()
n.Sym -> n.GetSym()
n.Pos -> n.GetPos()
n.Xoffset -> n.GetXoffset()
n.Esc -> n.GetEsc()
avoid (*ir.Node).PtrNinit
avoid (*ir.Node).PtrNbody
avoid (*ir.Node).PtrList
avoid (*ir.Node).PtrRlist
n.Ninit -> n.GetNinit()
n.Nbody -> n.GetNbody()
n.List -> n.GetList()
n.Rlist -> n.GetRlist()
}
'
cd ../ir
rf '
mv Node.Op Node.op
mv Node.GetOp Node.Op
mv Node.Left Node.left
mv Node.GetLeft Node.Left
mv Node.Right Node.right
mv Node.GetRight Node.Right
mv Node.Orig Node.orig
mv Node.GetOrig Node.Orig
mv Node.Type Node.typ
mv Node.GetType Node.Type
mv Node.Func Node.fn
mv Node.GetFunc Node.Func
mv Node.Name Node.name
mv Node.GetName Node.Name
# All uses are in other Node methods already.
mv Node.E Node.e
mv Node.Sym Node.sym
mv Node.GetSym Node.Sym
mv Node.Pos Node.pos
mv Node.GetPos Node.Pos
mv Node.Esc Node.esc
mv Node.GetEsc Node.Esc
# While we are here, rename Xoffset to more idiomatic Offset.
mv Node.Xoffset Node.offset
mv Node.GetXoffset Node.Offset
mv Node.SetXoffset Node.SetOffset
# While we are here, rename Ninit, Nbody to more idiomatic Init, Body.
mv Node.Ninit Node.init
mv Node.GetNinit Node.Init
mv Node.PtrNinit Node.PtrInit
mv Node.SetNinit Node.SetInit
mv Node.Nbody Node.body
mv Node.GetNbody Node.Body
mv Node.PtrNbody Node.PtrBody
mv Node.SetNbody Node.SetBody
mv Node.List Node.list
mv Node.GetList Node.List
mv Node.Rlist Node.rlist
mv Node.GetRlist Node.Rlist
# Unexport these
mv Node.SetHasOpt Node.setHasOpt
mv Node.SetHasVal Node.setHasVal
'
Change-Id: I9894f633375c5237a29b6d6d7b89ba181b56ca3a
Reviewed-on: https://go-review.googlesource.com/c/go/+/273009
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If we want to break up package gc at all, we will need to move
the compiler IR it defines into a separate package that can be
imported by packages that gc itself imports. This CL does that.
It also removes the TINT8 etc aliases so that all code is clear
about which package things are coming from.
This CL is automatically generated by the script below.
See the comments in the script for details about the changes.
[git-generate]
cd src/cmd/compile/internal/gc
rf '
# These names were never fully qualified
# when the types package was added.
# Do it now, to avoid confusion about where they live.
inline -rm \
Txxx \
TINT8 \
TUINT8 \
TINT16 \
TUINT16 \
TINT32 \
TUINT32 \
TINT64 \
TUINT64 \
TINT \
TUINT \
TUINTPTR \
TCOMPLEX64 \
TCOMPLEX128 \
TFLOAT32 \
TFLOAT64 \
TBOOL \
TPTR \
TFUNC \
TSLICE \
TARRAY \
TSTRUCT \
TCHAN \
TMAP \
TINTER \
TFORW \
TANY \
TSTRING \
TUNSAFEPTR \
TIDEAL \
TNIL \
TBLANK \
TFUNCARGS \
TCHANARGS \
NTYPE \
BADWIDTH
# esc.go and escape.go do not need to be split.
# Append esc.go onto the end of escape.go.
mv esc.go escape.go
# Pull out the type format installation from func Main,
# so it can be carried into package ir.
mv Main:/Sconv.=/-0,/TypeLinkSym/-1 InstallTypeFormats
# Names that need to be exported for use by code left in gc.
mv Isconst IsConst
mv asNode AsNode
mv asNodes AsNodes
mv asTypesNode AsTypesNode
mv basicnames BasicTypeNames
mv builtinpkg BuiltinPkg
mv consttype ConstType
mv dumplist DumpList
mv fdumplist FDumpList
mv fmtMode FmtMode
mv goopnames OpNames
mv inspect Inspect
mv inspectList InspectList
mv localpkg LocalPkg
mv nblank BlankNode
mv numImport NumImport
mv opprec OpPrec
mv origSym OrigSym
mv stmtwithinit StmtWithInit
mv dump DumpAny
mv fdump FDumpAny
mv nod Nod
mv nodl NodAt
mv newname NewName
mv newnamel NewNameAt
mv assertRepresents AssertValidTypeForConst
mv represents ValidTypeForConst
mv nodlit NewLiteral
# Types and fields that need to be exported for use by gc.
mv nowritebarrierrecCallSym SymAndPos
mv SymAndPos.lineno SymAndPos.Pos
mv SymAndPos.target SymAndPos.Sym
mv Func.lsym Func.LSym
mv Func.setWBPos Func.SetWBPos
mv Func.numReturns Func.NumReturns
mv Func.numDefers Func.NumDefers
mv Func.nwbrCalls Func.NWBRCalls
# initLSym is an algorithm left behind in gc,
# not an operation on Func itself.
mv Func.initLSym initLSym
mv nodeQueue NodeQueue
mv NodeQueue.empty NodeQueue.Empty
mv NodeQueue.popLeft NodeQueue.PopLeft
mv NodeQueue.pushRight NodeQueue.PushRight
# Many methods on Node are actually algorithms that
# would apply to any node implementation.
# Those become plain functions.
mv Node.funcname FuncName
mv Node.isBlank IsBlank
mv Node.isGoConst isGoConst
mv Node.isNil IsNil
mv Node.isParamHeapCopy isParamHeapCopy
mv Node.isParamStackCopy isParamStackCopy
mv Node.isSimpleName isSimpleName
mv Node.mayBeShared MayBeShared
mv Node.pkgFuncName PkgFuncName
mv Node.backingArrayPtrLen backingArrayPtrLen
mv Node.isterminating isTermNode
mv Node.labeledControl labeledControl
mv Nodes.isterminating isTermNodes
mv Nodes.sigerr fmtSignature
mv Node.MethodName methodExprName
mv Node.MethodFunc methodExprFunc
mv Node.IsMethod IsMethod
# Every node will need to implement RawCopy;
# Copy and SepCopy algorithms will use it.
mv Node.rawcopy Node.RawCopy
mv Node.copy Copy
mv Node.sepcopy SepCopy
# Extract Node.Format method body into func FmtNode,
# but leave method wrapper behind.
mv Node.Format:0,$ FmtNode
# Formatting helpers that will apply to all node implementations.
mv Node.Line Line
mv Node.exprfmt exprFmt
mv Node.jconv jconvFmt
mv Node.modeString modeString
mv Node.nconv nconvFmt
mv Node.nodedump nodeDumpFmt
mv Node.nodefmt nodeFmt
mv Node.stmtfmt stmtFmt
# Constant support needed for code moving to ir.
mv okforconst OKForConst
mv vconv FmtConst
mv int64Val Int64Val
mv float64Val Float64Val
mv Node.ValueInterface ConstValue
# Organize code into files.
mv LocalPkg BuiltinPkg ir.go
mv NumImport InstallTypeFormats Line fmt.go
mv syntax.go Nod NodAt NewNameAt Class Pxxx PragmaFlag Nointerface SymAndPos \
AsNode AsTypesNode BlankNode OrigSym \
Node.SliceBounds Node.SetSliceBounds Op.IsSlice3 \
IsConst Node.Int64Val Node.CanInt64 Node.Uint64Val Node.BoolVal Node.StringVal \
Node.RawCopy SepCopy Copy \
IsNil IsBlank IsMethod \
Node.Typ Node.StorageClass node.go
mv ConstType ConstValue Int64Val Float64Val AssertValidTypeForConst ValidTypeForConst NewLiteral idealType OKForConst val.go
# Move files to new ir package.
mv bitset.go class_string.go dump.go fmt.go \
ir.go node.go op_string.go val.go \
sizeof_test.go cmd/compile/internal/ir
'
: # fix mkbuiltin.go to generate the changes made to builtin.go during rf
sed -i '' '
s/\[T/[types.T/g
s/\*Node/*ir.Node/g
/internal\/types/c \
fmt.Fprintln(&b, `import (`) \
fmt.Fprintln(&b, ` "cmd/compile/internal/ir"`) \
fmt.Fprintln(&b, ` "cmd/compile/internal/types"`) \
fmt.Fprintln(&b, `)`)
' mkbuiltin.go
gofmt -w mkbuiltin.go
: # update cmd/dist to add internal/ir
cd ../../../dist
sed -i '' '/compile.internal.gc/a\
"cmd/compile/internal/ir",
' buildtool.go
gofmt -w buildtool.go
: # update cmd/compile TestFormats
cd ../..
go install std cmd
cd cmd/compile
go test -u || go test # first one updates but fails; second passes
Change-Id: I5f7caf6b20629b51970279e81231a3574d5b51db
Reviewed-on: https://go-review.googlesource.com/c/go/+/273008
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Move Flag, Debug, Ctxt, Exit, and error messages to
new package cmd/compile/internal/base.
These are the core functionality that everything in gc uses
and which otherwise prevent splitting any other code
out of gc into different packages.
A minor milestone: the compiler source code
no longer contains the string "yy".
[git-generate]
cd src/cmd/compile/internal/gc
rf '
mv atExit AtExit
mv Ctxt atExitFuncs AtExit Exit base.go
mv lineno Pos
mv linestr FmtPos
mv flusherrors FlushErrors
mv yyerror Errorf
mv yyerrorl ErrorfAt
mv yyerrorv ErrorfVers
mv noder.yyerrorpos noder.errorAt
mv Warnl WarnfAt
mv errorexit ErrorExit
mv base.go debug.go flag.go print.go cmd/compile/internal/base
'
: # update comments
sed -i '' 's/yyerrorl/ErrorfAt/g; s/yyerror/Errorf/g' *.go
: # bootstrap.go is not built by default so invisible to rf
sed -i '' 's/Fatalf/base.Fatalf/' bootstrap.go
goimports -w bootstrap.go
: # update cmd/dist to add internal/base
cd ../../../dist
sed -i '' '/internal.amd64/a\
"cmd/compile/internal/base",
' buildtool.go
gofmt -w buildtool.go
Change-Id: I59903c7084222d6eaee38823fd222159ba24a31a
Reviewed-on: https://go-review.googlesource.com/c/go/+/272250
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The flag values have grown fairly haphazard, with no organization
or even common naming convention. This CL moves all flag values
into the Flag struct (formerly misnamed Debug), except for a few
that live in Ctxt fields instead.
This CL is entirely automated changes.
A followup CL will make a few manual cleanups, leaving this CL
completely automated and easier to regenerate during merge
conflicts.
Cleaning up flags is necessary because the printing routines
look at some of them, and the printing routines need to move
out of package gc to a new package shared by gc and any
other packages that split out of gc.
[git-generate]
cd src/cmd/compile/internal/gc
rf '
mv Debug Flag
mv DebugFlags Flags
mv Flags.e Flags.LowerE
mv Flags.h Flags.LowerH
mv Flags.j Flags.LowerJ
mv Flags.l Flags.LowerL
mv Flags.m Flags.LowerM
mv Flags.r Flags.LowerR
mv Flags.w Flags.LowerW
mv Flags.P Flags.Percent
mv compiling_runtime Flag.CompilingRuntime
mv compiling_std Flag.Std
mv localimport Flag.D
mv asmhdr Flag.AsmHdr
mv buildid Flag.BuildID
mv nBackendWorkers Flag.LowerC
mv pure_go Flag.Complete
mv debugstr Flag.LowerD
mv flagDWARF Flag.Dwarf
mv genDwarfInline Flag.GenDwarfInl
mv flag_installsuffix Flag.InstallSuffix
mv flag_lang Flag.Lang
mv linkobj Flag.LinkObj
mv debuglive Flag.Live
mv flag_msan Flag.MSan
mv nolocalimports Flag.NoLocalImports
mv outfile Flag.LowerO
mv myimportpath Ctxt.Pkgpath
mv writearchive Flag.Pack
mv flag_race Flag.Race
mv spectre Flag.Spectre
mv trace Flag.LowerT
mv pathPrefix Flag.TrimPath
mv Debug_vlog Ctxt.Debugvlog
mv use_writebarrier Flag.WB
mv Main.flag_shared Flag.Shared
mv Main.flag_dynlink Flag.Dynlink
mv Main.goversion Flag.GoVersion
mv Main.symabisPath Flag.SymABIs
mv cpuprofile Flag.CPUProfile
mv memprofile Flag.MemProfile
mv traceprofile Flag.TraceProfile
mv blockprofile Flag.BlockProfile
mv mutexprofile Flag.MutexProfile
mv benchfile Flag.Bench
mv Main.smallFrames Flag.SmallFrames
mv Main.jsonLogOpt Flag.JSON
add Flag:$ \
Cfg struct{}
mv embedCfg Flag.Cfg.Embed
mv idirs Flag.Cfg.ImportDirs
mv importMap Flag.Cfg.ImportMap
mv packageFile Flag.Cfg.PackageFile
mv spectreIndex Flag.Cfg.SpectreIndex
mv addidir addImportDir
mv main.go:/Wasm/-0,/ssaDump/-3 ParseFlags
mv usage Flag Flags ParseFlags \
concurrentFlagOk concurrentBackendAllowed \
addImportDir addImportMap \
readImportCfg readEmbedCfg \
flag.go
# Remove //go:generate line copied from main.go
# along with two self-assignments from the merge.
rm flag.go:/go:generate/-+ \
flag.go:/Ctxt.Pkgpath = Ctxt.Pkgpath/-+ \
flag.go:/Ctxt.Debugvlog = Ctxt.Debugvlog/-+
'
Change-Id: I10431c15fe7d9f48024d53141d4224d957dbf334
Reviewed-on: https://go-review.googlesource.com/c/go/+/271667
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This replaces the compiler's legacy constant representation with
go/constant, which is used by go/types. This should ease integrating
with the new go/types-based type checker in the future.
Performance difference is mixed, but there's still room for
improvement.
name old time/op new time/op delta
Template 280ms ± 6% 281ms ± 6% ~ (p=0.488 n=592+587)
Unicode 132ms ±11% 129ms ±11% -2.61% (p=0.000 n=592+591)
GoTypes 865ms ± 3% 866ms ± 3% +0.16% (p=0.019 n=572+577)
Compiler 3.60s ± 3% 3.60s ± 3% ~ (p=0.083 n=578+582)
SSA 8.27s ± 2% 8.28s ± 2% +0.14% (p=0.002 n=575+580)
Flate 177ms ± 8% 176ms ± 8% ~ (p=0.133 n=580+590)
GoParser 238ms ± 7% 237ms ± 6% ~ (p=0.569 n=587+591)
Reflect 542ms ± 4% 543ms ± 4% ~ (p=0.064 n=581+579)
Tar 244ms ± 6% 244ms ± 6% ~ (p=0.880 n=586+584)
XML 322ms ± 5% 322ms ± 5% ~ (p=0.449 n=589+590)
LinkCompiler 454ms ± 6% 453ms ± 6% ~ (p=0.249 n=585+583)
ExternalLinkCompiler 1.35s ± 4% 1.35s ± 4% ~ (p=0.968 n=590+588)
LinkWithoutDebugCompiler 279ms ± 7% 280ms ± 7% ~ (p=0.270 n=589+586)
[Geo mean] 535ms 534ms -0.17%
name old user-time/op new user-time/op delta
Template 599ms ±22% 602ms ±21% ~ (p=0.377 n=588+590)
Unicode 410ms ±43% 376ms ±39% -8.36% (p=0.000 n=596+586)
GoTypes 1.96s ±15% 1.97s ±17% +0.70% (p=0.031 n=596+594)
Compiler 7.47s ± 9% 7.50s ± 8% +0.38% (p=0.031 n=591+583)
SSA 16.2s ± 4% 16.2s ± 5% ~ (p=0.617 n=531+531)
Flate 298ms ±25% 292ms ±30% -2.14% (p=0.001 n=594+596)
GoParser 379ms ±20% 381ms ±21% ~ (p=0.312 n=578+584)
Reflect 1.24s ±20% 1.25s ±23% +0.88% (p=0.031 n=592+596)
Tar 471ms ±23% 473ms ±21% ~ (p=0.616 n=593+587)
XML 674ms ±20% 681ms ±21% +1.03% (p=0.050 n=584+587)
LinkCompiler 842ms ±10% 839ms ±10% ~ (p=0.074 n=587+590)
ExternalLinkCompiler 1.65s ± 7% 1.65s ± 7% ~ (p=0.767 n=590+585)
LinkWithoutDebugCompiler 378ms ±11% 379ms ±12% ~ (p=0.677 n=591+586)
[Geo mean] 1.02s 1.02s -0.52%
name old alloc/op new alloc/op delta
Template 37.4MB ± 0% 37.4MB ± 0% +0.06% (p=0.000 n=589+585)
Unicode 29.6MB ± 0% 28.6MB ± 0% -3.11% (p=0.000 n=574+566)
GoTypes 120MB ± 0% 120MB ± 0% -0.01% (p=0.000 n=594+593)
Compiler 568MB ± 0% 568MB ± 0% -0.02% (p=0.000 n=588+591)
SSA 1.45GB ± 0% 1.45GB ± 0% -0.16% (p=0.000 n=596+592)
Flate 22.6MB ± 0% 22.5MB ± 0% -0.36% (p=0.000 n=593+595)
GoParser 30.1MB ± 0% 30.1MB ± 0% -0.01% (p=0.000 n=590+594)
Reflect 77.8MB ± 0% 77.8MB ± 0% ~ (p=0.631 n=584+591)
Tar 34.1MB ± 0% 34.1MB ± 0% -0.04% (p=0.000 n=584+588)
XML 43.6MB ± 0% 43.6MB ± 0% +0.07% (p=0.000 n=593+591)
LinkCompiler 98.6MB ± 0% 98.6MB ± 0% ~ (p=0.096 n=590+589)
ExternalLinkCompiler 89.6MB ± 0% 89.6MB ± 0% ~ (p=0.695 n=590+587)
LinkWithoutDebugCompiler 57.2MB ± 0% 57.2MB ± 0% ~ (p=0.674 n=590+589)
[Geo mean] 78.5MB 78.3MB -0.28%
name old allocs/op new allocs/op delta
Template 379k ± 0% 380k ± 0% +0.33% (p=0.000 n=593+590)
Unicode 344k ± 0% 338k ± 0% -1.67% (p=0.000 n=594+589)
GoTypes 1.30M ± 0% 1.31M ± 0% +0.19% (p=0.000 n=592+591)
Compiler 5.40M ± 0% 5.41M ± 0% +0.23% (p=0.000 n=587+585)
SSA 14.2M ± 0% 14.2M ± 0% +0.08% (p=0.000 n=594+591)
Flate 231k ± 0% 230k ± 0% -0.42% (p=0.000 n=588+589)
GoParser 314k ± 0% 315k ± 0% +0.16% (p=0.000 n=587+594)
Reflect 975k ± 0% 976k ± 0% +0.10% (p=0.000 n=590+594)
Tar 344k ± 0% 345k ± 0% +0.24% (p=0.000 n=595+590)
XML 422k ± 0% 424k ± 0% +0.57% (p=0.000 n=590+589)
LinkCompiler 538k ± 0% 538k ± 0% -0.00% (p=0.045 n=592+587)
ExternalLinkCompiler 593k ± 0% 593k ± 0% ~ (p=0.171 n=588+587)
LinkWithoutDebugCompiler 172k ± 0% 172k ± 0% ~ (p=0.996 n=590+585)
[Geo mean] 685k 685k -0.02%
name old maxRSS/op new maxRSS/op delta
Template 53.7M ± 8% 53.8M ± 8% ~ (p=0.666 n=576+574)
Unicode 54.4M ±12% 55.0M ±10% +1.15% (p=0.000 n=591+588)
GoTypes 95.1M ± 4% 95.1M ± 4% ~ (p=0.948 n=589+591)
Compiler 334M ± 6% 334M ± 6% ~ (p=0.875 n=592+593)
SSA 792M ± 5% 791M ± 5% ~ (p=0.067 n=592+591)
Flate 39.9M ±11% 40.0M ±10% ~ (p=0.131 n=596+596)
GoParser 45.2M ±11% 45.3M ±11% ~ (p=0.353 n=592+590)
Reflect 76.1M ± 5% 76.2M ± 5% ~ (p=0.114 n=594+594)
Tar 49.4M ±10% 49.6M ± 9% +0.57% (p=0.015 n=590+593)
XML 57.4M ± 9% 57.7M ± 8% +0.67% (p=0.000 n=592+580)
LinkCompiler 183M ± 2% 183M ± 2% ~ (p=0.229 n=587+591)
ExternalLinkCompiler 187M ± 2% 187M ± 3% ~ (p=0.362 n=571+562)
LinkWithoutDebugCompiler 143M ± 3% 143M ± 3% ~ (p=0.350 n=584+586)
[Geo mean] 103M 103M +0.23%
Passes toolstash-check.
Fixes #4617.
Change-Id: Id4f6759b4afc5e002770091d0d4f6e272ee6cbdd
Reviewed-on: https://go-review.googlesource.com/c/go/+/272654
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This CL replaces gc.Ctype (along with its CTINT, etc. constants) with
constant.Kind; renames Val.Ctype to Val.Kind; and replaces a handful
of abstraction-violating patterns that can be readily expressed
differently.
The next commit will actually replace Val with constant.Value.
Passes toolstash-check.
[git-generate]
cd src/cmd/compile/internal/gc
sed -i 's/type Ctype uint8/type Ctype = constant.Kind/' const.go
goimports -w const.go
rf '
inline -rm Ctype
mv Val.Ctype Val.Kind
ex import "go/constant"; \
CTxxx -> constant.Unknown; \
CTINT -> constant.Int; \
CTFLT -> constant.Float; \
CTCPLX -> constant.Complex; \
CTBOOL -> constant.Bool; \
CTSTR -> constant.String
rm CTxxx CTINT CTFLT CTCPLX CTBOOL CTSTR
ex import "cmd/compile/internal/types"; \
var t *types.Type; \
var v, v2 Val; \
v.U.(*Mpint).Cmp(maxintval[TINT]) > 0 -> doesoverflow(v, types.Types[TINT]); \
v.U.(*Mpint).Cmp(v2.U.(*Mpint)) > 0 -> compareOp(v, OGT, v2); \
maxintval[t.Etype].Cmp(maxintval[TUINT]) <= 0 -> t.Size() <= types.Types[TUINT].Size(); \
maxintval[t.Etype].Cmp(maxintval[TUINT]) > 0 -> t.Size() > types.Types[TUINT].Size();
'
go test cmd/compile -u
Change-Id: I6c22ec0597508845f88eee639a0d76cbaa66d08f
Reviewed-on: https://go-review.googlesource.com/c/go/+/272653
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Properly speaking, "nil" is a zero value, not a constant. So
go/constant does not have a representation for it. To allow replacing
Val with constant.Value, we split out ONIL separately from OLITERAL so
we can get rid of CTNIL.
Passes toolstash-check.
Change-Id: I4c8e60cae3b3c91bbac43b3b0cf2a4ade028d6cb
Reviewed-on: https://go-review.googlesource.com/c/go/+/272650
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
|
|
|
|
|
|
|
|
|
|
| |
We want to introduce a package cmd/compile/internal/base,
and these will shadow it at points where it is needed.
Change-Id: Ic936733fba1ccba8c2ca1fdedbd4d2989df4bbf4
Reviewed-on: https://go-review.googlesource.com/c/go/+/272249
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Remove go115ReduceLiveness feature gating flag, along with code
that only needed when go115ReduceLiveness is false.
Change-Id: I7571913cc74cbd17b330a0ee0160fefc9eeee66e
Reviewed-on: https://go-review.googlesource.com/c/go/+/264338
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Austin Clements <austin@google.com>
|