Skip to content

Commit

Permalink
8267611: Print more info when pointer_delta assert fails
Browse files Browse the repository at this point in the history
Reviewed-by: dholmes, jiefu, tschatzl, kbarrett
  • Loading branch information
stefank committed May 26, 2021
1 parent a4c46e1 commit de91643
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/hotspot/share/utilities/globalDefinitions.hpp
Expand Up @@ -151,6 +151,11 @@ class oopDesc;
#define INTX_FORMAT_W(width) "%" #width PRIdPTR
#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

Expand Down Expand Up @@ -416,7 +421,7 @@ inline address_word castable_address(void* x) { return address_w
inline size_t pointer_delta(const volatile void* left,
const volatile void* right,
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;
}

Expand Down Expand Up @@ -1089,11 +1094,6 @@ inline int build_int_from_shorts( jushort low, jushort high ) {
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
template<class T> static void swap(T& a, T& b) {
T tmp = a;
Expand Down

1 comment on commit de91643

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.