Commit Graph

447 Commits

Author SHA1 Message Date
Roman Artemev 78b29349c9 Fix lateinit isInitialized check in multi-file case 2019-10-31 14:45:15 +03:00
Georgy Bronnikov 9c8e8651be IR: make stub marker parameter for constructors nullable
In constructor stubs for default arguments, a marker parameter used
to have a non-null type, but null was passed as the corresponding
argument. This patch corrects the type.
2019-10-30 12:23:27 +03:00
Mark Punzalan 3c775c598c Extract utility function to create temporary variables if necessary. 2019-10-28 15:26:38 +01:00
Mark Punzalan 9bb9ab67a7 Add bytecode text tests for ForLoopsLowering. 2019-10-28 15:26:38 +01:00
Mark Punzalan 8a4185202f Handle step progressions in ForLoopsLowering. 2019-10-28 15:26:38 +01:00
Igor Chevdar 7b0f03cc1c [IR] Made IR validator weaker during validating IrConstNull 2019-10-28 12:39:29 +03:00
Mads Ager 52febbcc07 [JVM_IR] Support default interface suspend functions.
Do this by reordering the lowerings so that the lowering that
adds continuations happen after default methods have been
eliminated if needed.

Mark more functions as known to be tail-calls: bridges and
delegated members.

Preserve source info and annotations when creating replacement
functions.
2019-10-24 18:51:41 +03:00
pyos 55acc296a2 JVM_IR: never create temporaries in $default stubs
Given the strict pattern-matching in the inliner, this is the only way
to make it not crash when attempting to inline these stubs. Note that
the IR backend does not currently use the inliner's default method stub
handling; the crash only occurs when a module compiled with the non-IR
JVM backend is attempting to call an inline function with default
arguments defined in a module that was compiled with the IR backend.
2019-10-23 11:11:16 +02:00
Mads Ager 8b97819c04 [JVM_IR] Support suspend functions that can be overriden.
The challenge for overridable suspend functions is that the calling
the state machine method to resume after suspension would be
virtually dispatced to the wrong method. To avoid that a static
suspend implementation method is generated which becomes the
state machine method used to resume.
2019-10-22 12:48:21 +03:00
Ilmir Usmanov b0a0399dd0 JVM_IR: Support callable references to suspend functions 2019-10-21 13:15:39 +03:00
Dmitry Petrov 6bdc9ee65b IR BE common: isExpect 2019-10-21 13:04:59 +03:00
Dmitry Petrov 6532f29cc6 IR: isExpect 2019-10-21 13:04:59 +03:00
Steven Schäfer c905209504 JVM IR: Lower IrStringConcatenation 2019-10-18 17:24:53 +02:00
Steven Schäfer 78b4024ccb JVM IR: Unify the handling of IrStringConcatenation and toString 2019-10-18 17:24:12 +02:00
Steven Schäfer 417c570243 IR: Fix InnerClassConstructorCallsLowering
Prevent repeated passes over nested functions.
2019-10-18 17:20:22 +02:00
Steven Schäfer 9389d88232 JVM IR: Hide constructors with inline class parameters 2019-10-18 17:20:22 +02:00
Mads Ager 8305baa5fe [JVM_IR] Avoid unbounded recursion for recursive suspend functions.
Additionally, deal with primitive types in AddContinuationLowering.
2019-10-16 13:50:52 +03:00
Georgy Bronnikov 1abdcf3f57 JVM_IR: support function references with default parameters 2019-10-11 13:30:30 +03:00
Georgy Bronnikov c70b2e3e4b JVM_IR: specify correct type for defaultConstructorMarker arguments 2019-10-10 14:07:43 +03:00
Vitaliy.Tikhonov 184ae2fa43 [IR JS BE] create lowering for scripts 2019-10-10 12:52:05 +03:00
Vitaliy.Tikhonov 240abdb750 [JS IR BE] update current lowerings for IrScript 2019-10-10 12:52:05 +03:00
Vitaliy.Tikhonov 14510c1da3 [IR] create IrScript, infrastructure for it and update visitors 2019-10-10 12:52:05 +03:00
Mads Ager 92cf521e11 [IR] Deal with forward references in default argument lambdas.
Rely on the frontend weeding out cases that are not supported.

In psi2ir, introduce all the parameters before processing default
values.

Change the DefaultArgumentStubGenerator to generate code that
matches the behavior of the current backend.
2019-10-10 09:00:51 +02:00
pyos cd47c11efd Generate unique parameter names in LocalDeclarationsLowering 2019-10-07 15:14:48 +02:00
pyos 6163a8cf56 IR: keep source container when making functions static 2019-10-02 14:48:05 +02:00
pyos 35a0fc40a6 Don't create redundant copies in DefaultArgumentStubGenerator 2019-10-02 14:48:05 +02:00
Georgy Bronnikov 2e3428bbe7 JVM_IR: incorporate validation into jvmPhases 2019-10-02 14:56:54 +03:00
Georgy Bronnikov be002fc417 JVM_IR: do not copy bodies when creating static functions 2019-10-01 20:52:57 +03:00
Georgy Bronnikov 7e9cfbc91a IR: use toLowerCaseAsciiOnly 2019-10-01 16:43:23 +03:00
Mark Punzalan a01c53fb74 Use getPropertyGetter() in ForLoopsLowering to retrieve property
getters instead of directly retrieving the property first.

