On friday I found the bug why Boehm always crashed with OpenJDK's wrappers. The problem is that the wrappers create a thread which then runs the VM. Boehm doesn't like that. But it can simply be removed:
Index: j2se/src/share/bin/java.c
===================================================================
--- j2se/src/share/bin/java.c (revision 244)
+++ j2se/src/share/bin/java.c (working copy)
@@ -367,7 +367,8 @@ main(int argc, char ** argv)
args.classname = classname;
args.ifn = ifn;
- return ContinueInNewThread(JavaMain, threadStackSize,
(void*)&args, ret);
+/* return ContinueInNewThread(JavaMain,
threadStackSize, (void*)&args, ret); */
+ return JavaMain((void*)&args);
}
}
With that patch we can use OpenJDK's wrappers with CACAO's libjvm:
$ java -version LOG: [0x30021b70] JVM_GetStackAccessControlContext: IMPLEMENT ME! LOG: [0x30021b70] JVM_GetStackAccessControlContext: IMPLEMENT ME! LOG: [0x30021b70] JVM_FindSignal: name=HUP LOG: [0x30021b70] JVM_RegisterSignal: sig=0, handler=0x2, IMPLEMENT ME! LOG: [0x30021b70] JVM_FindSignal: name=INT LOG: [0x30021b70] JVM_RegisterSignal: sig=0, handler=0x2, IMPLEMENT ME! LOG: [0x30021b70] JVM_FindSignal: name=TERM LOG: [0x30021b70] JVM_RegisterSignal: sig=0, handler=0x2, IMPLEMENT ME! LOG: [0x30021b70] JVM_GetStackAccessControlContext: IMPLEMENT ME! LOG: [0x30021b70] JVM_GetStackAccessControlContext: IMPLEMENT ME! openjdk version "1.7.0-internal-fastdebug" OpenJDK Runtime Environment (build 1.7.0-internal-fastdebug-twisti_29_jul_2007_18_33-b00) CACAO (build 0.98+svn, JIT mode)
WOOHOO! :-)
That means we can build OpenJDK with its own tools, by providing a CACAO-Sun build to OpenJDK with ALT_HOTSPOT_IMPORT_PATH. Then CACAO's libjvm gets imported and all tools like javac, javah or rmic are called from the currently builing OpenJDK.
With some small patches and the help of IcedTea I get a fully compiled and working j2re-image on my powerpc-linux box!!!
That is _really_ cool!
j2sdk-image is currently failing because of missing annotations support. But the student working on CACAO's annotations support already has a working implementation for OpenJDK and it will be (hopefully) commited tomorrow. That probably means a new blog soon...
