mirror of
https://github.com/golang/go
synced 2024-11-25 07:07:57 -07:00
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: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
7dc1ee81f9
commit
24fd1a043d
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user