Commit Graph

1369 Commits

Author SHA1 Message Date
Mads Ager a8e2893494 JVM_IR: Output EnclosingMethod attribute.
This works in many cases, however, it is incomplete since there
are cases where classes are extracted to top-level and therefore
reparented. Therefore, we lose the information about the function
class are nested inside.
2019-04-10 20:50:03 +02:00
pyos 8ae9e7a106 JVM_IR: unwrap fake overrides when computing property signatures 2019-04-10 19:21:37 +02:00
Alexander Udalov 121f30d9cc Use IrType instead of KotlinType in SingleAbstractMethodLowering 2019-04-10 14:42:40 +03:00
Alexander Udalov 2f003ef545 Generate classes in MultifileClassCodegen exactly the same as in PackageCodegen
Two known issues with generateNonPartClassDeclarations that was here
before were the fact that we didn't sort sealed classes and its
subclasses which led to NoSuchMethodError (KT-27097), and the fact that
we didn't skip expect classes which led to incorrect duplicate JVM class
name diagnostic (KT-30843)

 #KT-27097 Fixed
 #KT-30843 Fixed
2019-04-10 14:39:16 +03:00
Georgy Bronnikov 43e87a1635 Merge pull request #2256 from pyos/flatten-phases
Flatten phase compositions
2019-04-10 10:43:14 +03:00
Steven Schäfer 26aeddf6d9 Remove broken KotlinType.toIrType function
The KotlinType.toIrType function sometimes produces unbound symbols
and was only used in IrIntrinsicFunction and SharedVariablesManager.

This change removes the broken function and changes SharedVariableManager
to use IrType consistently and IrIntrinsicFunction to use KotlinType
consistently.
2019-04-09 13:46:02 +02:00
pyos 048fd9fa25 Create a single instance of IrIntrinsicMethods per context.
This improves JVM_IR compilation times by 2%.
2019-04-09 11:56:58 +02:00
pyos f37d171a52 Flatten phase compositions.
This makes stack traces and flame graphs significantly more readable.
2019-04-09 10:15:45 +02:00
pyos fb0261bfc1 Remove JvmDescriptorWithExtraFlags and fix syntheticness
(of fields and classes, it is already correct for methods).
2019-04-09 08:18:14 +02:00
Mikhael Bogdanov 10e3dfa980 Support anonymous function as inline parameters 2019-04-08 13:10:25 +02:00
Mikhael Bogdanov 2a3a9bb5fc Support properties reificaton 2019-04-08 13:10:25 +02:00
Mikhael Bogdanov 944c200a5d Initial support of try as expression in JVM IR 2019-04-08 13:10:24 +02:00
Mikhael Bogdanov 30aeb8dc0a Support finally blocks in non-local returns 2019-04-08 13:10:23 +02:00
Mikhael Bogdanov 4c59d161d4 Support basic reification in IR 2019-04-08 13:10:22 +02:00
Mikhael Bogdanov 02cb1d7dcc Change return target in $default function on transformation 2019-04-08 13:10:22 +02:00
Mikhael Bogdanov 694a7c329d Initial support of non-local return in IR 2019-04-08 13:10:21 +02:00
Mikhael Bogdanov 3f9154a4a1 Remove declaration that would be inlined 2019-04-08 13:10:20 +02:00
Alexander Udalov dd2c7aff6e Implement IrType.equals/hashCode via isEqualTo/toHashCode 2019-04-08 13:06:01 +03:00
Alexander Udalov 8cce5dc8de Fix missing return for checkViaDescriptors in FqNameEqualityChecker 2019-04-08 13:06:01 +03:00
Alexander Udalov bdfe82cfff Fix incorrect condition in CheckIrElementVisitor.ensureTypeIs
Apparently it has no effect on behavior of tests because no backend uses
the checkTypes mode of IR validation
2019-04-08 13:06:01 +03:00
Mikhail Glukhikh 881073b1c9 Add basic FIR -> IR converter with a set of text tests
Tests duplicate IrTextTestCaseGenerated
#KT-24065 Fixed
2019-04-05 16:18:58 +03:00
Mikhail Glukhikh 92adfd8946 Add stub implementation of compileTimeInitializer in wrapped descriptors 2019-04-05 16:18:58 +03:00
Anton Bannykh b7ffdb9fde JS IR: support kotlin.test 2019-04-05 12:30:21 +03:00
Anton Bannykh d04a0246db make smartJavaExec composable with NoDebugJavaExec 2019-04-05 12:30:21 +03:00
Anton Bannykh ad4c2144a7 JS IR: moved klib creation to the serialization_test module 2019-04-05 12:30:20 +03:00
Anton Bannykh 0f183ed662 JS IR: split compilation and deserialization 2019-04-05 12:30:20 +03:00
Anton Bannykh 08785b7cea JS IR: split serialization into a separate module 2019-04-05 12:30:20 +03:00
Anton Bannykh 42f576f033 IR: move serialization to serialization.common 2019-04-05 12:30:20 +03:00
Steven Schäfer 59c5d8bdb8 Add an implicit cast to Unit in returns from a constructor. 2019-04-05 12:05:53 +03:00
Vasily Levchenko 826f55ecb4 Merge pull request #2240 from JetBrains/rr/minamoto/ir-IrFunctionInlineBodyImpl
[IR] introduced additional field 'inlineFunctionSymbol' to IrReturnableBlock
2019-04-05 11:49:08 +03:00
Vasily Levchenko 1ebf7faedc [IR][refactoring] g/c IrReturnableBlock[Impl]
- drop calculatable from 'inlineFunctionSymbol' fields: 'sourceFileSymbol' and 'sourceFileName' and
replace then with extension values

