Commit Graph

3815 Commits

Author SHA1 Message Date
Ilmir Usmanov d9caeca249 JVM_IR: Copy suspend lambda's attributes 2019-08-05 20:25:31 +03:00
Steven Schäfer 9182fe887e Fix inline class handling in DefaultParameterInjector 2019-08-05 16:48:18 +03:00
Steven Schäfer 79f71f61d5 JVM BE: Add more tests for default arguments
- Inline class parameters should not be boxed.
- Empty vararg parameters should not allocate an empty array.
2019-08-05 16:48:18 +03:00
Mikhael Bogdanov 971d36837a JVM_IR. Don't generate annotations and signature on synthetic methods 2019-08-05 15:00:51 +02:00
Georgy Bronnikov ce6e2621cf Unmute working tests 2019-08-04 01:35:05 +03:00
Ilya Gorbunov 2e445ebad6 Enable test that uses Array.fill in JS and Native 2019-08-01 19:02:39 +03:00
Ilmir Usmanov 06388b885c JVM_IR: Support suspend lambdas with receiver 2019-07-31 21:17:09 +03:00
Steven Schäfer efb938a7c8 (Un)mute tests 2019-07-31 11:18:44 +02:00
Steven Schäfer 9816e62d08 JVM_IR: Fix inlining of interface methods 2019-07-31 11:18:44 +02:00
Ilmir Usmanov 2910d8e9b2 Also check predecessors of PUSH Unit in unit tail-call optimization 2019-07-29 20:34:53 +03:00
Ilmir Usmanov e60674f5e1 Fix test data 2019-07-29 20:34:51 +03:00
Ilmir Usmanov cc06798e2c Implement unit suspend functions tail-call optimisation
Unlike previously, this optimisation works on every callee return type.
Tail-calls inside unit functions can be either
INVOKE...
ARETURN
or
INVOKE
POP
GETSTATIC kotlin/Unit.INSTANCE
ARETURN
The first pattern is already covered. The second one is a bit tricky,
since we cannot just assume than the function is tail-call, we also need
to check whether the callee returned COROUTINE_SUSPENDED marker.
Thus, resulting bytecode of function's 'epilogue' look like
DUP
INVOKESTATIC getCOROUTINE_SUSPENDED
IF_ACMPNE LN
ARETURN
LN:
POP

 #KT-28938 Fixed
2019-07-29 20:34:48 +03:00
Ilmir Usmanov a35d405892 Do not generate accessor if private function is accessed from
coroutines intrinsic lambda.
The logic is if the lambda is crossinline we need to generate the
accessor. However, suspendCoroutine's and
suspendCoroutineUninterceptedOrReturn's parameter, despite being
crossinline, are effectively inline. Thus, we do not need to generate
the accessor.
 #KT-27503 Fixed
2019-07-25 15:25:59 +03:00
Ilmir Usmanov 56b6b957d1 Generate line numbers for RHS of elvis expression if both LHS and RHS
are at the same line.
 #KT-32689 Fixed
2019-07-23 18:00:44 +03:00
Alexander Udalov 1f36f60f43 JVM IR: remove CrIrType, use class container in callable reference lowerings
This is possible now because after 3a9b94235f, 0423d0f41e and
5341de253f, all top level functions/properties in sources and in
binaries have a corresponding containing facade class
2019-07-23 16:39:38 +02:00
Igor Chevdar a048a11074 Enabled/disabled some tests for K/N 2019-07-23 19:16:46 +05:00
Mikhael Bogdanov 74e49d91ca Proper implement 'classForImplicitThis' 2019-07-22 10:35:03 +02:00
Alexander Udalov f38e4d618e Support Array::class literal, forbid Array<X>::class on non-JVM
#KT-31230 Fixed
2019-07-16 15:57:26 +02:00
Mikhael Bogdanov 496765f41e Support target templates in bytecode tests
Avoid test data duplication
2019-07-16 14:08:27 +02:00
Mark Punzalan de1e27c584 Make all progression headers inclusive, and decrement last for
last-exclusive progressions (i.e., "until" progressions and loop over
array indices).

This change makes it possible to correctly implement the handling of
"step" progressions. Computing the last element of a stepped progression
requires that the last is inclusive.

Also invert the while loop (into if + do-while) that is used when
lowering for-loops over progressions that cannot overflow. This keeps
the performance characteristics closer to the ForLoopsLowering in
kotlin-native, since the goal is to converge to this shared version.

Also used IrType instead of KotlinType, where possible.

 https://github.com/JetBrains/kotlin/pull/2390
 https://github.com/JetBrains/kotlin/pull/2305
2019-07-16 14:08:21 +02:00
Jake Wharton 4386518c4d Add intrinsic for ULong/UInt.toString on Java 8+
Unfortunately this cannot currently be done for the extension overload which accepts a radix due to behavior difference with regard to invalid radix values.
2019-07-16 11:15:19 +02:00
Alexander Udalov 385366384c Psi2ir: ignore unresolved annotations
Note that the test is an exact copy of an existing test
missingDependencyNestedAnnotation, but with -Xuse-ir
2019-07-15 18:40:00 +02:00
Ilya Chernikov 0cc40440fb Implement filePathPattern in the script configuration with handling
also
- tests
- extending kdoc for the definitions
2019-07-12 13:44:09 +03:00
Alexander Udalov f7fc5d2ffa Fix codegen for JvmOverloads with more than 32 parameters
Use DefaultCallArgs to handle mask list construction correctly

 #KT-31070 Fixed
