}
if mheap_.shadow_enabled {
- systemstack(func() {
- addr := uintptr(unsafe.Pointer(dst))
- shadow := shadowptr(addr)
- if shadow == nil {
- return
- }
- // There is a race here but only if the program is using
- // racy writes instead of sync/atomic. In that case we
- // don't mind crashing.
- if *shadow != *dst && *shadow != noShadow && istrackedptr(*dst) {
- mheap_.shadow_enabled = false
- print("runtime: write barrier dst=", dst, " old=", hex(*dst), " shadow=", shadow, " old=", hex(*shadow), " new=", hex(src), "\n")
- throw("missed write barrier")
- }
- *shadow = src
- })
+ writebarrierptr_shadow(dst, src)
}
*dst = src
writebarrierptr_nostore1(dst, src)
}
+//go:nosplit
+func writebarrierptr_shadow(dst *uintptr, src uintptr) {
+ systemstack(func() {
+ addr := uintptr(unsafe.Pointer(dst))
+ shadow := shadowptr(addr)
+ if shadow == nil {
+ return
+ }
+ // There is a race here but only if the program is using
+ // racy writes instead of sync/atomic. In that case we
+ // don't mind crashing.
+ if *shadow != *dst && *shadow != noShadow && istrackedptr(*dst) {
+ mheap_.shadow_enabled = false
+ print("runtime: write barrier dst=", dst, " old=", hex(*dst), " shadow=", shadow, " old=", hex(*shadow), " new=", hex(src), "\n")
+ throw("missed write barrier")
+ }
+ *shadow = src
+ })
+}
+
// Like writebarrierptr, but the store has already been applied.
// Do not reapply.
//go:nosplit