X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=doc%2Fruntime;h=f828bb132219915a68d02743af7e12a0c54b7b8e;hb=9d93ddc5daf9a96e7fcd5d9ef7fac0ddba68feb9;hp=e7dce3eb13db7edc41f4c2985d3910c75cb46fdc;hpb=dd9ff4ef687a3d083a2166842cd581c609673138;p=mono.git
diff --git a/doc/runtime b/doc/runtime
index e7dce3eb13d..f828bb13221 100644
--- a/doc/runtime
+++ b/doc/runtime
@@ -1,60 +1,166 @@
-* The MonoNet runtime
+* The Mono runtime
- The MonoNet runtime will implement the JIT engine (and a byte
- code interpreter for quickly porting to new systems), the
- class loader, the garbage collector, threading system and
- metadata access libraries.
+ The Mono runtime engine is considered feature complete.
- Currently the runtime contains the beginning of an image
- loader and metadata access entry points. Since Beta2 has been
- now released, it is possible to resume work using the ECMA
- specs and testing with Beta2-generated executables.
+ It implements a Just-in-Time compiler engine for the CIL
+ virtual machine, the class loader, the garbage collector,
+ threading system and metadata access libraries.
- The runtime core will be implemented in C, in a library
- "libMonoVES.so".
+ We currently have two runtimes:
-** Executing MSIL/CIL images
+
+ * mono: Our Just-in-Time and Ahead-of-Time code
+ generator for maximum performance.
+
+ * mint: The Mono interpreter. This is an
+ easy-to-port runtime engine.
+
+
+ We are using the Boehm conservative garbage collector.
+
+ The Mono runtime can be used as a stand-alone process, or it
+ can be embedded into applications (see
+ the documentation in mono/samples/embed for more details).
+
+ Embedding the Mono runtime allows applications to be extended
+ in C# while reusing all of the existing C and C++ code.
+
+ Paolo Molaro did a presentation on the current JIT engine and
+ the new JIT engine. You can find his slides
+ here
+
+** Current JIT Engine: technical details (updated, June 28th, 2003)
+
+ We have re-written our JIT compiler. We wanted to support a
+ number of features that were missing:
+
+
+ * Ahead-of-time compilation.
+
+ The idea is to allow developers to pre-compile their code
+ to native code to reduce startup time, and the working
+ set that is used at runtime in the just-in-time compiler.
+
+ Although in Mono this has not been a visible problem, we
+ wanted to pro-actively address this problem.
+
+ When an assembly (a Mono/.NET executable) is installed in
+ the system, it would then be possible to pre-compile the
+ code, and have the JIT compiler tune the generated code
+ to the particular CPU on which the software is
+ installed.
+
+ This is done in the Microsoft.NET world with a tool
+ called ngen.exe
+
+ * Have a good platform for doing code optimizations.
+
+ The design called for a good architecture that would
+ enable various levels of optimizations: some
+ optimizations are better performed on high-level
+ intermediate representations, some on medium-level and
+ some at low-level representations.
+
+ Also it should be possible to conditionally turn these on
+ or off. Some optimizations are too expensive to be used
+ in just-in-time compilation scenarios, but these
+ expensive optimizations can be turned on for
+ ahead-of-time compilations or when using profile-guided
+ optimizations on a subset of the executed methods.
+
+ * Reduce the effort required to port the Mono code
+ generator to new architectures.
+
+ For Mono to gain wide adoption in the Unix world, it is
+ necessary that the JIT engine works in most of today's
+ commercial hardware platforms.
+
+
+ The JIT engine implements a number of optimizations:
+
+
+ * Opcode cost estimates (our architecture allows
+ us to generate different code paths depending
+ on the target CPU dynamically).
+
+ * Inlining.
+
+ * Constant folding, copy propagation, dead code elimination.
+
+ Although compilers typically do
+ constant folding, the combination of inlining with
+ constant folding gives some very good results.
- The code will load an executable and map the references to
- external assemblies to our own version of the assemblies on
- GNU/Linux.
+ * Linear scan register allocation. In the past,
+ register allocation was our achilles heel, but now
+ we have left this problem behind.
- Our roadmap looks like this:
+ * SSA-based framework. Various optimizations are
+ implemented on top of this framework
+
+
+ There are a couple of books that deal with this technique: "A
+ Retargetable C Compiler" and "Advanced Compiler Design and
+ Implementation" are good references. You can also get a
+ technical description of lbrug.
+
+ The new JIT engines uses three intermediate representations:
+ the source is the CIL which is transformed into a forest of
+ trees; This is fed into a BURS instruction selector that
+ generates the final low-level intermediate representation.
+
+ The instruction selector is documented in the following
+ papers:
- * Milestone 4: non-Intel port of the JIT engine.
+** Garbage Collection
- * Milestone 5: Optimizing JIT engine port for IA32.
+ We are using the Boehm conservative GC. We might consider
+ adopting other GC engines in the future, like the Intel ORP GC
+ engine. The Intel ORP GC engine as it provides a precise
+ garbage collector engine, similar to what is available on the
+ .NET environment.
- * Milestone 6: non-Intel port of the Optimizing JIT
- engine.
+
- A setup similar to the Kaffe JIT engine can be used to
- layout the code to support non-IA32 architectures. Our work
- will be focused on getting a IA32 version running first.
+** IO and threading
+
+ The ECMA runtime and the .NET runtime assume an IO model and a
+ threading model that is very similar to the Win32 API.
- The JIT engine should work on Linux and Win32, although you
- might need to install the CygWin32 development tools to get a
- Unix-like compilation environment.
+ Dick Porter has developed WAPI: the Mono abstraction layer
+ that allows our runtime to execute code that depend on this
+ behaviour.
** Useful links
Paolo Molaro found a few interesting links:
-** Garbage Collection
+** PInvoke
- We have decided to implement a generational tracing garbage
- collector, which is very similar to the one being used by
- .NET. For an introduction to the garbage collection system
- used by Microsoft's CLR implementation, you can read this book
- on Garbage
- Collection.
+ PInvoke is the mechanism we are using to wrap Unix API calls
+ as well as talking to system libraries.
- Although using a conservative garbage collector like Bohem's
- would work, all the type information is available at runtime,
- so we can actually implement a better collector than a
- conservative collector.
+ Initially we used libffi, but it was fairly slow, so we have
+ reused parts of the JIT work to create efficient PInvoke
+ trampolines.
-** PInvoke
+** Remoting
+
+ Mono has support for remoting and proxy objects, just like
+ .NET does. The runtime provides these facilities.
+
+** Porting
+
+ If you are interested in porting the Mono runtime to other
+ platforms, you might find the pre-compiled Mono regression test
+ suite useful to debug your implementation.
+
+* COM and XPCOM
+
+ We plan on adding support for XPCOM on Unix and COM on Microsoft
+ Windows later in our development process.
- PInvoke will be supported, and will be used to wrap Unix API
- calls, these in turn are required for reusing some of the
- GNOME libraries that will reduce the work we have to do to
- deliver a complete class library.