java 2.5 KB

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