Commit Graph

1948 Commits

Author SHA1 Message Date
Denis Zharkov 3845ea863c Do not generate DefaultImpl method for MutableMap.remove(K;V)Z
#KT-13069 Fixed
2016-07-12 16:27:48 +03:00
Denis Zharkov 18c2d3070d Refine variables liveness analysis
Do not treat var as alive just because current instruction belongs to an item range
in local variables table, but the item has different sort of type

As liveness analysis is mostly used in coroutines spilling,
not applying this change may lead that to problems on Android (see tests)
2016-07-12 12:52:03 +03:00
Michael Bogdanov 23a0e19620 Fix for KT-13040: Invalid bytecode generated for extension lambda invocation with safe call
#KT-13040 Fixed
2016-07-09 14:55:49 +03:00
Michael Bogdanov 486aa5675f Fix for KT-12908: Variable initialization in loop causes VerifyError bad local variable type
#KT-12908 Fixed
2016-07-09 07:45:57 +03:00
Dmitry Petrov b0edec8449 KT-13023 Char operations throw ClassCastException for boxed Chars
Char is not a Number, so we can't use the same coercion strategy for Char members,
since it doesn't work for boxed Chars.
2016-07-08 10:26:04 +03:00
Denis Zharkov 3a59e1d222 Support suspending extension functions 2016-07-06 15:25:19 +03:00
Dmitry Petrov 3445fe0d30 KT-12985 Do not create range instances for 'for' loop in CharSequence.indices 2016-07-06 12:50:41 +03:00
Dmitry Petrov 3dc23a0e02 KT-12983 java.lang.VerifyError: Bad type on operand stack in arraylength
Use proper receiver value type.
2016-07-06 09:59:00 +03:00
Michael Bogdanov 6b8e8cee17 Fix for KT-12891: Allow to omit type in local delegated property declaration
#KT-12891 Fixed
2016-07-05 21:22:48 +03:00
Alexander Udalov 3b349e9be0 Fix reflection on reference to generic property
See a93484b457 for the similar fix to function
references

 #KT-12967 Fixed
2016-07-05 18:18:43 +03:00
Denis Zharkov a420fda825 Fix problem with missing handleResult call
At first we try to resolve 'handleResult' just as last expression
in a lambda is first argument, then if results are unsuccessful
try resolve 'handleResult' with fake Unit expression

 #KT-12969 Fixed
2016-07-05 15:36:06 +03:00
Denis Zharkov 888db4b3b5 Make 'controller' field package-private
To make it accessible from nested lambdas

 #KT-12974 Fixed
2016-07-05 15:36:06 +03:00
Denis Zharkov d657bc8110 Treat any coroutine as it has non-const closure
Because it's always does capture controller
2016-07-05 15:36:06 +03:00
Denis Zharkov df4bf61378 Refine types returned by OptimizationBasicInterpreter.newValue
#KT-12958 Fixed
2016-07-05 15:36:06 +03:00
Denis Zharkov 7723a3a105 Refine definition of whether single parameter the method should be boxed
Only 'Collection<Int>.remove(E): Boolean' should match
2016-07-04 15:44:00 +03:00
Denis Zharkov adff666b0e Introduce additional overridability rule
It works only for Java methods and it's purpose is Java overridability rules emulation,
namely distinction of primitive types and their wrappers.

For example `void foo(Integer x)` should not be an override for `void foo(int x)`

 #KT-11440 Fixed
 #KT-11389 Fixed
2016-07-04 15:44:00 +03:00
Dmitry Petrov bf4f26318e KT-6916: do not create Progression instances in for-in-downTo loops 2016-07-04 13:38:37 +03:00
Ilya Gorbunov 17e7c269ad Minor: make tryInlined test not depend on 'Closeable.use' implementation. 2016-07-01 04:42:38 +03:00
Denis Zharkov 1c3db309e5 Support repeated 'invoke' calls on coroutines defined within inline lambdas
#KT-12782 Fixed
2016-06-30 20:22:39 +03:00
Denis Zharkov c2ac49ec96 Support repeated 'invoke' calls on coroutines
#KT-12782 In Progress
2016-06-30 20:22:39 +03:00
Denis Zharkov a25602c709 Fix spilling algorithm for double-sized coroutine parameters 2016-06-30 20:22:39 +03:00
Denis Zharkov 84eb009c29 Refine stubs generation for special built-ins
Do not generate stub if declaration has the same signature

 #KT-12909 Fixed
2016-06-30 20:12:34 +03:00
Denis Zharkov 5c34b27ea9 Fix stub generation for special built-ins
Do not generate stubs if there is no special bridge in the current class
- there are already Kotlin super class in hierarchy
- special bridge has the same signature as method itself

 #KT-11915 Fixed
