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