Can optimizations performed by a C # compiler or JITter have visible side effects?
One example that I disabled.
var x = new Something();
A(x);
B(x);
When called, A(x) xstorage at the end Ais guaranteed - because it Buses the same parameter. But if Bdefined as
public void B(Something x) { }
It B(x)can then be fixed by the optimizer, and a call may be required instead GC.KeepAlive(x).
Can this optimization be performed by JITter?
Are there other optimizations that may have visible side effects besides stack trace changes?
source
share