Skip to content

Commit 5cfac64

Browse files
committed
stack: Lower IsPtr() floor from 8MiB to to 4MiB
That's frequent to have pointer lower in the address space. This was not well tested but will be well tested in v2. This will modify stack bucketing, generally helping in AnyPointer mode.
1 parent 05c8a99 commit 5cfac64

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

stack/stack.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,16 @@ type Arg struct {
124124
// IsPtr returns true if we guess it's a pointer. It's only a guess, it can be
125125
// easily be confused by a bitmask.
126126
func (a *Arg) IsPtr() bool {
127-
// Assumes all pointers are above 8MiB and positive; assuming that above half
128-
// the memory is kernel memory. This is not always true.
127+
// Assumes all values are above 4MiB and positive are pointers; assuming that
128+
// above half the memory is kernel memory.
129+
//
130+
// This is not always true but this should be good enough to help
131+
// implementing AnyPointer.
132+
//
129133
// Assume the stack was generated with the same bitness (32 vs 64) than the
130134
// code processing it.
131-
const maxInt = uint64(int((^uint(0)) >> 1))
132-
return a.Value > 8*1024*1024 && a.Value < maxInt
135+
const maxInt = uint64((^uint(0)) >> 1)
136+
return a.Value > 4*1024*1024 && a.Value < maxInt
133137
}
134138

135139
var lookup = []string{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}

0 commit comments

Comments
 (0)