mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-17 11:21:39 -10:00
67 lines
2.5 KiB
Plaintext
Executable File
67 lines
2.5 KiB
Plaintext
Executable File
* 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>.
|
|
|