Commit Graph

47 Commits

Author SHA1 Message Date
Marco Pennekamp 38ebe60e9f [FIR] Refactoring: Move set utility functions to setUtils.kt 2023-10-25 11:04:36 +00:00
Marco Pennekamp 8034d522b9 [LL FIR] Respect allowKotlinPackage in LLFirKotlinSymbolNamesProvider
- `LLFirProviderHelper` is guarded by `allowKotlinPackage` and the
  symbol names provider should reflect that in the name sets.
- Note that this does not apply to stub-based deserialized symbol
  providers, because they do not pass any value to `allowKotlinPackage`.

^KT-57314
2023-10-25 11:04:36 +00:00
Dmitriy Novozhilov 704e2ef5c5 Suppress K2 specific warnings in the codebase
^KT-62472
2023-10-18 07:59:27 +00:00
Dmitriy Novozhilov 6114e4f068 Fix compilation problems caused by migration to 2.0 2023-10-18 07:59:27 +00:00
Dmitriy Novozhilov 9e5ee3afa0 [FE] Add isLocal name to ClassId constructor calls where it needed 2023-09-21 12:40:44 +00:00
Marco Pennekamp e76692ef8d [LL FIR] KT-58257 Implement active session invalidation
- This commit replaces session modification trackers with event-based
  session invalidation. The removal of modification trackers should
  improve overall performance, because session invalidation events
  happen less frequently than sessions are accessed. Getting rid of
  modification trackers also allows sessions to refer to other sessions
  lazily, which is essential when cyclic dependencies occur.
- The new `LLFirSession` validity tracker has constant complexity and
  will not cause the same kind of performance issues as dependency
  modification trackers. It is a bridge to support modification trackers
  in certain parts of the code (e.g. for `CachedValue`s), while being
  backed by event-based invalidation.
- `LLFirSessionInvalidationService` is the bridge between modification
  events and `LLFirSessionCache`. It finds out which modules should be
  invalidated and instructs the session cache to remove the associated
  sessions.
- Session invalidation must always happen in a write action to preserve
  consistency between sessions. Otherwise, while a session A is already
  removed from the cache, it might still be referenced by a dependent
  session B which is in the process of being invalidated. Such a session
  must never be returned from `getSession`.

^KT-57515 fixed
2023-07-31 15:58:00 +00:00
Marco Pennekamp 017784d24f [LL FIR] KT-60570 Use emptySet in Kotlin symbol names provider to conserve memory
- As mentioned in KT-60570, memory consumption in cached symbol names
  providers is caused partially by lots of instances of empty mutable
  sets. This commit replaces such sets with the `emptySet()` singleton.
- This improvement also makes sense for callable names because the IDE
  "package names with top-level callables" set currently contains all
  package names in the project.
- In my local tests of the `setUp` Find Usages performance test, the
  retained size of `FirDelegatingCachedSymbolNamesProvider` is cut down
  from 208MB to 170MB by the empty class name set optimization, and from
  170MB to 115MB by the empty callable name set optimization.
2023-07-26 19:03:20 +00:00
aleksandrina-streltsova ca25162574 [AA] implement isExpect/isActual for KtClassLikeSymbol
KT-54846
2023-07-24 17:24:41 +00:00
Ilya Kirillov a9cd881a07 [FIR] add utilities to FIR compiler to throw error with attachment 2023-07-18 11:49:20 +00:00
Ilya Kirillov c5014d4765 Move PsiElement.getElementTextWithContext to psi module with small adjustments
* replace existing function (the new one makes it more clear which element was printed)
* prints position for element
* handles invalid psi element
2023-07-18 11:49:20 +00:00
Ilya Kirillov 2d791eb292 Rename buildErrorWithAttachment -> errorWithAttachment to emphasise the similar semantics to kotlin.error 2023-07-18 11:49:20 +00:00
Ilya Kirillov 15f6fe2627 Move ExceptionAttachmentBuilder near KotlinExceptionWithAttachments so it's accessible from KotlinExceptionWithAttachments 2023-07-18 11:49:20 +00:00
Ilya Kirillov 25911b1fec Move SmartPrinter to kotlin.core.util.runtime so it's accessible from KotlinExceptionWithAttachments 2023-07-18 11:49:20 +00:00
Ilya Kirillov 6f429ec072 [Analysis] migrate ExceptionAttachmentBuilder to use SmartPrinter
So it can be moved to a compiler module
2023-07-18 11:49:20 +00:00
Yan Zhulanow e9c077220f [LL API] Migrate 'getKtModule()' usages to 'ProjectStructureProvider'
Ensure the contextual module is passed wherever possible.

