42 memset(aligned_addr, 0, size);
43
44 // Since free expects pointers returned by malloc, aligned_addr cannot be
45 // freed since it is most likely not the same as addr after alignment.
46 return (uintptr_t)aligned_addr;
47 }
48
49 inline size_t ZUtils::bytes_to_words(size_t size_in_bytes) {
50 assert(is_aligned(size_in_bytes, BytesPerWord), "Size not word aligned");
51 return size_in_bytes >> LogBytesPerWord;
52 }
53
54 inline size_t ZUtils::words_to_bytes(size_t size_in_words) {
55 return size_in_words << LogBytesPerWord;
56 }
57
58 inline size_t ZUtils::object_size(zaddress addr) {
59 return words_to_bytes(to_oop(addr)->size());
60 }
61
62 inline void ZUtils::object_copy_disjoint(zaddress from, zaddress to, size_t size) {
63 Copy::aligned_disjoint_words((HeapWord*)untype(from), (HeapWord*)untype(to), bytes_to_words(size));
64 }
65
66 inline void ZUtils::object_copy_conjoint(zaddress from, zaddress to, size_t size) {
67 if (from != to) {
68 Copy::aligned_conjoint_words((HeapWord*)untype(from), (HeapWord*)untype(to), bytes_to_words(size));
69 }
70 }
71
72 #endif // SHARE_GC_Z_ZUTILS_INLINE_HPP
|
42 memset(aligned_addr, 0, size);
43
44 // Since free expects pointers returned by malloc, aligned_addr cannot be
45 // freed since it is most likely not the same as addr after alignment.
46 return (uintptr_t)aligned_addr;
47 }
48
49 inline size_t ZUtils::bytes_to_words(size_t size_in_bytes) {
50 assert(is_aligned(size_in_bytes, BytesPerWord), "Size not word aligned");
51 return size_in_bytes >> LogBytesPerWord;
52 }
53
54 inline size_t ZUtils::words_to_bytes(size_t size_in_words) {
55 return size_in_words << LogBytesPerWord;
56 }
57
58 inline size_t ZUtils::object_size(zaddress addr) {
59 return words_to_bytes(to_oop(addr)->size());
60 }
61
62 inline size_t ZUtils::copy_size(zaddress addr, size_t old_size) {
63 oop obj = to_oop(addr);
64 return words_to_bytes(obj->copy_size(bytes_to_words(old_size), obj->mark()));
65 }
66
67 inline void ZUtils::initialize_hash_if_necessary(zaddress to_addr, zaddress from_addr) {
68 to_oop(to_addr)->initialize_hash_if_necessary(to_oop(from_addr));
69 }
70
71 inline void ZUtils::object_copy_disjoint(zaddress from, zaddress to, size_t size) {
72 Copy::aligned_disjoint_words((HeapWord*)untype(from), (HeapWord*)untype(to), bytes_to_words(size));
73 }
74
75 inline void ZUtils::object_copy_conjoint(zaddress from, zaddress to, size_t size) {
76 if (from != to) {
77 Copy::aligned_conjoint_words((HeapWord*)untype(from), (HeapWord*)untype(to), bytes_to_words(size));
78 }
79 }
80
81 #endif // SHARE_GC_Z_ZUTILS_INLINE_HPP
|