From 3c505c22673701339d35eb2151f01c16eb3c78c3 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Fri, 14 Sep 2018 14:16:28 -0400 Subject: Improvements around IR representation and memory usage (#635) * * Remove dispose from IRInst * Use MemoryArena instead of MemoryPool * Make all IRInst not require Dtor - by having ref counted array store ptrs that need freeing * Increase block size - typically compilation is 2Mb of IR space(!) * Fix issues around StringRepresentation::equal because null has special meaning. * Don't bother to construct as String to compare StringRepresentation, just used UnownedStringSlice. * Added fromLiteral support to UnownedStringSlice and use instead of strlen version. * Use more conventional way to test StringRepresentation against a String. * Fix gcc/clang template problem with cast. --- source/core/slang-memory-arena.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source/core/slang-memory-arena.cpp') diff --git a/source/core/slang-memory-arena.cpp b/source/core/slang-memory-arena.cpp index 4d8b2ed2a..a0a89155c 100644 --- a/source/core/slang-memory-arena.cpp +++ b/source/core/slang-memory-arena.cpp @@ -222,6 +222,16 @@ MemoryArena::Block* MemoryArena::_newBlock(size_t allocSize, size_t alignment) return block; } +void* MemoryArena::_allocateAlignedFromNewBlockAndZero(size_t sizeInBytes, size_t alignment) +{ + void* mem = _allocateAlignedFromNewBlock(sizeInBytes, alignment); + if (mem) + { + ::memset(mem, 0, sizeInBytes); + } + return mem; +} + void* MemoryArena::_allocateAlignedFromNewBlock(size_t size, size_t alignment) { // Make sure init has been called (or has been set up in parameterized constructor) -- cgit v1.2.3