2019-07-09 19:31:59 +02:00
Alexander Udalov a6be6f4986 Use Class.forName instead of ClassLoader.loadClass in reflection
This fixes an issue in constructing annotation instances with array
class elements. For some reason, behavior of `ClassLoader.loadClass`
differs from `Class.forName` in handling arrays, namely:

* `loadClass("[Ltest.Foo;")` returns null
* `Class.forName("[Ltest.Foo;")` returns class for array of test.Foo

Overall, there doesn't seem to be any way to load an array class with
`CLassLoader.loadClass`.

We pass initialize=false to forName because this is the behavior of
ClassLoader.loadClass: it doesn't perform class initialization (e.g.
<clinit> is not executed).

 #KT-31318 Fixed
2019-07-09 18:14:45 +02:00
Ilya Gorbunov 7573fcde53 Demote new experimental capitalize overloads in overload resolution
Revert "Fix method reference ambiguity in test after introducing 'capitalize' overload"
This reverts commit fe9bd9ee
2019-07-09 03:39:25 +03:00
Steven Schäfer da8fb3a195 JVM_IR: Respect -Xno-param-assertions 2019-07-08 17:48:33 +02:00
Steven Schäfer dd20b74030 Split GenerateNotNullAssertionsTests into standard box and bytecode tests 2019-07-08 17:48:33 +02:00
Yan Zhulanow 188ed82081 Debugger: Handle closure receivers came from outer callables properly (KT-31709) 2019-07-08 16:25:17 +09:00
Svyatoslav Kuzmich 918d470e1b [JS IR BE] Simplify throwable lowering.
- Make kotlin.Throwable class extenral
- Add runtime function 'extendThrowable' to use instead of delegating
  constructors to Throwable
2019-07-03 20:37:48 +03:00
Steven Schäfer e7a5e5b4a0 JVM_IR: Handle annotation KClass fields in external declarations 2019-07-01 16:16:23 +02:00
Steven Schäfer 078ccbf077 JVM_IR: Implement name mangling exceptions for Result class. 2019-07-01 15:49:12 +02:00
Steven Schäfer d458e4a7b2 JVM_IR: Enable inlining for external declarations with inline class parameters. 2019-07-01 15:49:12 +02:00
Mark Punzalan 1abdf0561a Generate synthetic functions for local functions with default values, by
re-ordering the lowering phases.

The changes in InterfaceLowering are necessary so that IrElements that
target the removed functions are re-targeted to the new functions in
DefaultImpls. This affects local functions in interface functions since
now LocalDeclarationsLowering comes before InterfaceLowering.
2019-07-01 13:24:08 +02:00
Mikhail Zarechenskiy c2cf4aa2b5 [NI] Move ability to convert standalone SAM-argument under the feature
If new inference is enabled only for IDE analysis, then this feature
 will be disabled to reduce difference between new and old inference,
 but if new inference is enabled in the compiler, then this feature
 will be enabled too to preserve behavior of new inference for
 compilation

 #KT-32175 Fixed
 #KT-32143 Fixed
 #KT-32123 Fixed
 #KT-32230 Fixed
2019-07-01 12:53:33 +03:00
Georgy Bronnikov f332aff4ce Mute back tests that still fail 2019-06-28 19:44:04 +03:00
Georgy Bronnikov 3a9b94235f JVM_IR: generate facade classes for imported toplevel declarations 2019-06-28 17:34:49 +03:00
Anton Bannykh fadeac083f JS: fix reified T::class for primitive T (e.g. Int) (KT-32215 fixed) 2019-06-28 13:49:22 +03:00
Mikhael Bogdanov 9b6fef005f Simplify LocalDeclarationsLowering, support declaration pop up via separate lower
1. Scheme of capturing local variables not touched
 2. Lowered local functions are transposed to the nearest class (including local) or file
 3. Local classes are also transpose to the nearest class (including local) or file
2019-06-27 08:07:01 +02:00
Ilmir Usmanov 7a096b305f Do not mangle functions with inline classes when the only inline class
in arguments is kotlin.Result.
Fix returnTarget for suspend function views.
2019-06-26 22:28:08 +03:00
Pavel Punegov e9aec54f59 Ignore test in native because it doesn't support 40 parameters 2019-06-25 19:12:41 +03:00
Ilmir Usmanov c613e04962 Do not try to create view of suspend function descriptor on IR BE
Keep container source in wrapped descriptor
2019-06-25 16:30:02 +03:00
Ilmir Usmanov 60cbf0696d Do not generate tests with experimental coroutines on JVM_IR backend
Enable working tests.
2019-06-25 16:30:01 +03:00
Ilmir Usmanov 379390c472 Introduce add continuation pass, which transforms each suspend function
and call to have additional continuation parameter.
2019-06-25 16:30:00 +03:00
pyos 54d1df3147 JVM_IR: fix unbound function references 2019-06-25 12:29:23 +02:00
pyos 6a21285aed JVM_IR: do not generate two nullary constructors
when the primary constructor with @JvmOverloads has default values for
all arguments.
2019-06-24 14:58:45 +02:00
Svyatoslav Kuzmich 0b19a4a32b [JS IR BE] Initial version of member namer 2019-06-21 17:02:01 +03:00
Dmitry Petrov 79d4b46d2b KT-32044 Fix unsigned integer coercion in loop intrinsics 2019-06-21 16:30:23 +03:00
pyos 8cca74c932 JVM_IR: support vararg & defaults in function references 2019-06-20 22:37:56 +03:00
Roman Artemev 88e92be091 [IR] Fix name clash between properties with the same fqn
Promote ABI version
2019-06-20 12:08:55 +03:00