Add full compiler barriers to any fence that lacked a compiler barrier. (mono/mono#18177)
A compiler barrier generates no code.
It "only" inhibits certain compiler optimizations, which I do not consider
particularly worrisome, as most code is "fully" optimized, and
compiler barriers are relatively rare.
It could be a concern in code paths that greatly benefit
from compiler optimizations and for which barriers greatly
inhibits the compiler.
I would further suggest, though it is not here, that any compiler
half barrier (read, write) be a compiler full barrier instead,
as they sound pretty cheap, so simplify.
Similar cannot be said about CPU barriers.
They do not always generate code, but when they do, it can cost.
This is follow-up from https://github.com/mono/mono/pull/17849#issuecomment-
556273801
https://github.com/mono/mono/pull/17849#issuecomment-
557661604.
Commit migrated from https://github.com/mono/mono/commit/
e76fb5dbf92c34a944f6e3d5654a51661acbf6d8