Commit Graph

2864 Commits

Author SHA1 Message Date
Mikaël Peltier
73b9685f38 KT-23931 Avoid infinite loop into RedundantGotoMethodTransformer
- Follow-up of 9fb0f59813 to avoid
infinite loop during redundant goto otpimization.

Fix of https://youtrack.jetbrains.com/issue/KT-23931

(cherry picked from commit b1ef670)
2018-04-23 20:27:56 +03:00
Mikhail Zarechenskiy
fdfe801c92 Render unwrapped suspend function in backend
Hierarchy of specially wrapped suspend function may have inconsistent
 overridden descriptors: some of them may be wrapped, some unwrapped.
 To mitigate this problem, currently it's proposed to render only
 unwrapped functions, which are always have stable overridden descriptors

 #KT-23809 Fixed
2018-04-23 18:04:40 +03:00
Dmitry Petrov
8b446a1649 Use correctElementType to determine array element type for withIndex
Rather unkind "gotcha" in ASM API.
2018-04-23 17:56:16 +03:00
Anton Bannykh
4e0af21df4 Revert "Clean up test skips after KT-17137"
This reverts commit 715d5e9

(cherry picked from commit cc1c7dcb04c98bfb70a852e2a4d3456573015682)
2018-04-10 20:46:00 +03:00
Yan Zhulanow
2283366076 Revert "Debugger: Fix breakpoints and stepping for inline-only function lambda arguments (#KT-23064)"
This reverts commit aa75d88
2018-04-04 19:23:00 +03:00
Mikhael Bogdanov
2cd5bd4d83 Update test data
(cherry picked from commit 08ff1de)
2018-04-03 19:47:12 +02:00
Mikhael Bogdanov
7a1aa8ac81 Update test data. Use simple ''@JvmDefault' instead full qualifier
(cherry picked from commit 38f8924)
2018-04-03 19:46:50 +02:00
Mikhael Bogdanov
9e88b3d691 Check method abstractness during bridge generation per method not interface
(cherry picked from commit 2a8041e)
2018-04-03 19:46:45 +02:00
Mikhael Bogdanov
6e903333a6 Remove @JvmDefault members from delegation
(cherry picked from commit f290b32)
2018-04-03 19:46:40 +02:00
Mikhael Bogdanov
a51181b009 Support inline for private @JvmDefault members
(cherry picked from commit d84a15c)
2018-04-03 19:46:36 +02:00
Mikhael Bogdanov
5ba37fdff7 Support synthetic accessors for @JvmDefault members
(cherry picked from commit 308283e)
2018-04-03 19:46:29 +02:00
Mikhael Bogdanov
a28a0beaea Initial support of @JvmDefault
(cherry picked from commit fe45eb2)
2018-04-03 19:46:16 +02:00
Mikhael Bogdanov
995156b801 Remove wrong directive
Similar test exists under 'defaults' foldes

