runtime 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. * The Mono runtime
  2. The Mono runtime will implement the JIT engine (and a byte
  3. code interpreter for quickly porting to new systems), the
  4. class loader, the garbage collector, threading system and
  5. metadata access libraries.
  6. Currently the runtime has an image loader and metadata access
  7. entry points. The runtime comes with a simple interpreter
  8. that can execute very simple programs.
  9. ** Executing MSIL/CIL images
  10. The code will load an executable and map the references to
  11. external assemblies to our own version of the assemblies on
  12. GNU/Linux.
  13. Our roadmap looks like this, this has been updated as of
  14. <b>Jul 15, 2001</b>:
  15. <ul>
  16. * Milestone 1: <b> Done</b> Fully read and parse all CIL byte-codes
  17. and metadata tokens (ie, a disassembler).
  18. * Milestone 2: Complete an interpreter for CIL byte
  19. codes. This interpreter can be used temporarly to
  20. run CIL byte code on a system where no JIT is
  21. available.
  22. * Milestone 3: Define an <i>lburg</i>-like instruction
  23. selector for the JITer for Intel. Although slower
  24. at JITing than a streaming JITer, it generates
  25. better code. The same grammar can later be used for
  26. the stream jitter.
  27. * Milestone 4: Implement JITer.
  28. * Milestone 5: Port of the JITer to non IA32 systems.
  29. </ul>
  30. A setup similar to the Kaffe JIT engine can be used to
  31. layout the code to support non-IA32 architectures. Our work
  32. will be focused on getting a IA32 version running first.
  33. The JIT engine should work on Linux and Win32, although you
  34. will need to install the CygWin32 development tools to get a
  35. Unix-like compilation environment.
  36. ** JIT Engine (<b>updated, Jul 14th, 2001</b>)
  37. We will be using a code-generator generator approach for our
  38. JITer. Given the properties of CIL byte codes, we can take
  39. full advantage of a real instruction selector for our code
  40. generator.
  41. There are a couple of books that deal with this technique: "A
  42. Retargetable C Compiler" and "Advanced Compiler Design and
  43. Implementation" are good references. You can also get a
  44. technical description of <a
  45. href="http://research.microsoft.com/copyright/accept.asp?path=http://www.research.microsoft.com/~drh/pubs/iburg.pdf&pub=ACM">lbrug</a>
  46. Previously we had looked at a number of JIT engines and tools,
  47. but they would not take full advantage of the CIL properties:
  48. <ul>
  49. * <a
  50. href="http://www.intel.com/research/mrl/orp/">ORP</a>
  51. * <a
  52. href="http://www.gnu.org/software/lightning/">GNU
  53. Lightning</a>
  54. * <a href="http://www.eecs.harvard.edu/~nr/toolkit/">NJ Machine
  55. Toolkit</a>.).
  56. * VCODE.
  57. </ul>
  58. ** Garbage Collection
  59. We have decided to implement a generational tracing garbage
  60. collector, which is very similar to the one being used by
  61. .NET. For an introduction to the garbage collection system
  62. used by Microsoft's CLR implementation, you can read this book
  63. on <a
  64. href="http://www.amazon.com/exec/obidos/ASIN/0471941484/o/qid=992556433/sr=2-1/ref=aps_sr_b_1_1/103-5866388-0492603">Garbage
  65. Collection.</a>
  66. Another consideration is to use the same interface that ORP
  67. uses to its Garbage Collection system and reuse that GC system
  68. instead of rolling our own, as the ORP system is pretty advanced
  69. and is independent of the rest of ORP.
  70. Although using a conservative garbage collector like Bohem's
  71. would work, all the type information is available at runtime,
  72. so we can actually implement a better collector than a
  73. conservative collector.
  74. <ul>
  75. * Garbage collection list and FAQ:<br>
  76. <a href="http://www.iecc.com/gclist/">http://www.iecc.com/gclist/</a>
  77. * "GC points in a Threaded Environment":<br>
  78. <a href="http://research.sun.com/techrep/1998/abstract-70.html">
  79. http://research.sun.com/techrep/1998/abstract-70.html</a>
  80. * "A Generational Mostly-concurrent Garbage Collector":
  81. <a href="http://research.sun.com/techrep/2000/abstract-88.html">
  82. http://research.sun.com/techrep/2000/abstract-88.html</a>
  83. * Details on The Microsoft .NET Garbage Collection Implementation:<br>
  84. <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnmag00/html/GCI.asp">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnmag00/html/GCI.asp</a>
  85. <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnmag00/html/GCI2.asp">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnmag00/html/GCI2.asp</a>
  86. </ul>
  87. ** Useful links
  88. Paolo Molaro found a few interesting links:
  89. <ul>
  90. * On compilation of stack-based languages:<br>
  91. <a href="http://www.complang.tuwien.ac.at/projects/rafts.html">
  92. http://www.complang.tuwien.ac.at/projects/rafts.html</a>
  93. * A paper on fast JIT compilation of a stack-based language:<br>
  94. <a href="http://www.research.microsoft.com/~cwfraser/pldi99codegen.pdf">
  95. http://www.research.microsoft.com/~cwfraser/pldi99codegen.pdf</a>
  96. * Vmgen generates much of the code for efficient virtual machine (VM)
  97. interpreters from simple descriptions of the VM instructions:<br>
  98. <a href="http://www.complang.tuwien.ac.at/anton/vmgen/">
  99. http://www.complang.tuwien.ac.at/anton/vmgen</a>
  100. </ul>
  101. ** PInvoke
  102. PInvoke is the mechanism we are using to wrap Unix API calls
  103. as well as talking to system libraries.
  104. We hvae implemented PInvoke through libffi, but we are likely
  105. going to roll our own system as the runtime matures, specially
  106. as the interpreter is approaching completion, and we move into
  107. the JITer.