When the IR backend is used to compile the standard library, the
progression classes (in sources) are lowered, and therefore do not have
properties anymore (only fields and functions).
2019-10-01 13:34:59 +02:00
Mark Punzalan 9daea89221 Avoid duplicate IR elements in ForLoopsLowering (accidentally introduced
in #2620).
2019-10-01 12:40:50 +02:00
Georgy Bronnikov 53b7766910 IR: call toLowerCase() with root locale
Preventing complexities with Turkish Iı vs. İi.
2019-09-30 22:55:19 +03:00
Mark Punzalan c16b59191b Do not cache "last" value (i.e., size/length) in lowered for-loop
iteration over CharSequences.

CharSequences may be mutable (e.g., StringBuilder) and therefore its
contents and length can change within the loop.
2019-09-27 13:44:40 +02:00
Kristoffer Andersen 52dc469657 JVM IR: Generate synthetic methods for type aliases with annotations 2019-09-24 12:21:42 +02:00
Alexander Udalov a7b984bcbf JVM IR: fix generation of generic multi-file delegates 2019-09-19 22:23:16 +02:00
Alexander Udalov acbe5c4e21 JVM IR: fix IOOBE from remapTypeParameters for synthetic property annotations method 2019-09-19 22:23:16 +02:00
Mads Ager 507857d452 [IR] Support Collection<*>.indices in for loop lowering.
Unmute a couple of tests that are working as intended.
2019-09-18 19:00:17 +02:00
Alexander Udalov 6ef434a711 JVM IR: add -Xir-check-local-names to check names for consistency
Since KotlinTypeMapper is no longer used in the JVM IR backend, we need
not run CodegenBinding.initTrace and check that names of local entities
are exactly equal to local names computed by that algorithm.

However, it's still useful as an opt-in flag, to discover issues where
unwanted elements take part in the naming (such as temporary IR
variables, see for example cb2e68fece). So we introduce a new command
line argument -Xir-check-local-names which, when the IR backend is used
(via -Xuse-ir), launches the name computation algorithm from the old
backend and then compares that the names are exactly equal to the names
computed by the IR backend in InventNamesForLocalClasses.
2019-09-18 17:55:42 +02:00
Ilmir Usmanov 2ec3417e0e JVM_IR: Move suspend functions into view transformation to codegen phase
Support suspend functions with default arguments.
2019-09-16 16:49:18 +03:00
Mads Ager 90a37617a4 [JVM_IR, IR] Remove more needless temporary variables.
Avoid using a separate origin for temporary variables introduced
for for loops. That doesn't add anything and gives one more case
for optimizations to deal with.

Extend the JVM specific optimizations to remove temporary
variables to deal with more cases encountered in for loops
lowering.
2019-09-11 10:07:45 +02:00
Steven Schäfer 626f4c94f6 Handle special case visibility rules in LocalDeclarationsLowering 2019-09-06 12:12:58 +02:00
pyos 20626e4aaf Make ReturnableBlockLowering common
and remove special handling in JVM_IR codegen.
2019-09-05 15:48:26 +02:00
Mads Ager 75f9532959 [IR] Avoid duplicate IR elements in for loops lowering. 2019-09-05 11:33:26 +02:00
Mads Ager 3f28b71509 [IR] Fix issue getting the length property from CharSequence bounded type parameter
Use the class of the subtype of CharSequence when available. When
it is not (for type parameters bounded by CharSequence) call the
CharSequence getter and 'get' method. Using the most specific type
posible fixes the forInStringSpecialized test that expects the
use of INVOKEVIRTUAL and not INVOKEINTERFACE.

Add tests for the type parameter use.
2019-09-03 20:18:03 +02:00
Alexander Udalov bf5ca2ed84 Cleanup compiler warnings in IR-related modules 2019-09-03 19:32:57 +02:00
Igor Chevdar 5bd88f3191 [IR] ForLoopsLowering: fixed problems with type parameters 2019-09-03 14:40:06 +03:00
Mads Ager 85b1e0165b [IR] For loop lowering for CharacterSequence.indices. 2019-09-03 13:18:21 +02:00
Vasily Levchenko 22c53e14e6 [IR][inliner] fixed occasional endless recursion in InlinerExpressionLocationHint::toString 2019-08-30 12:23:18 +03:00
Mads Ager 8ed1317839 [IR] For loop lowering for iteration over CharacterSequences.
Change-Id: I7aeadfffc80f791ec19a3607e219c1dc4de028db
2019-08-30 09:35:59 +02:00
Vasily Levchenko d6c5fbace0 [IR][inliner] prevent of parameters location information loss 2019-08-29 16:53:56 +03:00