aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/lfstack.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/lfstack.go')
-rw-r--r--src/runtime/lfstack.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/runtime/lfstack.go b/src/runtime/lfstack.go
index 4787c5be3f..406561a275 100644
--- a/src/runtime/lfstack.go
+++ b/src/runtime/lfstack.go
@@ -55,3 +55,13 @@ func (head *lfstack) pop() unsafe.Pointer {
func (head *lfstack) empty() bool {
return atomic.Load64((*uint64)(head)) == 0
}
+
+// lfnodeValidate panics if node is not a valid address for use with
+// lfstack.push. This only needs to be called when node is allocated.
+func lfnodeValidate(node *lfnode) {
+ if lfstackUnpack(lfstackPack(node, ^uintptr(0))) != node {
+ printlock()
+ println("runtime: bad lfnode address", hex(uintptr(unsafe.Pointer(node))))
+ throw("bad lfnode address")
+ }
+}