Mikhail Zarechenskiy
8015295059
Desugar constructor call of inline class to the underlying value
...
Also add information about KotlinType to the constant stack values
2018-02-13 13:16:39 +03:00
Mikhail Zarechenskiy
913e4b42bb
Support inline classes as last expression in lambda
2018-02-09 05:06:32 +03:00
Mikhail Zarechenskiy
396cc7d02b
Support unboxing of inline classes in elvis
2018-02-09 05:06:31 +03:00
Mikhail Zarechenskiy
fefcddc803
Support boxing/unboxing for captured vars of inline class types
2018-02-09 05:06:29 +03:00
Mikhail Zarechenskiy
9f24bbd980
Support unboxing of inline classes after assertion operator
2018-02-09 05:06:27 +03:00
Mikhail Zarechenskiy
4eb64fb4b9
Support mapping for inline classes based on type variables
2018-02-09 04:56:41 +03:00
Mikhail Zarechenskiy
c5c8d84719
Support boxing/unboxing for method return types
2018-02-09 04:56:36 +03:00
Mikhail Zarechenskiy
390c214943
Support boxing for inline classes on function calls
2018-02-09 04:56:08 +03:00
Mikhail Zarechenskiy
0d682879f5
Initial boxing for inline classes: local variable assignments
2018-02-09 04:55:44 +03:00
Mikaël Peltier
126afbb8ac
Avoid to generate unecessary checkcast
...
StackValue already avoid to generate checkcast from a type or an
array to java.lang.Object. Add a new case to avoid to generate a
checkcast from an array to an array of java.lang.Object when arrays
have the same dimensions.
#KT-22714 Fixed
2018-02-08 16:38:46 +01:00
Mikaël Peltier
a2a3043607
KT-18731 Use reference equality to compare enums
...
Fix of https://youtrack.jetbrains.com/issue/KT-18731
2018-02-05 18:34:44 +03:00
Mikhail Zarechenskiy
5dacfae793
Support calling inline functions inside inline classes
2018-02-05 12:07:41 +03:00
Mikhail Zarechenskiy
928a342ace
Initial version of codegen for inline classes
2018-02-05 12:07:40 +03:00
Dmitry Petrov
40d1925e19
Provide optimized code generation for for-in-withIndex for sequences
...
#KT-5177 In Progress
2018-01-23 10:55:24 +03:00
Dmitry Petrov
2399a39414
Provide optimized code generation for for-in-withIndex for CharSequences
...
#KT-5177 In Progress
2018-01-23 10:55:24 +03:00
Dmitry Petrov
9c9e507172
Provide optimized code generation for for-in-withIndex for iterables
...
#KT-5177 In Progress
2018-01-23 10:55:24 +03:00
Dmitry Petrov
08622b0953
Provide optimized code generation for for-in-withIndex for arrays
...
#KT-5177 In Progress
2018-01-23 10:55:24 +03:00
Dmitry Jemerov
e80dae1802
Update copyright in generated tests
2018-01-10 11:55:28 +01:00
Denis Vnukov
52ccd67ec1
Remove duplicate parameter null checks in JvmStatic delegate methods.
...
Remove unnecessary non-null parameter checks inside static delegate methods
created for @JvmStatic companion object methods. Allows function generation
strategy decide if such checks need to be injected.
#KT-7188 Fixed
2017-12-14 13:48:50 +03:00
Dmitry Petrov
9fa9a8748b
Check that qualified const expressions are recognized properly in 'for'
2017-12-14 10:41:51 +03:00
Dmitry Petrov
54cceac99b
Intrinsics for 'reversed': until
2017-12-14 10:41:51 +03:00
Dmitry Petrov
a4c29b3587
Support Long and Char in const-bounded counter loop generation
...
If the loop end value is a compile-time constant (best we can do now),
and it is safe to iterate over a given range using "naive" for loop
(using '<=' or '>=' in loop condition),
generate such loops for Longs and Chars as well Ints (Bytes, Shorts).
2017-12-14 10:41:51 +03:00
Dmitry Petrov
455a1c0f53
Intrinsics for 'reversed': downTo
...
#KT-21323 In Progress
2017-12-14 10:41:51 +03:00
Dmitry Petrov
64ba811b7f
Intrinsics for 'reversed': CharSequence.indices
...
#KT-21323 In Progress
2017-12-14 10:41:51 +03:00
Dmitry Petrov
7ba73c1635
Intrinsics for 'reversed': collection.indices
...
#KT-21323 In Progress
2017-12-14 10:41:51 +03:00
Dmitry Petrov
5bcbe25469
Intrinsics for 'reversed': array.indices
...
#KT-21323 In Progress
2017-12-14 10:41:51 +03:00
Dmitry Petrov
beff4a1b92
Intrinsics for 'reversed': support non-literal range expressions
...
#KT-21323 In Progress
2017-12-14 10:41:51 +03:00
Dmitry Petrov
1775f294f4
Intrinsics for 'reversed': infrastructure & primitive range support
...
#KT-21323 In Progress
2017-12-14 10:41:51 +03:00
Dmitry Petrov
5b8c0d4c3e
Optimize for-in-string loops
...
For-in-string loop can be generated using specialized 'length' and
'charAt' method calls, and with cached string length.
Note that update of the string variable in loop body doesn't affect
loop execution semantics.
#KT-21322 Fixed Target versions 1.2.20
2017-11-29 10:15:38 +03:00
Alexander Udalov
938fd1a57e
Use ResolvedCall for callable reference in KCallableNameProperty intrinsic
...
Instead of manually inspecting the DOUBLE_COLON_LHS slice, which is a
bit more error-prone. Note that new tests were passing before this
change
2017-11-27 12:46:56 +01:00
Dmitry Petrov
354d54aef6
Don't generate DUPX instructions for in-range-literal expressions
...
Store argument into a local variable instead.
2017-11-16 10:54:25 +03:00
Dmitry Petrov
16b7bece46
Fix constant expression inlining logic
...
Constant expressions are inlined if they do not depend on non-inlineable
vals.
Java constants are always inlined.
Kotlin constants are inlined in LV 1.1+.
2017-10-13 17:01:42 +03:00
Dmitry Petrov
73724bcdc7
Do not copy immediately created arrays in spread arguments
...
E.g., 'foo(x = *intArrayOf(42))'.
#KT-20462 Fixed
2017-09-28 14:55:11 +03:00
Mikhael Bogdanov
81a1bf3319
Recalculate max stack on method emitting: optimizations could change it
2017-09-06 08:20:32 +02:00
Dmitry Petrov
78b69cad77
Support lateinit local vars in redundant null check elimination
...
Lateinit local vars are guaranteed to be non-null after store.
So we mark such stores as storing non-null value
(could be useful for some other constructs, too),
and optimize null checks accordingly.
2017-08-31 11:28:08 +03:00
Denis Zharkov
fcd7677a3f
Fix compatibility of suspend functions with strict bytecode analyzers
...
In short, some of the bytecode analyzers assume that there could be
no stores instructions into parameter vars with value of different
types (even when the value type is a subtype)
See the issue for details
#KT-19713 Fixed
2017-08-22 18:43:26 +03:00
Dmitry Petrov
2ed5a5e368
'when' should use intrinsics for '=='
...
#KT-19029 Fixed Target versions 1.1.5
#KT-18818 Fixed Target versions 1.1.5
2017-08-07 10:31:02 +03:00
Dmitry Petrov
c9ad290ad5
Do not store null for temporary in destructuring assignment
...
#KT-19256 Fixed Target versions 1.1.5
2017-07-27 09:02:26 +03:00
Dmitry Petrov
b867c46f72
Generate for-in-range loop as counter loop when possible
...
If an upper bound is a compile-time constant != Int.MAX_VALUE,
we can generate 'for (i in x..N)' as 'for (i in x until N+1)'.
2017-07-27 09:02:26 +03:00
Dmitry Petrov
f558b4238c
Use counter loop in intrinsic array constructors
...
#KT-19149 Fixed Target versions 1.1.5
2017-07-24 10:17:30 +03:00
Dmitry Petrov
8e9c0294fe
Do not box primitives for 'primitive == object'
...
NB user-defined 'equals' can violate contract for 'Object#equals', e.g.,
it can be asymmetric.
Thus we can't avoid boxing for 'object == primitive'.
2017-07-21 08:52:29 +03:00
Dmitry Petrov
8aacddb9f0
Avoid primitive boxing for 'boxed == primitive' if possible
...
This makes sense for non-floating-point primitive type
(boolean, char, byte, short, int, long):
floating-point types use specialized versions of 'areEqual'.
2017-07-21 08:52:29 +03:00
Dmitry Petrov
8c7352e668
Generate constant "" for effectively empty string
2017-07-17 09:18:41 +03:00
Dmitry Petrov
8a9707c140
Generate proper initialization for possibly nullable SAM wrapper
...
#KT-18916 Fixed Target versions 1.1.5
2017-07-12 09:37:16 +03:00
Dmitry Petrov
ad80c3cd7f
If at least one of the range bounds is "pure", order doesn't matter
2017-07-10 10:51:26 +03:00
Dmitry Petrov
9d1901fc7c
Intrinsify some mismatching range/element combinations for in/in!
...
It's safe to upcast integer types to Long,
floating-point types to Double.
So we don't have to create a range instance for cases such as
fun testLongInInt(x: Long, a: Int, b: Int) =
x in a .. b
which is equivalent to
fun testLongInInt(x: Long, a: Int, b: Int) =
x in a.toLong() .. b.toLong()
2017-07-10 10:51:26 +03:00
Dmitry Petrov
614d90d6ef
Skip NOP instructions in fast pop backward propagation
2017-07-10 10:51:26 +03:00
Dmitry Petrov
36cbc0defd
Ensure that {Collection, CharSequence}.indices intrinsic works with 'in'
2017-07-10 10:51:26 +03:00
Dmitry Petrov
ec99fa2142
Ensure that 'in/!in x until y' intrinsic works
2017-07-10 10:51:26 +03:00
Dmitry Petrov
5decf65d6a
Ensure that no range instance is created for 'x in array.indices'
2017-07-10 10:51:26 +03:00