Skip to content

Commit

Permalink
pref: reduce allocation
Browse files Browse the repository at this point in the history
Signed-off-by: Zxilly <[email protected]>
  • Loading branch information
Zxilly committed Jul 19, 2024
1 parent 1e5436a commit 6ff95ac
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions internal/dwarf/dwarf.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,16 @@ func SizeForDWARFVar(
return nil, uint64(typ.Size()), nil
}

var boolIgnores = [...]dwarf.Attr{
dwarf.AttrCallAllCalls,
dwarf.AttrCallAllTailCalls,
}

var ignores = [...]dwarf.Attr{
dwarf.AttrAbstractOrigin,
dwarf.AttrSpecification,
}

func EntryShouldIgnore(entry *dwarf.Entry) bool {
declaration := entry.Val(dwarf.AttrDeclaration)
if declaration != nil {
Expand All @@ -99,11 +109,6 @@ func EntryShouldIgnore(entry *dwarf.Entry) bool {
}
}

boolIgnores := []dwarf.Attr{
dwarf.AttrCallAllCalls,
dwarf.AttrCallAllTailCalls,
}

for _, ignore := range boolIgnores {
valAny := entry.Val(ignore)
if valAny != nil {
Expand All @@ -118,11 +123,6 @@ func EntryShouldIgnore(entry *dwarf.Entry) bool {
}
}

ignores := []dwarf.Attr{
dwarf.AttrAbstractOrigin,
dwarf.AttrSpecification,
}

for _, ignore := range ignores {
if entry.Val(ignore) != nil {
return true
Expand Down
2 changes: 1 addition & 1 deletion internal/knowninfo/disasm.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (k *KnownInfo) Disasm() error {
)

for fn := range k.Deps.Functions {
if err := sem.Acquire(resultProcess, 1); err != nil {
if err = sem.Acquire(resultProcess, 1); err != nil {
slog.Error(fmt.Sprintf("Failed to acquire semaphore: %v", err))
break
}
Expand Down

0 comments on commit 6ff95ac

Please sign in to comment.