Skip to content

Commit c04416c

Browse files
committed
enabling race
1 parent f2440c1 commit c04416c

File tree

5 files changed

+234
-0
lines changed

5 files changed

+234
-0
lines changed

src/runtime/race.go

+34
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,10 @@ var __tsan_report_count byte
323323
//go:cgo_import_static __tsan_go_atomic64_exchange
324324
//go:cgo_import_static __tsan_go_atomic32_fetch_add
325325
//go:cgo_import_static __tsan_go_atomic64_fetch_add
326+
//go:cgo_import_static __tsan_go_atomic32_fetch_and
327+
//go:cgo_import_static __tsan_go_atomic64_fetch_and
328+
//go:cgo_import_static __tsan_go_atomic32_fetch_or
329+
//go:cgo_import_static __tsan_go_atomic64_fetch_or
326330
//go:cgo_import_static __tsan_go_atomic32_compare_exchange
327331
//go:cgo_import_static __tsan_go_atomic64_compare_exchange
328332

@@ -642,6 +646,36 @@ func abigen_sync_atomic_AddUint64(addr *uint64, delta uint64) (new uint64)
642646
//go:linkname abigen_sync_atomic_AddUintptr sync/atomic.AddUintptr
643647
func abigen_sync_atomic_AddUintptr(addr *uintptr, delta uintptr) (new uintptr)
644648

649+
//go:linkname abigen_sync_atomic_AndInt32 sync/atomic.AndInt32
650+
func abigen_sync_atomic_AndInt32(addr *int32, mask int32) (old int32)
651+
652+
//go:linkname abigen_sync_atomic_AndUint32 sync/atomic.AndUint32
653+
func abigen_sync_atomic_AndUint32(addr *uint32, mask uint32) (old uint32)
654+
655+
//go:linkname abigen_sync_atomic_AndInt64 sync/atomic.AndInt64
656+
func abigen_sync_atomic_AndInt64(addr *int64, mask int64) (old int64)
657+
658+
//go:linkname abigen_sync_atomic_AndUint64 sync/atomic.AndUint64
659+
func abigen_sync_atomic_AndUint64(addr *uint64, mask uint64) (old uint64)
660+
661+
//go:linkname abigen_sync_atomic_AndUintptr sync/atomic.AndUintptr
662+
func abigen_sync_atomic_AndUintptr(addr *uintptr, mask uintptr) (old uintptr)
663+
664+
//go:linkname abigen_sync_atomic_OrInt32 sync/atomic.OrInt32
665+
func abigen_sync_atomic_OrInt32(addr *int32, mask int32) (old int32)
666+
667+
//go:linkname abigen_sync_atomic_OrUint32 sync/atomic.OrUint32
668+
func abigen_sync_atomic_OrUint32(addr *uint32, mask uint32) (old uint32)
669+
670+
//go:linkname abigen_sync_atomic_OrInt64 sync/atomic.OrInt64
671+
func abigen_sync_atomic_OrInt64(addr *int64, mask int64) (old int64)
672+
673+
//go:linkname abigen_sync_atomic_OrUint64 sync/atomic.OrUint64
674+
func abigen_sync_atomic_OrUint64(addr *uint64, mask uint64) (old uint64)
675+
676+
//go:linkname abigen_sync_atomic_OrUintptr sync/atomic.OrUintptr
677+
func abigen_sync_atomic_OrUintptr(addr *uintptr, mask uintptr) (old uintptr)
678+
645679
//go:linkname abigen_sync_atomic_CompareAndSwapInt32 sync/atomic.CompareAndSwapInt32
646680
func abigen_sync_atomic_CompareAndSwapInt32(addr *int32, old, new int32) (swapped bool)
647681

src/runtime/race_amd64.s

+50
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,56 @@ TEXT sync∕atomic·AddUintptr(SB), NOSPLIT, $0-24
303303
GO_ARGS
304304
JMP sync∕atomic·AddInt64(SB)
305305

