On Tuesday 19 June 2007 09:50, Andrew Haley wrote: > Andrew John Hughes writes: > > Hi everyone, > > > > I've recently been trying to build JikesRVM on a Free platform (using > > CACAO and some hacked up tools from OpenJDK in the form of IcePick). > > I've got it just about there now, but I've been let down by a missing > > native method. > > > > Within the java.util.concurrent framework, the class AtomicLong has a > > native method, VMSupportsCS8 which CACAO at least doesn't provide. It's > > basically just a check method to find out whether the VM supports > > lockless compare-set operations on longs. > > > > >From java.util.concurrent.atomic.AtomicLong: > > > > /** > > * Records whether the underlying JVM supports lockless > > * CompareAndSet for longs. While the unsafe.CompareAndSetLong > > * method works in either case, some constructions should be > > * handled at Java level to avoid locking user-visible locks. > > */ > > static final boolean VM_SUPPORTS_LONG_CAS = VMSupportsCS8(); > > > > /** > > * Returns whether underlying JVM supports lockless CompareAndSet > > * for longs. Called only once and cached in VM_SUPPORTS_LONG_CAS. > > */ > > private static native boolean VMSupportsCS8(); > > > > Has anyone implemented this so far? So near, but yet so far! > > Yes, it's in libgcj, of course. > > jboolean > java::util::concurrent::atomic::AtomicLong::VMSupportsCS8 () > { > // FIXME > return false; > } > > :-) > > Andrew. Ok, thought I'd give a quick update on this for those who are interested. I've now tried building with cacao and JamVM (both with latest Classpath CVS) and with GCJ SVN. As mentioned on my blog, twisti kindly plugged the above hole in cacao, but it didn't help too much as it also doesn't (yet) have annotation support. With gcj, I've run into some interesting issues. At present, the main showstopper is: [echo] Exception in thread “main” java.lang.ExceptionInInitializerError [echo] at java.lang.Class.initializeClass(libgcj.so.9) [echo] at java.lang.Class.forName(libgcj.so.9) [echo] at BootImageWriter.getJdkType(BootImageWriter.java:2473) [echo] at BootImageWriter.createBootImageObjects(BootImageWriter.java:1150) [echo] at BootImageWriter.main(BootImageWriter.java:614) [echo] Caused by: java.lang.NullPointerException [echo] at java.lang.VMClassLoader.getSystemClassLoaderInternal(libgcj.so.9) [echo] at java.lang.VMClassLoader.getSystemClassLoader(libgcj.so.9) [echo] at java.lang.ClassLoader$StaticData.(ClassLoader.java:154) [echo] at java.lang.Class.initializeClass(libgcj.so.9) due to some confusion between GCJ's classes and those from JikesRVM. JamVM is so far leading the race -- having the debug output has shown that GCJ is failing before it actually reaches the VMSupportsCS8 stage. I patched this into JamVM 1.4.5, which also missed this code. Most recently, I found a Classpath bug in VMDouble.toString, but I seem to have fixed this -- at least I know have a successful build (although not a running RVM)... Cheers, -- Andrew :-) Help end the Java Trap! Contribute to GNU Classpath and the OpenJDK http://www.gnu.org/software/classpath http://openjdk.java.net
Attachment:
pgplZOinnQhw3.pgp
Description: PGP signature