java 2.4 KB

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