^KT-57559 Fixed
2023-05-16 08:42:57 +00:00
Marco Pennekamp 73d99019bd [AA] KT-57515 Add createCompositeModificationTracker 2023-04-17 11:20:52 +00:00
Yan Zhulanow ef4a6168f1 [LL API] Minor, wrap an 'IdentityHashMap' into a set 2023-03-14 09:46:41 +00:00
Yan Zhulanow 5c9a9913db [LL API] Refactor session caches
Use 'CachedValue' and dependency handling with 'ModificationTracker'
for dependent session invalidation.
2023-03-14 09:46:40 +00:00
Marco Pennekamp e70a3a899f [AA] Move classIdIfNonLocal to analysis-internal-utils
- The utility will be needed by a `KtFir*Symbol` class.
2023-03-09 18:35:56 +00:00
Ilya Kirillov fbcaf3efeb [Analysis API] add information about KtModule to reported exceptions 2023-02-17 14:19:09 +00:00
Ilya Kirillov c37ee83791 [Analysis API] add more debug info to "pointer already disposed" error 2023-02-17 14:19:08 +00:00
Ilya Kirillov 8b286577c7 [Analysis API] do not throw exception when KtCall is improperly resolved
Log the exception instead. This way the analysis of the file will not be stuck after finding an improperly resolved call
2023-02-03 07:06:07 +00:00
Anna Kozlova 30fd34c2d7 [CLI] free cached values
^ KTIJ-24447
2023-02-02 08:03:05 +00:00
Ilya Kirillov d7ee312b83 [Analysis API] do not rethrow java.lang.Error
Errors as OutOfMemoryError should not be caught or wrapped
2022-12-14 08:33:05 +00:00
Ilya Kirillov a297240870 [LL FIR] fix a memory leak from LLFirNonUnderContentRootSessionFactory 2022-12-06 23:05:27 +00:00
Ilya Kirillov 7a89ca495c [LL FIR] do not execute resolve under a non-cancellable session
The sessions are invalidated on the PCE
2022-12-06 21:20:41 +00:00
Ilya Kirillov d1eb7c51f1 [Analysis API] rework renderer
^KTIJ-23268 fixed
2022-11-11 11:59:58 +01:00
Ilya Kirillov fceb3425c8 [Analysis API FIR] fix invalid usages of CachedValue
it should not cache map as values are stored on soft references
2022-10-05 15:53:54 +00:00
Ilya Kirillov 86670361a1 [Analysis] do not fail when reporting exception with invalid psi as attachment 2022-09-30 12:19:51 +02:00
Ilya Kirillov 913bfc0838 [Low Level FIR] fix one case in CME when traversing FIR tree
Before extra child nodes of classes were visited during declaration by ClassId search.
If some other thread was mutating this tree, CME could happen

this is a fix of one case from ^KTIJ-21791
2022-09-30 12:19:35 +02:00
Dmitry Gridin 8dbdea39da [analysis] remove redundant diagnostic suppression 2022-08-15 11:04:58 +02:00
Ilya Kirillov 9f1ecdfaa1 [LL FIR] add lazy resolve check to ensure that all nested declarations are resolved
This bow includes: value parameters, property accessors and class members;
before, only class members was checked
2022-08-10 22:49:17 +02:00
Ilya Kirillov 75787be2f8 [Analysis] change null element rendering in exceptions to distinguish will "null" strings 2022-08-10 22:49:17 +02:00
Ilya Kirillov f45f1ba3dc [Analysis API] do not create multiple attachments inside exceptions 2022-08-10 22:49:14 +02:00
Ilya Kirillov 6be2483824 [Analysis API FIR] rethrow IndexNotReadyException 2022-08-04 14:33:44 +00:00
Ilya Kirillov 91cf194a94 [LL FIR] incrementally update module caches 2022-07-24 15:37:44 +02:00
Ilya Kirillov 76f1744868 [Analysis API FIR] add more info to some exceptions 2022-07-23 19:54:47 +02:00
Ilya Kirillov 827c262f68 [Analysis API FIR, LL FIR] use exceptionWithAttachment to not leak user data 2022-07-23 17:08:22 +02:00
Ilya Kirillov 38c6d4b740 [LL FIR] correctly handle facade conflicts in module dependencies 2022-07-19 17:17:34 +02:00
Ilya Kirillov 86605c066b [Analysis API] move PSI utils to internal-utils module 2022-06-24 10:41:05 +02:00
Ilya Kirillov 7b1765cc8b [Analysis API] introduce base KtTypeScope -> KtScope converter 2022-06-22 09:31:42 +02:00
Ilya Kirillov 2649788b87 [analysis api fir] put every library into a separate KtModule in tests 2022-04-13 12:53:22 +02:00
Ilya Kirillov d926dda27f Analysis API FIR: introduce declarations from library resolve
^KT-50252 fixed
2022-01-31 21:11:52 +01:00
Ilya Kirillov abf7a4c5ac Introduce ConcurrentMapBasedCache 2021-12-27 16:23:17 +03:00
Vyacheslav Gerasimov f7a9065b75 Build: Use intellij maven repo instead of downloaded IDEA
#KTI-82
2021-12-16 21:48:23 +03:00
Ilya Kirillov 9cb950a2ae Analysis API: extract PrettyPrinter from DebugSymbolRenderer to utils 2021-12-02 20:09:17 +01:00
Ilya Kirillov dd9a96a12f FIR LC: fix light facade caching 2021-11-05 15:46:07 +01:00