Skip to content

Commit

Permalink
cmd/compile: set opendefer info symbol as content-addressable
Browse files Browse the repository at this point in the history
Also move the logic of setting arginfo symbols content-addressable
to the place of symbol creation.

Change-Id: Ia5c3d77b1cec988c42c84d573170120948575c07
Reviewed-on: https://go-review.googlesource.com/c/go/+/353830
Trust: Cherry Mui <[email protected]>
Run-TryBot: Cherry Mui <[email protected]>
TryBot-Result: Go Bot <[email protected]>
Reviewed-by: Than McIntosh <[email protected]>
  • Loading branch information
cherrymui committed Oct 4, 2021
1 parent 739328c commit d9952ff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/cmd/compile/internal/gc/obj.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,6 @@ func addGCLocals() {
if x := fn.ArgInfo; x != nil {
objw.Global(x, int32(len(x.P)), obj.RODATA|obj.DUPOK)
x.Set(obj.AttrStatic, true)
x.Set(obj.AttrContentAddressable, true)
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/cmd/compile/internal/ssagen/ssa.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ func dvarint(x *obj.LSym, off int, v int64) int {
// - Offset of the closure value to call
func (s *state) emitOpenDeferInfo() {
x := base.Ctxt.Lookup(s.curfn.LSym.Name + ".opendefer")
x.Set(obj.AttrContentAddressable, true)
s.curfn.LSym.Func().OpenCodedDeferInfo = x
off := 0
off = dvarint(x, off, -s.deferBitsTemp.FrameOffset())
Expand Down Expand Up @@ -6544,6 +6545,7 @@ func emitArgInfo(e *ssafn, f *ssa.Func, pp *objw.Progs) {
}

x := EmitArgInfo(e.curfn, f.OwnAux.ABIInfo())
x.Set(obj.AttrContentAddressable, true)
e.curfn.LSym.Func().ArgInfo = x

// Emit a funcdata pointing at the arg info data.
Expand All @@ -6557,6 +6559,9 @@ func emitArgInfo(e *ssafn, f *ssa.Func, pp *objw.Progs) {
// emit argument info (locations on stack) of f for traceback.
func EmitArgInfo(f *ir.Func, abiInfo *abi.ABIParamResultInfo) *obj.LSym {
x := base.Ctxt.Lookup(fmt.Sprintf("%s.arginfo%d", f.LSym.Name, f.ABI))
// NOTE: do not set ContentAddressable here. This may be referenced from
// assembly code by name (in this case f is a declaration).
// Instead, set it in emitArgInfo above.

PtrSize := int64(types.PtrSize)
uintptrTyp := types.Types[types.TUINTPTR]
Expand Down

0 comments on commit d9952ff

Please sign in to comment.