diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2019-02-11 10:54:58 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-02-11 10:54:58 -0500 |
| commit | e13fdd8fe19f248a925232e918501f55dafa40d8 (patch) | |
| tree | 70170bc92b92ebef02ad0adcaaab8efbee02a59b /tools/slang-test | |
| parent | 1c969b9a85e2e6d6981a31bb758647fc61cf6482 (diff) | |
MemoryArena rewindability/Improved IRInst construction (#837)
* Make MemoryArena rewindable.
* Add test for rewinding MemoryArena
* Use memory rewinding in IRInst lookup instead of malloc/free.
* Small tidy.
* Don't bother recreating instruction if after lookup it's found it's new.
* Fix 32 bit signed compare issue.
Diffstat (limited to 'tools/slang-test')
| -rw-r--r-- | tools/slang-test/unit-test-memory-arena.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/tools/slang-test/unit-test-memory-arena.cpp b/tools/slang-test/unit-test-memory-arena.cpp index 1b09ae9e7..e993d4f7a 100644 --- a/tools/slang-test/unit-test-memory-arena.cpp +++ b/tools/slang-test/unit-test-memory-arena.cpp @@ -169,6 +169,21 @@ static void memoryArenaUnitTest() arena.reset(); blocks.Clear(); } + else if (var == 3) + { + arena.rewindToCursor(nullptr); + blocks.Clear(); + } + else if (var == 4) + { + // Rewind to a random position + int rewindIndex = randGen.nextInt32UpTo(int32_t(blocks.Count())); + // rewind to this block + arena.rewindToCursor(blocks[rewindIndex].m_data); + // All the blocks (includign this one) and now deallocated + blocks.SetSize(rewindIndex); + + } else { size_t usedMemory = arena.calcTotalMemoryUsed(); @@ -248,6 +263,12 @@ static void memoryArenaUnitTest() } } } + { + // Do lots of allocations and test out rewind + + + + } } -SLANG_UNIT_TEST("MemoryArena", memoryArenaUnitTest);
\ No newline at end of file +SLANG_UNIT_TEST("MemoryArena", memoryArenaUnitTest); |
