# HG changeset patch # User simonis # Date 1573167374 18000 # Node ID 9148fcba5de91396843df7956751e85631c5a9fc # Parent ac3466ed5cb565cb36d6f67451c23c34a1424da7 8206173: MallocSiteTable::initialize() doesn't take function descriptors into account Reviewed-by: stuefe, zgu diff -r ac3466ed5cb5 -r 9148fcba5de9 src/share/vm/services/mallocSiteTable.cpp --- a/src/share/vm/services/mallocSiteTable.cpp Mon Nov 11 17:23:50 2019 +0000 +++ b/src/share/vm/services/mallocSiteTable.cpp Thu Nov 07 17:56:14 2019 -0500 @@ -84,12 +84,18 @@ // Create pseudo call stack for hashtable entry allocation address pc[3]; if (NMT_TrackingStackDepth >= 3) { - pc[2] = (address)MallocSiteTable::allocation_at; + uintx *fp = (uintx*)MallocSiteTable::allocation_at; + // On ppc64, 'fp' is a pointer to a function descriptor which is a struct of + // three native pointers where the first pointer is the real function address. + // See: http://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi-1.9.html#FUNC-DES + pc[2] = (address)(fp PPC64_ONLY(BIG_ENDIAN_ONLY([0]))); } if (NMT_TrackingStackDepth >= 2) { - pc[1] = (address)MallocSiteTable::lookup_or_add; + uintx *fp = (uintx*)MallocSiteTable::lookup_or_add; + pc[1] = (address)(fp PPC64_ONLY(BIG_ENDIAN_ONLY([0]))); } - pc[0] = (address)MallocSiteTable::new_entry; + uintx *fp = (uintx*)MallocSiteTable::new_entry; + pc[0] = (address)(fp PPC64_ONLY(BIG_ENDIAN_ONLY([0]))); // Instantiate NativeCallStack object, have to use placement new operator. (see comments above) NativeCallStack* stack = ::new ((void*)_hash_entry_allocation_stack) diff -r ac3466ed5cb5 -r 9148fcba5de9 src/share/vm/utilities/macros.hpp --- a/src/share/vm/utilities/macros.hpp Mon Nov 11 17:23:50 2019 +0000 +++ b/src/share/vm/utilities/macros.hpp Thu Nov 07 17:56:14 2019 -0500 @@ -416,6 +416,14 @@ #define NOT_EMBEDDED(code) code #endif +#ifdef VM_LITTLE_ENDIAN +#define LITTLE_ENDIAN_ONLY(code) code +#define BIG_ENDIAN_ONLY(code) +#else +#define LITTLE_ENDIAN_ONLY(code) +#define BIG_ENDIAN_ONLY(code) code +#endif + #define define_pd_global(type, name, value) const type pd_##name = value; #endif // SHARE_VM_UTILITIES_MACROS_HPP