-18-

 

Glossary

 

The Windows Operating System runs on the Intel family of microprocessor chips. The file containing Intel op codes or assembler will only be able to execute on Intel machines.

 

If we could compile our code into an assembler that runs on a hypothetical microprocessor, then the code will not execute on any machine in the world. However, if, at the time of execution, we could convert the compiled code from this hypothetical microprocessor assembler into a form that is suitable for the microprocessor chip of the machine that the code is running on, we could, theoretically at least, run the code on any machine, provided such a converter program was available.

 

This program would convert the code from our hypothetical chip's assembler into a form suitable to the actual chip of the machine that the code is to be run on.

 

This is the concept that Java is based on and the program that does this conversion is called the Java Virtual Machine or JVM. The assembler so generated is called byte code. The only flaw in Java is that the byte codes represent the Java programming language very closely. This is so because, it was difficult to get other programming languages to compile to Java byte codes.

 

Microsoft learnt from this drawback of the Sun based Java, and firstly created an assembler that was powerful and  generic. This assembler was named IL or Intermediate Language. Any code, whether written in C#, VB or COBOL, is initially converted to IL. The Perl compiler also converts code written in the Perl programming language into IL. This IL code is then converted to assembler of the chip at run time.

 

Therefore, if we study IL in depth, we can safely conclude that we will be able to master the .NET technologies, as everything eventually gets converted to it. If IL does not support a feature, then the programming language also cannot support it. Hence, undoubtedly, the most important language to learn is IL.

 

For example, the code of the commonly used WriteLine function may have been written in COBOL, but it can be used in C# since, finally it will get converted to IL. Thus, you will now be able to appreciate the significance and concept of compiling source code into an Intermediate Language.

 

IL directives

 

 

IL directives

.method

.entrypoint

.assembly

 

.class

 

.module

.subsystem

 

 

.corflags

 

.originator

 

.hash

.ver

 

 

.maxstack

 

 

.ctor

.custom

.locals

 

.cctor

.field

.namespace

.override

.emitbyte

 

.zeroinit

.property

.get

.set

.backing

.other

.event

.addon

.removeon

.file

 

.vtfixup

 

 

 

 

 

.data

 

 

:  creates a function

:  entrypoint  for program execution

:  gives a name to the program, a deployment

   unit.

:  optional directive, collection of functions and  

   variables

:  a logical entity, it can be a dll or an exe file

:  the operating system on which the executable

  runs

 

:  flags unique to a 64 bit computer, 1 - il generated

  executable, 4 - library

:  identity of the creator, a hash value representing

  the public key of the owner

:  algorithm used for hashing

:  4 numbers separated by colons: major, minor,

   build and revision

 

 

:  maximim no. of elements that can be placed on

   the evaluation stack  when a method is being

   executed

 

:  constructor of a class

:  deals with meta data

:  creates local variables for a particular function

   on the stack

:  static constructor

:  class variables

:  collection or grouping of code

:  functions overrides the base class functions

:  emits an unsigned 8 bit number directly into

   the code section

:  initialize the members to default values

:  a property directive

:  gets the value of the property

:  sets the value for the property

:  used to state the name of the field

:  other functions associated with the property

:  event directive

:  add method for event.

:  remove method for event.

:  manifest resource is in file <filename> at byte

  offset <int32>.

:  declares that at a certain memory location there

   is a table that contains MethodDefs which needs

   to converted into method pointers. The CLR will

  do this conversion automatically.

 

:  creates and initializes a data variable

 

 

IL instructions

ilasm

ret

call

ldstr

public

hidebysig

 

static

 

il managed

private

auto

ansi

 

extends

ldarg.0

 

specialname

rtspecialname

 

 

 

instance

 

mscorlib

extern

ildasm

init

newobj

pop

ldc.i4.value

 

stloc.position

 

conv

stsfld

stfld

ldc.i4.s

 

ldloca.s

 

box

 

ldsflda

ldloc.0

starg

ldarg

ldarga.s

ldarg.1

ldfld

br.s

ldsfld

brfalse.s

brtrue.s

add

 

cgt

 

 

ceq

ble.s

bne.un.s

stind.i4

 

 

virtual

 

newslot

 

 

 

callvirt

castclass

abstract

initonly

 

bge.s

clt

xor

dup

sizeof

localloc

serializable

ldtoken

 

 

isinst

 

 

mul

mul.ovf

ldlen

switch

not

rem

or

and

ldind

unbox

ldnull

interface

abstract

final

finalize

implements

explicit

 

sequential

initobj

value

ldobj

stobj

ldflda

ldsflda

ldftn

calli

 

jmp

jmpi

vararg

 

arglist

cpobj

bgt

sub

tail.