(cherry picked from commit c143480)
2018-04-03 19:46:05 +02:00
Yan Zhulanow
aa75d887dc Debugger: Fix breakpoints and stepping for inline-only function lambda arguments (#KT-23064)
(cherry picked from commit eec9c6b)
2018-04-03 03:20:15 +03:00
Zalim Bashorov
675c1df26c [JS BE] Fix the crash on compound operations with a qualified call on left side
#KT-22001 Fixed

(cherry picked from commit 9349b9b)
2018-03-28 22:51:57 +03:00
Ilmir Usmanov
2a859144d1 Do not generate beforeInlineMarker on tailrec jump
Before this change, the codegen used to generate beforeInlineMarker
in order to spill variables later. However, since the tailrec call
is replaced with jump, no afterInlineMarker is generated, leading to
inconsistency of these markers. Thus, the spilling fails.
This change disables generating of beforeInlineMarker.

 #KT-21521: Fixed
2018-03-28 16:29:32 +03:00
Ilmir Usmanov
420b313920 Fix transforming of coroutine's create when it is suspend lambda with receiver
Unlike ordinary lambdas suspend lambdas has create method which invokes
the constructor of the lambda object (continuation).
The inliner could not cope with this.
The previous change fixed the case of suspend lambda without receiver.
This change adds support of suspend lambdas with receiver.

 #KT-21605: Fixed
2018-03-28 16:29:26 +03:00
Roman Artemev
7d0087c55e Added test to check default params in declaration (issue KT-23239) 2018-03-26 15:44:13 +03:00
Ilmir Usmanov
aaf56ddbbc Do not ignore copy operations while finding source instructions
in redundant locals elimination.

Since IgnoringCopySourceInterpreter ignores ALOADs and ASTOREs,
the source instruction of ALOAD K in {ALOAD N, ASTORE K, ALOAD K}
sequence is not ASTORE K. In this case we cannot simply replace K
with N, since there can be multiple {ALOAD N, ASTORE K} sequences
in separate branches. After replacement we get different stack
frames.
This change resolves this.

However, in ReturnUnitMethodTransformer we want to ignore copies
of the same GETSTATIC kotlin/Unit.INSTANCE, since we do not mess
with local variables and just replace ASTORE with ARETURN to help
tail-call optimization.
 #KT-23373: Fixed
2018-03-23 22:02:21 +03:00
Ilmir Usmanov
6a2b9c33fc Raise deprecation level to ERROR of coroutineContext
inside kotlin.coroutines.experimental.intrinsics package
 #KT-22400
2018-03-23 22:02:11 +03:00
Ilmir Usmanov
826d667398 Remove redundant locals
Do not transform already transformed suspend lambdas
Ignore duplicates of continuation in local variable table during redundant locals elimination.
2018-03-16 16:26:14 +03:00
Ilmir Usmanov
81f3e39f29 Do not generate ACONST_NULL as continuation of crossinline suspend lambda 2018-03-16 16:26:13 +03:00
Ilmir Usmanov
6854135077 Support crossinline suspend lambda as parameter of inline function
Use fake continuation instead of ALOAD 0 while inlining
Do not generate state machine for inner lambdas and inner objects,
which capture crossinline suspend lambda.

 #KT-19159: Fixed
2018-03-16 16:26:11 +03:00
Ilmir Usmanov
e6a353e590 Remove returns unit markers in suspend lambdas 2018-03-16 16:26:09 +03:00
Ilmir Usmanov
e169383f76 Fix problem with transforming suspend lambda instantiation by itself
#KT-21605: Fixed
2018-03-16 16:26:09 +03:00
Mikaël Peltier
d0ed0c4049 KT-14258 Optimize accesses to properties defined into companion
- Use direct access to property defined into companion object when
it is possible rather than always use an accessor to access the
property.
- Use direct access will speedup runtime performance.
- Avoid to generate useless accessors for companion properties.

Fix of https://youtrack.jetbrains.com/issue/KT-14258
2018-03-14 15:30:40 +01:00
Dmitry Petrov
d38258d7a0 Use specified comparison generator for chars in optimized ranges
Otherwise if Char value is a result of some erased generic call,
coercing it to I (primitive int) causes CCE at run-time.

 #KT-23104 Fixed Target versions 1.2.40
2018-03-13 09:34:10 +03:00
Mikhael Bogdanov
c1c8660e55 Don't try to transform sam wrappers in same module
#KT-22304 Fixed
2018-03-08 11:50:08 +01:00
Ilmir Usmanov
07ec704228 Fix modifiers generation for companion objects
when language verion is 1.3

 #KT-23002: Fixed
2018-03-01 20:03:26 +03:00
Egor Neliuba
715d5e90ba Clean up test skips after KT-17137
We need to clean these up since primitive array `is` checks work now

(cherry picked from commit b413e9ef51606c51ebfb21bd7ff646b0fb75470a)
2018-03-01 14:26:13 +03:00
Anton Bannykh
ed80252ba8 JS: fix double compareTo behaviour for NaN and +-0 (KT-22723) 2018-02-28 15:01:58 +03:00
Dmitry Petrov
8fbdf52d34 Chars are not promoted to Int on comparisons 2018-02-27 10:09:17 +03:00
Denis Zharkov
5a591be25f Convert SwitchCodegen to Kotlin, prettify and optimize codegen 2018-02-22 11:42:18 +03:00
Ilmir Usmanov
9fdd34ce6e Minor. Add regression test for KT-15930
#KT-15930: Obsolete
2018-02-21 19:32:50 +03:00
Mikhail Zarechenskiy
f23b5103ec Avoid non-null assertions for inline classes based on nullable types
Note that there are more places where assertions for inline classes should refined:
  - lateinit vars
  - values that come from Java
  - type casts (interfaces to inline class type)
2018-02-20 14:41:48 +03:00
Mikhail Zarechenskiy
413e2d7fa1 Fix KotlinType of constructor call for inline classes 2018-02-20 11:58:18 +03:00
Mikhail Zarechenskiy
530dd01ca6 Fix unboxing values of inline class type from type parameters 2018-02-20 11:45:49 +03:00
Dmitry Petrov
99cea07bf4 Correctly map container element type in intrinsic for withIndex
In case of arrays, we couldn't distinguish array of boxed Ints
from array of primitive Ints.

 #KT-22904 Fixed Target versions 1.2.40
2018-02-20 09:18:25 +03:00
Igor Chevdar
a2897a29b5 Added tests on default arguments of fake overridden functions 2018-02-19 18:39:08 +03:00
Mikhael Bogdanov
cc4ab832b7 Properly calculate outermost parent class for sam wrapper
#KT-22906 Fixed
2018-02-19 13:29:56 +01:00
Mikhael Bogdanov
d732f0e160 Never delete types from inline functions during inline transformations
#KT-19399 Fixed
2018-02-16 16:48:53 +01:00
Mikaël Peltier
9fb0f59813 KT-17110 Rewrite branches targeting other branches
- Rewrite branches targeting other branches to target directly the
final destination to avoid runtime performance penalties.

Fix of https://youtrack.jetbrains.com/issue/KT-17110
2018-02-16 15:15:52 +03:00
Dmitry Petrov
8bfbbe456f Use NoScopeRecordCliBindingTrace for codegen tests 2018-02-15 16:40:26 +03:00
Mikaël Peltier
ef6b6cd261 Fix NPE into isArraySizeAccess 2018-02-15 12:41:33 +03:00
Mikaël Peltier
3c2f137fd5 Exclude tests from JS backend due to a bug into it 2018-02-15 12:41:33 +03:00
Mikaël Peltier
be07a348ea Reformat tests 2018-02-15 12:41:33 +03:00
Mikaël Peltier
8676ca34d7 KT-22334 Specialized loops using range such as integer..array.size-1
- Into PrimitiveNumberRangeLiteralRangeValue modifies how bounded
value are created by checking if the high bound range can be modified
to be exclusive instead of inclusive such as the generated code will
be optimized.
- Add black box tests checking that the specialization does not fail
on any kind of arrays.
- Add a bytecode test checking that the code is correctly optimized.

Fix of https://youtrack.jetbrains.com/issue/KT-22334
2018-02-15 12:41:33 +03:00
Mikaël Peltier
8ab7e5c406 KT-10057 Use lcmp instead of Intrinsics.compare
Fix of https://youtrack.jetbrains.com/issue/KT-10057
2018-02-14 09:46:29 +01:00
Denis Zharkov
c47c1c5ffd Fix runtime CCE in case of out-projected SAM
Probably, when NI is there this fix will become unnecessary because
there will be no approximation applied, thus the value parameter
will remain Hello<#Captured> instead of Nothing

 #KT-17171 Fixed
2018-02-14 10:29:14 +03:00
Mikhail Zarechenskiy
e017e9cb5f Support passing inline class values with spread operator 2018-02-13 13:16:45 +03:00