- drop unused constructors.
2019-04-05 11:47:45 +03:00
pyos 05e09df683 Throw a clearer error on unexpected IR nodes in expressions 2019-04-04 21:39:49 +02:00
pyos c3a74ded0e Make isDefaultValueForType shorter 2019-04-04 21:39:47 +02:00
pyos fb55e34b8f Merge generateBreakOrContinueExpression and doFinallyOnReturn 2019-04-04 21:39:46 +02:00
pyos c0af91b6d1 Inline markFunctionLineNumber 2019-04-04 21:11:39 +02:00
pyos 9f28b2042a Move common declarations up 2019-04-04 21:11:37 +02:00
pyos a7dbd08f45 Inline genFinallyBlockOrGoto 2019-04-04 21:11:35 +02:00
pyos 6690e50dd2 Remove direct block stack manipulation 2019-04-04 21:11:33 +02:00
pyos 57450912fb Remove a couple unused classes, inline a short method 2019-04-04 21:11:31 +02:00
Vasily Levchenko 6f9feacf6e [IR] introduced additional field 'inlineFunctionSymbol' to IrReturnableBlock
This change let backend calculate and bind right function to the code block on generation debug information
e.g. for Kotlin/Native backend this let codegnerator to produce DILocation(..., inlinedAt:..) with correct value
for inlinedAt parameter, thus signifiacntly improve behaviour of debugger.
2019-04-04 16:14:34 +03:00
Dmitry Petrov 1c0c01725b Preserve original for constructors of LazySubstitutingClassDescriptor
We would like DeclarationDescriptor.getOriginal() to always point to a
(preferably unique) unsubstituted descriptors for the given possibly
substituted descriptor. In case of LazySubstitutingClassDescriptor
(which can be observed for nested generic Java classes), this invariant
was broken, because 'getOriginal()' for constructors of substituted
class returned a copy created for this particular substituted class.
2019-04-04 14:42:23 +03:00
pyos 4c01614136 Avoid leaking SamConstructorDescriptors from psi2ir 2019-04-04 09:45:00 +02:00
pyos ee59530f71 Fix casts of the null constant to SAM types 2019-04-04 09:45:00 +02:00
pyos 39c8939241 JVM_IR: optimize SAM conversion of lambda literals
Instead of materializing an invokable object and storing it in an
instance of the implementation, create a specialized class that calls
the lambda directly, resulting in one less nesting layer and one less
class.
2019-04-04 09:45:00 +02:00
pyos b74586f84e JVM_IR: implement single-abstract-method conversions 2019-04-04 09:45:00 +02:00
Mark Punzalan dd65e0876f Simplify loop building by encoding open/closed bound information in the
HeaderInfo object, and modifying the operator in the loop condition.

The "additional emptiness condition" is no longer necessary with this.
The open/closed property was removed from HeaderInfo in an earlier
commit, but bringing it back in to simplify the loop building makes
more sense.

Also expanded tests for evaluation order of range bounds.
2019-04-04 09:07:19 +02:00
Mark Punzalan 7680e7fd56 Use while loop for progressions that cannot overflow (instead of
do-while with enclosing "not empty" check).

Also do not add additional "not empty" condition for `until` loops when
the given bound is a constant != MIN_VALUE.
2019-04-04 09:07:19 +02:00
Mark Punzalan ba0e016c4e Add bytecode tests for array for-loop iteration. 2019-04-04 09:07:19 +02:00
Mark Punzalan 7afe121238 Eliminated the redundant ForLoopHeader.needsEmptinessCheck property, cast "bound" to progression type if necessary, fixed variable declaration order. 2019-04-04 09:07:19 +02:00
Mark Punzalan 6b83c04472 Cast step expression to the correct Number type, if necessary. 2019-04-04 09:07:19 +02:00