Commit Graph

4151 Commits

Author SHA1 Message Date
Vladimir Ivanov fd02802028 [Native] Export KDoc into generated native header 2021-03-09 16:50:23 +03:00
Mads Ager 7dbb0c7d20 [IR] Make IrGetObjectValue copyable to avoid duplicate IR nodes.
Fixes KT-45170
2021-03-09 09:48:16 +03:00
Mads Ager e5631addf3 [IR] Move annotations from original to new constructor declarations.
LocalDeclarationsLowering did not move annotations when creating
a new constructor declaration, thereby losing the annotations.

Fixes KT-45298
2021-03-05 12:24:38 -08:00
Alexander Udalov 566f97ae3e JVM IR: remove dependency of 'backend.jvm' on 'psi2ir', 'ir.serialization.jvm'
Add a new module 'backend.jvm.entrypoint' which depends on psi2ir and
contains code that runs psi2ir + JVM IR backend with serialization
implementations.

Hopefully this will allow to compile these modules in parallel and
reduce the build time.
2021-03-05 20:46:33 +01:00
Alexander Udalov 5e0860ca14 IR: move PsiSourceManager, PsiErrorBuilder to ir.backend.common 2021-03-05 20:46:33 +01:00
Alexander Udalov bec4d1903b IR: move PsiFileEntry to ir.tree, rename to PsiIrFileEntry 2021-03-05 20:46:33 +01:00
Alexander Udalov 1f8de46b3c JVM IR: do not depend on StubGeneratorExtensions in backend
Move most of the implementation from JvmGeneratorExtensions to
JvmGeneratorExtensionsImpl. The latter implements
StubGeneratorExtensions from psi2ir, and doing so helps to remove direct
dependency on this part of psi2ir from backend.
2021-03-05 20:46:33 +01:00
Alexander Udalov 22d269a0a8 Minor, rename JvmGeneratorExtensions.kt -> JvmGeneratorExtensionsImpl.kt
To keep git history for this file after the subsequent commit, where
most of the implementation is moved to JvmGeneratorExtensionsImpl.
2021-03-05 20:46:33 +01:00
Alexander Udalov f332192de8 IR: remove SourceManager, make PsiSourceManager a singleton 2021-03-05 20:46:33 +01:00
Roman Artemev 9bdfbc948c [KLIB] Support assignable value parameters in deserializer
- fix KT-44945
2021-03-05 13:47:07 +03:00
Shagen Ogandzhanian 2a170652c5 Don't create IIFE for varags at all when it possible
^KT-40689 fixed
2021-03-02 22:13:32 +03:00
Shagen Ogandzhanian cac57e4178 Don't create externalVarargReceiverTmp when there's no need to create it
^KT-40689 fixed
2021-03-02 22:13:31 +03:00
Shagen Ogandzhanian 6255f2bd77 Simplify JsInvocation in case we not it's Array
^KT-40689 fixed
2021-03-02 22:13:30 +03:00
Shagen Ogandzhanian e98413740b Pass scope to the call of iifeFun only when it make sense
^KT-40689 fixed
2021-03-02 22:13:29 +03:00
Shagen Ogandzhanian 1dbe7d12a2 Simplify concatElements resolution for size=0 and size=1 cases
^KT-40689 fixed
2021-03-02 22:13:28 +03:00
Shagen Ogandzhanian bcfc0c21b1 Don't add to the concatenation chain empty arraysForConcat at all
^KT-40689 fixed
2021-03-02 22:13:26 +03:00
Shagen Ogandzhanian d71fa4831d Filter out empty arrays before concatentating
^KT-40689 fixed
2021-03-02 22:13:25 +03:00
Shagen Ogandzhanian 31f5bcfaef Minor cosmetic readability fixes in VarargLowering
^KT-40689 fixed
2021-03-02 22:13:24 +03:00
Shagen Ogandzhanian c996161db0 Unroll any constructor call if argument is JsArrayLiteral
^KT-40689 fixed
2021-03-02 22:13:23 +03:00
Shagen Ogandzhanian 997d23eb43 Simplify signatures for arrays in argumentsWithVarargAsSingleArray
^KT-40689 fixed
2021-03-02 22:13:22 +03:00
Dmitriy Novozhilov 245bc7c8e2 [FIR2IR] Fix interpreting constants from const properties from other module 2021-03-02 19:11:26 +03:00
Anton Bannykh 87f3ca3f36 IR: make isExternal immutable 2021-03-02 14:30:18 +03:00
Anton Bannykh b0e0e62c0b Propagate isExternal flag in Psi2Ir and deserializer 2021-03-02 14:30:16 +03:00
Anton Bannykh 027f656790 JS IR: make PIR Carriers immutable 2021-03-02 14:30:15 +03:00
Mikhael Bogdanov 49aa36b70d Generate local delegated properties in interface in jvm-default all modes 2021-03-01 16:20:20 +01:00
Mikhael Bogdanov 8764bb09f2 Generate synthetic annotation method in interface if -Xjvm-default is on 2021-03-01 16:20:19 +01:00
Alexander Udalov acc2256de9 IR: support smart cast values in RangeContainsLowering
#KT-44878 Fixed
2021-02-25 21:00:09 +01:00
Alexander Udalov 820762ca16 IR: add isUnsignedType/getUnsignedType 2021-02-25 21:00:09 +01:00
Alexander Udalov 0ebdf7c3c4 IR: add getPrimitiveType, optimize some usages of isInt/isByte/... 2021-02-25 21:00:09 +01:00
Ilmir Usmanov d67e4f0c48 Rename inline class -> @JvmInline value class in stdlib and compiler 2021-02-25 16:06:51 +01:00
Alexander Udalov b417786fd4 JVM IR: do not hide constructor with inline class in anonymous object
#KT-45131 Fixed
2021-02-25 14:44:16 +01:00
Alexander Udalov 7e149a3a44 IR: remove unneeded dependencies on psi2ir 2021-02-24 19:07:38 +01:00
Alexander Udalov e69cc183a4 IR: remove dependency of 'ir.tree' on 'frontend' 2021-02-24 19:07:38 +01:00
Alexander Udalov addabae8d2 IR: move frontend-dependent code into implementations in psi2ir 2021-02-24 19:07:38 +01:00
Alexander Udalov d991a3e40f IR: simplify initialization cycle of TypeTranslator/ConstantValueGenerator 2021-02-24 19:07:38 +01:00
Alexander Udalov 5ea3d32b98 IR: remove TranslationPluginContext.bindingContext
This removes another dependency of 'ir.tree' on 'frontend', and among
other things, makes it possible to implement TranslationPluginContext
for FIR in the future.
2021-02-24 19:07:38 +01:00
Alexander Udalov 274e0ad136 IR: remove unused dependency on BindingContext 2021-02-24 19:07:37 +01:00
Alexander Udalov 837eb739ea IR: move CompilationErrorException to frontend.common 2021-02-24 19:07:37 +01:00
Alexander Udalov 1ae46b529f IR: move ExpectDeclarationRemover to ir.backend.common 2021-02-24 19:07:37 +01:00
Alexander Udalov ca5a35b4b3 Move CompilerEnvironment from 'frontend' to 'cli'
This is needed in order to have a single convenient place where to
register frontend services implemented _outside_ of the 'frontend'
module, such as the control flow analysis, extracted to a separate
module in a subsequent commit.
2021-02-24 17:17:03 +01:00
Mikhail Glukhikh a9b9cced15 IrInterpret: remove thread creation / joining (performance fix) 2021-02-24 18:56:06 +03:00
Anton Bannykh df62b5e311 JS IR: special origins for declaration created during lowerings
Otherwise the lazy properties lowering may try to process them
2021-02-24 18:32:56 +03:00
Mads Ager 8852323a76 [PSI2IR] Do not generate property reference setter if inaccessible.
Fixes KT-45064.
2021-02-23 19:33:49 +01:00
Ilmir Usmanov d44799fa78 JVM IR: Use INVOKESPECIAL instead of INVOKEVIRTUAL for default private
suspend functions.

 #KT-26592