306+
// And
307+
TEXT sync∕atomic·AndInt32(SB), NOSPLIT|NOFRAME, $0-20
308+
GO_ARGS
309+
MOVQ $__tsan_go_atomic32_fetch_and(SB), AX
310+
CALL racecallatomic<>(SB)
311+
RET
312+
313+
TEXT sync∕atomic·AndInt64(SB), NOSPLIT|NOFRAME, $0-24
314+
GO_ARGS
315+
MOVQ $__tsan_go_atomic64_fetch_and(SB), AX
316+
CALL racecallatomic<>(SB)
317+
RET
318+
319+
TEXT sync∕atomic·AndUint32(SB), NOSPLIT, $0-20
320+
GO_ARGS
321+
JMP sync∕atomic·AndInt32(SB)
322+
323+
TEXT sync∕atomic·AndUint64(SB), NOSPLIT, $0-24
324+
GO_ARGS
325+
JMP sync∕atomic·AndInt64(SB)
326+
327+
TEXT sync∕atomic·AndUintptr(SB), NOSPLIT, $0-24
328+
GO_ARGS
329+
JMP sync∕atomic·AndInt64(SB)
330+
331+
// Or
332+
TEXT sync∕atomic·OrInt32(SB), NOSPLIT|NOFRAME, $0-20
333+
GO_ARGS
334+
MOVQ $__tsan_go_atomic32_fetch_or(SB), AX
335+
CALL racecallatomic<>(SB)
336+
RET
337+
338+
TEXT sync∕atomic·OrInt64(SB), NOSPLIT|NOFRAME, $0-24
339+
GO_ARGS
340+
MOVQ $__tsan_go_atomic64_fetch_or(SB), AX
341+
CALL racecallatomic<>(SB)
342+
RET
343+
344+
TEXT sync∕atomic·OrUint32(SB), NOSPLIT, $0-20
345+
GO_ARGS
346+
JMP sync∕atomic·OrInt32(SB)
347+
348+
TEXT sync∕atomic·OrUint64(SB), NOSPLIT, $0-24
349+
GO_ARGS
350+
JMP sync∕atomic·OrInt64(SB)
351+
352+
TEXT sync∕atomic·OrUintptr(SB), NOSPLIT, $0-24
353+
GO_ARGS
354+
JMP sync∕atomic·OrInt64(SB)
355+
306356
// CompareAndSwap
307357
TEXT sync∕atomic·CompareAndSwapInt32(SB), NOSPLIT|NOFRAME, $0-17
308358
GO_ARGS

src/runtime/race_arm64.s

+50
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,56 @@ TEXT sync∕atomic·AddUintptr(SB), NOSPLIT, $0-24
312312
GO_ARGS
313313
JMP sync∕atomic·AddInt64(SB)
314314

315+
// And
316+
TEXT sync∕atomic·AndInt32(SB), NOSPLIT, $0-20
317+
GO_ARGS
318+
MOVD $__tsan_go_atomic32_fetch_and(SB), R9
319+
BL racecallatomic<>(SB)
320+
RET
321+
322+
TEXT sync∕atomic·AndInt64(SB), NOSPLIT, $0-24
323+
GO_ARGS
324+
MOVD $__tsan_go_atomic64_fetch_and(SB), R9
325+
BL racecallatomic<>(SB)
326+
RET
327+
328+
TEXT sync∕atomic·AndUint32(SB), NOSPLIT, $0-20
329+
GO_ARGS
330+
JMP sync∕atomic·AndInt32(SB)
331+
332+
TEXT sync∕atomic·AndUint64(SB), NOSPLIT, $0-24
333+
GO_ARGS
334+
JMP sync∕atomic·AndInt64(SB)
335+
336+
TEXT sync∕atomic·AndUintptr(SB), NOSPLIT, $0-24
337+
GO_ARGS
338+
JMP sync∕atomic·AndInt64(SB)
339+
340+
// Or
341+
TEXT sync∕atomic·OrInt32(SB), NOSPLIT, $0-20
342+
GO_ARGS
343+
MOVD $__tsan_go_atomic32_fetch_or(SB), R9
344+
BL racecallatomic<>(SB)
345+
RET
346+
347+
TEXT sync∕atomic·OrInt64(SB), NOSPLIT, $0-24
348+
GO_ARGS
349+
MOVD $__tsan_go_atomic64_fetch_or(SB), R9
350+
BL racecallatomic<>(SB)
351+
RET
352+
353+
TEXT sync∕atomic·OrUint32(SB), NOSPLIT, $0-20
354+
GO_ARGS
355+
JMP sync∕atomic·OrInt32(SB)
356+
357+
TEXT sync∕atomic·OrUint64(SB), NOSPLIT, $0-24
358+
GO_ARGS
359+
JMP sync∕atomic·OrInt64(SB)
360+
361+
TEXT sync∕atomic·OrUintptr(SB), NOSPLIT, $0-24
362+
GO_ARGS
363+
JMP sync∕atomic·OrInt64(SB)
364+
315365
// CompareAndSwap
316366
TEXT sync∕atomic·CompareAndSwapInt32(SB), NOSPLIT, $0-17
317367
GO_ARGS

src/runtime/race_ppc64le.s

+50
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,56 @@ TEXT sync∕atomic·AddUintptr(SB), NOSPLIT, $0-24
325325
GO_ARGS
326326
BR sync∕atomic·AddInt64(SB)
327327

328+
// And
329+
TEXT sync∕atomic·AndInt32(SB), NOSPLIT, $0-20
330+
GO_ARGS
331+
MOVD $__tsan_go_atomic32_fetch_and(SB), R8
332+
BR racecallatomic<>(SB)
333+
RET
334+
335+
TEXT sync∕atomic·AndInt64(SB), NOSPLIT, $0-24
336+
GO_ARGS
337+
MOVD $__tsan_go_atomic64_fetch_and(SB), R8
338+
BR racecallatomic<>(SB)
339+
RET
340+
341+
TEXT sync∕atomic·AndUint32(SB), NOSPLIT, $0-20
342+
GO_ARGS
343+
BR sync∕atomic·AndInt32(SB)
344+
345+
TEXT sync∕atomic·AndUint64(SB), NOSPLIT, $0-24
346+
GO_ARGS
347+
BR sync∕atomic·AndInt64(SB)
348+
349+
TEXT sync∕atomic·AndUintptr(SB), NOSPLIT, $0-24
350+
GO_ARGS
351+
BR sync∕atomic·AndInt64(SB)
352+
353+
// Or
354+
TEXT sync∕atomic·OrInt32(SB), NOSPLIT, $0-20
355+
GO_ARGS
356+
MOVD $__tsan_go_atomic32_fetch_or(SB), R8
357+
BR racecallatomic<>(SB)
358+
RET
359+
360+
TEXT sync∕atomic·OrInt64(SB), NOSPLIT, $0-24
361+
GO_ARGS
362+
MOVD $__tsan_go_atomic64_fetch_or(SB), R8
363+
BR racecallatomic<>(SB)
364+
RET
365+
366+
TEXT sync∕atomic·OrUint32(SB), NOSPLIT, $0-20
367+
GO_ARGS
368+
BR sync∕atomic·OrInt32(SB)
369+
370+
TEXT sync∕atomic·OrUint64(SB), NOSPLIT, $0-24
371+
GO_ARGS
372+
BR sync∕atomic·OrInt64(SB)
373+
374+
TEXT sync∕atomic·OrUintptr(SB), NOSPLIT, $0-24
375+
GO_ARGS
376+
BR sync∕atomic·OrInt64(SB)
377+
328378
// CompareAndSwap in tsan
329379
TEXT sync∕atomic·CompareAndSwapInt32(SB), NOSPLIT, $0-17
330380
GO_ARGS

src/runtime/race_s390x.s

+50
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,56 @@ TEXT sync∕atomic·AddUintptr(SB), NOSPLIT, $0-24
274274
GO_ARGS
275275
JMP sync∕atomic·AddInt64(SB)
276276

277+
// And
278+
TEXT sync∕atomic·AndInt32(SB), NOSPLIT, $0-20
279+
GO_ARGS
280+
MOVD $__tsan_go_atomic32_fetch_and(SB), R1
281+
BL racecallatomic<>(SB)
282+
RET
283+
284+
TEXT sync∕atomic·AndInt64(SB), NOSPLIT, $0-24
285+
GO_ARGS
286+
MOVD $__tsan_go_atomic64_fetch_and(SB), R1
287+
BL racecallatomic<>(SB)
288+
RET
289+
290+
TEXT sync∕atomic·AndUint32(SB), NOSPLIT, $0-20
291+
GO_ARGS
292+
JMP sync∕atomic·AndInt32(SB)
293+
294+
TEXT sync∕atomic·AndUint64(SB), NOSPLIT, $0-24
295+
GO_ARGS
296+
JMP sync∕atomic·AndInt64(SB)
297+
298+
TEXT sync∕atomic·AndUintptr(SB), NOSPLIT, $0-24
299+
GO_ARGS
300+
JMP sync∕atomic·AndInt64(SB)
301+
302+
// Or
303+
TEXT sync∕atomic·OrInt32(SB), NOSPLIT, $0-20
304+
GO_ARGS
305+
MOVD $__tsan_go_atomic32_fetch_or(SB), R1
306+
BL racecallatomic<>(SB)
307+
RET
308+
309+
TEXT sync∕atomic·OrInt64(SB), NOSPLIT, $0-24
310+
GO_ARGS
311+
MOVD $__tsan_go_atomic64_fetch_or(SB), R1
312+
BL racecallatomic<>(SB)
313+
RET
314+
315+
TEXT sync∕atomic·OrUint32(SB), NOSPLIT, $0-20
316+
GO_ARGS
317+
JMP sync∕atomic·OrInt32(SB)
318+
319+
TEXT sync∕atomic·OrUint64(SB), NOSPLIT, $0-24
320+
GO_ARGS
321+
JMP sync∕atomic·OrInt64(SB)
322+
323+
TEXT sync∕atomic·OrUintptr(SB), NOSPLIT, $0-24
324+
GO_ARGS
325+
JMP sync∕atomic·OrInt64(SB)
326+
277327
// CompareAndSwap
278328

279329
TEXT sync∕atomic·CompareAndSwapInt32(SB), NOSPLIT, $0-17

0 commit comments

Comments
 (0)