Browse Source

Removed cache

segfaults
Pjotr Prins 3 years ago
parent
commit
27a2d37852
  1. 9
      bio/core/bgzf/block.d
  2. 4
      bio/core/bgzf/inputstream.d

9
bio/core/bgzf/block.d

@ -108,14 +108,13 @@ struct DecompressedBgzfBlock {
}
///
alias Cache!(BgzfBlock, DecompressedBgzfBlock) BgzfBlockCache;
// alias Cache!(BgzfBlock, DecompressedBgzfBlock) BgzfBlockCache;
/// Function for BGZF block decompression.
/// Reuses buffer allocated for storing compressed data,
/// i.e. after execution buffer of the passed $(D block)
/// is overwritten with uncompressed data.
DecompressedBgzfBlock decompressBgzfBlock(BgzfBlock block,
BgzfBlockCache cache=null)
DecompressedBgzfBlock decompressBgzfBlock(BgzfBlock block)
{
if (block.input_size == 0) {
return DecompressedBgzfBlock(block.start_offset,
@ -124,11 +123,13 @@ DecompressedBgzfBlock decompressBgzfBlock(BgzfBlock block,
// TODO: add check for correctness of EOF marker
}
/*
if (cache !is null) {
auto ptr = cache.lookup(block);
if (ptr !is null)
return *ptr;
}
*/
int err = void;
@ -175,6 +176,7 @@ DecompressedBgzfBlock decompressBgzfBlock(BgzfBlock block,
assert(block.crc32 == crc32(0, uncompressed[]));
/*
if (cache !is null) {
BgzfBlock compressed_bgzf_block = block;
compressed_bgzf_block._buffer = block._buffer.dup;
@ -186,6 +188,7 @@ DecompressedBgzfBlock decompressBgzfBlock(BgzfBlock block,
}
cache.put(compressed_bgzf_block, decompressed_bgzf_block);
}
*/
// Now copy back to block._buffer, overwriting existing data.
// It should have enough bytes already allocated.

4
bio/core/bgzf/inputstream.d

@ -355,7 +355,7 @@ class BgzfInputStream : Stream {
TaskPool _pool;
enum _max_block_size = BGZF_MAX_BLOCK_SIZE * 2;
alias Task!(decompressBgzfBlock, BgzfBlock, BgzfBlockCache)
alias Task!(decompressBgzfBlock, BgzfBlock)
DecompressionTask;
DecompressionTask[] _task_buf;
@ -389,7 +389,7 @@ class BgzfInputStream : Stream {
}
DecompressionTask tmp = void;
tmp = scopedTask!decompressBgzfBlock(b.block, _cache);
tmp = scopedTask!decompressBgzfBlock(b.block);
auto t = _task_buf.ptr + _offset / _max_block_size;
import core.stdc.string : memcpy;
memcpy(t, &tmp, DecompressionTask.sizeof);

Loading…
Cancel
Save