2021-02-23 18:49:10 +01:00
Ilmir Usmanov 3ee62cb1b2 JVM IR: Do not generate private suspend functions as synthetic package-private
#KT-26592
2021-02-23 18:49:06 +01:00
Alexander Udalov e6476c39ca JVM IR: fix isMarkedNullable for nullability-flexible types
Since nullability-flexible types in IR are represented by an annotation
on an IrSimpleType, not a special instance, the common implementation of
`KotlinTypeMarker.isMarkedNullable` in `TypeSystemContext` doesn't work.

This method is used for example to generate `typeOf` in JVM IR, in
`TypeSystemCommonBackendContext.generateTypeOf`, and this issue led to a
difference in behavior of `typeOf` for nullability-flexible types.

 #KT-44726 Fixed
2021-02-22 12:52:48 +01:00
Dmitry Petrov 387d84f826 JVM_IR indy-SAM: KT-45069 box lambda 'Unit' return type if needed 2021-02-20 15:07:24 +03:00
Ilya Goncharov 187d4998fa [JS IR] Not cast to declaration parent in JsCodeOutlineLowering, use parent otherwise
^KT-45057 fixed
2021-02-20 13:08:45 +03:00
Ilya Goncharov bd2601f289 [JS IR] Extract adding of function call to another function
[JS IR] Add option for dce mode

[JS IR] Add logging to non useful declarations if appropriate dce mode

[JS IR] Add mode with throwing exception

[JS IR] unreachableDeclaration method is in rootDeclarations

[JS IR] Add js extra help arg with dce mode and include debug.kt to compile unreachableMethod

[JS IR] unreachableDeclaration as internal to not reproduce stdlib api

[JS IR] Fix description of dce mode argument

- Use console.error instead of console.log
- Use JsError instead Kotlin exception for lightweight

[JS IR] Remove body for throwing exception

[JS IR] Remove default parameter in unreachableDeclaration

[JS IR] Process without removing fields and declaration containers

[JS IR] Rename dce mode on dce runtime diagnostic

[JS IR] Use console.trace instead of console.error

[JS IR] Extract JsError

- Fix naming in prependFunctionCall
- Fix description on runtime diagnostic argument
- Using message collector instead of throwing exception

[JS IR] Distinguish unreachableMethods for log and exception

[JS IR] Extract checking of Kotlin packages of IrField

^KT-45059 fixed
2021-02-20 12:05:06 +03:00
Alexander Udalov 56f9e3360f JVM IR: do not generate invokeinterface hashCode if smart cast is present
#KT-45008 Fixed
2021-02-19 14:21:54 +01:00