Commit Graph

4941 Commits

Author SHA1 Message Date
Ilmir Usmanov 63f6d515bc JVM_IR: Generate correct invoke of numbered suspend lambda
Instead of continuation type as last parameter's type, generate Object
type.
2019-09-19 19:28:05 +03:00
Ilmir Usmanov 587fcafc85 JVM_IR: Support continuation crossing inline lambda boundaries
I.E. generate fake continuation markers.
2019-09-19 19:28:03 +03:00
Mads Ager 507857d452 [IR] Support Collection<*>.indices in for loop lowering.
Unmute a couple of tests that are working as intended.
2019-09-18 19:00:17 +02:00
Steven Schäfer ce3ef4e4d0 Add more tests for inline class equality with nullable arguments 2019-09-18 18:52:58 +02:00
Steven Schäfer d8646e29b7 Add additional Result api test 2019-09-18 18:52:58 +02:00
Steven Schäfer 49efa5fbc4 Split up Result API boxing tests 2019-09-18 18:52:58 +02:00
Steven Schäfer b85b2d9af8 Add more tests for inline class equality 2019-09-18 18:52:58 +02:00
Steven Schäfer cdc5e1347b JVM: Avoid boxing in inline class equality 2019-09-18 18:52:58 +02:00
Steven Schäfer f53b28e8a3 JVM: Generate equals-impl0 method for inline classes 2019-09-18 18:52:58 +02:00
Steven Schäfer 2c7da67600 JVM IR: Avoid boxing in inline class equality 2019-09-18 18:52:58 +02:00
Steven Schäfer b85a475358 JVM IR: Generate equals-impl0 method for inline classes 2019-09-18 18:52:58 +02:00
Steven Schäfer 475079611d JVM IR: Avoid parameter null-checks in inline class impl methods 2019-09-18 18:52:58 +02:00
Steven Schäfer cdd3f82396 JVM IR: Use correct scope owner in JvmInlineClassLowering 2019-09-18 18:52:58 +02:00
Alexander Udalov aa77f6c245 Improve KParameter.toString for instance and extension receiver parameter
#KT-17860 Fixed
2019-09-18 14:05:43 +02:00
Alexander Udalov c69997491f JVM IR: generate file annotations on file facade classes 2019-09-18 14:05:28 +02:00
Ilmir Usmanov 0e3f0c98e5 JVM_IR: Support inline suspend lambdas 2019-09-17 19:19:27 +03:00
Dmitry Petrov 0531bd4fe6 KT-29229 Intrinsify 'in' operator for unsigned integer ranges
Support mixed type case, e.g., '[UByte] in [UIntRange]'.
2019-09-17 15:50:47 +03:00
Ilmir Usmanov 1951ff8054 JVM_IR: Minor. Unmute tests 2019-09-16 16:49:24 +03:00
Ilmir Usmanov a3284326af JVM_IR: Do not box/unbox result in continuations
Otherwise, it leads to CCE from kotlin/Result.
2019-09-16 16:49:22 +03:00
Ilmir Usmanov 402a77126f JVM_IR: Support inline suspend functions
Only no state-machine version for now.
2019-09-16 16:49:21 +03:00
Ilmir Usmanov 2ec3417e0e JVM_IR: Move suspend functions into view transformation to codegen phase
Support suspend functions with default arguments.
2019-09-16 16:49:18 +03:00
Alexander Udalov bd8ea9412d JVM IR: implement MethodSignatureMapper.mapFunctionName directly 2019-09-16 14:57:20 +02:00
Alexander Udalov 45929f57b6 Minor, add test on name mangling of private multi-file part members 2019-09-16 14:44:16 +02:00
Alexander Udalov 9d257a1ed8 JVM IR: generate call to checkNotNull in IrCheckNotNull since 1.4
#KT-22275
2019-09-16 12:33:01 +02:00
Dmitry Petrov f3837e91e3 Add BE tests for 'break' and 'continue' inside 'when' 2019-09-12 15:11:01 +03:00
Mads Ager 90a37617a4 [JVM_IR, IR] Remove more needless temporary variables.
Avoid using a separate origin for temporary variables introduced
for for loops. That doesn't add anything and gives one more case
for optimizations to deal with.

Extend the JVM specific optimizations to remove temporary
variables to deal with more cases encountered in for loops
lowering.
2019-09-11 10:07:45 +02:00
Roman Artemev e5a1040dbd [KLIB] Fix references to private top-level typealias via type abbreviation 2019-09-10 19:59:01 +03:00
Kristoffer Andersen e7d0909979 JVM_IR: Fix null-constant comparison with primitive types. 2019-09-09 10:23:11 +02:00
Mikhail Zarechenskiy e21da3a61a Avoid resolving array-set method several times
While origin problem was in NI, it's also nice to have this change in OI
 in order to slightly improve performance

 #KT-33125 Fixed
2019-09-09 11:04:18 +03:00
Mikhail Zarechenskiy f8449bf15a [NI] Clear partially resolved calls after resolve of top-level call
#KT-32433 Fixed
2019-09-09 11:04:17 +03:00
Steven Schäfer 62a1ea643a Add additional tests for bound receivers in callable references 2019-09-06 15:11:59 +02:00
Steven Schäfer d89d68e3df JVM IR: Cache SAM wrappers in top-level classes and use proper naming scheme 2019-09-06 15:11:59 +02:00
Steven Schäfer c77fa1ecd6 JVM IR: Fixes in SAM lowering 2019-09-06 15:11:59 +02:00
Georgy Bronnikov 7ede26e8f4 IrCompileKotlinAgainstInlineKotlin tests 2019-09-06 09:19:57 +03:00
Mads Ager 3f28b71509 [IR] Fix issue getting the length property from CharSequence bounded type parameter
Use the class of the subtype of CharSequence when available. When
it is not (for type parameters bounded by CharSequence) call the
CharSequence getter and 'get' method. Using the most specific type
posible fixes the forInStringSpecialized test that expects the
use of INVOKEVIRTUAL and not INVOKEINTERFACE.

Add tests for the type parameter use.
2019-09-03 20:18:03 +02:00
Mads Ager 85b1e0165b [IR] For loop lowering for CharacterSequence.indices. 2019-09-03 13:18:21 +02:00
Steven Schäfer 102a3d60e0 IR: Consistently copyAttributes in DeepCopyIrTreeWithSymbols
This was missing for IrFunctionReferences, which caused problems when
copying default parameters before CallableReferenceLowering in the
JVM_IR backend.
2019-09-02 19:55:36 +02:00
Nikolay Krasko 4d0fc1dc22 Remove 182 support
#KT-33536 Fixed
2019-08-30 12:13:44 +03:00
Mads Ager 8ed1317839 [IR] For loop lowering for iteration over CharacterSequences.
Change-Id: I7aeadfffc80f791ec19a3607e219c1dc4de028db
2019-08-30 09:35:59 +02:00
Mads Ager 6c7a904663 Psi2Ir: Mark accessors with no bodies as default accessors.
They are currently marked as defined even when they get a
default implementation. That makes it hard to figure out
if the accessor should be removed when introducing a backing
field in the JVM_IR backend.
2019-08-28 19:25:13 +02:00
Alexander Udalov aea9642ea0 JVM IR: implement MethodSignatureMapper.mapToCallableMethod directly
Instead of calling enormously complicated
KotlinTypeMapper.mapToCallableMethod, where most of special cases are
handled in the IR backend via lowerings.
2019-08-27 19:27:46 +02:00
Alexander Udalov 2b4424b564 JVM IR: replace function accesses in multi-file parts
Any access to a function from a multi-file part needs to be replaced
with the access to the corresponding public method (if it exists) from
the facade class. Note that this has no immediate effect because we use
KotlinTypeMapper for mapping calls, and it understands that a call to a
function from the part must actually be generated into a call to the
function from the facade in the bytecode. This commit merely changes the
IR to better reflect what's generated in the final bytecode, and to be
able to use simplified IR-based method signature mapping instead of the
legacy KotlinTypeMapper in the future.
2019-08-27 19:27:45 +02:00
Steven Schäfer 6bf16a96e1 Add more tests for type operators on the jvm 2019-08-27 10:44:23 +02:00
Ilmir Usmanov ef5fcb4e9e Fix test data 2019-08-23 19:09:28 +03:00
Alexander Udalov d59f2bcc80 Fix KotlinReflectionInternalError on invoking callBy with defaults in supertypes
There are two parts in this change:

1) Previously, we looked up $default methods with the incorrect
   signature in supertypes. For example in defaultInSuperClass.kt, we'd
   try to find a method foo$default with the signature `(B, String,
   String, int, Object)` in the class A. Now we're modifying the array
   of parameter types on each step if we're looking for a static
   $default method, by assigning its first element to be the containing
   class. This fixes cases when defaults come from a superclass.
2) For interfaces, $default methods are actually located in the
   corresponding DefaultImpls class. Now we look up that class and
   search for the $default method there. Note that this is needed
   because of KT-33430. This fixes cases when defaults come from a
   superinterface.

 #KT-13936 Fixed
2019-08-22 18:04:00 +02:00
Alexander Udalov cb2e68fece JVM IR: skip temporary variables in InventNamesForLocalClasses 2019-08-22 18:04:00 +02:00
Ilmir Usmanov f9506db20a Ignore sources which are not LOADs in refinedIntTypeAnalysis
#KT-33414 Fixed
2019-08-22 16:08:08 +03:00
Alexander Udalov f64afbf152 JVM IR: reduce usages of IrTypeMapper.kotlinTypeMapper 2019-08-21 15:13:49 +02:00
Igor Chevdar 8d2ccb7bcd [IR] Taught inliner to work with inline suspend lambdas 2019-08-20 12:52:54 +03:00
pyos 7ff700ff97 JVM_IR: lower calls to @JvmStatic functions from other files.
Note: this currently results in invalid IR (but valid bytecode) if the
@JvmStatic function is imported, because its IR representation is
unlowered and therefore has a dispatch receiver, but the call will not.
2019-08-20 11:39:25 +03:00