From: Than McIntosh Date: Wed, 6 Jan 2021 18:27:17 +0000 (-0500) Subject: cmd/internal/dwarf: minor cleanups X-Git-Tag: go1.17beta1~1433 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=e5159b2a2f0fdd47c644d1655f5a7b57ec7dd509;p=gostls13.git cmd/internal/dwarf: minor cleanups Remove a stale comment, demote PutInlinedFunc from public to private, and remove an unused interface originally used for sorting vars. No change in functionality. Change-Id: I5ee1ad2b10b78b158e2223c6979bab830202db95 Reviewed-on: https://go-review.googlesource.com/c/go/+/295009 Trust: Than McIntosh Run-TryBot: Than McIntosh Reviewed-by: Jeremy Faller Reviewed-by: Cherry Zhang TryBot-Result: Go Bot --- diff --git a/src/cmd/internal/dwarf/dwarf.go b/src/cmd/internal/dwarf/dwarf.go index 8de4096f06..70d792fec6 100644 --- a/src/cmd/internal/dwarf/dwarf.go +++ b/src/cmd/internal/dwarf/dwarf.go @@ -318,8 +318,6 @@ const ( ) // Index into the abbrevs table below. -// Keep in sync with ispubname() and ispubtype() in ld/dwarf.go. -// ispubtype considers >= NULLTYPE public const ( DW_ABRV_NULL = iota DW_ABRV_COMPUNIT @@ -1257,7 +1255,7 @@ func PutAbstractFunc(ctxt Context, s *FnState) error { // its corresponding 'abstract' DIE (containing location-independent // attributes such as name, type, etc). Inlined subroutine DIEs can // have other inlined subroutine DIEs as children. -func PutInlinedFunc(ctxt Context, s *FnState, callersym Sym, callIdx int) error { +func putInlinedFunc(ctxt Context, s *FnState, callersym Sym, callIdx int) error { ic := s.InlCalls.Calls[callIdx] callee := ic.AbsFunSym @@ -1268,7 +1266,7 @@ func PutInlinedFunc(ctxt Context, s *FnState, callersym Sym, callIdx int) error Uleb128put(ctxt, s.Info, int64(abbrev)) if logDwarf { - ctxt.Logf("PutInlinedFunc(caller=%v,callee=%v,abbrev=%d)\n", callersym, callee, abbrev) + ctxt.Logf("putInlinedFunc(caller=%v,callee=%v,abbrev=%d)\n", callersym, callee, abbrev) } // Abstract origin. @@ -1304,7 +1302,7 @@ func PutInlinedFunc(ctxt Context, s *FnState, callersym Sym, callIdx int) error // Children of this inline. for _, sib := range inlChildren(callIdx, &s.InlCalls) { absfn := s.InlCalls.Calls[sib].AbsFunSym - err := PutInlinedFunc(ctxt, s, absfn, sib) + err := putInlinedFunc(ctxt, s, absfn, sib) if err != nil { return err } @@ -1346,7 +1344,7 @@ func PutConcreteFunc(ctxt Context, s *FnState) error { // Inlined subroutines. for _, sib := range inlChildren(-1, &s.InlCalls) { absfn := s.InlCalls.Calls[sib].AbsFunSym - err := PutInlinedFunc(ctxt, s, absfn, sib) + err := putInlinedFunc(ctxt, s, absfn, sib) if err != nil { return err } @@ -1394,7 +1392,7 @@ func PutDefaultFunc(ctxt Context, s *FnState) error { // Inlined subroutines. for _, sib := range inlChildren(-1, &s.InlCalls) { absfn := s.InlCalls.Calls[sib].AbsFunSym - err := PutInlinedFunc(ctxt, s, absfn, sib) + err := putInlinedFunc(ctxt, s, absfn, sib) if err != nil { return err } @@ -1600,14 +1598,6 @@ func putvar(ctxt Context, s *FnState, v *Var, absfn Sym, fnabbrev, inlIndex int, // Var has no children => no terminator } -// VarsByOffset attaches the methods of sort.Interface to []*Var, -// sorting in increasing StackOffset. -type VarsByOffset []*Var - -func (s VarsByOffset) Len() int { return len(s) } -func (s VarsByOffset) Less(i, j int) bool { return s[i].StackOffset < s[j].StackOffset } -func (s VarsByOffset) Swap(i, j int) { s[i], s[j] = s[j], s[i] } - // byChildIndex implements sort.Interface for []*dwarf.Var by child index. type byChildIndex []*Var