Commit 3cf72322 authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

cmd/compile: reuse LSyms in dumptypestructs

Passes toolstash-check.

Change-Id: I4a5c841eb16e05db7d923d4c3c7cd2d7695fa4af
Reviewed-on: https://go-review.googlesource.com/41409
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
parent 1dc3b60b
...@@ -1441,19 +1441,20 @@ func dumptypestructs() { ...@@ -1441,19 +1441,20 @@ func dumptypestructs() {
// unused [2]byte // unused [2]byte
// fun [1]uintptr // variable sized // fun [1]uintptr // variable sized
// } // }
o := dsymptr(i.sym.Linksym(), 0, dtypesym(i.itype).Linksym(), 0) ilsym := i.sym.Linksym()
o = dsymptr(i.sym.Linksym(), o, dtypesym(i.t).Linksym(), 0) o := dsymptr(ilsym, 0, dtypesym(i.itype).Linksym(), 0)
o += Widthptr // skip link field o = dsymptr(ilsym, o, dtypesym(i.t).Linksym(), 0)
o = duint32(i.sym.Linksym(), o, typehash(i.t)) // copy of type hash o += Widthptr // skip link field
o += 4 // skip bad/inhash/unused fields o = duint32(ilsym, o, typehash(i.t)) // copy of type hash
o += len(imethods(i.itype)) * Widthptr // skip fun method pointers o += 4 // skip bad/inhash/unused fields
o += len(imethods(i.itype)) * Widthptr // skip fun method pointers
// at runtime the itab will contain pointers to types, other itabs and // at runtime the itab will contain pointers to types, other itabs and
// method functions. None are allocated on heap, so we can use obj.NOPTR. // method functions. None are allocated on heap, so we can use obj.NOPTR.
ggloblsym(i.sym.Linksym(), int32(o), int16(obj.DUPOK|obj.NOPTR)) ggloblsym(ilsym, int32(o), int16(obj.DUPOK|obj.NOPTR))
ilink := itablinkpkg.Lookup(i.t.ShortString() + "," + i.itype.ShortString()) ilink := itablinkpkg.Lookup(i.t.ShortString() + "," + i.itype.ShortString()).Linksym()
dsymptr(ilink.Linksym(), 0, i.sym.Linksym(), 0) dsymptr(ilink, 0, ilsym, 0)
ggloblsym(ilink.Linksym(), int32(Widthptr), int16(obj.DUPOK|obj.RODATA)) ggloblsym(ilink, int32(Widthptr), int16(obj.DUPOK|obj.RODATA))
} }
// process ptabs // process ptabs
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment