Commit Graph

679 Commits

Author SHA1 Message Date
Igor Chevdar 2bf73ccfe5 [IR] Supported extension receivers in SAM conversions 2020-06-18 13:17:38 +05:00
Igor Chevdar ecf9727568 [IR] Supported IrEnumEntry
Fixes https://youtrack.jetbrains.com/issue/KT-38996
2020-06-18 12:44:48 +05:00
Georgy Bronnikov c015463926 IR: remove field fake overrides 2020-06-17 20:02:26 +03:00
Mikhail Glukhikh ab5cb13dae Rename: DescriptorBasedIr -> ObsoleteDescriptorBasedAPI 2020-06-16 19:17:14 +03:00
Mikhail Glukhikh cbbb497edf Make descriptor-based API in ir:tree more granular 2020-06-16 19:17:12 +03:00
Mikhail Glukhikh c4b24548cb IrValidator: report errors without rendering descriptors 2020-06-16 19:17:11 +03:00
Mikhail Glukhikh 293df7bd50 [IR BE common] Use Descriptor-based IR only in CheckIrElementVisitor 2020-06-16 19:17:10 +03:00
Mikhail Glukhikh 7a0f986823 [IR] Introduce & use DescriptorBasedIr OptIn 2020-06-16 19:17:03 +03:00
Steven Schäfer 846fc13519 JVM IR: Fix inline class constructor ABI (KT-37013, KT-37015) 2020-06-16 09:23:58 +03:00
Georgy Bronnikov 58a9c0c996 JVM_IR: remove descriptor usage from IrTypeMapper 2020-06-13 12:44:59 +03:00
Igor Chevdar 66bbd3e102 [IR] Improved tuning of SAM wrapper visibility 2020-06-11 23:00:32 +05:00
Vasily Levchenko 25f0e38c73 [inliner] parent fix after copy
this change fix issue with inlining lambda in inline function which(function) inlined from other library.
E.g.

> cat i-lib.kt
class _special_class(val v:Int)
class _special_class1(val v:Int)

class __helper(val v:Int)

inline fun foo(h: __helper): Int {
    val sum = h.op {
        _special_class(it.v)
    }.v
    return sum
}

inline fun __helper.op(block:(_special_class1) -> _special_class) = block(_special_class1(v))

> cat i-main.kt
fun main() {
    val h = __helper(42)
    println(foo(h))
}

Here how the incorrect parent affects debug information:

(lldb) target create "program.kexe"
Current executable set to '/Users/minamoto/ws/kotlin-native/program.kexe' (x86_64).
(lldb) command source -s 0 'i-test.lldb'
Executing commands in '/Users/minamoto/ws/kotlin-native/i-test.lldb'.
(lldb) b i-lib.kt:8
Breakpoint 1: where = program.kexe`kfun:#main(){} + 435 [inlined] foo + 98 at i-main.kt:3, address = 0x00000001000540e3
(lldb) r
Process 70550 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
    frame #0: 0x00000001000540e3 program.kexe`kfun:#main(){} [inlined] foo at i-lib.kt:9:7
   6       inline fun foo(h: __helper): Int {
   7           val sum = h.op {
   8               _special_class(it.v)
-> 9           }.v
              ^
   10          return sum
   11      }
   12
Target 0: (program.kexe) stopped.

the parent of lambda is i-main.kt instead of i-lib.kt, and offsets calculated against wrong file.
Here is behaviour with fix:

(lldb) target create "program.kexe"
Current executable set to '/Users/minamoto/ws/.git-trees/minamoto/debug-info/subprograms-with-missed-scopes/program.kexe' (x86_64).
(lldb) command source -s 0 '/Users/minamoto/ws/kotlin-native/i-test.lldb'
Executing commands in '/Users/minamoto/ws/kotlin-native/i-test.lldb'.
(lldb) b i-lib.kt:8
Breakpoint 1: where = program.kexe`kfun:#main(){} + 337 [inlined] <anonymous>_2 at i-lib.kt:14, address = 0x0000000100054bb1
(lldb) r
Process 70560 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
    frame #0: 0x0000000100054bb1 program.kexe`kfun:#main(){} [inlined] <anonymous>_2 at i-lib.kt:8:24
   5
   6       inline fun foo(h: __helper): Int {
   7           val sum = h.op {
-> 8               _special_class(it.v)
                               ^
   9           }.v
   10          return sum
   11      }
