Sunday, July 13, 2008

Free Books Online

If you want to download free e-books, please visit this URL.

ftp://ftp.uar.net/pub/e-books/

http://www.esnips.com/

it will give you a series of old/new all the books of software developement.


-Tarun

IL Assembly Language



This article teaches the basics of IL Assembly language which can be used to debug your .NET code (written in any .NET high level language) at low level. From low level, I meant the point where the compiler of your high level language has finished his work. Also, using these basics, you can plan to write your own compiler for a new .NET language.

Whenever you complier your code in .NET, regardless the language you choose, it is converted to Intermediate Language (IL) which is also known as Microsoft Intermediate Language or Common Intermediate Language. You can think the IL as that the Byte Code generated by the Java Language. If you are interested to understand that how .NET deals with data types, and how the code you wrote is converted to IL code etc, then knowledge of IL will give you great advantages. These advantages may include understanding that what the code .NET compiler emits. Hence, if you know the IL, then you can examine the code emitted by the complier and make necessary changes (though not needed in most cases). You can change the IL code to make necessary changes (which your high level language may not allow) to increase the performance of you code. This also may help you to debug your code at low level. And also, if you are planning to write a compiler for .NET, then it is necessary to understand the IL.

IL itself is in the binary format which means it can't be read by the human. But as other binary (executable) code have an assembly language, so the same way IL also has an assembly language known as IL Assembly (ILAsm). IL Assembly has the instruction in the same way as that the native assembly language have. Like, to add two numbers, you have add instruction, to subtract two numbers, you have sub instruction etc. It is obvious that .NET runtime (JIT) can not execute the ILAsm directly. If you have written some code in ILAsm then first you have to compile that to IL code and then JIT will take care of running this IL code.

NOTE: Please note that IL and IL assembly are two different things. Whenever we talk about IL, then it means the binary code emitted by the .NET compiler whereas ILAsm will refer to the IL assembly language which is not in binary form.

NOTE: Please note that I am expecting that you are very much familiar with .NET (including any high level language). In this article, I will not go into details of everything but only those which I think are needed to be explained. If something confuse you, then you can contact me for more discussion.


Reference: http://www.codeproject.com/Articles/3778/Introduction-to-IL-Assembly-Language