2016-06-30 20:12:34 +03:00
Alexander Udalov c07d0d48d3 Fix KCallable#callBy to JvmStatic companion object members
#KT-12915 Fixed
2016-06-30 19:41:47 +03:00
Michael Bogdanov 3b419e8ba3 Fix for KT-11964: No TABLESWITCH in when on enum bytecode if enum constant is imported
#KT-11964 Fixed
2016-06-29 09:32:45 +03:00
Michael Bogdanov 249be0a142 Small changes in tests to support them on Android 2016-06-28 10:12:15 +03:00
Michael Bogdanov abc7d5101d Fix for KT-12106: import static of reified companion object method throws IllegalAccessError
#KT-12106 Fixed
2016-06-27 12:31:31 +03:00
Mikhael Bogdanov 5df52e08cc Temporary removed increment and '+=' tests on local delegated properties 2016-06-27 12:13:28 +03:00
Mikhael Bogdanov 7baf70e8fa Support reified extension properties 2016-06-24 17:05:51 +03:00
Mikhael Bogdanov 5a2e00d2ad Base support of StackValue.Property inlining 2016-06-24 17:05:50 +03:00
Mikhael Bogdanov 679f53b449 Inline get/setValues for local delegated properties 2016-06-24 17:05:48 +03:00
Denis Zharkov 2578fc3344 Do not generate mutable collection stub methods in interfaces
#KT-12359 Fixed
2016-06-24 16:37:19 +03:00
Denis Zharkov 1780f57265 Fix mutable collection stub methods generation for corner case
The problem is that
`override fun remove(element: E): CollectionWithRemove<E>`
seems to be illegal from Java's point of view, while it's OK for JVM

These declarations have the same signature (return type is isgnored)
- override fun remove(element: E): CollectionWithRemove<E>
- override fun remove(element: E): Boolean

When we meet such declaration we choose random declaration for fake override in synthetic class
that may lead to signature clash
2016-06-24 16:37:19 +03:00
Alexander Udalov 3eeccb407e Simplify and fix createReflectionTypeForCallableDescriptor
Previously its call sites needed to determine if the receiver type should be
ignored (e.g. if the reference is to static member or nested class constructor,
or if it's a bound reference), and 3 of 4 callers did it incorrectly. Simplify
this by passing the DoubleColonLHS instance everywhere.

Also rename it to createKCallableTypeForReference

 #KT-12738 Fixed
 #KT-12751 Fixed
 #KT-12799 Fixed
2016-06-22 21:35:57 +03:00
Alexander Udalov e68de436bb Allow data classes to inherit from other classes
#KT-10330 Fixed
2016-06-22 21:35:57 +03:00
Denis Zharkov 453ee55615 Fix coroutine generation in case of empty lambda
'handleResult' should be called in such case too
2016-06-21 15:52:44 +03:00
Denis Zharkov b6ccd03ef4 Make loops generation lazy
As well as all other kinds of expressions

While it's not necessary in a sense that 'for' loop can not be plain expression,
i.e. it can't be an argument for safe-call etc., but laziness is still very convenient property.

E.g. within attached test they were generated twice in case of last expression
of coroutine block, because coroutine related codegen part is built upon
assumption that all expressions should be generated lazy.
2016-06-21 15:52:44 +03:00
Denis Zharkov ad71934c55 Minor. Add 'operator' modifier in test for handleResult 2016-06-21 15:52:44 +03:00
Alexander Udalov 311301f430 Check return type when locating method in reflection
#KT-11824 Fixed
2016-06-20 21:03:51 +03:00
Denis Zharkov 5ee33e6ad5 Generate last expression in coroutine block even for Unit expected type 2016-06-19 12:50:54 +03:00
Denis Zharkov 96eb3f411d Minor. Simplify 'async' tests 2016-06-19 12:50:54 +03:00
Denis Zharkov 72eb87f5d0 Support inline suspend functions
A lot of additional work was required to support them:
- Suspension points are being identified by two markers
  instead of one pointing to suspend function call
- Approach with replacing return type of suspend function does not work anymore.
  So we decode suspension return type as an argument for begin marker
- It became necessary to perform variables liveness analysis
  (see comment in org.jetbrains.kotlin.codegen.coroutines.CoroutineTransformerMethodVisitor.spillVariables)
2016-06-19 12:50:54 +03:00
Denis Zharkov e7b9564699 Support coroutine lambda parameters in JVM backend 2016-06-19 12:50:53 +03:00
Denis Zharkov 07dcc6c616 Support 'handleException' operator in JVM backend 2016-06-19 12:50:53 +03:00
Alexander Udalov 6562a2db19 Type-check reference to property with invisible setter to KProperty
#KT-12337 Fixed
2016-06-19 12:45:22 +03:00
Alexander Udalov de986ed051 Do not skip synthesized members when generating bridges
The condition here is obsolete since SAM adapters can no longer be overridden:
they are now extensions in another scope

 #KT-12708 Fixed
2016-06-16 16:51:18 +03:00
Alexander Udalov b4f81d4bb5 Use 'JVM_TARGET: 1.8' directive in codegen tests on 1.8 target 2016-06-16 16:51:18 +03:00
Dmitry Petrov 9240c82934 KT-12733 'rangeTo' as a non-qualified call is not optimized in 'for'
Use ResolvedCall corresponding to 'for' loop range expression
for optimized "for-in-range-literal".
Cleanup.
2016-06-16 11:30:05 +03:00
Dmitry Petrov a17b0dd1b5 KT-5075 Optimize array/collection indices usage in 'for' loop
Use specialized 'for' loop code generation strategy for loops over array indices and collection indices.
2016-06-15 14:01:18 +03:00
Mikhael Bogdanov 1c3ce93275 Generate same delagation structure as in jvm 6 target until new binary compatibility design
We need to make some decision about binary compatibility beetwen targets and semantics, so now old logic is used
2016-06-15 13:43:29 +03:00