Target 0: (program.kexe) stopped.
2020-06-10 14:29:13 +02:00
Alexander Udalov 6adad1055b JVM IR: generate delegates to DefaultImpls for fun interfaces 2020-06-09 11:49:45 +02:00
Alexander Udalov 2793187bda Handle IllegalArgumentException in trimMargin intrinsics on JVM
#KT-38537 Fixed
2020-06-09 11:11:06 +02:00
Roman Artemev 311b2d7969 [PLUGIN API] Make context provide information about target platform 2020-06-05 17:14:33 +03:00
Georgy Bronnikov 80afe42d17 JVM_IR: implement getJvmNameIfSpecial in MethodSignatureMapper 2020-06-03 22:42:02 +03:00
Roman Artemev a401374ed4 [PLUGIN API] Add extension point to customize linkage process 2020-06-03 12:17:14 +03:00
Roman Artemev f9c2c846f7 [IR] Move IrProvider and 'IrDeserializer' into separate package 2020-06-03 12:17:14 +03:00
Igor Chevdar e41b5fc1c6 [IR] Turned on a test for K/N + minor refactoring
NothingValueException has already been supported in K/N
2020-06-02 14:50:17 +05:00
Alexander Gorshenev 789efc7c3a Created a deep copier good for fake overrides.
Adapted it from inliner copier.
It is capable of producing type substituted members.
2020-05-31 06:00:31 +03:00
Mikhail Glukhikh 07b1bd9d99 IrTypeUtils: take name directly from IrDeclaration 2020-05-28 14:02:59 +03:00
Mikhail Glukhikh a631c24e8c [IR] Drop unused 'withDescriptors' dumper 2020-05-28 14:02:57 +03:00
Mikhail Glukhikh 724101cdd2 [IR] Get rid of minor symbol.descriptor usages 2020-05-28 14:02:53 +03:00
Dmitry Petrov 69fa067df9 Fix compiler bootstrap (1.4.0-dev-9205) 2020-05-27 00:28:58 +03:00
Dmitry Petrov f81be526bc Support deserialized IR in IfNullExpressionsFusionLowering
Deserializer generates simple branches instead of IrElseBranches.
2020-05-26 20:29:12 +03:00
Roman Artemev 444ecc0981 [PLUGIN API] Fix misprint 2020-05-26 14:38:18 +03:00
Roman Artemev bc32688497 [PLUGIN API] Drop PureIrGenerationExtension 2020-05-26 14:38:18 +03:00
Mikhail Glukhikh 3f09bb40c0 [IR] Unbind construction methods of IrVariableImpl from symbol.descriptor 2020-05-25 15:40:37 +03:00
Mikhail Glukhikh a7d514a0a9 [IR] Unbind construction methods of IrClassImpl from symbol.descriptor 2020-05-25 15:40:35 +03:00
Roman Artemev 257c4c5604 [PLUGIN API] Extract IrPluginContext into separate interface
- Isolate ir infrastructure implementation details behind special interface
2020-05-25 13:26:35 +03:00
Roman Artemev 8f71bdbf01 [JS SCRIPT] Fix IrScript visit order 2020-05-14 17:58:32 +03:00
Roman Artemev f792c5c936 [JS SCRIPT] Fix default arguments in script 2020-05-14 17:58:32 +03:00
Steven Schäfer 9bc8fdcb3c JVM IR: Validate corresponding properties 2020-05-13 20:57:52 +02:00
Steven Schäfer 4a2b5df9fa JVM IR: Fix corresponding properties for default impls redirections 2020-05-13 20:57:52 +02:00
Anton Bannykh b5f31a3d76 JS IR: make CodeCleaner more conservative
The CodeCleaner treated all expressions with type `Nothing` as
non-terminating. This is not true for cases when return type is generic,
e.g:

```
fun <T> foo(): T = Any() as T

foo<Nothing>() // type: Nothing
```

This change makes the CodeCleaner more conservative, so that it doesn't
treat to such functions as non-terminating. This eliminates the need
to change call types from Nothing to Unit in
KotlinNothingValueExceptionLowering.
2020-05-13 16:30:47 +03:00
pyos 8809abdbac JVM_IR: do not handle Nothing in suspend tail call bridges
Else they wouldn't be tail call, would they?
2020-05-13 05:54:37 -07:00
Mark Punzalan 99856afc31 ForLoopsLowering: Use @file:OptIn(ExperimentalUnsignedTypes::class)
instead of annotating declarations.
2020-05-13 13:54:35 +02:00
Mark Punzalan b85da8411d ForLoopsLowering: Convert ProgressionType from enum to sealed class and
move more logic into the class.

This refactoring simplifies their usage with fewer `when` switches and
passing around of Symbols.
2020-05-13 13:54:35 +02:00
Mark Punzalan 177967258b ForLoopsLowering: Eliminate construction/boxing/unboxing of UInt/ULong.
This needs further cleanup to encapsulate more logic into ProgressionType.
2020-05-13 13:54:35 +02:00
Mark Punzalan e1120f49d8 ForLoopsLowering: Reduce unnecessary temporary variables. 2020-05-13 13:54:35 +02:00
Mark Punzalan 03ef3724f4 ForLoopsLowering: Add support for unsigned progressions. 2020-05-13 13:54:35 +02:00
Alexander Udalov 012ffa2993 Support new scheme of compilation of OptionalExpectation annotations
Instead of generating these annotation classes as package-private on
JVM, serialize their metadata to the .kotlin_module file, and load it
when compiling dependent multiplatform modules.

The problem with generating them as package-private was that
kotlin-stdlib for JVM would end up declaring symbols from other
platforms, which would include some annotations from package
kotlin.native. But using that package is discouraged by some tools
because it has a Java keyword in its name. In particular, jlink refused
to work with such artifact altogether (KT-21266).

 #KT-38652 Fixed
2020-05-12 19:28:57 +02:00
Roman Artemev 7737c76540 [PLUGIN API] Do postprocess after symbol resolve 2020-05-12 14:29:55 +03:00
Roman Artemev 92befaac5d [IR] Remove IrExtensionGenerator 2020-05-12 14:29:55 +03:00
Roman Artemev d41bbbae0d [IR] Deprecate some API 2020-05-12 14:29:54 +03:00
Roman Artemev 2f0840388d [IR] Fix context 2020-05-12 14:29:54 +03:00
Roman Artemev 559b654a4f [IR] Provide new plugin API to access declaration via FqName in the safe way 2020-05-12 14:29:53 +03:00
Roman Artemev 8335ce8665 [IR] Fix to make K/N work 2020-05-12 14:29:53 +03:00
Roman Artemev 3d24665c0d [IR] Use ReferenceSymbolTable in BuiltinSymbolsBase 2020-05-12 14:29:53 +03:00
Roman Artemev 3c50b47333 [IR] Add new API into IrBuiltIns to access functional interfaces 2020-05-12 14:29:53 +03:00