Introduce runtime ClassValue-based cache for typeOf machinery

* Cache KType instances constructor from the given classifier
* For generics, cache KTypes with already substituted arguments
* It significantly speeds up all typeOf-based APIs, both accesses to typeOf and its related properties (i.e. classifier)

#KT-53508

Merge-request: KT-MR-6818
Merged-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
This commit is contained in:
Vsevolod Tolstopyatov
2022-08-09 18:40:32 +00:00
committed by Space
parent c84a70c654
commit fdd541c1e9
6 changed files with 124 additions and 27 deletions
@@ -44330,6 +44330,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/reflection/typeOf/annotatedType.kt");
}
@Test
@TestMetadata("caching.kt")
public void testCaching() throws Exception {
runTest("compiler/testData/codegen/box/reflection/typeOf/caching.kt");
}
@Test
@TestMetadata("classes.kt")
public void testClasses() throws Exception {