Skip to content
Snippets Groups Projects
Commit 24fd1a04 authored by Tim King's avatar Tim King
Browse files

cmd/compile: deprecate has init and derived func instance

Removes 'has init' and 'derived func instance' fields from unified IR
starting with V2.

This should be a no-op at the moment as the writer is hardwired to create V1.

Updates #68778

Change-Id: I84a606cbc27cd6d8bd6eee2aff44c89f4aa7413c
Reviewed-on: https://go-review.googlesource.com/c/go/+/606035


Reviewed-by: default avatarCuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: default avatarRobert Griesemer <gri@google.com>
Reviewed-by: default avatarDavid Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
parent 7dc1ee81
No related branches found
No related tags found
No related merge requests found
......@@ -39,13 +39,18 @@ func ReadPackage(ctxt *types2.Context, imports map[string]*types2.Package, input
r := pr.newReader(pkgbits.RelocMeta, pkgbits.PublicRootIdx, pkgbits.SyncPublic)
pkg := r.pkg()
r.Bool() // TODO(mdempsky): Remove; was "has init"
if r.Version().Has(pkgbits.HasInit) {
r.Bool()
}
for i, n := 0, r.Len(); i < n; i++ {
// As if r.obj(), but avoiding the Scope.Lookup call,
// to avoid eager loading of imports.
r.Sync(pkgbits.SyncObject)
assert(!r.Bool())
if r.Version().Has(pkgbits.DerivedFuncInstance) {
assert(!r.Bool())
}
r.p.objIdx(r.Reloc(pkgbits.RelocObj))
assert(r.Len() == 0)
}
......@@ -366,7 +371,9 @@ func (r *reader) param() *types2.Var {
func (r *reader) obj() (types2.Object, []types2.Type) {
r.Sync(pkgbits.SyncObject)
assert(!r.Bool())
if r.Version().Has(pkgbits.DerivedFuncInstance) {
assert(!r.Bool())
}
pkg, name := r.p.objIdx(r.Reloc(pkgbits.RelocObj))
obj := pkg.Scope().Lookup(name)
......
......@@ -640,7 +640,9 @@ func (r *reader) obj() ir.Node {
// and returns the encoded reference to it, without instantiating it.
func (r *reader) objInfo() objInfo {
r.Sync(pkgbits.SyncObject)
assert(!r.Bool()) // TODO(mdempsky): Remove; was derived func inst.
if r.Version().Has(pkgbits.DerivedFuncInstance) {
assert(!r.Bool())
}
idx := r.Reloc(pkgbits.RelocObj)
explicits := make([]typeInfo, r.Len())
......
......@@ -329,7 +329,10 @@ func writePkgStub(m posMap, noders []*noder) string {
{
w := publicRootWriter
w.pkg(pkg)
w.Bool(false) // TODO(mdempsky): Remove; was "has init"
if w.Version().Has(pkgbits.HasInit) {
w.Bool(false)
}
scope := pkg.Scope()
names := scope.Names()
......@@ -410,11 +413,15 @@ func readPackage(pr *pkgReader, importpkg *types.Pkg, localStub bool) {
base.ErrorExit()
}
r.Bool() // TODO(mdempsky): Remove; was "has init"
if r.Version().Has(pkgbits.HasInit) {
r.Bool()
}
for i, n := 0, r.Len(); i < n; i++ {
r.Sync(pkgbits.SyncObject)
assert(!r.Bool())
if r.Version().Has(pkgbits.DerivedFuncInstance) {
assert(!r.Bool())
}
idx := r.Reloc(pkgbits.RelocObj)
assert(r.Len() == 0)
......@@ -477,11 +484,15 @@ func writeUnifiedExport(out io.Writer) {
r.Sync(pkgbits.SyncPkg)
selfPkgIdx = l.relocIdx(pr, pkgbits.RelocPkg, r.Reloc(pkgbits.RelocPkg))
r.Bool() // TODO(mdempsky): Remove; was "has init"
if r.Version().Has(pkgbits.HasInit) {
r.Bool()
}
for i, n := 0, r.Len(); i < n; i++ {
r.Sync(pkgbits.SyncObject)
assert(!r.Bool())
if r.Version().Has(pkgbits.DerivedFuncInstance) {
assert(!r.Bool())
}
idx := r.Reloc(pkgbits.RelocObj)
assert(r.Len() == 0)
......@@ -508,12 +519,17 @@ func writeUnifiedExport(out io.Writer) {
w.Sync(pkgbits.SyncPkg)
w.Reloc(pkgbits.RelocPkg, selfPkgIdx)
w.Bool(false) // TODO(mdempsky): Remove; was "has init"
if w.Version().Has(pkgbits.HasInit) {
w.Bool(false)
}
w.Len(len(idxs))
for _, idx := range idxs {
w.Sync(pkgbits.SyncObject)
w.Bool(false)
if w.Version().Has(pkgbits.DerivedFuncInstance) {
w.Bool(false)
}
w.Reloc(pkgbits.RelocObj, idx)
w.Len(0)
}
......
......@@ -730,7 +730,9 @@ func (w *writer) obj(obj types2.Object, explicits *types2.TypeList) {
// bitstream.
func (w *writer) objInfo(info objInfo) {
w.Sync(pkgbits.SyncObject)
w.Bool(false) // TODO(mdempsky): Remove; was derived func inst.
if w.Version().Has(pkgbits.DerivedFuncInstance) {
w.Bool(false)
}
w.Reloc(pkgbits.RelocObj, info.idx)
w.Len(len(info.explicits))
......
......@@ -65,13 +65,17 @@ func readUnifiedPackage(fset *token.FileSet, ctxt *types.Context, imports map[st
r := pr.newReader(pkgbits.RelocMeta, pkgbits.PublicRootIdx, pkgbits.SyncPublic)
pkg := r.pkg()
r.Bool() // TODO(mdempsky): Remove; was "has init"
if r.Version().Has(pkgbits.HasInit) {
r.Bool()
}
for i, n := 0, r.Len(); i < n; i++ {
// As if r.obj(), but avoiding the Scope.Lookup call,
// to avoid eager loading of imports.
r.Sync(pkgbits.SyncObject)
assert(!r.Bool())
if r.Version().Has(pkgbits.DerivedFuncInstance) {
assert(!r.Bool())
}
r.p.objIdx(r.Reloc(pkgbits.RelocObj))
assert(r.Len() == 0)
}
......@@ -428,7 +432,9 @@ func (r *reader) param() *types.Var {
func (r *reader) obj() (types.Object, []types.Type) {
r.Sync(pkgbits.SyncObject)
assert(!r.Bool())
if r.Version().Has(pkgbits.DerivedFuncInstance) {
assert(!r.Bool())
}
pkg, name := r.p.objIdx(r.Reloc(pkgbits.RelocObj))
obj := pkgScope(pkg).Lookup(name)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment