Andrew Haley writes: > 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; > } Actually, I didn't quite tell you the *whole* truth: VMSupportsCS8 is also a gcj builtin. The code in libgcj is a fallback that gets called only if libgcj is built with no optimization. Andrew.