Commit Graph

1337 Commits

Author SHA1 Message Date
Mikhail Bogdanov 5bdf3d5757 Don't generate compatibility stubs for @JvmDefaultWithoutCompatibility 2020-06-19 11:57:35 +02: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
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 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 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
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 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
Igor Chevdar 66bbd3e102 [IR] Improved tuning of SAM wrapper visibility 2020-06-11 23:00:32 +05: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
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
Steven Schäfer 3291cf7a6e JVM IR: Mark lateinit fields as NotNull
This is needed for compatibility with the JVM backend.
2020-06-04 17:52:56 +02:00
Alexander Udalov 5647a935a2 JVM IR: do not generate DefaultImpls delegate for collection fake overrides
In the newly added test, prior to this change, JVM IR was generating
DefaultImpls classes with calls to things like
`kotlin/collections/MutableList$DefaultImpls.spliterator` and other
default methods present in JDK 8+. This obviously didn't make much
sense. Although these weren't explicitly mentioned anywhere in the
bytecode, they caused some validation tools to report errors (e.g.
animalsniffer used in arrow).
2020-06-04 14:27:46 +02:00
Georgy Bronnikov 0db02926f5 JVM_IR: remove descriptors from MethodSignatureMapper 2020-06-03 22:42:02 +03:00
Georgy Bronnikov 77c20066a8 JVM_IR: implement getJvmModuleNameForDeserialized in MethodSignatureMapper 2020-06-03 22:42:02 +03:00
Georgy Bronnikov 80afe42d17 JVM_IR: implement getJvmNameIfSpecial in MethodSignatureMapper 2020-06-03 22:42:02 +03:00
Roman Artemev 5eae262264 [PLUGIN API] Implement custom linkage for plugin extensions 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
Mads Ager f128e5222a [JVM_IR] Fix line number information for try-catch.
In particular, the current line numbers could lead to stepping
into the catch handler even when the code in the try did not
throw an exception.

This was caused by the code materializing the final value having
the catch line number. This patch delays the materialization
until the line number of the usage has been emitted.
2020-06-03 07:33:21 +02:00
Mikhail Zarechenskiy 0ab9b3639b Approximate types for lambda literals before serialization 2020-05-31 17:38:18 +03:00
Steven Schäfer 7ea71a17f0 JVM IR: Use language feature for inline class mangling rules 2020-05-29 19:54:09 +03:00
pyos 35460fed19 JVM_IR: fix a bug when isInlineParameter is applied to default stubs
If an inline parameter has a default value, its type is nullable.
There's already code to handle this in `IrInlineCodegen`, but it
really should be in `isInlineParameter` instead, otherwise e.g.
SyntheticAccessorLowering fails.
2020-05-29 10:04:36 +02:00
Steven Schäfer dc0ef996b7 JVM IR: Implement the new inline class ABI 2020-05-28 18:00:35 +03:00
Mikhail Glukhikh 487a698e49 [IR] Add IrSymbolBase.toString() implementation 2020-05-28 14:02:59 +03:00
Mikhail Glukhikh 2d842d061e IrSourceCompilerForInline: get ownerKind without descriptor 2020-05-28 14:02:57 +03:00
Mikhail Glukhikh 8a15edf5e6 [IR] Extract IrDeclaration(Access).psiElement extension 2020-05-28 14:02:55 +03:00
Mikhail Glukhikh 724101cdd2 [IR] Get rid of minor symbol.descriptor usages 2020-05-28 14:02:53 +03:00
Mikhail Glukhikh bf66929b5b Extract IrClass.syntheticAccessorToSuperSuffix() 2020-05-28 14:02:53 +03:00
Mikhail Glukhikh 66da676b9e [IR] Extract IrCallableReference.referencedName 2020-05-28 14:02:52 +03:00
Steven Schäfer 86cd039526 JVM IR: Use original descriptors for lambdas in JvmDeclarationOrigin 2020-05-27 20:21:42 +03:00
Jinseong Jeon b93868c30b IR: migrate IrType utils about array element type. 2020-05-27 11:38:32 +03:00
Roman Artemev bc32688497 [PLUGIN API] Drop PureIrGenerationExtension 2020-05-26 14:38:18 +03:00
pyos d17a18f96d JVM: do not write trivial SMAPs to classes outside inline funs
where trivial == those that map the file to itself.
2020-05-25 20:03:56 +02:00
Mikhail Glukhikh b05a1bb1a2 [IR] Extract IrExternalPackageFragmentImpl.createEmptyExternalPackageFragment 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
Steven Schäfer 933440dc63 JVM IR: Fix mangling of @JvmStatic internal function in companion objects 2020-05-20 15:57:03 +02:00
pyos 7222a732c1 JVM: treat empty SMAP instances as "skip all line numbers" 2020-05-19 18:33:27 +02:00
pyos 86b28b95ca JVM: keep call site markers when inlining lambdas into objects
A follow-up for KT-35006:

    fun f() = foo {
        bar()
    }
    inline fun foo(crossinline x: () -> Unit) = { x() }()
    inline fun bar() = TODO()

does not provide the option to navigate to bar's call site at all.
2020-05-19 18:33:27 +02:00
pyos 1fe7ef6521 JVM: separate the two kinds of source mappers
* a writing source mapper has `mapLineNumber(line, file, class)` that
   inserts a new SMAP entry and returns a fake line number from it;
 * a copying source mapper has `mapLineNumber(line)` that uses an
   existing SMAP to resolve the line number and call the former method
   on a different source mapper;
 * those two types are disjoint.
2020-05-19 18:33:27 +02:00