CHAPTER 15 UNDERSTANDING CIL AND THE ROLE (How to cite a web site)
CHAPTER 15 UNDERSTANDING CIL AND THE ROLE OF DYNAMIC ASSEMBLIES 497 Opcode Meaning in Life ldobj Obtains all the values gathered by a heap-based object and places them on the stack. ldstr Loads a string value onto the stack. In addition to the set of load-specific opcodes, CIL provides numerous opcodes that explicitly pop the topmost value off the stack. As shown over the first few examples in this chapter, popping a value off the stack typically involves storing the value into temporary local storage for further use (such as a parameter for an upcoming method invocation). Given this, note how many opcodes that pop the current value off the virtual execution stack take an st (store) prefix. Table 15-7 hits the highlights. Table 15-7. Various Pop-Centric Opcodes Opcode Meaning in Life pop Removes the value currently on top of the evaluation stack, but does not bother to store the value starg Stores the value on top of the stack into the method argument at a specified index stloc (with numerous variations) Pops the current value from the top of the evaluation stack and stores it in a local variable list at a specified index stobj Copies a value of a specified type from the evaluation stack into a supplied memory address stsfld Replaces the value of a static field with a value from the evaluation stack Do be aware that various CIL opcodes will implicitly pop values off the stack to perform the task at hand. For example, if you are attempting to subtract two numbers using the sub opcode, it should be clear that sub will have to pop off the next two available values before it can perform the calculation. Once the calculation is complete, the result of the value (surprise, surprise) is pushed onto the stack once again. Considering the .maxstack Directive When you write method implementations using raw CIL, you need to be mindful of a special directive named .maxstack. As its name suggests, .maxstack establishes the maximum number of variables that may be pushed onto the stack at any given time during the execution of the method. The good news is that the .maxstack directive has a default value (8), which should be safe for a vast majority of methods you may be authoring. However, if you wish to be very explicit, you are able to manually calculate the number of local variables on the stack and define this value explicitly: .method public hidebysig instance void Speak() cil managed { // During the scope of this method, exactly // 1 value (the string literal) is on the stack. .maxstack 1 ldstr “Hello there…” call void [mscorlib]System.Console::WriteLine(string) ret }
You want to have a cheap webhost for your apache application, then check apache web hosting services.