Содержание
- 2. Overview Compilation and interpretation Virtual machines Simple C# program CIL, ildasm util CLR .NET Framework JIT,
- 3. Compilation (Ahead-of-Time) and interpretation A program written in a high level language can run in two
- 4. Compilation and interpretation How is a C++ program executed on linprog? cl try.cpp ? compiling the
- 5. Compilation and interpretation In general, which approach is more efficient? A[i][j] = 1; Compilation: mov eax,
- 6. Compilation and interpretation In general, which approach is more efficient? A[i][j] = 1; Compilation: mov eax,
- 7. Compilers versus Interpreters Compilers “try to be as smart as possible” to fix decisions that can
- 8. Compilers versus Interpreters Benefit of interpretation? Interpretation facilitates interactive debugging and testing Interpretation leads to better
- 9. Virtual Machines (for programming language) A virtual machine executes an instruction stream in software Adopted by
- 10. Compilation and Execution on Virtual Machines Compiler generates intermediate program Virtual machine interprets the intermediate program
- 11. Two Steps Compilation Process Compilation is done in two steps: At compile time: compile each language
- 12. Simple C# program namespace SimpleConsoleApplication { class Program { static void Main(string[] args) { int init
- 13. C# -> CIL Using ildasm .method private hidebysig static void Main(string[] args) cil managed { .entrypoint
- 14. .maxstack 3 .locals init ([0] int32 'init', [1] int32 rate, [2] int32 pos) ldc.i4.s 10
- 15. stloc.0
- 16. ldc.i4.5
- 17. stloc.1
- 18. ldloc.0 ldloc.1 .1
- 19. ldc.i4.s 60
- 20. mul
- 21. add
- 22. stloc.2
- 23. ldloc.2
- 24. call void mscorlib]System.Console::WriteLine(int32) ret
- 25. Common Intermediate Language (CIL) Much like the native languages of devices. CIL was originally known as
- 26. Common Language Runtime (CLR) The Common Language Runtime (CLR) manages the execution of code. CLR uses
- 27. Compilation Process So if we have 3 programming languages and 3 devices, how many compilers do
- 28. Platform and Language Independent What we have described so far will lead us to Platform independent
- 29. Language interoperability All .NET languages can interoperate C# calling VB.NET class Hello { static void Main()
- 30. CLR Execution engine Common Language Runtime (CLR) is the execution engine loads IL compiles IL executes
- 31. Cache JIT runtime compile CIL is compiled into machine code at runtime by the CLR compiles
- 32. NGEN install time compile Can compile CIL into machine code when app installed use native image
- 33. C# VB.NET Language variability Not all .NET languages have exactly the same capabilities differ in small
- 34. Common Language Specification Common Language Specification (CLS) defines type subset required to be supported by all
- 35. CLS,CLR/CTS & Languages Languages offer a subset of the CLR/CTS and a superset of the CLS
- 39. Method call performance Let's compare C ++, C # (.NET) method call performance C++ Function C++
- 42. Deitel & Deitel, Fig 24.24
- 43. Calling a method for the first time Managed EXE Shared Sub Main() Console.WriteLine(“Paul”) Console.WriteLine(“Cross”) End Sub
- 45. Скачать презентацию