Commit Graph

3043 Commits

Author SHA1 Message Date
Mikhail Bogdanov 5bdf3d5757 Don't generate compatibility stubs for @JvmDefaultWithoutCompatibility 2020-06-19 11:57:35 +02:00
Roman Artemev a0cccdf75c [JS IR] Make backend work with new shared boxes 2020-06-19 12:23:15 +03:00
Roman Artemev 596c3d1af8 [JS IR] Implement shared box intrinsics translator 2020-06-19 12:23:15 +03:00
Roman Artemev 4c878c27a9 [JS IR] Introduce intrinsics to create shared boxes 2020-06-19 12:23:15 +03:00
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
Dmitry Petrov 4739adb6dc KT-36992 Do not generate annotations on synthetic accessors
Also, do not generate nullability annotations on synthetic methods.
2020-06-17 23:54:51 +03:00
Steven Schäfer 03651f1dd4 IR: Fix inner class type parameters in IrTypeSystemContext 2020-06-17 22:10:00 +03:00
Georgy Bronnikov c015463926 IR: remove field fake overrides 2020-06-17 20:02:26 +03:00
Georgy Bronnikov 1bb3f60bad IR: use super qualifier in Java field accesses 2020-06-17 20:02:26 +03:00
Georgy Bronnikov 36f22dafc5 IR: remove field fake override usage
Still a problem: Java static fields.
2020-06-17 20:02:26 +03:00
Dmitry Petrov 02f6a03ff7 JVM_IR: fix nullability annotations on synthetic marker parameters
Synthetic marker parameters (of type
Lkotlin/jvm/internal/DefaultConstructorMarker;) don't have annotations
(including nullability annotations).

Also, for constructor accessors corresponding parameter should be
nullable (since we pass 'null' as an argument there).

KT-36966
2020-06-16 21:29:52 +03:00
Mikhail Glukhikh 6f957c7b31 Provide more accurate clash check in JsDeclarationTable 2020-06-16 19:17:26 +03:00
Mikhail Glukhikh aaacbaaaec Add KDoc to ObsoleteDescriptorBasedAPI 2020-06-16 19:17:24 +03:00
Mikhail Glukhikh a035404c96 Mark IrSymbolBase/IrPublicSymbolBase.descriptor as obsolete API 2020-06-16 19:17:22 +03:00
Mikhail Glukhikh 3297237f3d Drop ObsoleteDescriptorBasedAPI in ClassGenerator (module-wide) 2020-06-16 19:17:20 +03:00
Mikhail Glukhikh fe61530357 Declare IrGeneratorContext.builtIns as obsolete descriptor-based API 2020-06-16 19:17:16 +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 63394858ac Minor typo fix 2020-06-16 19:17:08 +03:00
Mikhail Glukhikh e787dbf374 [IR.serialization.jvm] Use Descriptor-based IR in JvmIrLinker only 2020-06-16 19:17:06 +03:00
Mikhail Glukhikh 1c2fbb61fe [IR] Introduce & use declaration-based SymbolTable.withReferenceScope 2020-06-16 19:17:04 +03:00
Mikhail Glukhikh 7a0f986823 [IR] Introduce & use DescriptorBasedIr OptIn 2020-06-16 19:17:03 +03:00
Mikhail Glukhikh 67158caf73 FunctionGenerator: use owner instead of descriptor 2020-06-16 19:17:01 +03:00
Mikhail Glukhikh 41306d25fd JsDeclarationTable: drop descriptors in assertion 2020-06-16 19:16:59 +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
Alexander Gorshenev 99c5585790 Allow dynamic types in ir fake override substitution arguments 2020-06-16 02:56:46 +03:00
Mikhail Bogdanov db50afeafe Fix compilation with ASM 8
General rule to use linkedLabel or linkWithLabel
  when label from node is reused in other instructions.
  If label is not linked then it will point to another labelNode when visited

  #KT-39013 Fixed
2020-06-15 15:13:10 +02:00
Kristoffer Andersen f0ff8f202c [JVM IR] Use JVM8 support for unsigned int operations
- unmute tests
- add test to ensure JVM target is respected
- add test to cover smart-casted cases
- implement function matching and replacement
- Switching on uint constants
- introduce lowering for standard library replacements
2020-06-15 14:26:28 +03:00
Georgy Bronnikov 89aa15c419 JVM_IR: implement isCompiledToJvm8OrHigher on IrClass 2020-06-13 12:45:00 +03:00
Georgy Bronnikov 8037baf307 IR: add SourceElement reference to IrClass 2020-06-13 12:44:59 +03:00
Georgy Bronnikov 811e8d0f24 JVM_IR: remove one usage of descriptors from AnnotationCodegen 2020-06-13 12:44:59 +03:00
Georgy Bronnikov 58a9c0c996 JVM_IR: remove descriptor usage from IrTypeMapper 2020-06-13 12:44:59 +03:00
Alexander Udalov 2bf31ae3c3 IR: minor reformat of IdSignature 2020-06-11 21:42:45 +02:00
Alexander Udalov d8aee421ac IR: don't store isPublic as field in IdSignature 2020-06-11 21:42:44 +02:00
Alexander Udalov 3154eca218 IR: use String instead of FqName in IdSignature.PublicSignature
FqName/FqNameUnsafe tend to eagerly compute things like
safe/parent/shortName which take a lot of space.

This change helps to lower strongly reachable memory just before codegen
in JVM IR by about 5% on a relatively big project.
2020-06-11 21:42:44 +02:00
Alexander Udalov d24e136ba8 Minor, make IdSignature.PublicSignature not a data class 2020-06-11 21:42:44 +02:00
Igor Chevdar 66bbd3e102 [IR] Improved tuning of SAM wrapper visibility 2020-06-11 23:00:32 +05:00
Ilya Chernikov c720fa5793 Optimize LazyScopeAdapter internals 2020-06-11 16:16:14 +02:00
Alexander Udalov 6e67e1e78d Replace appendln with appendLine in project 2020-06-11 13:01:30 +02: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
Mads Ager dc34d355bc [JVM_IR] Generate line numbers and nops for init blocks.
This seems to be what JVM does and it allows you to set a
breakpoint on the init line.
2020-06-10 08:05:52 +02:00
Alexander Udalov 6adad1055b JVM IR: generate delegates to DefaultImpls for fun interfaces 2020-06-09 11:49:45 +02:00
Alexander Udalov 77e479fda8 JVM IR: generate InnerClasses attribute for nested classes in annotation arguments
#KT-38853
2020-06-09 11:33:27 +02:00
Alexander Udalov 2793187bda Handle IllegalArgumentException in trimMargin intrinsics on JVM
#KT-38537 Fixed
2020-06-09 11:11:06 +02:00
Mikhail Glukhikh 261ed46341 IR metadata source: do not require descriptor in property metadata 2020-06-09 11:40:26 +03:00
Mikhail Glukhikh 5c6f40b34a IR metadata source: extract & use declaration name 2020-06-09 11:40:26 +03:00
Alexander Gorshenev ce1ef6c159 Fixing a bug with private accessors in IR fake override construction 2020-06-08 17:07:06 +03:00