Commit Graph

440 Commits

Author SHA1 Message Date
Svyatoslav Kuzmich c4ffe36a21 [JS IR BE] Add CharSequence type check 2019-02-25 15:09:25 +03:00
Georgy Bronnikov 3531f47bfb Remove descriptors from ToArrayLowering 2019-02-23 00:42:16 +03:00
Georgy Bronnikov 72ea4cc3d7 Remove descriptors from BridgeLowering 2019-02-23 00:42:16 +03:00
Georgy Bronnikov 5f4b8dd0aa Remove descriptors from EnumClassLowering 2019-02-23 00:42:16 +03:00
Dmitry Petrov c248dd29c2 IR: declaration builders, initial iteration, use in some JVM lowerings 2019-02-21 16:03:11 +03:00
Alexander Udalov d267f1e875 JVM IR: generate synthetic $annotations methods for properties 2019-02-19 17:25:47 +01:00
Alexander Udalov c357967c2c JVM IR: generate Kotlin metadata
Introduce MetadataSource as a way to store the original descriptor for
any element (before any lowerings) and maintain it until the end of the
codegen where it's used in generating the metadata. Note that JVM
signatures written to the metadata are formed from the _resulting_
generated elements, not by mapping the original descriptors.

Some corner cases are not supported yet, namely properties declared in
companion objects, synthetic methods for property annotations,
JvmPackageName, etc.

 #KT-29119 Fixed
2019-02-19 16:37:47 +01:00
Jim S 47d63fc9be Make IrDeclaration.origin mutable 2019-02-16 09:55:03 -08:00
Dmitry Petrov 4cee8c6f00 Minor: fix IrDynamicOperatorExpressionImpl double dispatch methods 2019-02-14 16:03:11 +03:00
Dmitry Petrov 83b2fed5be psi2ir: minor: drop unused import 2019-02-14 16:03:11 +03:00
Dmitry Petrov 9a2bd5f4e6 psi2ir: dynamic member simple assignment/augmented assignment/++/-- 2019-02-14 16:03:11 +03:00
Dmitry Petrov 3c8f52b436 psi2ir: simple dynamic member calls 2019-02-14 16:03:11 +03:00
Dmitry Petrov 6e7ccfbfff Introduce IrDynamicExpression and children
Dynamic expressions are represented as either operator expressions -
e.g., `d1 + d2`, `d[e]`, `d(e1, e2, e3)`, `d += e` -
where "operator" is a one of the known operators,
or as member reference expressions - e.g., `d.memberName` - where
member name is some arbitrary name (unresolved at compile-time and
represented as String).
2019-02-14 16:03:11 +03:00
Svyatoslav Kuzmich 0ff23544fc [JS IR BE] Initial support for mudule wrapper generation 2019-02-12 18:45:35 +03:00
Svyatoslav Kuzmich d8b1d09566 [JS IR BE] Support codegen for external objects and properties 2019-02-12 18:45:35 +03:00
Mikhael Bogdanov a122cba862 Switch Kotlin project to jvm-target 1.8
#KT-29405
2019-01-31 07:43:05 +01:00
Mads Ager fb6eafddf1 JVM_IR: Generate better code for null checks.
Simplify ifs when branches have condition true/false.

Simplify blocks containing only a variable declaration
and a variable get of the same variable. Simplify to
just the condition.

Do not introduce temporary variables for constants for
null checks. Constants have no side-effects and can be
reloaded freely instead of going through a local.

This simplifies code such as "42.toLong()!!" so that the
resulting code has no branches and uses no locals. The
simplifications happen as follows:

```
block
  temp = 42.toLong()
  when
    (temp == null) throw NPE
    (true) load temp

---> null test simplification

block
  temp = 42.toLong()
  when
    (false) throw NPE
    (true) load temp

---> when simplification

block
  temp = 42.toLong()
  load temp

---> block simplification

42.toLong()
```
2019-01-23 15:11:14 +01:00
Dmitry Petrov 360bfcaf6a KT-29340 Provide effective modality for enum class in IR
* if enum class has abstract members, then it is ABSTRACT
* otherwise, if enum class has entries with members, then it is OPEN
* otherwise, it is FINAL.
2019-01-22 10:52:54 +03:00
Mads Ager 690b8e0ac9 JVM_IR: Optimize null checks.
Introduce lowering to remove null checks for primitive type
expressions and replace them with true/false. Side-effects
are preserved.

