181 // Algorithm for encoding and decoding oops from 64 bit pointers to 32 bit |
181 // Algorithm for encoding and decoding oops from 64 bit pointers to 32 bit |
182 // offset from the heap base. Saving the check for null can save instructions |
182 // offset from the heap base. Saving the check for null can save instructions |
183 // in inner GC loops so these are separated. |
183 // in inner GC loops so these are separated. |
184 |
184 |
185 inline bool check_obj_alignment(oop obj) { |
185 inline bool check_obj_alignment(oop obj) { |
186 return (intptr_t)obj % MinObjAlignmentInBytes == 0; |
186 return cast_from_oop<intptr_t>(obj) % MinObjAlignmentInBytes == 0; |
187 } |
187 } |
188 |
188 |
189 inline narrowOop oopDesc::encode_heap_oop_not_null(oop v) { |
189 inline narrowOop oopDesc::encode_heap_oop_not_null(oop v) { |
190 assert(!is_null(v), "oop value can never be zero"); |
190 assert(!is_null(v), "oop value can never be zero"); |
191 assert(check_obj_alignment(v), "Address not aligned"); |
191 assert(check_obj_alignment(v), "Address not aligned"); |