Mercurial > hg > release > icedtea-1.10
view patches/icedtea-test-atomic-operations.patch @ 1804:bbac5c54022b
Always apply Zero/Shark patches.
2009-05-20 Andrew John Hughes <ahughes@redhat.com>
* HACKING: Updated.
2009-05-08 Gary Benson <gbenson@redhat.com>
* Makefile.am: Always apply Zero and Shark patches.
* patches/icedtea-test-atomic-operations.patch: Only test on Zero.
* HACKING: Updated.
author | Andrew John Hughes <ahughes@redhat.com> |
---|---|
date | Wed, 20 May 2009 20:50:48 +0100 |
parents | 3748242d0fa1 |
children |
line wrap: on
line source
diff -r d384f5a5bd0c hotspot/src/share/vm/prims/jni.cpp --- openjdk/hotspot/src/share/vm/prims/jni.cpp Mon Aug 06 13:11:51 2007 +0100 +++ openjdk/hotspot/src/share/vm/prims/jni.cpp Fri Sep 14 09:58:33 2007 +0100 @@ -3209,6 +3209,21 @@ _JNI_IMPORT_OR_EXPORT_ jint JNICALL JNI_ jint result = JNI_ERR; DT_RETURN_MARK(CreateJavaVM, jint, (const jint&)result); + // We're about to use Atomic::xchg for locking. On zero platforms + // this is implemented using the GCC builtin __sync_lock_test_and_set + // which is not guaranteed to do what we're using it for on all + // platforms. So we check it works before doing anything else. +#if defined(ZERO) && defined(ASSERT) + { + jint a = 0xCAFEBABE; + jint b = Atomic::xchg(0xC0FFEE, &a); + void *c = &a; + void *d = Atomic::xchg_ptr(&b, &c); + assert(a == 0xC0FFEE && b == (jint) 0xCAFEBABE, "Atomic::xchg() works"); + assert(c == &b && d == &a, "Atomic::xchg_ptr() works"); + } +#endif // ZERO & ASSERT + // At the moment it's only possible to have one Java VM, // since some of the runtime state is in global variables.