From 0399d992e21128a2c4b676e8f5456981ccfa6469 Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 2 May 2018 15:11:04 -0400 Subject: Speedup type checking using cached overload resolution results. This change adds caches to built-in operator overload resolution and type coersion to avoid running these time-consuming operations every time. - Adds `TypeCheckingCache` type, which is defined in check.cpp, that contains two dictionaries for the cached results of `ResolveInvoke` and `CanCoerce` calls. - Add `destroyTypeCheckingCache` and `getTypeCheckingCache` methods to `Session` class to reuse these cached results over the entire session. --- source/slang/slang.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source/slang/slang.cpp') diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp index 9e740d5f5..3cb580f00 100644 --- a/source/slang/slang.cpp +++ b/source/slang/slang.cpp @@ -823,6 +823,8 @@ Session::~Session() irBasicBlockType = nullptr; constExprRate = nullptr; + destroyTypeCheckingCache(); + builtinTypes = decltype(builtinTypes)(); // destroy modules next loadedModuleCode = decltype(loadedModuleCode)(); -- cgit v1.2.3