Business web site - CHAPTER 15 UNDERSTANDING CIL AND THE 496
Monday, January 21st, 2008CHAPTER 15 UNDERSTANDING CIL AND THE 496 THE ROLE OF DYNAMIC ASSEMBLIES To provide some insight to the world of member implementation via CIL, Table 15-5 defines some of the more useful opcodes that are directly related to member implementation logic, grouped by related functionality. Table 15-5. Various Implementation-Specific CIL Opcodes Opcodes Meaning in Life add, sub, mul, div, rem These CIL opcodes allow you to add, subtract, multiply, and divide two values (rem returns the remainder of a division operation). and, or, not, xor These CIL opcodes allow you to perform binary operations on two values. ceq, cgt, clt These CIL opcodes allow you to compare two values on the stack in various manners, for example: ceq: Compare for equality cgt: Compare for greater than clt: Compare for less than box, unbox These CIL opcodes are used to convert between reference types and value types. ret This CIL opcode is used to exit a method and return a value to the caller (if necessary). beq, bgt, ble, blt, switch These CIL opcodes (in addition to many other related opcodes) are used to control branching logic within a method, for example: beq: Break to code label if equal bgt: Break to code label if greater than ble: Break to code label if less than or equal to blt: Break to code label if less than All of the branch-centric opcodes require that you specify a CIL code label to jump to if the result of the test is true. call This CIL opcode is used to call a member on a given type. newarr, newobj These CIL opcodes allow you to allocate a new array or new object type into memory (respectively). The next broad category of CIL opcodes (a subset of which is shown in Table 15-6) are used to load (push) arguments onto the virtual execution stack. Note how these load-specific opcodes take an ld (load) prefix. Table 15-6. The Primary Stack-Centric Opcodes of CIL Opcode Meaning in Life ldarg (with numerous variations) Loads a method s argument onto the stack. In addition to the generic ldarg (which works in conjunction with a given index that identifies the argument), there are numerous other variations. For example, ldarg opcodes that have a numerical suffix (ldarg_0) hard-code which argument to load. As well, variations of the ldarg opcode allow you to hardcode the data type using the CIL constant notation shown in Table 15-4 (ldarg_I4, for an int32) as well as the data type and value (ldarg_I4_5, to load an int32 with the value of 5). ldc (with numerous variations) Loads a constant value onto the stack. ldfld (with numerous variations) Loads the value of an instance-level field onto the stack. ldloc (with numerous variations) Loads the value of a local variable onto the stack.
If you are in need for chaep and reliable webhost to host your website, our recommendation is http web server services.