Przeglądaj źródła

Merge "PackBitmapIndex: Not buffer inflated bitmap during bitmap creation."

tags/v5.9.0.202008260805-m3
Terry Parker 4 lat temu
rodzic
commit
641069971d

+ 15
- 2
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/BasePackBitmapIndex.java Wyświetl plik

* @return the full bitmap * @return the full bitmap
*/ */
EWAHCompressedBitmap getBitmap() { EWAHCompressedBitmap getBitmap() {
EWAHCompressedBitmap bitmap = getBitmapWithoutCaching();
// Cache the result.
bitmapContainer = bitmap;
return bitmap;
}

/**
* Compute and return the full bitmap, do NOT cache the expanded bitmap,
* which saves memory and should only be used during bitmap creation in
* garbage collection.
*
* @return the full bitmap
*/
EWAHCompressedBitmap getBitmapWithoutCaching() {
// Fast path to immediately return the expanded result. // Fast path to immediately return the expanded result.
Object r = bitmapContainer; Object r = bitmapContainer;
if (r instanceof EWAHCompressedBitmap) if (r instanceof EWAHCompressedBitmap)
return (EWAHCompressedBitmap) r; return (EWAHCompressedBitmap) r;


// Expand the bitmap and cache the result.
// Expand the bitmap but not cache the result.
XorCompressedBitmap xb = (XorCompressedBitmap) r; XorCompressedBitmap xb = (XorCompressedBitmap) r;
EWAHCompressedBitmap out = xb.bitmap; EWAHCompressedBitmap out = xb.bitmap;
for (;;) { for (;;) {
if (r instanceof EWAHCompressedBitmap) { if (r instanceof EWAHCompressedBitmap) {
out = out.xor((EWAHCompressedBitmap) r); out = out.xor((EWAHCompressedBitmap) r);
out.trim(); out.trim();
bitmapContainer = out;
return out; return out;
} }
xb = (XorCompressedBitmap) r; xb = (XorCompressedBitmap) r;

+ 2
- 1
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndexRemapper.java Wyświetl plik

return null; return null;


inflated.clear(); inflated.clear();
for (IntIterator i = oldBitmap.getBitmap().intIterator(); i.hasNext();)
for (IntIterator i = oldBitmap.getBitmapWithoutCaching()
.intIterator(); i.hasNext();)
inflated.set(prevToNewMapping[i.next()]); inflated.set(prevToNewMapping[i.next()]);
bitmap = inflated.toEWAHCompressedBitmap(); bitmap = inflated.toEWAHCompressedBitmap();
bitmap.trim(); bitmap.trim();

Ładowanie…
Anuluj
Zapisz