81 volatile unsigned int* dest, unsigned int compare_value) { |
81 volatile unsigned int* dest, unsigned int compare_value) { |
82 assert(sizeof(unsigned int) == sizeof(jint), "more work to do"); |
82 assert(sizeof(unsigned int) == sizeof(jint), "more work to do"); |
83 return (unsigned int)Atomic::cmpxchg((jint)exchange_value, (volatile jint*)dest, |
83 return (unsigned int)Atomic::cmpxchg((jint)exchange_value, (volatile jint*)dest, |
84 (jint)compare_value); |
84 (jint)compare_value); |
85 } |
85 } |
|
86 |
|
87 jlong Atomic::add(jlong add_value, volatile jlong* dest) { |
|
88 jlong old = load(dest); |
|
89 jlong new_value = old + add_value; |
|
90 while (old != cmpxchg(new_value, dest, old)) { |
|
91 old = load(dest); |
|
92 new_value = old + add_value; |
|
93 } |
|
94 return old; |
|
95 } |