diff --git a/xs/sources/xsMapSet.c b/xs/sources/xsMapSet.c index 8aefd1e3f2..9410d1e614 100644 --- a/xs/sources/xsMapSet.c +++ b/xs/sources/xsMapSet.c @@ -1034,6 +1034,9 @@ txBoolean fxDeleteEntry(txMachine* the, txSlot* table, txSlot* list, txSlot* key address = &slot->next; } } +#ifdef __XSNAP__ + the->mapSetRemoveCount += 1; +#endif return 1; } } @@ -1098,6 +1101,9 @@ void fxSetEntry(txMachine* the, txSlot* table, txSlot* list, txSlot* key, txSlot txSlot* first; txSlot* last; txSlot* slot; +#ifdef __XSNAP__ + txUnsigned qty = 0; +#endif while ((entry = *address)) { if (entry->value.entry.sum == sum) { first = entry->value.entry.slot; @@ -1110,8 +1116,17 @@ void fxSetEntry(txMachine* the, txSlot* table, txSlot* list, txSlot* key, txSlot return; } } +#ifdef __XSNAP__ + qty += 1; +#endif address = &entry->next; } +#ifdef __XSNAP__ + the->mapSetAddCount += 1; + if (qty > the->maxBucketSize) { + the->maxBucketSize = qty; + } +#endif first = fxNewSlot(the); first->kind = key->kind; first->value = key->value; diff --git a/xs/sources/xsMemory.c b/xs/sources/xsMemory.c index de115ad804..9e7b797925 100644 --- a/xs/sources/xsMemory.c +++ b/xs/sources/xsMemory.c @@ -331,7 +331,7 @@ void fxCollect(txMachine* the, txBoolean theFlag) (long)(the->peakHeapCount * sizeof(txSlot)), the->collectFlag & XS_TRASHING_FLAG); #endif -#ifdef mxInstrument +#if defined(mxInstrument) || defined(__XSNAP__) the->garbageCollectionCount++; #endif #ifdef mxProfile @@ -428,7 +428,7 @@ void fxGrowChunks(txMachine* the, txSize theSize) if (!(the->collectFlag & XS_SKIPPED_COLLECT_FLAG)) { txSize modulo = theSize % the->minimumChunksSize; if (modulo) - fxAddChunkSizes(the, theSize, the->minimumChunksSize - modulo); + theSize = fxAddChunkSizes(the, theSize, the->minimumChunksSize - modulo); } theSize = fxAddChunkSizes(the, theSize, sizeof(txBlock)); aData = fxAllocateChunks(the, theSize);