mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: test that write barriers are correctly marked unpreemptible
Followon to CL 518055. Change-Id: I05c4b429f49feb7012070e467fefbf3392260915 Reviewed-on: https://go-review.googlesource.com/c/go/+/518538 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Keith Randall <khr@google.com>
This commit is contained in:
parent
3378adc517
commit
1f4bb6112b
3 changed files with 146 additions and 0 deletions
|
|
@ -7,6 +7,7 @@
|
|||
package runtime
|
||||
|
||||
import (
|
||||
"internal/abi"
|
||||
"internal/goarch"
|
||||
"internal/goos"
|
||||
"runtime/internal/atomic"
|
||||
|
|
@ -1940,3 +1941,21 @@ func MyGenericFunc[T any]() {
|
|||
testUintptr = 4
|
||||
})
|
||||
}
|
||||
|
||||
func UnsafePoint(pc uintptr) bool {
|
||||
fi := findfunc(pc)
|
||||
v := pcdatavalue(fi, abi.PCDATA_UnsafePoint, pc, nil)
|
||||
switch v {
|
||||
case abi.UnsafePointUnsafe:
|
||||
return true
|
||||
case abi.UnsafePointSafe:
|
||||
return false
|
||||
case abi.UnsafePointRestart1, abi.UnsafePointRestart2, abi.UnsafePointRestartAtEntry:
|
||||
// These are all interruptible, they just encode a nonstandard
|
||||
// way of recovering when interrupted.
|
||||
return false
|
||||
default:
|
||||
var buf [20]byte
|
||||
panic("invalid unsafe point code " + string(itoa(buf[:], uint64(v))))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue