diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2017-05-31 12:05:26 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2017-05-31 12:05:39 +0200 |
commit | dece229a7c2284598c36fb668de766309a6893cf (patch) | |
tree | 6e34cfa52416b2f27d2fa0631cf34f8ffd171be4 /src/qml/memory/qv4mm.cpp | |
parent | e2520ff76be49c5aa917741cc6a380fe1549e47d (diff) | |
parent | c158ca8be49a75026e83751dfd825c5bdd63189a (diff) |
Merge remote-tracking branch 'origin/dev' into wip/scenegraphng
Change-Id: Iea0bb0788357bc615d0e9ea411087114b8b3b720
Diffstat (limited to 'src/qml/memory/qv4mm.cpp')
-rw-r--r-- | src/qml/memory/qv4mm.cpp | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/src/qml/memory/qv4mm.cpp b/src/qml/memory/qv4mm.cpp index c4bd1a733f..64b07153cc 100644 --- a/src/qml/memory/qv4mm.cpp +++ b/src/qml/memory/qv4mm.cpp @@ -266,6 +266,18 @@ void ChunkAllocator::free(Chunk *chunk, size_t size) Q_ASSERT(false); } +#ifdef DUMP_SWEEP +QString binary(quintptr n) { + QString s = QString::number(n, 2); + while (s.length() < 64) + s.prepend(QChar::fromLatin1('0')); + return s; +} +#define SDUMP qDebug +#else +QString binary(quintptr) { return QString(); } +#define SDUMP if (1) ; else qDebug +#endif void Heap::Base::markChildren(MarkStack *markStack) { @@ -338,8 +350,9 @@ static void increaseFreedCountForClass(const char *className) void Chunk::sweep(ClassDestroyStatsCallback classCountPtr) { - // DEBUG << "sweeping chunk" << this << (*freeList); + SDUMP() << "sweeping chunk" << this; HeapItem *o = realBase(); + bool lastSlotFree = false; for (uint i = 0; i < Chunk::EntriesInBitmap; ++i) { #if WRITEBARRIER(none) Q_ASSERT((grayBitmap[i] | blackBitmap[i]) == blackBitmap[i]); // check that we don't have gray only objects @@ -347,7 +360,13 @@ void Chunk::sweep(ClassDestroyStatsCallback classCountPtr) quintptr toFree = objectBitmap[i] ^ blackBitmap[i]; Q_ASSERT((toFree & objectBitmap[i]) == toFree); // check all black objects are marked as being used quintptr e = extendsBitmap[i]; - // DEBUG << hex << " index=" << i << toFree; + SDUMP() << " index=" << i; + SDUMP() << " toFree =" << binary(toFree); + SDUMP() << " black =" << binary(blackBitmap[i]); + SDUMP() << " object =" << binary(objectBitmap[i]); + SDUMP() << " extends =" << binary(e); + if (lastSlotFree) + e &= (e + 1); // clear all lowest extent bits while (toFree) { uint index = qCountTrailingZeroBits(toFree); quintptr bit = (static_cast<quintptr>(1) << index); @@ -377,6 +396,10 @@ void Chunk::sweep(ClassDestroyStatsCallback classCountPtr) objectBitmap[i] = blackBitmap[i]; grayBitmap[i] = 0; extendsBitmap[i] = e; + lastSlotFree = !((objectBitmap[i]|extendsBitmap[i]) >> (sizeof(quintptr)*8 - 1)); + SDUMP() << " new extends =" << binary(e); + SDUMP() << " lastSlotFree" << lastSlotFree; + Q_ASSERT((objectBitmap[i] & extendsBitmap[i]) == 0); o += Chunk::Bits; } // DEBUG << "swept chunk" << this << "freed" << slotsFreed << "slots."; @@ -1084,6 +1107,13 @@ size_t dumpBins(BlockAllocator *b, bool printOutput = true) if (printOutput) qDebug() << " number of entries in slot" << i << ":" << nEntries; } + SDUMP() << " large slot map"; + HeapItem *h = b->freeBins[BlockAllocator::NumBins - 1]; + while (h) { + SDUMP() << " " << hex << (quintptr(h)/32) << h->freeData.availableSlots; + h = h->freeData.next; + } + if (printOutput) qDebug() << " total mem in bins" << totalSlotMem*Chunk::SlotSize; return totalSlotMem*Chunk::SlotSize; |