News for hackers. Stuff that matters.
Re:No sane compiler would optimize atomics (2015) by sharikone on Sunday July 11, 2021 @08:01PM (#27805558)
Not to mention that a big part of the confusion is not even the compilation - it's not beyond possibilities to inspect the machine code - but the processor itself still does a lot of unintuitive stuff, even more so with concurrency. I wish the tooling you mention existed, but also some microcode simulation/implementation to look beyond that.
Re:No sane compiler would optimize atomics (2015) by kaba0 on Sunday July 11, 2021 @11:17PM (#27806584)
I’m not sure what are you thinking of, but CPUs are guaranteed to run as if the given instructions were executed one after another, even though in practice it is free to reorder them slightly.
Re:No sane compiler would optimize atomics (2015) by astrange on Sunday July 11, 2021 @11:26PM (#27806643)
Memory operations aren't required to behave like that, although on x86 they mostly do. ARM and Alpha certainly don't.
Re:No sane compiler would optimize atomics (2015) by chrisseaton on Monday July 12, 2021 @05:41AM (#27808621)
> CPUs are guaranteed to run as if the given instructions were executed one after another

That’s just not true. Intel models will reorder reads and other processors will even reorder writes - and I’m talking about observably.

Re:No sane compiler would optimize atomics (2015) by bregma on Monday July 12, 2021 @08:55AM (#27809732)
I've dealt with many CPUs designed to run out of sequence and to guarantee that. I've dealt with multiprocessor computers where order is not guaranteed at all outside the use of hardware interlinks. I've dealt with embarrassingly parallel processors where instruction order is orthogonal.

Perhaps you're thinking of a simple abstract CPUs used in "introduction to computers" courses instead of the real-life silicon used in most applications?