comparison src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp @ 2114:4fc084dac61e

7009756: volatile variables could be broken throw reflection API Summary: Use Atomic::load() and Atomic::store() to access a volatile long. Reviewed-by: iveresov, jrose, dholmes, never
author kvn
date Fri, 07 Jan 2011 10:16:57 -0800
parents f95d63e2154a
children 63e54c37ac64
comparison
equal deleted inserted replaced
2113:0e52ef6e94d3 2114:4fc084dac61e
1 /* 1 /*
2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
149 149
150 inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value) { 150 inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value) {
151 return (void*)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value); 151 return (void*)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value);
152 } 152 }
153 153
154 extern "C" void _Atomic_load_long(volatile jlong* src, volatile jlong* dst); 154 extern "C" void _Atomic_move_long(volatile jlong* src, volatile jlong* dst);
155 155
156 inline jlong Atomic::load(volatile jlong* src) { 156 inline jlong Atomic::load(volatile jlong* src) {
157 volatile jlong dest; 157 volatile jlong dest;
158 _Atomic_load_long(src, &dest); 158 _Atomic_move_long(src, &dest);
159 return dest; 159 return dest;
160 }
161
162 inline void Atomic::store(jlong store_value, jlong* dest) {
163 _Atomic_move_long((volatile jlong*)&store_value, (volatile jlong*)dest);
164 }
165
166 inline void Atomic::store(jlong store_value, volatile jlong* dest) {
167 _Atomic_move_long((volatile jlong*)&store_value, dest);
160 } 168 }
161 169
162 #endif // AMD64 170 #endif // AMD64
163 171
164 #ifdef _GNU_SOURCE 172 #ifdef _GNU_SOURCE