summaryrefslogtreecommitdiff
path: root/libgo/go/runtime/export_test.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2020-07-27 22:27:54 -0700
committerIan Lance Taylor <iant@golang.org>2020-08-01 11:21:40 -0700
commitf75af8c1464e948b5e166cf5ab09ebf0d82fc253 (patch)
tree3ba3299859b504bdeb477727471216bd094a0191 /libgo/go/runtime/export_test.go
parent75a23e59031fe673fc3b2e60fd1fe5f4c70ecb85 (diff)
downloadgcc-f75af8c1464e948b5e166cf5ab09ebf0d82fc253.tar.gz
libgo: update to go1.15rc1
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/245157
Diffstat (limited to 'libgo/go/runtime/export_test.go')
-rw-r--r--libgo/go/runtime/export_test.go34
1 files changed, 24 insertions, 10 deletions
diff --git a/libgo/go/runtime/export_test.go b/libgo/go/runtime/export_test.go
index ab74e34d611..482d014ad58 100644
--- a/libgo/go/runtime/export_test.go
+++ b/libgo/go/runtime/export_test.go
@@ -477,6 +477,8 @@ func GetNextArenaHint() uintptr {
type G = g
+type Sudog = sudog
+
func Getg() *G {
return getg()
}
@@ -727,9 +729,12 @@ func (p *PageAlloc) Free(base, npages uintptr) {
func (p *PageAlloc) Bounds() (ChunkIdx, ChunkIdx) {
return ChunkIdx((*pageAlloc)(p).start), ChunkIdx((*pageAlloc)(p).end)
}
-func (p *PageAlloc) Scavenge(nbytes uintptr, locked bool) (r uintptr) {
+func (p *PageAlloc) Scavenge(nbytes uintptr, mayUnlock bool) (r uintptr) {
+ pp := (*pageAlloc)(p)
systemstack(func() {
- r = (*pageAlloc)(p).scavenge(nbytes, locked)
+ lock(pp.mheapLock)
+ r = pp.scavenge(nbytes, mayUnlock)
+ unlock(pp.mheapLock)
})
return
}
@@ -737,8 +742,8 @@ 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,
+ Base: r.base.addr(),
+ Limit: r.limit.addr(),
})
}
return ranges
@@ -784,6 +789,7 @@ func NewPageAlloc(chunks, scav map[ChunkIdx][]BitRange) *PageAlloc {
// We've got an entry, so initialize the pageAlloc.
p.init(new(mutex), nil)
+ lockInit(p.mheapLock, lockRankMheap)
p.test = true
for i, init := range chunks {
@@ -810,7 +816,6 @@ func NewPageAlloc(chunks, scav map[ChunkIdx][]BitRange) *PageAlloc {
}
}
}
- p.resetScavengeAddr()
// Apply alloc state.
for _, s := range init {
@@ -824,6 +829,11 @@ func NewPageAlloc(chunks, scav map[ChunkIdx][]BitRange) *PageAlloc {
// Update heap metadata for the allocRange calls above.
p.update(addr, pallocChunkPages, false, false)
}
+ systemstack(func() {
+ lock(p.mheapLock)
+ p.scavengeStartGen()
+ unlock(p.mheapLock)
+ })
return (*PageAlloc)(p)
}
@@ -860,13 +870,9 @@ func FreePageAlloc(pp *PageAlloc) {
// 64 bit and 32 bit platforms, allowing the tests to share code
// between the two.
//
-// On AIX, the arenaBaseOffset is 0x0a00000000000000. However, this
-// constant can't be used here because it is negative and will cause
-// a constant overflow.
-//
// This should not be higher than 0x100*pallocChunkBytes to support
// mips and mipsle, which only have 31-bit address spaces.
-var BaseChunkIdx = ChunkIdx(chunkIndex(((0xc000*pageAlloc64Bit + 0x100*pageAlloc32Bit) * pallocChunkBytes) + 0x0a00000000000000*sys.GoosAix*sys.GoarchPpc64))
+var BaseChunkIdx = ChunkIdx(chunkIndex(((0xc000*pageAlloc64Bit + 0x100*pageAlloc32Bit) * pallocChunkBytes) + arenaBaseOffset*sys.GoosAix*sys.GoarchPpc64))
// PageBase returns an address given a chunk index and a page index
// relative to that chunk.
@@ -970,4 +976,12 @@ func MapHashCheck(m interface{}, k interface{}) (uintptr, uintptr) {
return x, y
}
+func MSpanCountAlloc(bits []byte) int {
+ s := mspan{
+ nelems: uintptr(len(bits) * 8),
+ gcmarkBits: (*gcBits)(unsafe.Pointer(&bits[0])),
+ }
+ return s.countAlloc()
+}
+
var Pusestackmaps = &usestackmaps