JLang
JLang copied to clipboard
Support Multiple Target Hosts
The current runtime implementation (and JDK support) assumes that the target host is a *nix host. This is relevant in two major places:
-
The particular JDK system specific classes that get loaded and therefore must be compiled with the JDK (e.g. OSEnvironment.java and UnixFileSystem.java).
-
The JNI, JVM and Unsafe runtime interfaces (jni.cpp, jvm.cpp and unsafe.cpp) which delegate functionality to system calls. An example of this is the [ JVM_Write(jint fd, char *buf, jint nbytes) ] API which delegates to the *nix write(fd, buf, nbytes) system call.
The runtime code can be refactored to include separate 'OS' files that implement such functionality with the appropriate system call for a given target (e.g. JVM_write calls os_write(..) which is implemented in either nix.cpp or windows.cpp). Makefiles can be updated to compile code for the desired target host.
For the JDK specific classes, we just need to be sure to compile ALL required system implementation classes; there may be instances where the method for doing this is non-trivial as it seems that some classes in the JDK have weird assumptions about target host (e.g OSEnvironment needed to be patched to remove a non-existent windows class dependency).