54 lines
1.7 KiB
Plaintext
54 lines
1.7 KiB
Plaintext
$OpenBSD: patch-src_runtime_stack_go,v 1.2 2018/04/06 13:01:39 kn Exp $
|
|
|
|
Index: src/runtime/stack.go
|
|
--- src/runtime/stack.go.orig
|
|
+++ src/runtime/stack.go
|
|
@@ -180,6 +180,7 @@ func stackpoolalloc(order uint8) gclinkptr {
|
|
if s == nil {
|
|
throw("out of memory")
|
|
}
|
|
+ sysMarkStack(unsafe.Pointer(s.base()), s.npages << _PageShift)
|
|
if s.allocCount != 0 {
|
|
throw("bad allocCount")
|
|
}
|
|
@@ -238,6 +239,7 @@ func stackpoolfree(x gclinkptr, order uint8) {
|
|
// By not freeing, we prevent step #4 until GC is done.
|
|
stackpool[order].remove(s)
|
|
s.manualFreeList = 0
|
|
+ sysUnmarkStack(unsafe.Pointer(s.base()), s.npages << _PageShift)
|
|
mheap_.freeManual(s, &memstats.stacks_inuse)
|
|
}
|
|
}
|
|
@@ -385,6 +387,7 @@ func stackalloc(n uint32) stack {
|
|
if s == nil {
|
|
throw("out of memory")
|
|
}
|
|
+ sysMarkStack(unsafe.Pointer(s.base()), s.npages << _PageShift)
|
|
s.elemsize = uintptr(n)
|
|
}
|
|
v = unsafe.Pointer(s.base())
|
|
@@ -463,6 +466,7 @@ func stackfree(stk stack) {
|
|
if gcphase == _GCoff {
|
|
// Free the stack immediately if we're
|
|
// sweeping.
|
|
+ sysUnmarkStack(unsafe.Pointer(s.base()), s.npages << _PageShift)
|
|
mheap_.freeManual(s, &memstats.stacks_inuse)
|
|
} else {
|
|
// If the GC is running, we can't return a
|
|
@@ -1162,6 +1166,7 @@ func freeStackSpans() {
|
|
if s.allocCount == 0 {
|
|
list.remove(s)
|
|
s.manualFreeList = 0
|
|
+ sysUnmarkStack(unsafe.Pointer(s.base()), s.npages << _PageShift)
|
|
mheap_.freeManual(s, &memstats.stacks_inuse)
|
|
}
|
|
s = next
|
|
@@ -1176,6 +1181,7 @@ func freeStackSpans() {
|
|
for s := stackLarge.free[i].first; s != nil; {
|
|
next := s.next
|
|
stackLarge.free[i].remove(s)
|
|
+ sysUnmarkStack(unsafe.Pointer(s.base()), s.npages << _PageShift)
|
|
mheap_.freeManual(s, &memstats.stacks_inuse)
|
|
s = next
|
|
}
|