Thu, 07 Nov 2019 17:56:14 -0500
8206173: MallocSiteTable::initialize() doesn't take function descriptors into account
Reviewed-by: stuefe, zgu
src/share/vm/services/mallocSiteTable.cpp | file | annotate | diff | comparison | revisions | |
src/share/vm/utilities/macros.hpp | file | annotate | diff | comparison | revisions |
1.1 --- a/src/share/vm/services/mallocSiteTable.cpp Mon Nov 11 17:23:50 2019 +0000 1.2 +++ b/src/share/vm/services/mallocSiteTable.cpp Thu Nov 07 17:56:14 2019 -0500 1.3 @@ -84,12 +84,18 @@ 1.4 // Create pseudo call stack for hashtable entry allocation 1.5 address pc[3]; 1.6 if (NMT_TrackingStackDepth >= 3) { 1.7 - pc[2] = (address)MallocSiteTable::allocation_at; 1.8 + uintx *fp = (uintx*)MallocSiteTable::allocation_at; 1.9 + // On ppc64, 'fp' is a pointer to a function descriptor which is a struct of 1.10 + // three native pointers where the first pointer is the real function address. 1.11 + // See: http://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi-1.9.html#FUNC-DES 1.12 + pc[2] = (address)(fp PPC64_ONLY(BIG_ENDIAN_ONLY([0]))); 1.13 } 1.14 if (NMT_TrackingStackDepth >= 2) { 1.15 - pc[1] = (address)MallocSiteTable::lookup_or_add; 1.16 + uintx *fp = (uintx*)MallocSiteTable::lookup_or_add; 1.17 + pc[1] = (address)(fp PPC64_ONLY(BIG_ENDIAN_ONLY([0]))); 1.18 } 1.19 - pc[0] = (address)MallocSiteTable::new_entry; 1.20 + uintx *fp = (uintx*)MallocSiteTable::new_entry; 1.21 + pc[0] = (address)(fp PPC64_ONLY(BIG_ENDIAN_ONLY([0]))); 1.22 1.23 // Instantiate NativeCallStack object, have to use placement new operator. (see comments above) 1.24 NativeCallStack* stack = ::new ((void*)_hash_entry_allocation_stack)
2.1 --- a/src/share/vm/utilities/macros.hpp Mon Nov 11 17:23:50 2019 +0000 2.2 +++ b/src/share/vm/utilities/macros.hpp Thu Nov 07 17:56:14 2019 -0500 2.3 @@ -416,6 +416,14 @@ 2.4 #define NOT_EMBEDDED(code) code 2.5 #endif 2.6 2.7 +#ifdef VM_LITTLE_ENDIAN 2.8 +#define LITTLE_ENDIAN_ONLY(code) code 2.9 +#define BIG_ENDIAN_ONLY(code) 2.10 +#else 2.11 +#define LITTLE_ENDIAN_ONLY(code) 2.12 +#define BIG_ENDIAN_ONLY(code) code 2.13 +#endif 2.14 + 2.15 #define define_pd_global(type, name, value) const type pd_##name = value; 2.16 2.17 #endif // SHARE_VM_UTILITIES_MACROS_HPP