summaryrefslogtreecommitdiffstats
path: root/source/core
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2022-09-13 13:11:48 -0700
committerGitHub <noreply@github.com>2022-09-13 13:11:48 -0700
commitf216b77752b9e4aea52882b2110ceb1cc64a2171 (patch)
treefbb33485b7260bc0f89b406e1be6fb8196f94196 /source/core
parent9f3e83cf0d664c87a618edf08d834829178030e6 (diff)
Deduplicate AST type nodes and cache lookup operations. (#2397)
* wip: dedup AST type nodes and cache lookup. * Fix. * Remove profiling. * Fixes. Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/core')
-rw-r--r--source/core/slang-array.h17
-rw-r--r--source/core/slang-short-list.h2
2 files changed, 19 insertions, 0 deletions
diff --git a/source/core/slang-array.h b/source/core/slang-array.h
index 2647e163f..8d22e1848 100644
--- a/source/core/slang-array.h
+++ b/source/core/slang-array.h
@@ -125,6 +125,23 @@ namespace Slang
insertArray(rs, args...);
return rs;
}
+
+
+ template<typename TList>
+ void addToList(TList&)
+ {
+ }
+ template<typename TList, typename T>
+ void addToList(TList& list, T node)
+ {
+ list.add(node);
+ }
+ template<typename TList, typename T, typename ... TArgs>
+ void addToList(TList& list, T node, TArgs ... args)
+ {
+ list.add(node);
+ addToList(list, args...);
+ }
}
#endif
diff --git a/source/core/slang-short-list.h b/source/core/slang-short-list.h
index 7d51a8abf..5bad9faf8 100644
--- a/source/core/slang-short-list.h
+++ b/source/core/slang-short-list.h
@@ -288,6 +288,8 @@ namespace Slang
void addRange(ArrayView<T> list) { addRange(list.m_buffer, list.m_count); }
+ void addRange(ConstArrayView<T> list) { addRange(list.m_buffer, list.m_count); }
+
template<int _otherShortListSize, typename TOtherAllocator>
void addRange(const ShortList<T, _otherShortListSize, TOtherAllocator>& list)
{