Mono Ahead Of Time Compiler
===========================

The new mono JIT has sophisticated optimization features. It uses SSA and has a
pluggable architecture for further optimizations. This makes it possible and
efficient to use the JIT also for AOT compilation.


* file format: We use the native object format of the platform. That way it is
  possible to reuse existing tools like objdump and the dynamic loader. All we
  need is a working assembler, i.e. we write out a text file which is then
  passed to gas (the gnu assembler) to generate the object file.

* file names: we simply add ".so" to the generated file. For example:
  basic.exe -> basic.exe.so
  corlib.dll -> corlib.dll.so

* staring the AOT compiler: mini --aot assembly_name

The following things are saved in the object file:

* version infos: 

* native code: this is labeled with method_XXXXXXXX: where XXXXXXXX is the
  hexadecimal token number of the method.

* additional informations needed by the runtime: For example we need to store
  the code length and the exception tables. We also need a way to patch
  constants only available at runtime (for example vtable and class
  addresses). This is stored i a binary blob labeled method_info_XXXXXXXX:

PROBLEMS:

- all precompiled methods must be domain independent, or we add patch infos to
  patch the target doamin.

- the main problem is how to patch runtime related addresses, for example:

  - current application domain
  - string objects loaded with LDSTR
  - address of MonoClass data
  - static field offsets 
  - method addreses
  - virtual function and interface slots
