diff options
Diffstat (limited to 'src/runtime/export_test.go')
| -rw-r--r-- | src/runtime/export_test.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/runtime/export_test.go b/src/runtime/export_test.go index 48628370db..b1ebfba0d1 100644 --- a/src/runtime/export_test.go +++ b/src/runtime/export_test.go @@ -684,6 +684,25 @@ func (d *PallocData) Scavenged() *PallocBits { // Expose fillAligned for testing. func FillAligned(x uint64, m uint) uint64 { return fillAligned(x, m) } +// Expose pageCache for testing. +type PageCache pageCache + +const PageCachePages = pageCachePages + +func NewPageCache(base uintptr, cache, scav uint64) PageCache { + return PageCache(pageCache{base: base, cache: cache, scav: scav}) +} +func (c *PageCache) Empty() bool { return (*pageCache)(c).empty() } +func (c *PageCache) Base() uintptr { return (*pageCache)(c).base } +func (c *PageCache) Cache() uint64 { return (*pageCache)(c).cache } +func (c *PageCache) Scav() uint64 { return (*pageCache)(c).scav } +func (c *PageCache) Alloc(npages uintptr) (uintptr, uintptr) { + return (*pageCache)(c).alloc(npages) +} +func (c *PageCache) Flush(s *PageAlloc) { + (*pageCache)(c).flush((*pageAlloc)(s)) +} + // Expose chunk index type. type ChunkIdx chunkIdx @@ -694,6 +713,9 @@ type PageAlloc pageAlloc func (p *PageAlloc) Alloc(npages uintptr) (uintptr, uintptr) { return (*pageAlloc)(p).alloc(npages) } +func (p *PageAlloc) AllocToCache() PageCache { + return PageCache((*pageAlloc)(p).allocToCache()) +} func (p *PageAlloc) Free(base, npages uintptr) { (*pageAlloc)(p).free(base, npages) } |
