diff options
author | Matthew Dempsky <mdempsky@google.com> | 2021-06-28 22:41:50 -0700 |
---|---|---|
committer | Matthew Dempsky <mdempsky@google.com> | 2021-06-30 04:31:37 +0000 |
commit | f503740ccf6302ed13c7722ea50c6880a17703fb (patch) | |
tree | 30f68c9fb92446cf5998aaba96895b21155006fb /src/cmd/compile/internal/noder/linker.go | |
parent | 6a5f7e8498b7cd53bb5461fbf777aa83aea067a8 (diff) | |
download | go-f503740ccf6302ed13c7722ea50c6880a17703fb.tar.gz go-f503740ccf6302ed13c7722ea50c6880a17703fb.zip |
[dev.typeparams] cmd/compile: add derived-type dictionaries to unified IR
This CL updates the unified IR export data serialization to explicitly
and separately record the derived types used by a declaration. The
readers currently just use this data to construct types/IR the same as
before, but eventually we can use it for emitting GC-shape
dictionaries.
Change-Id: I7d67ad9b3f1fbe69664bf19e056bc94f73507220
Reviewed-on: https://go-review.googlesource.com/c/go/+/331829
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: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Trust: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/cmd/compile/internal/noder/linker.go')
-rw-r--r-- | src/cmd/compile/internal/noder/linker.go | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/src/cmd/compile/internal/noder/linker.go b/src/cmd/compile/internal/noder/linker.go index 23e9446759..ed47a355d8 100644 --- a/src/cmd/compile/internal/noder/linker.go +++ b/src/cmd/compile/internal/noder/linker.go @@ -134,11 +134,15 @@ func (l *linker) relocObj(pr *pkgReader, idx int) int { } w := l.pw.newEncoderRaw(relocObj) - bside := l.pw.newEncoderRaw(relocObjExt) - assert(bside.idx == w.idx) + wext := l.pw.newEncoderRaw(relocObjExt) + wdict := l.pw.newEncoderRaw(relocObjDict) + l.decls[sym] = w.idx + assert(wext.idx == w.idx) + assert(wdict.idx == w.idx) l.relocCommon(pr, &w, relocObj, idx) + l.relocCommon(pr, &wdict, relocObjDict, idx) var obj *ir.Name if path == "" { @@ -153,18 +157,18 @@ func (l *linker) relocObj(pr *pkgReader, idx int) int { } if obj != nil { - bside.sync(syncObject1) + wext.sync(syncObject1) switch tag { case objFunc: - l.relocFuncExt(&bside, obj) + l.relocFuncExt(&wext, obj) case objType: - l.relocTypeExt(&bside, obj) + l.relocTypeExt(&wext, obj) case objVar: - l.relocVarExt(&bside, obj) + l.relocVarExt(&wext, obj) } - bside.flush() + wext.flush() } else { - l.relocCommon(pr, &bside, relocObjExt, idx) + l.relocCommon(pr, &wext, relocObjExt, idx) } return w.idx @@ -286,7 +290,17 @@ func (pr *pkgDecoder) peekObj(idx int) (string, string, codeObj, []int) { bounds := make([]int, r.len()) for i := range bounds { r.sync(syncType) - bounds[i] = r.reloc(relocType) + if r.bool() { + r.len() + } else { + r.reloc(relocType) + } + + // TODO(mdempsky): This result now needs to include the 'derived' + // bool too, but none of the callers currently depend on it + // anyway. Either fix it to be meaningful, or just get rid of it + // altogether. + bounds[i] = -1 } tag := codeObj(r.code(syncCodeObj)) |