Backed out changeset 497561b76737 (bug 1052579) for bustages on mozjemalloc_types.h . CLOSED TREE

This commit is contained in:
Narcis Beleuzu 2019-04-22 19:00:58 +03:00
parent 1bb0a93285
commit cd1fcbc396
2 changed files with 15 additions and 34 deletions

View File

@ -3054,7 +3054,7 @@ inline void MozJemalloc::jemalloc_ptr_info(const void* aPtr,
// Alternatively, if the allocator is not initialized yet, the pointer
// can't be known.
if (!chunk || !malloc_initialized) {
*aInfo = {TagUnknown, nullptr, 0, 0};
*aInfo = {TagUnknown, nullptr, 0};
return;
}
@ -3071,14 +3071,14 @@ inline void MozJemalloc::jemalloc_ptr_info(const void* aPtr,
&huge)
->Search(&key);
if (node) {
*aInfo = {TagLiveHuge, node->mAddr, node->mSize, node->mArena->mId};
*aInfo = {TagLiveHuge, node->mAddr, node->mSize};
return;
}
}
// It's not a huge allocation. Check if we have a known chunk.
if (!gChunkRTree.Get(chunk)) {
*aInfo = {TagUnknown, nullptr, 0, 0};
*aInfo = {TagUnknown, nullptr, 0};
return;
}
@ -3088,7 +3088,7 @@ inline void MozJemalloc::jemalloc_ptr_info(const void* aPtr,
size_t pageind = (((uintptr_t)aPtr - (uintptr_t)chunk) >> gPageSize2Pow);
if (pageind < gChunkHeaderNumPages) {
// Within the chunk header.
*aInfo = {TagUnknown, nullptr, 0, 0};
*aInfo = {TagUnknown, nullptr, 0};
return;
}
@ -3109,7 +3109,7 @@ inline void MozJemalloc::jemalloc_ptr_info(const void* aPtr,
}
void* pageaddr = (void*)(uintptr_t(aPtr) & ~gPageSizeMask);
*aInfo = {tag, pageaddr, gPageSize, chunk->arena->mId};
*aInfo = {tag, pageaddr, gPageSize};
return;
}
@ -3129,20 +3129,20 @@ inline void MozJemalloc::jemalloc_ptr_info(const void* aPtr,
pageind--;
MOZ_DIAGNOSTIC_ASSERT(pageind >= gChunkHeaderNumPages);
if (pageind < gChunkHeaderNumPages) {
*aInfo = {TagUnknown, nullptr, 0, 0};
*aInfo = {TagUnknown, nullptr, 0};
return;
}
mapbits = chunk->map[pageind].bits;
MOZ_DIAGNOSTIC_ASSERT(mapbits & CHUNK_MAP_LARGE);
if (!(mapbits & CHUNK_MAP_LARGE)) {
*aInfo = {TagUnknown, nullptr, 0, 0};
*aInfo = {TagUnknown, nullptr, 0};
return;
}
}
void* addr = ((char*)chunk) + (pageind << gPageSize2Pow);
*aInfo = {TagLiveLarge, addr, size, chunk->arena->mId};
*aInfo = {TagLiveLarge, addr, size};
return;
}
@ -3157,7 +3157,7 @@ inline void MozJemalloc::jemalloc_ptr_info(const void* aPtr,
uintptr_t reg0_addr = (uintptr_t)run + run->mBin->mRunFirstRegionOffset;
if (aPtr < (void*)reg0_addr) {
// In the run header.
*aInfo = {TagUnknown, nullptr, 0, 0};
*aInfo = {TagUnknown, nullptr, 0};
return;
}
@ -3173,7 +3173,7 @@ inline void MozJemalloc::jemalloc_ptr_info(const void* aPtr,
PtrInfoTag tag =
((run->mRegionsMask[elm] & (1U << bit))) ? TagFreedSmall : TagLiveSmall;
*aInfo = {tag, addr, size, chunk->arena->mId};
*aInfo = {tag, addr, size};
}
namespace Debug {

View File

@ -94,22 +94,22 @@ typedef struct {
enum PtrInfoTag {
// The pointer is not currently known to the allocator.
// 'addr', 'size', and 'arenaId' are always 0.
// 'addr' and 'size' are always 0.
TagUnknown,
// The pointer is within a live allocation.
// 'addr', 'size', and 'arenaId' describe the allocation.
// 'addr' and 'size' describe the allocation.
TagLiveSmall,
TagLiveLarge,
TagLiveHuge,
// The pointer is within a small freed allocation.
// 'addr', 'size', and 'arenaId' describe the allocation.
// 'addr' and 'size' describe the allocation.
TagFreedSmall,
// The pointer is within a freed page. Details about the original
// allocation, including its size, are not available.
// 'addr', 'size', and 'arenaId' describe the page.
// 'addr' and 'size' describe the page.
TagFreedPageDirty,
TagFreedPageDecommitted,
TagFreedPageMadvised,
@ -121,29 +121,10 @@ enum PtrInfoTag {
// - The number of fields is minimized.
// - The 'tag' field unambiguously defines the meaning of the subsequent fields.
// Helper functions are used to group together related categories of tags.
typedef struct jemalloc_ptr_info_s {
typedef struct {
enum PtrInfoTag tag;
void* addr; // meaning depends on tag; see above
size_t size; // meaning depends on tag; see above
#ifdef MOZ_DEBUG
arena_id_t arenaId; // meaning depends on tag; see above
#endif
#ifdef __cplusplus
jemalloc_ptr_info_s() {}
jemalloc_ptr_info_s(enum PtrInfoTag tag, void* addr, size_t size,
arena_id_t arenaId)
: tag(tag),
addr(addr),
size(size)
# ifdef MOZ_DEBUG
,
arenaId(arenaId)
# endif
{
}
#endif
} jemalloc_ptr_info_t;
static inline bool jemalloc_ptr_is_live(jemalloc_ptr_info_t* info) {