2010-04-16 Sebastien Pouliot <sebastien@ximian.com>
[mono/afaerber.git] / web / java
blobadcd888f1be314c5e9dfff18aeda3ea00de25e62
1 * Java
3         <b>This is an outline on how to support Java, actual
4         implementations of ideas like this can be found <a href="http://radio.weblogs.com/0109845/">here</a></b>
7         It would be interesting to support the Java language as part
8         of the Mono project.  
10         You have to think of Java as various pieces: Java the
11         language and Java the virtual machine.  
13         It is possible to compile Java to .NET, as shown by the
14         Microsoft J# compiler.   We could then allow the migration of
15         Java applications to the Mono runtime. 
17 ** Native compiler
19         Although a native compiler can be built, and probably should be
20         built using an existing compiler, a short term solution is to 
21         build a translator from Java class files to the ECMA CIL images.
23         This has the advantage that we can use an existing and tested
24         Java compiler to generate the code, and then we can use an automated
25         code compiler that compiles Java VM bytecodes to CIL bytecodes.
27 ** The translator.
29         It would be interesting to write a semantic translator that
30         converts java byte codes into CIL opcodes.  This is possible
31         because the Java byte codes are a subset of the CIL ones.
33         A semantic tree needs to be constructed (very much in the
34         spirit of what is done in mono_analize_stack in
35         <tt>mono/mono/jit/jit.c</tt>.  Once such a semantic tree is
36         constructed, we could generate the equivalent Java code.
38         This has a number of interesting side effects: people can
39         continue to use their existing Java compilers to compile their
40         code, and a simple tool that converts their .class files into
41         a .NET assembly can be used.
43 ** Libraries
45         We could translate the GNU Classpath libraries with the above
46         tools to provide the Java runtime required to host into the
47         Mono runtime.  Some special treatment would be required for
48         core data types like integers, arrays and strings, and of
49         course reuse where possible existing classes from .NET to make
50         them compatible.
52 ** JILC - Java to IL Compiler
54         This is an attempt to make the java bytecode available for the
55         .NET environment.
57         The project attempts to generate the IL code / bytecode from the
58         compiled java class files. It has reached the stage of code-generation.
59         The issues that needs to be addressed is the mapping of java objects
60         to the IL objects, eg: java.lang.String to System.String.
62         Gaurav Vaish and Abhaya Agarwal are currently leading this project.
63         The project is currently hosted at <a href="http://sourceforge.net/projects/jilc">SourceForge.Net</a>.
64         The official home page of the project is 
65         <a href="http://jilc.sourceforge.net">http://jilc.sourceforge.net</a>.