< prev index next >

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

Print this page




  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_OOPS_ACCESSBACKEND_INLINE_HPP
  26 #define SHARE_OOPS_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, IS_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, IS_NOT_NULL>::value) {


 345 template <DecoratorSet decorators>
 346 inline void RawAccessBarrier<decorators>::clone(oop src, oop dst, size_t size) {
 347   // 4839641 (4840070): We must do an oop-atomic copy, because if another thread
 348   // is modifying a reference field in the clonee, a non-oop-atomic copy might
 349   // be suspended in the middle of copying the pointer and end up with parts
 350   // of two different pointers in the field.  Subsequent dereferences will crash.
 351   // 4846409: an oop-copy of objects with long or double fields or arrays of same
 352   // won't copy the longs/doubles atomically in 32-bit vm's, so we copy jlongs instead
 353   // of oops.  We know objects are aligned on a minimum of an jlong boundary.
 354   // The same is true of StubRoutines::object_copy and the various oop_copy
 355   // variants, and of the code generated by the inline_native_clone intrinsic.
 356 
 357   assert(MinObjAlignmentInBytes >= BytesPerLong, "objects misaligned");
 358   AccessInternal::arraycopy_conjoint_atomic(reinterpret_cast<jlong*>((oopDesc*)src),
 359                                             reinterpret_cast<jlong*>((oopDesc*)dst),
 360                                             align_object_size(size) / HeapWordsPerLong);
 361   // Clear the header
 362   dst->init_mark_raw();
 363 }
 364 





 365 #endif // SHARE_OOPS_ACCESSBACKEND_INLINE_HPP


  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_OOPS_ACCESSBACKEND_INLINE_HPP
  26 #define SHARE_OOPS_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 #include "oops/valueKlass.hpp"
  33 
  34 template <DecoratorSet decorators>
  35 template <DecoratorSet idecorators, typename T>
  36 inline typename EnableIf<
  37   AccessInternal::MustConvertCompressedOop<idecorators, T>::value, T>::type
  38 RawAccessBarrier<decorators>::decode_internal(typename HeapOopType<idecorators>::type value) {
  39   if (HasDecorator<decorators, IS_NOT_NULL>::value) {
  40     return CompressedOops::decode_not_null(value);
  41   } else {
  42     return CompressedOops::decode(value);
  43   }
  44 }
  45 
  46 template <DecoratorSet decorators>
  47 template <DecoratorSet idecorators, typename T>
  48 inline typename EnableIf<
  49   AccessInternal::MustConvertCompressedOop<idecorators, T>::value,
  50   typename HeapOopType<idecorators>::type>::type
  51 RawAccessBarrier<decorators>::encode_internal(T value) {
  52   if (HasDecorator<decorators, IS_NOT_NULL>::value) {


 346 template <DecoratorSet decorators>
 347 inline void RawAccessBarrier<decorators>::clone(oop src, oop dst, size_t size) {
 348   // 4839641 (4840070): We must do an oop-atomic copy, because if another thread
 349   // is modifying a reference field in the clonee, a non-oop-atomic copy might
 350   // be suspended in the middle of copying the pointer and end up with parts
 351   // of two different pointers in the field.  Subsequent dereferences will crash.
 352   // 4846409: an oop-copy of objects with long or double fields or arrays of same
 353   // won't copy the longs/doubles atomically in 32-bit vm's, so we copy jlongs instead
 354   // of oops.  We know objects are aligned on a minimum of an jlong boundary.
 355   // The same is true of StubRoutines::object_copy and the various oop_copy
 356   // variants, and of the code generated by the inline_native_clone intrinsic.
 357 
 358   assert(MinObjAlignmentInBytes >= BytesPerLong, "objects misaligned");
 359   AccessInternal::arraycopy_conjoint_atomic(reinterpret_cast<jlong*>((oopDesc*)src),
 360                                             reinterpret_cast<jlong*>((oopDesc*)dst),
 361                                             align_object_size(size) / HeapWordsPerLong);
 362   // Clear the header
 363   dst->init_mark_raw();
 364 }
 365 
 366 template <DecoratorSet decorators>
 367 inline void RawAccessBarrier<decorators>::value_copy(void* src, void* dst, ValueKlass* md) {
 368   assert(is_aligned(src, md->get_alignment()) && is_aligned(dst, md->get_alignment()), "Unalign value_copy");
 369   AccessInternal::arraycopy_conjoint_atomic(src, dst, static_cast<size_t>(md->get_exact_size_in_bytes()));
 370 }
 371 #endif // SHARE_OOPS_ACCESSBACKEND_INLINE_HPP
< prev index next >