diff options
Diffstat (limited to 'src/runtime/export_test.go')
| -rw-r--r-- | src/runtime/export_test.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/runtime/export_test.go b/src/runtime/export_test.go index 5206fa0109..d8cf2acad8 100644 --- a/src/runtime/export_test.go +++ b/src/runtime/export_test.go @@ -734,6 +734,16 @@ func (p *PageAlloc) Scavenge(nbytes uintptr, locked bool) (r uintptr) { }) return } +func (p *PageAlloc) InUse() []AddrRange { + ranges := make([]AddrRange, 0, len(p.inUse.ranges)) + for _, r := range p.inUse.ranges { + ranges = append(ranges, AddrRange{ + Base: r.base, + Limit: r.limit, + }) + } + return ranges +} // Returns nil if the PallocData's L2 is missing. func (p *PageAlloc) PallocData(i ChunkIdx) *PallocData { @@ -745,6 +755,12 @@ func (p *PageAlloc) PallocData(i ChunkIdx) *PallocData { return (*PallocData)(&l2[ci.l2()]) } +// AddrRange represents a range over addresses. +// Specifically, it represents the range [Base, Limit). +type AddrRange struct { + Base, Limit uintptr +} + // BitRange represents a range over a bitmap. type BitRange struct { I, N uint // bit index and length in bits |
