diff options
author | Matthew Dempsky <mdempsky@google.com> | 2021-06-25 01:54:50 -0700 |
---|---|---|
committer | Matthew Dempsky <mdempsky@google.com> | 2021-06-25 14:32:28 +0000 |
commit | 1b60284c0a375de2349540771a3bc1a719ddf52e (patch) | |
tree | 3d39d8307c0471def2f2b63b66c73bb4e752a413 /src/cmd/compile/internal/noder/linker.go | |
parent | 9fe7c38d3d7cd8a90e33515981dd00e1233563c9 (diff) | |
download | go-1b60284c0a375de2349540771a3bc1a719ddf52e.tar.gz go-1b60284c0a375de2349540771a3bc1a719ddf52e.zip |
[dev.typeparams] cmd/compile: simplify variable capturing in unified IR
While initially building out unified IR, I didn't have any indexing
scheme. Everything was written out in order. Consequently, if I wanted
to write A before B, I had to compute A before B.
One particular example of this is handling closure variables: the
reader needs the list of closure variables before it can start reading
the function body, so I had to write them out first, and so I had to
compute them first in a separate, dedicated pass.
However, that constraint went away a while ago. For example, it's now
possible to replace the two-pass closure variable capture with a
single pass. We just write out the function body earlier, but then
wait to write out its index.
I anticipate this approach will make it easier to implement
dictionaries: rather than needing a separate pass to correctly
recognize and handle all of the generics cases, we can just hook into
the existing logic.
Change-Id: Iab1e07f9202cd5d2b6864eef10116960456214df
Reviewed-on: https://go-review.googlesource.com/c/go/+/330851
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>
Diffstat (limited to 'src/cmd/compile/internal/noder/linker.go')
-rw-r--r-- | src/cmd/compile/internal/noder/linker.go | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/src/cmd/compile/internal/noder/linker.go b/src/cmd/compile/internal/noder/linker.go index 7291138160..23e9446759 100644 --- a/src/cmd/compile/internal/noder/linker.go +++ b/src/cmd/compile/internal/noder/linker.go @@ -209,8 +209,6 @@ func (l *linker) relocFuncExt(w *encoder, name *ir.Name) { pri, ok := bodyReader[name.Func] assert(ok) - w.sync(syncAddBody) - w.sync(syncImplicitTypes) w.reloc(relocBody, l.relocIdx(pri.pr, relocBody, pri.idx)) } |