diff options
| author | Yong He <yonghe@outlook.com> | 2018-05-02 15:11:04 -0400 |
|---|---|---|
| committer | Yong He <yonghe@outlook.com> | 2018-05-02 18:20:32 -0400 |
| commit | 0399d992e21128a2c4b676e8f5456981ccfa6469 (patch) | |
| tree | 8ca5c144c438d95406eba5b41be3a3e689beb36a /source/slang/compiler.h | |
| parent | 60bcc6809f57e12f3705cc65cb325b0983b08899 (diff) | |
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.
Diffstat (limited to 'source/slang/compiler.h')
| -rw-r--r-- | source/slang/compiler.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source/slang/compiler.h b/source/slang/compiler.h index 4cda366f0..e7c40bdc8 100644 --- a/source/slang/compiler.h +++ b/source/slang/compiler.h @@ -445,6 +445,7 @@ namespace Slang char const* text, CodeGenTarget target); + struct TypeCheckingCache; // class Session @@ -535,6 +536,10 @@ namespace Slang Dictionary<Name*, SyntaxClass<RefObject> > mapNameToSyntaxClass; + // cache used by type checking, implemented in check.cpp + TypeCheckingCache* typeCheckingCache = nullptr; + TypeCheckingCache* getTypeCheckingCache(); + void destroyTypeCheckingCache(); // Session(); |
