3 ms·
“machine code” isn't really the zero point that's special nowadays. The code the programmer wrote is compiled to something such as LLVM IR, LLVM IR is further
by Blikkentrekker 4y ago
“machine code” isn't really the zero point that's special nowadays.
The code the programmer wrote is compiled to something such as LLVM IR, LLVM IR is further compiled by LLVM to Assembly, this is further compiled by an assembler into machine code, and then the c.p.u. further compiles this to it's internal code as it executes it. “machine code” really is no more special in this chain of events than, say, LLVM IR.
- blueflow 4y agoMachine code is special because its the only thing the CPU can actually execute.
- clhodapp 4y ago... then the c.p.u. further compiles this to it's internal code as it executes it. “machine code” really is no more special in this chain of events than, say, LLVM IR. I think this is the core point. Even though you are mechanically feeding machine code into the CPU, modern CPUs deeply transform your program before (or even while) running it, with potentially deep performance implications. With modern CPUs, the only choice we truly have is which compiler we trust to optimize our program.
- iopq 4y agoSometimes it executes it exactly how you think it will execute. But it's still slower because the "less optimized code" fit in its cache.
- pjmlp 4y agoExcept if the CPU is microcoded, those instructions might not mean what you think they do, and you need something like Intel's V-Tune to actually understand what the CPU is doing with them.
- blueflow 4y ago> ... to actually understand what the CPU is doing with them. x86 has a developers manual for this purpose.
- pjmlp 4y agoIt has, and if you manage to know everything on those pages, for every single processor on the market, while taking into consideration motherboard architectures, and OS workloads you're our hero. We are way beyond MS-DOS days and Michael Abrash's books.
- izacus 4y agoIt's slightly different - machine code is special because it's a visible API between our programming work and the CPU sillicon. Microcode is private implementation detail which you usually can't affect as a software developer. Machine code is something you are directly creating by writing things though.
- Blikkentrekker 4y agoWhy is that visible a.p.i. different than, say, LLVM i.r. which is also a visible a.p.i.? Why is the c.p.u. special?
- deleted 4y ago[deleted]