8267611: Print more info when pointer_delta assert fails
Reviewed-by: dholmes, jiefu, tschatzl, kbarrett
This commit is contained in:
parent
a4c46e1e4f
commit
de91643bfa
@ -151,6 +151,11 @@ class oopDesc;
|
|||||||
#define INTX_FORMAT_W(width) "%" #width PRIdPTR
|
#define INTX_FORMAT_W(width) "%" #width PRIdPTR
|
||||||
#define UINTX_FORMAT_W(width) "%" #width PRIuPTR
|
#define UINTX_FORMAT_W(width) "%" #width PRIuPTR
|
||||||
|
|
||||||
|
// Convert pointer to intptr_t, for use in printing pointers.
|
||||||
|
inline intptr_t p2i(const volatile void* p) {
|
||||||
|
return (intptr_t) p;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
// Constants
|
// Constants
|
||||||
|
|
||||||
@ -416,7 +421,7 @@ inline address_word castable_address(void* x) { return address_w
|
|||||||
inline size_t pointer_delta(const volatile void* left,
|
inline size_t pointer_delta(const volatile void* left,
|
||||||
const volatile void* right,
|
const volatile void* right,
|
||||||
size_t element_size) {
|
size_t element_size) {
|
||||||
assert(left >= right, "avoid underflow");
|
assert(left >= right, "avoid underflow - left: " PTR_FORMAT " right: " PTR_FORMAT, p2i(left), p2i(right));
|
||||||
return (((uintptr_t) left) - ((uintptr_t) right)) / element_size;
|
return (((uintptr_t) left) - ((uintptr_t) right)) / element_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1089,11 +1094,6 @@ inline int build_int_from_shorts( jushort low, jushort high ) {
|
|||||||
return ((int)((unsigned int)high << 16) | (unsigned int)low);
|
return ((int)((unsigned int)high << 16) | (unsigned int)low);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert pointer to intptr_t, for use in printing pointers.
|
|
||||||
inline intptr_t p2i(const void * p) {
|
|
||||||
return (intptr_t) p;
|
|
||||||
}
|
|
||||||
|
|
||||||
// swap a & b
|
// swap a & b
|
||||||
template<class T> static void swap(T& a, T& b) {
|
template<class T> static void swap(T& a, T& b) {
|
||||||
T tmp = a;
|
T tmp = a;
|
||||||
|
Loading…
Reference in New Issue
Block a user