< prev index next >

src/share/vm/runtime/atomic.cpp

Print this page
rev 8910 : full patch for jfr

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -72,20 +72,40 @@
   assert(sizeof(unsigned int) == sizeof(jint), "more work to do");
   return (unsigned int)Atomic::cmpxchg((jint)exchange_value, (volatile jint*)dest,
                                        (jint)compare_value);
 }
 
+julong Atomic::cmpxchg(julong exchange_value,
+                         volatile julong* dest, julong compare_value) {
+  return (julong)Atomic::cmpxchg((jlong)exchange_value, (volatile jlong*)dest,
+                                       (jlong)compare_value);
+}
+
+julong Atomic::load(volatile julong* src) {
+  return (julong)load((volatile jlong*)src);
+}
+
 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;
 }
 
+julong Atomic::add(julong    add_value, volatile julong*    dest) {
+  julong old = load(dest);
+  julong new_value = old + add_value;
+  while (old != cmpxchg(new_value, dest, old)) {
+    old = load(dest);
+    new_value = old + add_value;
+  }
+  return old;
+}
+
 void Atomic::inc(volatile short* dest) {
   // Most platforms do not support atomic increment on a 2-byte value. However,
   // if the value occupies the most significant 16 bits of an aligned 32-bit
   // word, then we can do this with an atomic add of 0x10000 to the 32-bit word.
   //
< prev index next >