Commit Graph

4219 Commits

Author SHA1 Message Date
Ivan Kylchik 77539fe2db Add visitExpressionBody method to IrCompileTimeChecker
This method is needed to explicitly indicate that IrExpressionBody can
be interpreted in any evaluation mode.
2021-03-24 21:24:17 +01:00
Igor Chevdar 246a907753 [FE][PSI2IR] Generalized SamType
Operations regarding <fun interface> are common for all backends
2021-03-24 20:42:40 +05:00
Dmitriy Novozhilov 50f2666eba [IR] Properly render type arguments in error messages 2021-03-24 12:56:14 +03:00
Dmitry Petrov 4f250ed498 JVM_IR KT-45377 rewrite constants again after AddContinuationLowering 2021-03-23 16:05:24 +03:00
Alexander Udalov b5f9b1dfc0 JVM IR: support inline classes with private constructors from other modules
#KT-44723 Fixed
2021-03-22 21:57:07 +01:00
Ilya Goncharov f85ad41674 [IR] Check pureness in inlining lowering after transformation 2021-03-19 21:52:51 +03:00
Ilya Goncharov 8ac8dbdab8 [JS IR] Type operator call pureness 2021-03-19 21:52:51 +03:00
Ilya Goncharov 47d050c420 [JS IR] Correct pureness of expressions for arrayLiteral 2021-03-19 21:52:50 +03:00
Ilya Goncharov f890156dde [JS IR] arrayConcat not use additional slice 2021-03-19 21:52:50 +03:00
Ilya Goncharov 76005813ff [JS IR] Fix for pureness of vararg 2021-03-19 21:52:50 +03:00
Ilya Goncharov 278a8c27fc [JS IR] Not create temporary variable for pure expressions on inline 2021-03-19 21:52:50 +03:00
Ilya Goncharov ece0e200d5 [JS IR] Not nullize external varargs if it is not on the end of call 2021-03-19 21:52:50 +03:00
Ilya Goncharov b8d5712bc0 [JS IR] Not use double slice for external varargs 2021-03-19 21:52:50 +03:00
Ilya Goncharov 120b5b9e05 [JS IR] Move isPure check to backend.common and add platform-specific check on calls with side effects 2021-03-19 21:52:50 +03:00
Ilya Goncharov 7bbb5b77db [JS IR] Concat varargs with non varargs on compile time for function w/o receiver 2021-03-19 21:52:50 +03:00
Ilya Goncharov fc559ab0cd [JS IR] Unite varargs and non varargs before vararg 2021-03-19 21:52:49 +03:00
Dmitry Petrov 9e30ddd12e JVM_IR KT-45581 generate H_INVOKEINTERFACE for interface method handles 2021-03-19 18:57:21 +03:00
Dmitry Petrov 73d4fa65ea JVM_IR KT-45431 don't optimize out $$delegatedProperties in companion
Corresponding delegates are initialized in the host class, using
'$$delegatedProperties'.
TODO figure out proper code generation scheme for delegated properties
in companions (KT-45580)
2021-03-19 18:54:01 +03:00
Dmitry Petrov f6baabd98e JVM_IR KT-45408 rewrite static calls recursively 2021-03-19 18:53:59 +03:00
Alexander Udalov e5f218859b JVM IR: minor, improve error messages for inline classes
It will help in diagnosing problems like KT-44723.
2021-03-19 16:33:42 +01:00
Ilya Goncharov 88abb3d6c9 [JS IR] Fix creating of classes extended from nested one
[JS IR] Extract getClassRef method

 ^KT-44950 fixed
2021-03-18 21:14:00 +03:00
Dmitry Petrov 17da240910 JVM_IR KT-45195 generate non-static annotation members as ACC_ABSTRACT 2021-03-18 19:41:24 +03:00
Steven Schäfer d0424465b8 JVM IR: Resolve fake overrides when calculating return types (KT-44867) 2021-03-18 16:02:35 +01:00
Roman Artemev 44d03bc727 [Psi2Ir] Fix generation of property references for synthetic java props
- Declare it on use-site
 - Fix export checker for that case
 - Fix KT-45297
