mirror of https://github.com/golang/go.git
[dev.regabi] cmd/compile: rewrite to use linksym helpers [generated]
Passes toolstash -cmp.
[git-generate]
cd src/cmd/compile/internal/gc
pkgs=$(grep -l -w Linksym ../*/*.go | xargs dirname | grep -v '/gc$' | sort -u)
rf '
ex . '"$(echo $pkgs)"' {
import "cmd/compile/internal/ir"
import "cmd/compile/internal/reflectdata"
import "cmd/compile/internal/staticdata"
import "cmd/compile/internal/types"
avoid reflectdata.TypeLinksym
avoid reflectdata.TypeLinksymLookup
avoid reflectdata.TypeLinksymPrefix
avoid staticdata.FuncLinksym
var f *ir.Func
var n *ir.Name
var s string
var t *types.Type
f.Sym().Linksym() -> f.Linksym()
n.Sym().Linksym() -> n.Linksym()
reflectdata.TypeSym(t).Linksym() -> reflectdata.TypeLinksym(t)
reflectdata.TypeSymPrefix(s, t).Linksym() -> reflectdata.TypeLinksymPrefix(s, t)
staticdata.FuncSym(n.Sym()).Linksym() -> staticdata.FuncLinksym(n)
types.TypeSymLookup(s).Linksym() -> reflectdata.TypeLinksymLookup(s)
}
'
Change-Id: I7a3ae1dcd61bcdf4a29f708ff12f7f80c2b280c6
Reviewed-on: https://go-review.googlesource.com/c/go/+/280640
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
This commit is contained in:
parent
25c613c02d
commit
ec59b197d5
|
|
@ -26,7 +26,7 @@ func Info(fnsym *obj.LSym, infosym *obj.LSym, curfn interface{}) ([]dwarf.Scope,
|
||||||
fn := curfn.(*ir.Func)
|
fn := curfn.(*ir.Func)
|
||||||
|
|
||||||
if fn.Nname != nil {
|
if fn.Nname != nil {
|
||||||
expect := fn.Sym().Linksym()
|
expect := fn.Linksym()
|
||||||
if fnsym.ABI() == obj.ABI0 {
|
if fnsym.ABI() == obj.ABI0 {
|
||||||
expect = fn.Sym().LinksymABI0()
|
expect = fn.Sym().LinksymABI0()
|
||||||
}
|
}
|
||||||
|
|
@ -90,7 +90,7 @@ func Info(fnsym *obj.LSym, infosym *obj.LSym, curfn interface{}) ([]dwarf.Scope,
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
apdecls = append(apdecls, n)
|
apdecls = append(apdecls, n)
|
||||||
fnsym.Func().RecordAutoType(reflectdata.TypeSym(n.Type()).Linksym())
|
fnsym.Func().RecordAutoType(reflectdata.TypeLinksym(n.Type()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -240,7 +240,7 @@ func createDwarfVars(fnsym *obj.LSym, complexOK bool, fn *ir.Func, apDecls []*ir
|
||||||
ChildIndex: -1,
|
ChildIndex: -1,
|
||||||
})
|
})
|
||||||
// Record go type of to insure that it gets emitted by the linker.
|
// Record go type of to insure that it gets emitted by the linker.
|
||||||
fnsym.Func().RecordAutoType(reflectdata.TypeSym(n.Type()).Linksym())
|
fnsym.Func().RecordAutoType(reflectdata.TypeLinksym(n.Type()))
|
||||||
}
|
}
|
||||||
|
|
||||||
return decls, vars
|
return decls, vars
|
||||||
|
|
@ -309,7 +309,7 @@ func createSimpleVar(fnsym *obj.LSym, n *ir.Name) *dwarf.Var {
|
||||||
}
|
}
|
||||||
|
|
||||||
typename := dwarf.InfoPrefix + types.TypeSymName(n.Type())
|
typename := dwarf.InfoPrefix + types.TypeSymName(n.Type())
|
||||||
delete(fnsym.Func().Autot, reflectdata.TypeSym(n.Type()).Linksym())
|
delete(fnsym.Func().Autot, reflectdata.TypeLinksym(n.Type()))
|
||||||
inlIndex := 0
|
inlIndex := 0
|
||||||
if base.Flag.GenDwarfInl > 1 {
|
if base.Flag.GenDwarfInl > 1 {
|
||||||
if n.Name().InlFormal() || n.Name().InlLocal() {
|
if n.Name().InlFormal() || n.Name().InlLocal() {
|
||||||
|
|
@ -376,7 +376,7 @@ func createComplexVar(fnsym *obj.LSym, fn *ir.Func, varID ssa.VarID) *dwarf.Var
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
gotype := reflectdata.TypeSym(n.Type()).Linksym()
|
gotype := reflectdata.TypeLinksym(n.Type())
|
||||||
delete(fnsym.Func().Autot, gotype)
|
delete(fnsym.Func().Autot, gotype)
|
||||||
typename := dwarf.InfoPrefix + gotype.Name[len("type."):]
|
typename := dwarf.InfoPrefix + gotype.Name[len("type."):]
|
||||||
inlIndex := 0
|
inlIndex := 0
|
||||||
|
|
|
||||||
|
|
@ -40,10 +40,10 @@ func TestMain(m *testing.M) {
|
||||||
types.PtrSize = ssagen.Arch.LinkArch.PtrSize
|
types.PtrSize = ssagen.Arch.LinkArch.PtrSize
|
||||||
types.RegSize = ssagen.Arch.LinkArch.RegSize
|
types.RegSize = ssagen.Arch.LinkArch.RegSize
|
||||||
types.TypeLinkSym = func(t *types.Type) *obj.LSym {
|
types.TypeLinkSym = func(t *types.Type) *obj.LSym {
|
||||||
return reflectdata.TypeSym(t).Linksym()
|
return reflectdata.TypeLinksym(t)
|
||||||
}
|
}
|
||||||
types.TypeLinkSym = func(t *types.Type) *obj.LSym {
|
types.TypeLinkSym = func(t *types.Type) *obj.LSym {
|
||||||
return reflectdata.TypeSym(t).Linksym()
|
return reflectdata.TypeLinksym(t)
|
||||||
}
|
}
|
||||||
typecheck.Init()
|
typecheck.Init()
|
||||||
os.Exit(m.Run())
|
os.Exit(m.Run())
|
||||||
|
|
|
||||||
|
|
@ -174,5 +174,5 @@ func isInlinableButNotInlined(fn *ir.Func) bool {
|
||||||
if fn.Sym() == nil {
|
if fn.Sym() == nil {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return !fn.Sym().Linksym().WasInlined()
|
return !fn.Linksym().WasInlined()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -191,7 +191,7 @@ func Main(archInit func(*ssagen.ArchInfo)) {
|
||||||
types.RegSize = ssagen.Arch.LinkArch.RegSize
|
types.RegSize = ssagen.Arch.LinkArch.RegSize
|
||||||
types.MaxWidth = ssagen.Arch.MAXWIDTH
|
types.MaxWidth = ssagen.Arch.MAXWIDTH
|
||||||
types.TypeLinkSym = func(t *types.Type) *obj.LSym {
|
types.TypeLinkSym = func(t *types.Type) *obj.LSym {
|
||||||
return reflectdata.TypeSym(t).Linksym()
|
return reflectdata.TypeLinksym(t)
|
||||||
}
|
}
|
||||||
|
|
||||||
typecheck.Target = new(ir.Package)
|
typecheck.Target = new(ir.Package)
|
||||||
|
|
@ -203,7 +203,7 @@ func Main(archInit func(*ssagen.ArchInfo)) {
|
||||||
base.AutogeneratedPos = makePos(src.NewFileBase("<autogenerated>", "<autogenerated>"), 1, 0)
|
base.AutogeneratedPos = makePos(src.NewFileBase("<autogenerated>", "<autogenerated>"), 1, 0)
|
||||||
|
|
||||||
types.TypeLinkSym = func(t *types.Type) *obj.LSym {
|
types.TypeLinkSym = func(t *types.Type) *obj.LSym {
|
||||||
return reflectdata.TypeSym(t).Linksym()
|
return reflectdata.TypeLinksym(t)
|
||||||
}
|
}
|
||||||
typecheck.Init()
|
typecheck.Init()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -261,8 +261,8 @@ func addGCLocals() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func ggloblnod(nam *ir.Name) {
|
func ggloblnod(nam *ir.Name) {
|
||||||
s := nam.Sym().Linksym()
|
s := nam.Linksym()
|
||||||
s.Gotype = reflectdata.TypeSym(nam.Type()).Linksym()
|
s.Gotype = reflectdata.TypeLinksym(nam.Type())
|
||||||
flags := 0
|
flags := 0
|
||||||
if nam.Name().Readonly() {
|
if nam.Name().Readonly() {
|
||||||
flags = obj.RODATA
|
flags = obj.RODATA
|
||||||
|
|
|
||||||
|
|
@ -932,7 +932,7 @@ func mkinlcall(n *ir.CallExpr, fn *ir.Func, maxCost int32, inlMap map[*ir.Func]b
|
||||||
parent = b.InliningIndex()
|
parent = b.InliningIndex()
|
||||||
}
|
}
|
||||||
|
|
||||||
sym := fn.Sym().Linksym()
|
sym := fn.Linksym()
|
||||||
newIndex := base.Ctxt.InlTree.Add(parent, n.Pos(), sym)
|
newIndex := base.Ctxt.InlTree.Add(parent, n.Pos(), sym)
|
||||||
|
|
||||||
// Add an inline mark just before the inlined body.
|
// Add an inline mark just before the inlined body.
|
||||||
|
|
|
||||||
|
|
@ -314,7 +314,7 @@ func (n *Name) MarkReadonly() {
|
||||||
// Mark the linksym as readonly immediately
|
// Mark the linksym as readonly immediately
|
||||||
// so that the SSA backend can use this information.
|
// so that the SSA backend can use this information.
|
||||||
// It will be overridden later during dumpglobls.
|
// It will be overridden later during dumpglobls.
|
||||||
n.Sym().Linksym().Type = objabi.SRODATA
|
n.Linksym().Type = objabi.SRODATA
|
||||||
}
|
}
|
||||||
|
|
||||||
// Val returns the constant.Value for the node.
|
// Val returns the constant.Value for the node.
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ func Task() *ir.Name {
|
||||||
if n.Op() != ir.ONAME || n.(*ir.Name).Class_ != ir.PEXTERN {
|
if n.Op() != ir.ONAME || n.(*ir.Name).Class_ != ir.PEXTERN {
|
||||||
base.Fatalf("bad inittask: %v", n)
|
base.Fatalf("bad inittask: %v", n)
|
||||||
}
|
}
|
||||||
deps = append(deps, n.(*ir.Name).Sym().Linksym())
|
deps = append(deps, n.(*ir.Name).Linksym())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make a function that contains all the initialization statements.
|
// Make a function that contains all the initialization statements.
|
||||||
|
|
@ -74,7 +74,7 @@ func Task() *ir.Name {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fns = append(fns, fn.Nname.Sym().Linksym())
|
fns = append(fns, fn.Nname.Linksym())
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(deps) == 0 && len(fns) == 0 && types.LocalPkg.Name != "main" && types.LocalPkg.Name != "runtime" {
|
if len(deps) == 0 && len(fns) == 0 && types.LocalPkg.Name != "main" && types.LocalPkg.Name != "runtime" {
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ func genhash(t *types.Type) *obj.LSym {
|
||||||
// For other sizes of plain memory, we build a closure
|
// For other sizes of plain memory, we build a closure
|
||||||
// that calls memhash_varlen. The size of the memory is
|
// that calls memhash_varlen. The size of the memory is
|
||||||
// encoded in the first slot of the closure.
|
// encoded in the first slot of the closure.
|
||||||
closure := types.TypeSymLookup(fmt.Sprintf(".hashfunc%d", t.Width)).Linksym()
|
closure := TypeLinksymLookup(fmt.Sprintf(".hashfunc%d", t.Width))
|
||||||
if len(closure.P) > 0 { // already generated
|
if len(closure.P) > 0 { // already generated
|
||||||
return closure
|
return closure
|
||||||
}
|
}
|
||||||
|
|
@ -120,7 +120,7 @@ func genhash(t *types.Type) *obj.LSym {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
closure := TypeSymPrefix(".hashfunc", t).Linksym()
|
closure := TypeLinksymPrefix(".hashfunc", t)
|
||||||
if len(closure.P) > 0 { // already generated
|
if len(closure.P) > 0 { // already generated
|
||||||
return closure
|
return closure
|
||||||
}
|
}
|
||||||
|
|
@ -347,7 +347,7 @@ func geneq(t *types.Type) *obj.LSym {
|
||||||
case types.AMEM:
|
case types.AMEM:
|
||||||
// make equality closure. The size of the type
|
// make equality closure. The size of the type
|
||||||
// is encoded in the closure.
|
// is encoded in the closure.
|
||||||
closure := types.TypeSymLookup(fmt.Sprintf(".eqfunc%d", t.Width)).Linksym()
|
closure := TypeLinksymLookup(fmt.Sprintf(".eqfunc%d", t.Width))
|
||||||
if len(closure.P) != 0 {
|
if len(closure.P) != 0 {
|
||||||
return closure
|
return closure
|
||||||
}
|
}
|
||||||
|
|
@ -363,7 +363,7 @@ func geneq(t *types.Type) *obj.LSym {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
closure := TypeSymPrefix(".eqfunc", t).Linksym()
|
closure := TypeLinksymPrefix(".eqfunc", t)
|
||||||
if len(closure.P) > 0 { // already generated
|
if len(closure.P) > 0 { // already generated
|
||||||
return closure
|
return closure
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1583,7 +1583,7 @@ func dgcprog(t *types.Type) (*obj.LSym, int64) {
|
||||||
if t.Width == types.BADWIDTH {
|
if t.Width == types.BADWIDTH {
|
||||||
base.Fatalf("dgcprog: %v badwidth", t)
|
base.Fatalf("dgcprog: %v badwidth", t)
|
||||||
}
|
}
|
||||||
lsym := TypeSymPrefix(".gcprog", t).Linksym()
|
lsym := TypeLinksymPrefix(".gcprog", t)
|
||||||
var p gcProg
|
var p gcProg
|
||||||
p.init(lsym)
|
p.init(lsym)
|
||||||
p.emit(t, 0)
|
p.emit(t, 0)
|
||||||
|
|
@ -1857,7 +1857,7 @@ var ZeroSize int64
|
||||||
// MarkTypeUsedInInterface marks that type t is converted to an interface.
|
// MarkTypeUsedInInterface marks that type t is converted to an interface.
|
||||||
// This information is used in the linker in dead method elimination.
|
// This information is used in the linker in dead method elimination.
|
||||||
func MarkTypeUsedInInterface(t *types.Type, from *obj.LSym) {
|
func MarkTypeUsedInInterface(t *types.Type, from *obj.LSym) {
|
||||||
tsym := TypeSym(t).Linksym()
|
tsym := TypeLinksym(t)
|
||||||
// Emit a marker relocation. The linker will know the type is converted
|
// Emit a marker relocation. The linker will know the type is converted
|
||||||
// to an interface if "from" is reachable.
|
// to an interface if "from" is reachable.
|
||||||
r := obj.Addrel(from)
|
r := obj.Addrel(from)
|
||||||
|
|
@ -1870,7 +1870,7 @@ func MarkTypeUsedInInterface(t *types.Type, from *obj.LSym) {
|
||||||
func MarkUsedIfaceMethod(n *ir.CallExpr) {
|
func MarkUsedIfaceMethod(n *ir.CallExpr) {
|
||||||
dot := n.X.(*ir.SelectorExpr)
|
dot := n.X.(*ir.SelectorExpr)
|
||||||
ityp := dot.X.Type()
|
ityp := dot.X.Type()
|
||||||
tsym := TypeSym(ityp).Linksym()
|
tsym := TypeLinksym(ityp)
|
||||||
r := obj.Addrel(ir.CurFunc.LSym)
|
r := obj.Addrel(ir.CurFunc.LSym)
|
||||||
r.Sym = tsym
|
r.Sym = tsym
|
||||||
// dot.Xoffset is the method index * Widthptr (the offset of code pointer
|
// dot.Xoffset is the method index * Widthptr (the offset of code pointer
|
||||||
|
|
|
||||||
|
|
@ -166,7 +166,7 @@ func selectLSym(f *ir.Func, hasBody bool) {
|
||||||
f.LSym = nam.Sym().LinksymABI0()
|
f.LSym = nam.Sym().LinksymABI0()
|
||||||
needABIWrapper, wrapperABI = true, obj.ABIInternal
|
needABIWrapper, wrapperABI = true, obj.ABIInternal
|
||||||
} else {
|
} else {
|
||||||
f.LSym = nam.Sym().Linksym()
|
f.LSym = nam.Linksym()
|
||||||
// No ABI override. Check that the symbol is
|
// No ABI override. Check that the symbol is
|
||||||
// using the expected ABI.
|
// using the expected ABI.
|
||||||
want := obj.ABIInternal
|
want := obj.ABIInternal
|
||||||
|
|
|
||||||
|
|
@ -2112,7 +2112,7 @@ func (s *state) expr(n ir.Node) *ssa.Value {
|
||||||
n := n.(*ir.Name)
|
n := n.(*ir.Name)
|
||||||
if n.Class_ == ir.PFUNC {
|
if n.Class_ == ir.PFUNC {
|
||||||
// "value" of a function is the address of the function's closure
|
// "value" of a function is the address of the function's closure
|
||||||
sym := staticdata.FuncSym(n.Sym()).Linksym()
|
sym := staticdata.FuncLinksym(n)
|
||||||
return s.entryNewValue1A(ssa.OpAddr, types.NewPtr(n.Type()), sym, s.sb)
|
return s.entryNewValue1A(ssa.OpAddr, types.NewPtr(n.Type()), sym, s.sb)
|
||||||
}
|
}
|
||||||
if s.canSSA(n) {
|
if s.canSSA(n) {
|
||||||
|
|
@ -4959,7 +4959,7 @@ func (s *state) addr(n ir.Node) *ssa.Value {
|
||||||
switch n.Class_ {
|
switch n.Class_ {
|
||||||
case ir.PEXTERN:
|
case ir.PEXTERN:
|
||||||
// global variable
|
// global variable
|
||||||
v := s.entryNewValue1A(ssa.OpAddr, t, n.Sym().Linksym(), s.sb)
|
v := s.entryNewValue1A(ssa.OpAddr, t, n.Linksym(), s.sb)
|
||||||
// TODO: Make OpAddr use AuxInt as well as Aux.
|
// TODO: Make OpAddr use AuxInt as well as Aux.
|
||||||
if offset != 0 {
|
if offset != 0 {
|
||||||
v = s.entryNewValue1I(ssa.OpOffPtr, v.Type, offset, v)
|
v = s.entryNewValue1I(ssa.OpOffPtr, v.Type, offset, v)
|
||||||
|
|
@ -6831,7 +6831,7 @@ func AddAux2(a *obj.Addr, v *ssa.Value, offset int64) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
a.Name = obj.NAME_AUTO
|
a.Name = obj.NAME_AUTO
|
||||||
a.Sym = n.Sym().Linksym()
|
a.Sym = n.Linksym()
|
||||||
a.Offset += n.FrameOffset()
|
a.Offset += n.FrameOffset()
|
||||||
default:
|
default:
|
||||||
v.Fatalf("aux in %s not implemented %#v", v, v.Aux)
|
v.Fatalf("aux in %s not implemented %#v", v, v.Aux)
|
||||||
|
|
@ -6963,7 +6963,7 @@ func CheckLoweredGetClosurePtr(v *ssa.Value) {
|
||||||
func AddrAuto(a *obj.Addr, v *ssa.Value) {
|
func AddrAuto(a *obj.Addr, v *ssa.Value) {
|
||||||
n, off := ssa.AutoVar(v)
|
n, off := ssa.AutoVar(v)
|
||||||
a.Type = obj.TYPE_MEM
|
a.Type = obj.TYPE_MEM
|
||||||
a.Sym = n.Sym().Linksym()
|
a.Sym = n.Linksym()
|
||||||
a.Reg = int16(Arch.REGSP)
|
a.Reg = int16(Arch.REGSP)
|
||||||
a.Offset = n.FrameOffset() + off
|
a.Offset = n.FrameOffset() + off
|
||||||
if n.Class_ == ir.PPARAM || n.Class_ == ir.PPARAMOUT {
|
if n.Class_ == ir.PPARAM || n.Class_ == ir.PPARAMOUT {
|
||||||
|
|
@ -6979,7 +6979,7 @@ func (s *State) AddrScratch(a *obj.Addr) {
|
||||||
}
|
}
|
||||||
a.Type = obj.TYPE_MEM
|
a.Type = obj.TYPE_MEM
|
||||||
a.Name = obj.NAME_AUTO
|
a.Name = obj.NAME_AUTO
|
||||||
a.Sym = s.ScratchFpMem.Sym().Linksym()
|
a.Sym = s.ScratchFpMem.Linksym()
|
||||||
a.Reg = int16(Arch.REGSP)
|
a.Reg = int16(Arch.REGSP)
|
||||||
a.Offset = s.ScratchFpMem.Offset_
|
a.Offset = s.ScratchFpMem.Offset_
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,8 +37,8 @@ func InitAddr(n *ir.Name, noff int64, a *ir.Name, aoff int64) {
|
||||||
if a.Op() != ir.ONAME {
|
if a.Op() != ir.ONAME {
|
||||||
base.Fatalf("addrsym a op %v", a.Op())
|
base.Fatalf("addrsym a op %v", a.Op())
|
||||||
}
|
}
|
||||||
s := n.Sym().Linksym()
|
s := n.Linksym()
|
||||||
s.WriteAddr(base.Ctxt, noff, types.PtrSize, a.Sym().Linksym(), aoff)
|
s.WriteAddr(base.Ctxt, noff, types.PtrSize, a.Linksym(), aoff)
|
||||||
}
|
}
|
||||||
|
|
||||||
// InitFunc writes the static address of f to n. f must be a global function.
|
// InitFunc writes the static address of f to n. f must be a global function.
|
||||||
|
|
@ -53,18 +53,18 @@ func InitFunc(n *ir.Name, noff int64, f *ir.Name) {
|
||||||
if f.Class_ != ir.PFUNC {
|
if f.Class_ != ir.PFUNC {
|
||||||
base.Fatalf("pfuncsym class not PFUNC %d", f.Class_)
|
base.Fatalf("pfuncsym class not PFUNC %d", f.Class_)
|
||||||
}
|
}
|
||||||
s := n.Sym().Linksym()
|
s := n.Linksym()
|
||||||
s.WriteAddr(base.Ctxt, noff, types.PtrSize, FuncSym(f.Sym()).Linksym(), 0)
|
s.WriteAddr(base.Ctxt, noff, types.PtrSize, FuncLinksym(f), 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
// InitSlice writes a static slice symbol {&arr, lencap, lencap} to n+noff.
|
// InitSlice writes a static slice symbol {&arr, lencap, lencap} to n+noff.
|
||||||
// InitSlice does not modify n.
|
// InitSlice does not modify n.
|
||||||
func InitSlice(n *ir.Name, noff int64, arr *ir.Name, lencap int64) {
|
func InitSlice(n *ir.Name, noff int64, arr *ir.Name, lencap int64) {
|
||||||
s := n.Sym().Linksym()
|
s := n.Linksym()
|
||||||
if arr.Op() != ir.ONAME {
|
if arr.Op() != ir.ONAME {
|
||||||
base.Fatalf("slicesym non-name arr %v", arr)
|
base.Fatalf("slicesym non-name arr %v", arr)
|
||||||
}
|
}
|
||||||
s.WriteAddr(base.Ctxt, noff, types.PtrSize, arr.Sym().Linksym(), 0)
|
s.WriteAddr(base.Ctxt, noff, types.PtrSize, arr.Linksym(), 0)
|
||||||
s.WriteInt(base.Ctxt, noff+types.SliceLenOffset, types.PtrSize, lencap)
|
s.WriteInt(base.Ctxt, noff+types.SliceLenOffset, types.PtrSize, lencap)
|
||||||
s.WriteInt(base.Ctxt, noff+types.SliceCapOffset, types.PtrSize, lencap)
|
s.WriteInt(base.Ctxt, noff+types.SliceCapOffset, types.PtrSize, lencap)
|
||||||
}
|
}
|
||||||
|
|
@ -141,7 +141,7 @@ func fileStringSym(pos src.XPos, file string, readonly bool, hash []byte) (*obj.
|
||||||
if readonly {
|
if readonly {
|
||||||
sym = StringSym(pos, string(data))
|
sym = StringSym(pos, string(data))
|
||||||
} else {
|
} else {
|
||||||
sym = slicedata(pos, string(data)).Sym().Linksym()
|
sym = slicedata(pos, string(data)).Linksym()
|
||||||
}
|
}
|
||||||
if len(hash) > 0 {
|
if len(hash) > 0 {
|
||||||
sum := sha256.Sum256(data)
|
sum := sha256.Sum256(data)
|
||||||
|
|
@ -189,7 +189,7 @@ func fileStringSym(pos src.XPos, file string, readonly bool, hash []byte) (*obj.
|
||||||
} else {
|
} else {
|
||||||
// Emit a zero-length data symbol
|
// Emit a zero-length data symbol
|
||||||
// and then fix up length and content to use file.
|
// and then fix up length and content to use file.
|
||||||
symdata = slicedata(pos, "").Sym().Linksym()
|
symdata = slicedata(pos, "").Linksym()
|
||||||
symdata.Size = size
|
symdata.Size = size
|
||||||
symdata.Type = objabi.SNOPTRDATA
|
symdata.Type = objabi.SNOPTRDATA
|
||||||
info := symdata.NewFileInfo()
|
info := symdata.NewFileInfo()
|
||||||
|
|
@ -318,7 +318,7 @@ func InitConst(n *ir.Name, noff int64, c ir.Node, wid int) {
|
||||||
if c.Op() != ir.OLITERAL {
|
if c.Op() != ir.OLITERAL {
|
||||||
base.Fatalf("litsym c op %v", c.Op())
|
base.Fatalf("litsym c op %v", c.Op())
|
||||||
}
|
}
|
||||||
s := n.Sym().Linksym()
|
s := n.Linksym()
|
||||||
switch u := c.Val(); u.Kind() {
|
switch u := c.Val(); u.Kind() {
|
||||||
case constant.Bool:
|
case constant.Bool:
|
||||||
i := int64(obj.Bool2int(constant.BoolVal(u)))
|
i := int64(obj.Bool2int(constant.BoolVal(u)))
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ func WriteEmbed(v *ir.Name) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
base.ErrorfAt(v.Pos(), "embed %s: %v", file, err)
|
base.ErrorfAt(v.Pos(), "embed %s: %v", file, err)
|
||||||
}
|
}
|
||||||
sym := v.Sym().Linksym()
|
sym := v.Linksym()
|
||||||
off := 0
|
off := 0
|
||||||
off = objw.SymPtr(sym, off, fsym, 0) // data string
|
off = objw.SymPtr(sym, off, fsym, 0) // data string
|
||||||
off = objw.Uintptr(sym, off, uint64(size)) // len
|
off = objw.Uintptr(sym, off, uint64(size)) // len
|
||||||
|
|
@ -187,7 +187,7 @@ func WriteEmbed(v *ir.Name) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
objw.Global(slicedata, int32(off), obj.RODATA|obj.LOCAL)
|
objw.Global(slicedata, int32(off), obj.RODATA|obj.LOCAL)
|
||||||
sym := v.Sym().Linksym()
|
sym := v.Linksym()
|
||||||
objw.SymPtr(sym, 0, slicedata, 0)
|
objw.SymPtr(sym, 0, slicedata, 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -313,7 +313,7 @@ func (s *Schedule) StaticAssign(l *ir.Name, loff int64, r ir.Node, typ *types.Ty
|
||||||
return val.Op() == ir.ONIL
|
return val.Op() == ir.ONIL
|
||||||
}
|
}
|
||||||
|
|
||||||
reflectdata.MarkTypeUsedInInterface(val.Type(), l.Sym().Linksym())
|
reflectdata.MarkTypeUsedInInterface(val.Type(), l.Linksym())
|
||||||
|
|
||||||
var itab *ir.AddrExpr
|
var itab *ir.AddrExpr
|
||||||
if typ.IsEmptyInterface() {
|
if typ.IsEmptyInterface() {
|
||||||
|
|
@ -445,7 +445,7 @@ func StaticName(t *types.Type) *ir.Name {
|
||||||
statuniqgen++
|
statuniqgen++
|
||||||
typecheck.Declare(n, ir.PEXTERN)
|
typecheck.Declare(n, ir.PEXTERN)
|
||||||
n.SetType(t)
|
n.SetType(t)
|
||||||
n.Sym().Linksym().Set(obj.AttrLocal, true)
|
n.Linksym().Set(obj.AttrLocal, true)
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ func (c initContext) String() string {
|
||||||
func readonlystaticname(t *types.Type) *ir.Name {
|
func readonlystaticname(t *types.Type) *ir.Name {
|
||||||
n := staticinit.StaticName(t)
|
n := staticinit.StaticName(t)
|
||||||
n.MarkReadonly()
|
n.MarkReadonly()
|
||||||
n.Sym().Linksym().Set(obj.AttrContentAddressable, true)
|
n.Linksym().Set(obj.AttrContentAddressable, true)
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func instrument(fn *ir.Func) {
|
func instrument(fn *ir.Func) {
|
||||||
if fn.Pragma&ir.Norace != 0 || (fn.Sym().Linksym() != nil && fn.Sym().Linksym().ABIWrapper()) {
|
if fn.Pragma&ir.Norace != 0 || (fn.Linksym() != nil && fn.Linksym().ABIWrapper()) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue