mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: constant-fold loads from constant dictionaries and types
Retrying the original CL with a small modification. The original CL did not handle the case of reading an itab out of a dictionary correctly. When we read an itab out of a dictionary, we must treat the type inside that itab as maybe being put in an interface. Original CL: 486895 Revert CL: 490156 Change-Id: Id2dc1699d184cd8c63dac83986a70b60b4e6cbd7 Reviewed-on: https://go-review.googlesource.com/c/go/+/491495 Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
parent
b60db8f7d9
commit
bd3f44e4ff
11 changed files with 513 additions and 56 deletions
|
|
@ -180,6 +180,14 @@ func (d *deadcodePass) flood() {
|
|||
// converted to an interface, i.e. should have UsedInIface set. See the
|
||||
// comment below for why we need to unset the Reachable bit and re-mark it.
|
||||
rs := r.Sym()
|
||||
if d.ldr.IsItab(rs) {
|
||||
// This relocation can also point at an itab, in which case it
|
||||
// means "the _type field of that itab".
|
||||
rs = decodeItabType(d.ldr, d.ctxt.Arch, rs)
|
||||
}
|
||||
if !d.ldr.IsGoType(rs) && !d.ctxt.linkShared {
|
||||
panic(fmt.Sprintf("R_USEIFACE in %s references %s which is not a type or itab", d.ldr.SymName(symIdx), d.ldr.SymName(rs)))
|
||||
}
|
||||
if !d.ldr.AttrUsedInIface(rs) {
|
||||
d.ldr.SetAttrUsedInIface(rs, true)
|
||||
if d.ldr.AttrReachable(rs) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue