Here’s a Treiber stack implementation I’ve been playing around with. The upper 32-bits of the stack head are used as a “version” to avoid ABA. Fun things to try out:
Change line 18 to return head to introduce the ABA problem.
Change the memory order on lines 37 or 50 to relaxed to allow the store in push to move before the loads in pop
genmc detects both of these, which is neat.
One thing I’ve noticed is that it’s very easy to get a very large state space. This encourages cutting down the program to only what’s needed. But this also runs the risk of not capturing enough of the complexity of the algorithm to really stress it. So I’m not sure how practical this is to use on real programs.
Here’s a Treiber stack implementation I’ve been playing around with. The upper 32-bits of the stack head are used as a “version” to avoid ABA. Fun things to try out:
return head
to introduce the ABA problem.push
to move before the loads inpop
genmc detects both of these, which is neat.
One thing I’ve noticed is that it’s very easy to get a very large state space. This encourages cutting down the program to only what’s needed. But this also runs the risk of not capturing enough of the complexity of the algorithm to really stress it. So I’m not sure how practical this is to use on real programs.