< prev index next >

src/hotspot/share/gc/z/zUtils.inline.hpp

Print this page

 45   memset(aligned_addr, 0, size);
 46 
 47   // Since free expects pointers returned by malloc, aligned_addr cannot be
 48   // freed since it is most likely not the same as addr after alignment.
 49   return (uintptr_t)aligned_addr;
 50 }
 51 
 52 inline size_t ZUtils::bytes_to_words(size_t size_in_bytes) {
 53   assert(is_aligned(size_in_bytes, BytesPerWord), "Size not word aligned");
 54   return size_in_bytes >> LogBytesPerWord;
 55 }
 56 
 57 inline size_t ZUtils::words_to_bytes(size_t size_in_words) {
 58   return size_in_words << LogBytesPerWord;
 59 }
 60 
 61 inline size_t ZUtils::object_size(zaddress addr) {
 62   return words_to_bytes(to_oop(addr)->size());
 63 }
 64 









 65 inline void ZUtils::object_copy_disjoint(zaddress from, zaddress to, size_t size) {
 66   Copy::aligned_disjoint_words((HeapWord*)untype(from), (HeapWord*)untype(to), bytes_to_words(size));
 67 }
 68 
 69 inline void ZUtils::object_copy_conjoint(zaddress from, zaddress to, size_t size) {
 70   if (from != to) {
 71     Copy::aligned_conjoint_words((HeapWord*)untype(from), (HeapWord*)untype(to), bytes_to_words(size));
 72   }
 73 }
 74 
 75 inline void ZUtils::object_copy_disjoint_atomic(zaddress from, zaddress to, size_t offset, size_t size) {
 76   const uintptr_t from_addr = untype(from) + offset;
 77   const uintptr_t to_addr = untype(to) + offset;
 78 
 79   Copy::disjoint_words_atomic((HeapWord*)from_addr, (HeapWord*)to_addr, bytes_to_words(size));
 80 }
 81 
 82 template <typename T>
 83 inline void ZUtils::copy_disjoint(T* dest, const T* src, size_t count) {
 84   memcpy(dest, src, sizeof(T) * count);

 45   memset(aligned_addr, 0, size);
 46 
 47   // Since free expects pointers returned by malloc, aligned_addr cannot be
 48   // freed since it is most likely not the same as addr after alignment.
 49   return (uintptr_t)aligned_addr;
 50 }
 51 
 52 inline size_t ZUtils::bytes_to_words(size_t size_in_bytes) {
 53   assert(is_aligned(size_in_bytes, BytesPerWord), "Size not word aligned");
 54   return size_in_bytes >> LogBytesPerWord;
 55 }
 56 
 57 inline size_t ZUtils::words_to_bytes(size_t size_in_words) {
 58   return size_in_words << LogBytesPerWord;
 59 }
 60 
 61 inline size_t ZUtils::object_size(zaddress addr) {
 62   return words_to_bytes(to_oop(addr)->size());
 63 }
 64 
 65 inline size_t ZUtils::copy_size(zaddress addr, size_t old_size) {
 66   oop obj = to_oop(addr);
 67   return words_to_bytes(obj->copy_size(bytes_to_words(old_size), obj->mark()));
 68 }
 69 
 70 inline void ZUtils::initialize_hash_if_necessary(zaddress to_addr, zaddress from_addr) {
 71   to_oop(to_addr)->initialize_hash_if_necessary(to_oop(from_addr));
 72 }
 73 
 74 inline void ZUtils::object_copy_disjoint(zaddress from, zaddress to, size_t size) {
 75   Copy::aligned_disjoint_words((HeapWord*)untype(from), (HeapWord*)untype(to), bytes_to_words(size));
 76 }
 77 
 78 inline void ZUtils::object_copy_conjoint(zaddress from, zaddress to, size_t size) {
 79   if (from != to) {
 80     Copy::aligned_conjoint_words((HeapWord*)untype(from), (HeapWord*)untype(to), bytes_to_words(size));
 81   }
 82 }
 83 
 84 inline void ZUtils::object_copy_disjoint_atomic(zaddress from, zaddress to, size_t offset, size_t size) {
 85   const uintptr_t from_addr = untype(from) + offset;
 86   const uintptr_t to_addr = untype(to) + offset;
 87 
 88   Copy::disjoint_words_atomic((HeapWord*)from_addr, (HeapWord*)to_addr, bytes_to_words(size));
 89 }
 90 
 91 template <typename T>
 92 inline void ZUtils::copy_disjoint(T* dest, const T* src, size_t count) {
 93   memcpy(dest, src, sizeof(T) * count);
< prev index next >