From 8ced9d2a0efaca8f6dbdaf427be1db52844787b5 Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Tue, 30 Jun 2020 12:25:27 -0700 Subject: Clean up unused code for IR object ownership (#1416) There was a small but non-trivial amount of code across `IRModule`, the `ObjectScopeManager`, and `StringRepresentationCache` that had to do with managing the lifetimes of `RefObject`s that might be referenced by IR instructions (and thus need to be kept alive for the lifetime of the IR module). We have long since migrated to a model where IR instruction do not include owned references to `RefObject`s, so these facilities weren't actually needed. This streamlines `IRModule`'s declaration, and trims code that we aren't actually using. One note for the future is that the `StringRepresentationCache` no longer does what its name implies (it is not a cache of `StringRepresentation`s), so we should consider giving it a more narrowly scoped name. I didn't include that in this change because I wanted to keep the diffs narrow and easy to review. A follow-on renaming change should be trivial if/when we can agree on what the type should be called at this point. Alternatively, we could simply bake the functionality of `StringRepresentationCache` into he IR deserialiation logic itself, since that is the only code using it. --- source/core/slang-object-scope-manager.cpp | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 source/core/slang-object-scope-manager.cpp (limited to 'source/core/slang-object-scope-manager.cpp') diff --git a/source/core/slang-object-scope-manager.cpp b/source/core/slang-object-scope-manager.cpp deleted file mode 100644 index 2e7b7dfe3..000000000 --- a/source/core/slang-object-scope-manager.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include "slang-object-scope-manager.h" - -namespace Slang { - -void ObjectScopeManager::_releaseAll() -{ - RefObject*const* objs = m_objs.begin(); - const Index numObjs = m_objs.getCount(); - for (Index i = 0; i < numObjs; ++i) - { - objs[i]->decreaseReference(); - } -} - -void ObjectScopeManager::clear() -{ - _releaseAll(); - // Free the memory as well as resizing - m_objs = List(); -} - -} // namespace Slang - -- cgit v1.2.3