Generate ifnull/ifnonnull instructions for null checks instead
of materializing a null literal for an equality check.
2019-01-19 09:43:43 +01:00
Georgy Bronnikov 7df0cffac9 Move declaration origins to IrDeclarationOrigin.kt 2019-01-17 23:46:26 +03:00
Georgy Bronnikov bccb451afd Add isSyntheic flag to IrDeclarationOrigin 2019-01-17 23:46:26 +03:00
Georgy Bronnikov ec0842c0f4 Remove descriptors from CallableReferenceLowering 2019-01-17 23:46:26 +03:00
Georgy Bronnikov da0a823992 Remove descriptors from LocalDeclarationslowering 2019-01-17 23:46:26 +03:00
Svyatoslav Kuzmich ebdbe7ec30 [JS IR BE] Fix fake override functions resolve
Use signature of function 'target' (a real function that will
be called instad of fake override) to make boxing/unboxing decision for
return value and type parameters on call site.
2019-01-16 12:11:27 +03:00
Alexander Gorshenev 606c622e61 Removed unnecessary nullability marks. 2019-01-15 14:54:27 +03:00
Alexander Gorshenev 1e6240730b Added a TODO statement on special treatment of properties in deserializer. 2019-01-15 14:54:27 +03:00
Alexander Gorshenev f10e826b52 Less eagerly fail on the boundary between deserializer and DeclarationStubGenerator. 2019-01-15 14:54:27 +03:00
Alexander Gorshenev 884e6e15e9 Added a comment for separate treatment of properties in IrDeserializer interface. 2019-01-15 14:54:27 +03:00
Alexander Gorshenev 32c2e841f2 Reversed DumpIrTree.kt fix for now, as it breaks tests comparing textual IR representation. 2019-01-15 14:54:27 +03:00
Alexander Gorshenev cea32bd4e3 Minor changes in preparation for IR deserialization. 2019-01-15 14:54:27 +03:00
Igor Chevdar 9fee03ca81 IR: Fixed some parents 2019-01-10 14:35:10 +03:00
Igor Chevdar a78b80f8bf IR fixes to help symbolization of K/N 2019-01-10 14:35:10 +03:00
Dmitry Petrov 57c12476d7 Provide parent reference for temporary variables immediately 2018-12-20 15:57:31 +03:00
Dmitry Petrov e5d946a96c Parent for thisReceiver of IrLazyClass is the corresponding class
Fixes issue in Kotlin/Native.
2018-12-19 15:48:07 +03:00
Dmitry Petrov 85f55dec9a Support SAM conversion in psi2ir
SAM conversion takes a function value (function type or a subtype),
and produces a SAM interface value.
2018-12-19 10:58:34 +03:00
Roman Artemev e436e7cf61 [JS IR BE] Support call super with default parameters 2018-12-18 15:55:09 +03:00
Georgy Bronnikov 3b16fa6af9 Do not generate interface delegation for default parameter stubs 2018-12-18 13:57:23 +03:00
Mikhail Zarechenskiy e8a8318ead [NI] Fix input/output types for callable reference atom
Input and output types are crucial for type variable fixation order and
 analysis of postponed arguments (callable references, lambdas).

 Specifically, if there is non-fixed type variable inside input types of
 a callable reference, then we'll postpone resolution for such callable
 reference.

 Initial example with the expected type `KMutableProperty1<*, F>` caused
 problems because input types were computed incorrectly (while there
 aren't input types here)

 #KT-25431 Fixed
2018-12-11 11:33:29 +03:00
Georgy Bronnikov a695e21e44 Introduce IrLazyProperty 2018-12-10 17:26:55 +03:00
Georgy Bronnikov c018109bca React to review comments 2018-12-10 17:26:55 +03:00
Georgy Bronnikov c9343c89bc Mark java external declarations in IrFunction.origin 2018-12-10 17:26:55 +03:00
Georgy Bronnikov bba711a189 JVM_IR. Remove descriptors from ConstAndJvmFieldPropertiesLowering 2018-12-10 17:26:55 +03:00
Georgy Bronnikov 41da078de5 IR. Create IrAnonymousInitializerSymbolImpl using a class symbol 2018-12-10 17:26:55 +03:00
Georgy Bronnikov bf4f552478 IR. Remove descriptors from KCallableNamePropertyLowering 2018-12-10 17:26:55 +03:00
Roman Artemev eff81525d3 Make IrField be IrDeclarationParent
* fix parent in TypeOperatorLowering
2018-12-07 17:58:20 +03:00
Roman Artemev ce70e5850f [JS IR BE] New Inliner from native 2018-12-07 17:58:20 +03:00
Dmitry Petrov f8582c1929 psi2ir: ersatz type approximation for intersection types
Emulate old JVM back-end behavior for intersection type mapping.

IrType renderer should render the IR type, not the original Kotlin type.
2018-12-07 10:51:55 +03:00
Svyatoslav Kuzmich 8359887696 [JS IR BE] Fix inline classes workarounds
- Remove uninitialized return type check
- Remove unbound classifier symbol check
2018-12-03 13:07:41 +03:00
Svyatoslav Kuzmich 2172a12df4 [JS IR BE] Eliminate identical IrElements duplicates 2018-11-29 15:36:56 +03:00
Svyatoslav Kuzmich d5f8c63130 [IR] Add returnType to consturcotrs of IrFunctionBase 2018-11-29 15:36:56 +03:00