From what I understand, a “mutable” modifier in C # has two effects:
- Inserts the barriers needed for the target processor.
- Prevents certain compiler optimizations
In x86 / amd64, (1) does not matter. These processors do not require fences for volatile semantics. (ia64 is different, however.)
So, we get to (2). But, for example, I tried, volatile doesn't make any difference to the jit-ted build.
My question is: can you give an example C # code example where adding a “volatile” modifier to a field leads to another jit-ted assembler?
Igor ostrovsky
source share