Commit Graph

76 Commits

Author SHA1 Message Date
Svyatoslav Kuzmich 279f184703 [JS] Remove failed checks based on unstable naming 2021-10-12 23:29:39 +03:00
Sergej Jaskiewicz 65d40c2253 [JS IR] Make tests that use directives pass with IR BE 2021-10-06 09:23:50 +00:00
pyos d3de0109ca Add tests for KT-48180 2021-08-18 18:39:33 +02:00
pyos 100d2d629c JVM: inline default lambda coercions from bridge invoke
The type of the default lambda may be a subtype of the parameter type,
so we can't really generate our own coercions at all as we don't know
the precise Kotlin type of the `invoke` method.
2021-07-14 10:11:05 +02:00
pyos 392e4fba42 JVM: fix inlining of default lambdas of signature (Result) -> Any
They have no `invoke` bridge, and the overridden invoke expectes a boxed
`Result` as an argument.
2021-06-16 12:13:32 +02:00
pyos ade8b0a7d3 JVM_IR: box bound receiver before calling the reference constructor
This is needed for the inliner: since the information about Kotlin type
of the bound receiver is nowhere in the output binary, the inliner will
have no clue how to box inline class values. Moving the boxing outside
the object means the inliner doesn't need to know about it; from its
point of view, the captured value has type `Any`.
2021-06-09 14:36:07 +03:00
pyos 57c934987c JVM_IR: try to load mangled invoke from default lambdas
Old compiler versions still won't be able to load default lambdas
generated by JVM_IR, but this way we avoid incorrect behavior of
function references taking inline class types that unbox to Any.

 #KT-46601 Fixed
2021-05-18 10:48:31 +02:00
pyos 34ac232a82 Add a test for KT-46601 2021-05-18 10:48:31 +02:00
Dmitriy Novozhilov 64a300bfcd [TD] Update testdata according to previous commit 2021-02-02 17:53:52 +03:00
Mads Ager fae5b8da4b [JVM] Do not put the name of default lambda parameter in LVT.
If we do, the local variable table will not make sense. As as
example:

```
inline fun foo(getString: () -> String = { "OK" }) {
  println(getString())
}

inline fun bar() {
}

fun main() {
    bar()
    foo()
}
```

leads to the following bytecode:

```
  public static final void main();
    descriptor: ()V
    flags: ACC_PUBLIC, ACC_STATIC, ACC_FINAL
    Code:
      stack=2, locals=4, args_size=0
         0: iconst_0
         1: istore_0
         2: nop
         3: nop
         4: iconst_0
         5: istore_1
         6: nop
         7: ldc           #53                 // String OK
         9: astore_2
        10: iconst_0
        11: istore_3
        12: getstatic     #30                 // Field java/lang/System.out:Ljava/io/PrintStream;
        15: aload_2
        16: invokevirtual #36                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
        19: nop
        20: return
      LineNumberTable:
        line 9: 0
        line 13: 2
        line 10: 3
        line 14: 4
        line 15: 6
        line 16: 7
        line 17: 19
        line 11: 20
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
            2       1     0 $i$f$bar   I
            6      14     1 $i$f$foo   I
            4      16     0 getString$iv   Lkotlin/jvm/functions/Function0;
```

The `getString$iv` local should not be there. It has been inlined away.
Leaving it in the local variable table leads to inconsistent locals
info. Local 0 contains an int but we declare a local of type
Function0.
2020-12-03 13:41:36 +01:00
Mads Ager 03fb49bb38 [JVM_IR] Improve debugging behavior of inline functions
Specifically, this commit improves the stepping behavior of the IR
backend around functions with defaults.

  - Improved line numbers in the default handler itself for better
    stepping when inlined.

  - Improved source information on default arguments

  - Improved test coverage of stepping behavior in old and IR backends.

