remove arena_push_contiguous
This commit is contained in:
parent
3bf5af34b4
commit
e77b973b02
2 changed files with 6 additions and 17 deletions
11
src/mem.cpp
11
src/mem.cpp
|
@ -191,17 +191,6 @@ T *arena_push_nozero(Arena *arena)
|
||||||
return arena_push_array_nozero<T>(arena, 1);
|
return arena_push_array_nozero<T>(arena, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal
|
|
||||||
u8 *arena_push_contiguous(Arena *arena, u64 size)
|
|
||||||
{
|
|
||||||
b32 restore = arena->grow;
|
|
||||||
arena->grow = 0;
|
|
||||||
void *mem = arena_push_impl(arena, size);
|
|
||||||
arena->grow = restore;
|
|
||||||
if (!mem) fprintf(stderr, "Failed to allocate %lu bytes of contiguous memory\n", size);
|
|
||||||
return (u8 *)mem;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal
|
internal
|
||||||
u64 arena_pos(Arena *arena)
|
u64 arena_pos(Arena *arena)
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,14 +21,14 @@ ROOT::Experimental::RNTupleDescriptor create_descriptor(Arena *arena, RMicroFile
|
||||||
const RNTuple_Anchor &anchor = info.anchor;
|
const RNTuple_Anchor &anchor = info.anchor;
|
||||||
|
|
||||||
// Read compressed header+footer
|
// Read compressed header+footer
|
||||||
u8 *header_zip = arena_push_contiguous(scratch.arena, anchor.fNBytesHeader);
|
u8 *header_zip = arena_push_array_nozero<u8>(scratch.arena, anchor.fNBytesHeader);
|
||||||
u8 *footer_zip = arena_push_contiguous(scratch.arena, anchor.fNBytesFooter);
|
u8 *footer_zip = arena_push_array_nozero<u8>(scratch.arena, anchor.fNBytesFooter);
|
||||||
reader.ReadBuffer(header_zip, anchor.fNBytesHeader, anchor.fSeekHeader);
|
reader.ReadBuffer(header_zip, anchor.fNBytesHeader, anchor.fSeekHeader);
|
||||||
reader.ReadBuffer(footer_zip, anchor.fNBytesFooter, anchor.fSeekFooter);
|
reader.ReadBuffer(footer_zip, anchor.fNBytesFooter, anchor.fSeekFooter);
|
||||||
|
|
||||||
// Decompress header+footer
|
// Decompress header+footer
|
||||||
u8 *header = arena_push_contiguous(scratch.arena, anchor.fLenHeader);
|
u8 *header = arena_push_array_nozero<u8>(scratch.arena, anchor.fLenHeader);
|
||||||
u8 *footer = arena_push_contiguous(scratch.arena, anchor.fLenFooter);
|
u8 *footer = arena_push_array_nozero<u8>(scratch.arena, anchor.fLenFooter);
|
||||||
RNTupleDecompressor::Unzip(header_zip, anchor.fNBytesHeader, anchor.fLenHeader, header);
|
RNTupleDecompressor::Unzip(header_zip, anchor.fNBytesHeader, anchor.fLenHeader, header);
|
||||||
RNTupleDecompressor::Unzip(footer_zip, anchor.fNBytesFooter, anchor.fLenFooter, footer);
|
RNTupleDecompressor::Unzip(footer_zip, anchor.fNBytesFooter, anchor.fLenFooter, footer);
|
||||||
|
|
||||||
|
@ -44,12 +44,12 @@ ROOT::Experimental::RNTupleDescriptor create_descriptor(Arena *arena, RMicroFile
|
||||||
// Read page list
|
// Read page list
|
||||||
u64 page_list_zip_size = cgdesc.GetPageListLocator().fBytesOnStorage;
|
u64 page_list_zip_size = cgdesc.GetPageListLocator().fBytesOnStorage;
|
||||||
u64 page_list_seek = cgdesc.GetPageListLocator().GetPosition<u64>();
|
u64 page_list_seek = cgdesc.GetPageListLocator().GetPosition<u64>();
|
||||||
u8 *page_list_zip = arena_push_contiguous(scratch.arena, page_list_zip_size);
|
u8 *page_list_zip = arena_push_array_nozero<u8>(scratch.arena, page_list_zip_size);
|
||||||
reader.ReadBuffer(page_list_zip, page_list_zip_size, page_list_seek);
|
reader.ReadBuffer(page_list_zip, page_list_zip_size, page_list_seek);
|
||||||
|
|
||||||
// Decompress page list
|
// Decompress page list
|
||||||
u64 page_list_len = cgdesc.GetPageListLength();
|
u64 page_list_len = cgdesc.GetPageListLength();
|
||||||
u8 *page_list = arena_push_contiguous(scratch.arena, page_list_len);
|
u8 *page_list = arena_push_array_nozero<u8>(scratch.arena, page_list_len);
|
||||||
RNTupleDecompressor::Unzip(page_list_zip, page_list_zip_size, page_list_len, page_list);
|
RNTupleDecompressor::Unzip(page_list_zip, page_list_zip_size, page_list_len, page_list);
|
||||||
|
|
||||||
// Deserialize page list
|
// Deserialize page list
|
||||||
|
|
Loading…
Reference in a new issue