diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/Chunk.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/Chunk.java index d1404d5b282..b64b4f7a7f6 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/Chunk.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/Chunk.java @@ -28,8 +28,6 @@ public class Chunk { // Cache info private Database db; int index; - private Chunk prevChunk; - private Chunk nextChunk; Chunk(RandomAccessFile file, int offset) throws CoreException { try { @@ -64,32 +62,13 @@ public class Chunk { return buffer.getChar(offset % Database.CHUNK_SIZE); } - Chunk getNextChunk() { - return nextChunk; - } - - void setNextChunk(Chunk nextChunk) { - this.nextChunk = nextChunk; - } - - Chunk getPrevChunk() { - return prevChunk; - } - - void setPrevChunk(Chunk prevChunk) { - this.prevChunk = prevChunk; - } - void clear(int offset, int length) { buffer.position(offset % Database.CHUNK_SIZE); buffer.put(new byte[length]); } void free() { - // nextChunk should be null db.toc[index] = null; - db.lruChunk = prevChunk; - prevChunk.nextChunk = null; } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/Database.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/Database.java index e79d196370a..7d66ba854cb 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/Database.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/Database.java @@ -26,15 +26,10 @@ public class Database { private final RandomAccessFile file; Chunk[] toc; - Chunk mruChunk; - Chunk lruChunk; - - private int loadedChunks; // public for tests only, you shouldn't need these public static final int VERSION_OFFSET = 0; public static final int CHUNK_SIZE = 4096; - public static final int CACHE_SIZE = 10000; // Should be configable public static final int MIN_SIZE = 16; public static final int INT_SIZE = 4; public static final int CHAR_SIZE = 2; @@ -106,28 +101,9 @@ public class Database { int index = offset / CHUNK_SIZE; Chunk chunk = toc[index]; if (chunk == null) { - if (loadedChunks == CACHE_SIZE) - // cache is full, free lruChunk - lruChunk.free(); - chunk = toc[index] = new Chunk(file, index * CHUNK_SIZE); } - // insert into cache - // TODO We can move this into the chunks - Chunk prevChunk = chunk.getPrevChunk(); - Chunk nextChunk = chunk.getNextChunk(); - if (prevChunk != null) - prevChunk.setNextChunk(nextChunk); - if (nextChunk != null) - nextChunk.setPrevChunk(prevChunk); - if (mruChunk != null) { - chunk.setNextChunk(mruChunk); - mruChunk.setPrevChunk(chunk); - } - mruChunk = chunk; - chunk.setPrevChunk(null); - return chunk; }