Basic IL
The CLR is what causes your code to execute. The CLR is like a virtual CPU. Just like your x86 CPU pulls in an instruction at a time (with pre-fetch, cache, and so forth, it might not be as simple as that, but logically, this is what is happening), you can think of the CLR as pushing and pulling variables from the stack and executing instructions. That doesn't happen in real life, but the model forms a basis for understanding IL. Because IL is “intermediate,” it cannot depend on a CPU execution model. It cannot assume that registers will be available, even though most modern CPUs have registers; the number and types of registers vary greatly between CPUs. IL does not even have the concept of registers. IL is completely stack based. Instruction ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access