4 ms·
I'm so glad that you have linked this article from Chisnall. I can now ask you in what ways is the abstract model of a machine on which assembly language operat
by nec4b 5y ago
I'm so glad that you have linked this article from Chisnall. I can now ask you in what ways is the abstract model of a machine on which assembly language operates on, different from the one on which the C language operates on?
This is the claim which started this thread:
>>C is a portable alternative to assembly language.
- pjmlp 5y agoC's abstract machine is leaky and full of surprises when UB comes into play for one. Second when people talk about C being portable Assembly, they mistakenly assume to know what comes out of the compiler's backend. Third, unless we are speaking about PDP-11 like CPUs, modern CPUs have tons of capabilities not exposed to ISO C. Finally, since 1958 there are portable alternatives to Assembly in systems programming with JOVIAL being one of the first remarkable ones, yet another thing that C did not invent.
- nec4b 5y agoYou haven't answered the question? Maybe because is there is no concernable difference between abstract machine models of both languages? You can't do anything more about instruction reordering or cache invalidation at the CPU level with assembly than you can with C.
- pjmlp 5y agoYou surely can, better read those CPU manuals about line bus controllers.
- nec4b 5y agoHave you? I used to write device drivers mostly on ARM architectures and I have newer seen an instruction which would let me precisely control CPU instruction ordering or what it does with cache that I couldn't do in C.
- pjmlp 5y agoThat is why stuff like V-Tune exist with micro-ops profiler and pipeline debugging, maybe ARM should provide better tooling.
- nec4b 5y agoThis tool helps as much with C (or even higher level languages) as it does with Assembly. It doesn't change the fact both languages work on the same abstract machine model.
- pjmlp 5y agoWhat is C's abstract model for NEON?
- nec4b 5y agoA simple c library: https://github.com/projectNe10/Ne10 https://github.com/projectNe10/Ne10 You have not yet shown an argument for why c is not a portable assembly.
- potiuper 5y agoAccess to CPU-specific flags like the carry flag. When doing a multiple-precision addition, if the CPU carry bit is inaccessible, then it must instead be compared to the result to see if it overflowed, which takes 3-5 more instructions per limb or worse on modern superscalar processors that are serial in terms of data accesses.