2021-03-18 16:50:31 +03:00
Dmitry Petrov ac6232b4ba JVM_IR KT-36853 patch parents after tailrecPhase 2021-03-18 15:19:24 +03:00
Svyatoslav Kuzmich 6bd34db725 [JS IR] Fix kotlin.js.js with complex constant expressions
Use IR interpreter to evaluate complex constexprs
2021-03-17 15:12:18 +03:00
Steven Schäfer bf2942b5cc JVM IR: Add Object.clone to JvmSymbols
The `clone` function is not available in the builtin classes created
from fir.
2021-03-16 21:30:18 +01:00
Steven Schäfer 99a4779c6b JVM IR: Don't produce line numbers in synthetic Enum members 2021-03-16 21:30:18 +01:00
Steven Schäfer 5be00cfa04 JVM IR: Don't use null checks in Enum.valueOf 2021-03-16 21:30:18 +01:00
Steven Schäfer bea1a8c422 JVM IR: Use Object.clone in Enum.values 2021-03-16 21:30:18 +01:00
Georgy Bronnikov bff6e9b972 IR: document lock priority. 2021-03-16 19:49:31 +03:00
Georgy Bronnikov 42279c3b5b IR: introduce IrLock
Use a single lock object for synchronization to avoid deadlocks.
2021-03-16 19:49:30 +03:00
Georgy Bronnikov 78d62dcb1e JVM_IR: use ConcurrentHashMap in codegen where appropriate 2021-03-16 19:49:30 +03:00
Georgy Bronnikov 3a10ea4f88 JVM_IR: synchronize code generation for inline functions 2021-03-16 19:49:29 +03:00
Georgy Bronnikov c7feaee8ae IR: make copying optional in performByIrFile
For codegen phases, input files are readonly data. There is no need to
copy them.
2021-03-16 19:49:29 +03:00
Georgy Bronnikov fe4d33dcb1 JVM_IR: make codegen a phase 2021-03-16 19:49:29 +03:00
Dmitry Petrov decfaa3ba5 JVM_IR KT-44993 preserve inner expression type when fusing if-null 2021-03-16 15:30:45 +03:00
Denis.Zharkov 74ecae7f6d IR: Optimize IrSimpleFunction::collectRealOverrides 2021-03-16 09:28:52 +03:00
Denis.Zharkov 1a36ee2110 IR: Postpone computing real fake overrides at SyntheticAccessorLowering 2021-03-16 09:28:52 +03:00
Denis.Zharkov f141c276be IR: Avoid recomputing Symbols::progressionElementTypes 2021-03-16 09:28:52 +03:00
Dmitry Petrov d74168fb8f PSI2IR KT-44414 fix adapted reference to imported object member 2021-03-15 21:24:25 +03:00
Alexander Udalov 83a4b6396a Deduplicate source roots in psi2ir and CLI
Compiler plugins can add new source roots to the next compilation round
by using `AnalysisResult.RetryWithAdditionalRoots`. Some plugins added
already existing source roots to this list in some cases. For example,
this is reproducible with `square/anvil` with incremental compilation
(KT-45100, KT-44925). Psi2ir didn't deduplicate the source files before,
which resulted in several classes with the same name linked to the same
symbol. This led to a "symbol is already bound" exception, and in case
of KT-44925, to an additional NPE when we were rendering the class to
display it in the message.

The solution is to deduplicate classes before psi2ir. Note that this
commit has two changes, in CLI and in psi2ir. Any one of these is
sufficient for fixing the problem, however both are made just to make it
more future-proof against new components and/or changes in existing
subsystems (e.g. fir2ir).

In the old JVM backend, similar deduplication was happening in
`ClassFileFactory.registerSourceFiles`, which is why the problem is not
reproducible there.

 #KT-45100 Fixed
2021-03-15 16:30:46 +01:00
Dmitry Petrov e630e00e99 JVM_IR KT-44744 check accessibility of enum entry 'this' 2021-03-15 17:26:49 +03:00
Ilmir Usmanov 149064803d JVM_IR: Do not unbox Result argument inside java SAM adapters
#KT-45259
2021-03-15 06:14:42 +01:00
Ilmir Usmanov 4099dfc7e0 JVM_IR: Do not unbox Result argument inside SAM adapters
#KT-45259 Fixed
2021-03-15 06:14:40 +01:00
Roman Artemev 0d8fff7186 [KLIB] Fix annotation type deserialization
Instead of hardcoded `Unit` restore it basing on annotation class and
constructor's type arguments
2021-03-12 19:03:04 +03:00
Roman Artemev 79935e29de [IR] Support type arguments in psi2ir 2021-03-12 19:02:29 +03:00
Roman Artemev b60ebc0975 [IR] Support type arguments on annotations in IR render 2021-03-12 19:00:11 +03:00
Mads Ager 8588412a56 [JVM IR] Support break in do-while condition.
This breaks from the loop itself which is inconsistent with
what happens for breaks in while conditions.

Also, the frontend will report that code after the loop is
unreachable, which it isn't. :-\

However, those issues are covered in
https://youtrack.jetbrains.com/issue/KT-17728, so for now
we follow the old backend to not "break" anyone. :)

Fixes KT-44412
2021-03-12 13:46:27 +01:00
pyos e06bacafad JVM: fix inline cycle detection
1. use the correct descriptor in the old backend;
 2. clear the temporary variables for arguments in the IR backend.

 #KT-45292 Fixed
2021-03-12 11:49:42 +01:00