< prev index next >

src/hotspot/share/oops/accessBackend.inline.hpp

Print this page




  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  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 #ifndef SHARE_VM_RUNTIME_ACCESSBACKEND_INLINE_HPP
  26 #define SHARE_VM_RUNTIME_ACCESSBACKEND_INLINE_HPP
  27 
  28 #include "oops/access.hpp"
  29 #include "oops/accessBackend.hpp"
  30 #include "oops/oop.inline.hpp"

  31 
  32 template <DecoratorSet decorators>
  33 template <DecoratorSet idecorators, typename T>
  34 inline typename EnableIf<
  35   AccessInternal::MustConvertCompressedOop<idecorators, T>::value, T>::type
  36 RawAccessBarrier<decorators>::decode_internal(typename HeapOopType<idecorators>::type value) {
  37   if (HasDecorator<decorators, OOP_NOT_NULL>::value) {
  38     return oopDesc::decode_heap_oop_not_null(value);
  39   } else {
  40     return oopDesc::decode_heap_oop(value);
  41   }
  42 }
  43 
  44 template <DecoratorSet decorators>
  45 template <DecoratorSet idecorators, typename T>
  46 inline typename EnableIf<
  47   AccessInternal::MustConvertCompressedOop<idecorators, T>::value,
  48   typename HeapOopType<idecorators>::type>::type
  49 RawAccessBarrier<decorators>::encode_internal(T value) {
  50   if (HasDecorator<decorators, OOP_NOT_NULL>::value) {
  51     return oopDesc::encode_heap_oop_not_null(value);
  52   } else {
  53     return oopDesc::encode_heap_oop(value);
  54   }
  55 }
  56 
  57 template <DecoratorSet decorators>
  58 template <typename T>
  59 inline void RawAccessBarrier<decorators>::oop_store(void* addr, T value) {
  60   typedef typename AccessInternal::EncodedType<decorators, T>::type Encoded;
  61   Encoded encoded = encode(value);
  62   store(reinterpret_cast<Encoded*>(addr), encoded);
  63 }
  64 
  65 template <DecoratorSet decorators>
  66 template <typename T>
  67 inline void RawAccessBarrier<decorators>::oop_store_at(oop base, ptrdiff_t offset, T value) {
  68   oop_store(field_addr(base, offset), value);
  69 }
  70 
  71 template <DecoratorSet decorators>
  72 template <typename T>
  73 inline T RawAccessBarrier<decorators>::oop_load(void* addr) {




  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  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 #ifndef SHARE_VM_RUNTIME_ACCESSBACKEND_INLINE_HPP
  26 #define SHARE_VM_RUNTIME_ACCESSBACKEND_INLINE_HPP
  27 
  28 #include "oops/access.hpp"
  29 #include "oops/accessBackend.hpp"
  30 #include "oops/compressedOops.inline.hpp"
  31 #include "oops/oopsHierarchy.hpp"
  32 
  33 template <DecoratorSet decorators>
  34 template <DecoratorSet idecorators, typename T>
  35 inline typename EnableIf<
  36   AccessInternal::MustConvertCompressedOop<idecorators, T>::value, T>::type
  37 RawAccessBarrier<decorators>::decode_internal(typename HeapOopType<idecorators>::type value) {
  38   if (HasDecorator<decorators, OOP_NOT_NULL>::value) {
  39     return CompressedOops::decode_not_null(value);
  40   } else {
  41     return CompressedOops::decode(value);
  42   }
  43 }
  44 
  45 template <DecoratorSet decorators>
  46 template <DecoratorSet idecorators, typename T>
  47 inline typename EnableIf<
  48   AccessInternal::MustConvertCompressedOop<idecorators, T>::value,
  49   typename HeapOopType<idecorators>::type>::type
  50 RawAccessBarrier<decorators>::encode_internal(T value) {
  51   if (HasDecorator<decorators, OOP_NOT_NULL>::value) {
  52     return CompressedOops::encode_not_null(value);
  53   } else {
  54     return CompressedOops::encode(value);
  55   }
  56 }
  57 
  58 template <DecoratorSet decorators>
  59 template <typename T>
  60 inline void RawAccessBarrier<decorators>::oop_store(void* addr, T value) {
  61   typedef typename AccessInternal::EncodedType<decorators, T>::type Encoded;
  62   Encoded encoded = encode(value);
  63   store(reinterpret_cast<Encoded*>(addr), encoded);
  64 }
  65 
  66 template <DecoratorSet decorators>
  67 template <typename T>
  68 inline void RawAccessBarrier<decorators>::oop_store_at(oop base, ptrdiff_t offset, T value) {
  69   oop_store(field_addr(base, offset), value);
  70 }
  71 
  72 template <DecoratorSet decorators>
  73 template <typename T>
  74 inline T RawAccessBarrier<decorators>::oop_load(void* addr) {


< prev index next >