Skip to content

Commit

Permalink
cmd/internal/dwarf: minor cleanups
Browse files Browse the repository at this point in the history
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 <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
  • Loading branch information
thanm committed Feb 23, 2021
1 parent b3b65f2 commit e5159b2
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions src/cmd/internal/dwarf/dwarf.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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.
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit e5159b2

Please sign in to comment.