extends

leave.s

throw

try - catch

 

finally-endfinally

 

sealed

nested

rethrow

endfilter

runtime managed

synchronized

 

 

newarr

ldlen

ldelem.i4

stelem.i4

Stelem.ref

 

ldelem.ref

 

fixed

ldvirtftn

ldnull

arglist

optil

 

pinvokeimpl

 

CLR

 

 

:  il assembler

:  return from funcion

:  calls / executes a function

:  load a string on the stack

:  accessible to all parts of the code

:  functions with similar signatures in parent class

  are not available to the derived class

:  belongs to a class, only one copy is created,

   must be referenced using typename

:  code is managed by il assembler

:  access is restricted to the current class

:  layout in memory to be decided at runtime

:  refers to ansi character set for smooth transition

  from managed to unmanaged code

:  a class deriving from base class

:  loads the this pointer or the value in the 0th

   parameter on the execution stack

:  attribute signifies that the function is special

:  attribute signifies that the function is special

  and is to be treated in a special manner at

  runtime

:  a normal function which is always associated

   with the class

:  library name that contains code for .Net function

:  references code from other assemblies

:  il disassembler

:  initializes variables to default initialization value

:  creates a new object in memory

:  removes values off the stack

:  load constant numeric value on the stack (i4 -

  four bytes of memory)

:  stores the value from the stack at the location

   identified by position

:  convert value to fit the data type specified

:  store value in static field

:  store value in field

:  load the constant value following it on the stack

  (in short form)

:  load the address of the local variable on the

   stack (in short form)

 

:  converts value type variables to reference type 

   variables

:  loads the static field address on the stack

:  load the local variable value on the stach

:  stores/ changes argument value on the stack

:  load argument on the stack

:  load an argument address

:  load argument onto the stack (the second one)

:  load field of an object

:  branch to target (1 byte)

:  load the value of the static field on the stack

:  branch to label when false

:  branch to label when true

:  adds loaded value2 to loaded  value1 and pushes

   the result on the stack

:  compares the value 1 pushed first on the stack 

   to be greater than value2

 

:  compares the two values for equality

:  branch on less than or equal to

:  branch on not equal or unordered

:  store value indirect from stack (top value on

    the stack is placed in the second block holding

   the address)

 

:  base class functions can be overridden by the

   derived class

:  the virtual function is treated as a new function

  and detaches itself from a similar function in                       

  the base class                       

:  call a virtual function

:  cast the value to the class following it

:  class that cannot be derived from

:  can be initialized only once and read from, no

   modifications allowed

:  branch on greater than or equal to

:  compare less than

:  bitwise XOR

:  duplicate the top value of the stack

:  returns the size in terms of bytes in memory

:  allocate space in the local dynamic memory

  pool

:  data can be written to disk or sent over network

:  load the runtime representation of a metadata

   token

:  test if an object is an instance of a class or

    interface, returning NULL or an instance of that

   class or interface

:  multiply values

:  overflow check while multiplying two numbers

:  load the length of an array

:  checks for values and branches accordingly

:  bitwise complement

:  compute remainder

:  bitwise OR

:  bitwise AND

:  load value indirect onto the stack

:  convert boxed value type to its raw form 

:  load a null pointer

:  class with function prototypes

:  class with no code

:   the method cannot be overridden

:  destroys the instance members and the object

:  class implementing functions of the interfaces

:  the layout of the fields depends on programmer's  

   instruction

 

:  layout is in a sequential order

:  initializes a value type

:  value class - a structure

:  copy value type to the stack

:  store a value type from the stack into memory

:  load field address

:  load static field address

:  load a method pointer on the stack

:  call method indicated on the stack with

   arguments

:  jump to method

:  jump using method pointer on the stack

:  vararg is a calling convention that lets us pass

   multiple number of parameters to a function

:  get argument list

:  copy a value type

:  branch on greater than

:  subtract numeric values

:  subsequent call terminates current method

:  a class derives from the base class

:  unconditionally transfers control to target

:  throw an exception

:  block of statements where exceptions can be

   thrown and caught

:  code that gets called inspite of exceptions

  being thrown

:  class cannot be derived from

:  class within class

:  rethrows the current exception

:  end filter clause of SEH

:  the runtime generates code for the function

:  code gets executed on completion of the earlier

   code

:  create a zero-based, one-dimensional array

:  load the length of an array

:  load an element of an array

:  store an element of an array

:  implicitly casts value to the element type of

  array

:  load the element at index, an object, onto the

   top of the stack as an O

:  fixes the array reference in memory

:  load a virtual functon

:  load null value

 

: multiple arguments to a function

 

: optimised IL code

 

: invokes a function from the dll

 

:  Common Language Runtime