hotspot/src/share/vm/runtime/atomic.cpp
changeset 9990 c8683968c01b
parent 7397 5b173b4ca846
child 10019 6ea76c84109f
--- a/hotspot/src/share/vm/runtime/atomic.cpp	Wed Jun 08 21:48:38 2011 -0400
+++ b/hotspot/src/share/vm/runtime/atomic.cpp	Fri Jun 10 15:08:36 2011 -0700
@@ -83,3 +83,13 @@
   return (unsigned int)Atomic::cmpxchg((jint)exchange_value, (volatile jint*)dest,
                                        (jint)compare_value);
 }
+
+jlong Atomic::add(jlong    add_value, volatile jlong*    dest) {
+  jlong old = load(dest);
+  jlong new_value = old + add_value;
+  while (old != cmpxchg(new_value, dest, old)) {
+    old = load(dest);
+    new_value = old + add_value;
+  }
+  return old;
+}