Currently, we have a bit of a mess in ShenandoahBarrierSetAssembler::cmpxchg_oop(): It has special code paths for C1-only (everthing under the boolean arg 'encode') and it has a code path for !ShenandoahCASBarrier. Also, while C1 actually does not exchange, we call it with exchange==true and cmove the result. This is backwards. Also, we hacked to call storeval-barrier in C1-only path, because it can't easily be done otherwise in C1. Streamlining this code would help tremendously to clarify the actual CAS barrier algorithm, which is currently buried under all those special paths.