Mercurial > hg > graal-compiler
comparison src/share/vm/prims/jni.cpp @ 1078:8e7adf982378
6896043: first round of zero fixes
Reviewed-by: kvn
Contributed-by: Gary Benson <gbenson@redhat.com>
author | twisti |
---|---|
date | Fri, 27 Nov 2009 07:56:58 -0800 |
parents | 08780c8a9f04 |
children | 896da934748c |
comparison
equal
deleted
inserted
replaced
1073:de44705e6b33 | 1078:8e7adf982378 |
---|---|
3229 HS_DTRACE_PROBE3(hotspot_jni, CreateJavaVM__entry, vm, penv, args); | 3229 HS_DTRACE_PROBE3(hotspot_jni, CreateJavaVM__entry, vm, penv, args); |
3230 | 3230 |
3231 jint result = JNI_ERR; | 3231 jint result = JNI_ERR; |
3232 DT_RETURN_MARK(CreateJavaVM, jint, (const jint&)result); | 3232 DT_RETURN_MARK(CreateJavaVM, jint, (const jint&)result); |
3233 | 3233 |
3234 // We're about to use Atomic::xchg for synchronization. Some Zero | |
3235 // platforms use the GCC builtin __sync_lock_test_and_set for this, | |
3236 // but __sync_lock_test_and_set is not guaranteed to do what we want | |
3237 // on all architectures. So we check it works before relying on it. | |
3238 #if defined(ZERO) && defined(ASSERT) | |
3239 { | |
3240 jint a = 0xcafebabe; | |
3241 jint b = Atomic::xchg(0xdeadbeef, &a); | |
3242 void *c = &a; | |
3243 void *d = Atomic::xchg_ptr(&b, &c); | |
3244 assert(a == 0xdeadbeef && b == (jint) 0xcafebabe, "Atomic::xchg() works"); | |
3245 assert(c == &b && d == &a, "Atomic::xchg_ptr() works"); | |
3246 } | |
3247 #endif // ZERO && ASSERT | |
3248 | |
3234 // At the moment it's only possible to have one Java VM, | 3249 // At the moment it's only possible to have one Java VM, |
3235 // since some of the runtime state is in global variables. | 3250 // since some of the runtime state is in global variables. |
3236 | 3251 |
3237 // We cannot use our mutex locks here, since they only work on | 3252 // We cannot use our mutex locks here, since they only work on |
3238 // Threads. We do an atomic compare and exchange to ensure only | 3253 // Threads. We do an atomic compare and exchange to ensure only |