11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "jfr/recorder/jfrRecorder.hpp"
27 #include "jfr/utilities/jfrAllocation.hpp"
28 #include "logging/log.hpp"
29 #include "memory/allocation.inline.hpp"
30 #include "runtime/atomic.hpp"
31 #include "runtime/orderAccess.inline.hpp"
32 #include "runtime/vm_version.hpp"
33 #include "utilities/debug.hpp"
34 #include "utilities/macros.hpp"
35 #include "utilities/nativeCallStack.hpp"
36
37 #ifdef ASSERT
38 static jlong atomic_add_jlong(jlong value, jlong volatile* const dest) {
39 assert(VM_Version::supports_cx8(), "unsupported");
40 jlong compare_value;
41 jlong exchange_value;
42 do {
43 compare_value = OrderAccess::load_acquire(dest);
44 exchange_value = compare_value + value;
45 } while (Atomic::cmpxchg(exchange_value, dest, compare_value) != compare_value);
46 return exchange_value;
47 }
48
49 // debug statistics
50 static volatile jlong _allocated_bytes = 0;
51 static volatile jlong _deallocated_bytes = 0;
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "jfr/recorder/jfrRecorder.hpp"
27 #include "jfr/utilities/jfrAllocation.hpp"
28 #include "logging/log.hpp"
29 #include "memory/allocation.inline.hpp"
30 #include "runtime/atomic.hpp"
31 #include "runtime/orderAccess.hpp"
32 #include "runtime/vm_version.hpp"
33 #include "utilities/debug.hpp"
34 #include "utilities/macros.hpp"
35 #include "utilities/nativeCallStack.hpp"
36
37 #ifdef ASSERT
38 static jlong atomic_add_jlong(jlong value, jlong volatile* const dest) {
39 assert(VM_Version::supports_cx8(), "unsupported");
40 jlong compare_value;
41 jlong exchange_value;
42 do {
43 compare_value = OrderAccess::load_acquire(dest);
44 exchange_value = compare_value + value;
45 } while (Atomic::cmpxchg(exchange_value, dest, compare_value) != compare_value);
46 return exchange_value;
47 }
48
49 // debug statistics
50 static volatile jlong _allocated_bytes = 0;
51 static volatile jlong _deallocated_bytes = 0;
|