Improves the stepping behaviour around inline methods with default
arguments. In particular, we now accurately step through the
evaluation of default arguments, but do _not_ spuriously show the exit
from the $default handler.
2020-04-07 16:52:45 +02:00
Mikhael Bogdanov ab7e71fd68 Support per files test directives 2020-03-19 16:45:10 +01:00
Alexander Udalov 0f7122a88a Support MutablePropertyReferenceN supertypes in LambdaInfo
#KT-37087 Fixed
2020-03-05 14:01:30 +01:00
Mikhael Bogdanov 19ce055322 JVM_IR. Pass stub function reference in 'getSignature' 2019-11-20 12:57:38 +01:00
Mikhael Bogdanov ac31e0e8c7 Support default lambda inlining in IR 2019-11-20 12:57:36 +01:00
pyos 06c00f4d9e Unmute some JVM_IR inlining tests 2019-10-08 17:19:41 +02:00
pyos cd47c11efd Generate unique parameter names in LocalDeclarationsLowering 2019-10-07 15:14:48 +02:00
pyos ea56a5e8b1 Unmute some JVM_IR inlining tests 2019-10-02 14:48:05 +02:00
Georgy Bronnikov 7ede26e8f4 IrCompileKotlinAgainstInlineKotlin tests 2019-09-06 09:19:57 +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
Mikhael Bogdanov 1eda42cb88 JVM_IR. Generate SMAP information for anonymous classes
#KT-28092 Fixed
2019-08-08 12:02:50 +02:00
Georgy Bronnikov ce6e2621cf Unmute working tests 2019-08-04 01:35:05 +03:00
pyos 90f11211d3 JVM_IR: wrap performInline in enterIntoInlining/exitFromInliningOf 2019-05-06 16:23:28 +02:00
pyos 8c55376f0c Unmute almost all JVM_IR tests that use property references 2019-03-19 12:00:29 +01:00
Svyatoslav Kuzmich 8fbf1ed683 [JS IR BE] Unmute tests 2019-01-24 23:05:56 +03:00
Mikhael Bogdanov cfc21ffa56 Test for obsolete KT-16496
#KT-16496 Obsolete
2019-01-07 15:49:26 +01:00
Mikhael Bogdanov 6bf70a5dd2 Properly find invoke method on default lambda inlining
In general case parameter type could differ from actual default lambda type.
  E.g.: fun inlineFun(s: (Child) -> Base = { a: Base -> a as Child}),
  where type of default lambda is '(Base) -> Child'.
  In such case we should find somehow actual invoke method in bytecode knowing
  only name, number of parameters and that's actual invoke is non-synthetic
  regardless of bridge one.

  #KT-21946 Fixed
2019-01-02 12:37:06 +01:00
Mikhael Bogdanov f4e532e449 Specify JVM target backend for test with '@JvmXXX' annotations 2018-12-21 16:09:07 +01:00
Alexander Udalov 9b6a52ccba Remove LANGUAGE_VERSION from boxInline tests 2018-12-20 12:53:22 +01:00
Roman Artemev fb499def59 Update tests 2018-10-25 15:49:21 +03:00
Svyatoslav Kuzmich 4c38d55f21 [JS IR BE] Unmute tests 2018-10-15 00:03:45 +03:00
Anton Bannykh 2e709a81fa [JS IR BE] Arrays, varargs 2018-09-18 14:36:20 +03:00
Roman Artemev 8a871b3f0c Update tests 2018-08-31 15:34:18 +03:00
Svyatoslav Kuzmich f5a80a30f7 Mute and unmute tests 2018-08-15 18:20:07 +03:00
Mikhael Bogdanov 357359b1dd Unmute ir-tests after CR support 2018-08-09 14:22:50 +03:00
Mikhael Bogdanov 9ccb25789b Unmute jvm-ir inline tests 2018-08-02 13:19:24 +02:00
Anton Bannykh 07b3b66fd9 JS IR: unmute tests 2018-07-10 13:34:19 +03:00
Mikhael Bogdanov e149cbe852 Mute failed jvm ir tests 2018-06-28 12:26:41 +02:00
Anton Bannykh 04a2ffc0c1 JS IR: unmute tests 2018-06-21 13:27:17 +03:00
Anton Bannykh 9039b75c25 JS IR: unmute tests 2018-06-21 13:27:17 +03:00
Anton Bannykh b551afb202 JS IR: minor fix for callable ref translation
The caching variable has to have no initializers so that there is no
dependence on evaluation order.
2018-06-18 13:15:19 +03:00
Anton Bannykh 43e3314255 JS IR: Remove inline functions with reified type parameters
Otherwise we cannot handle type casts
2018-06-18 13:15:19 +03:00
Anton Bannykh 3808d77bf4 JS IR: inliner 2018-06-18 13:15:19 +03:00
Anton Bannykh 96355e2732 JS IR: mute codegen box tests automatically 2018-06-09 19:15:38 +03:00
Mikhael Bogdanov 50608d0844 Don't delete nested default lambda classes during inline transformation 2017-12-21 12:52:29 +01:00
Mikhael Bogdanov 3513f1a86a Properly process default lambda source mapping
#KT-21827 Fixed
2017-12-21 12:52:27 +01:00
Alexey Andreev 834cd1d93d Fix testdata for new JS inliner 2017-09-04 15:33:07 +03:00
Mikhael Bogdanov 79ecc7fd5c Don't recognize nullable function types as inlinable
#KT-19679 Fixed
2017-08-17 14:24:00 +02:00
Mikhael Bogdanov 2808e45b89 Enable test in js, native 2017-07-05 11:15:38 +02:00
Mikhael Bogdanov 8121c1d3c4 Update test to support js-backend 2017-07-04 10:12:42 +02:00