Commit Graph

73 Commits

Author SHA1 Message Date
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
Mikhael Bogdanov 5a2e00d2ad Base support of StackValue.Property inlining 2016-06-24 17:05:50 +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 092be8ca8e Don't generate unnecessary checkcast to java.lang.Number 2016-06-02 16:01:05 +03:00
Mikhael Bogdanov c7d97c63a8 Small refactoring in constant processing 2016-06-02 16:01:03 +03:00
Nikolay Krasko 3f4cde3d25 NoSuchFieldError in Evaluate Expression on a property of a derived class (KT-12206)
#KT-12206 Fixed
2016-06-02 14:39:51 +03:00
Mikhail Glukhikh 8713190e33 Back-end JVM: more accurate handling of when expressions with Unit result #KT-12192 Fixed 2016-05-27 18:08:15 +03:00
Mikhail Glukhikh f35fd32a25 Exhaustive when with 'Unit' result now also generates an exception in else branch #KT-12192 Fixed 2016-05-17 14:28:57 +03:00
Mikhael Bogdanov cd6b709ef5 'bytecodeText' test for synthetic accessor generic signature converted to 'writeSignature' test 2016-05-04 17:07:48 +03:00
Michael Bogdanov be999ca4cb Write proper start label for parameters of inline function default implementation 2016-04-12 15:31:49 +03:00
Michael Bogdanov a6044c81ff Write proper start label for loop parameter 2016-04-08 14:32:51 +03:00
Dmitry Petrov f1b061d662 Optimize coercion to Unit.
POP operations are backward-propagated.

Operation can't be transformed if its result is moved within stack
(by DUP, DUP_X1, DUP_X2, DUP2, DUP2_X1, DUP2_X2, or SWAP).

Unnecessary operations are replaced with NOPs (for debugger).
Unnecessary NOPs are removed.

KT-9922 Suboptimal generation for simple safe call with unused return value
KT-11116 Optimize methods returning Unit
2016-04-07 11:40:58 +03:00
Dmitry Petrov db58ebc4b2 KT-11410: Class hierarchy for parts/facade of multi-file class.
Preserve static initialization semantics for parts by introducing a special "clinit trigger" class.
Insert "static initialization trigger" call to every method of a part class, remove this call on inline.
Always mangle names for private functions in multifile class parts to avoid resolution clashes on inheritance.

NB in codegen tests initializers for all non-const vals are wrapped in 'run { ... }',
so that the initializer is not a constant expression, and some static initialization code should be generated.
2016-04-01 10:13:22 +03:00
Michael Bogdanov bec6126b06 Support when mapping transformation on inlining 2016-03-14 11:24:39 +03:00
Alexander Udalov bab127ad33 Remove some legacy codegen tests, move some to generated 2016-03-09 10:25:38 +03:00
Dmitry Petrov 3bbd8979e4 KT-9670: optimize Class <-> KClass wrapping/unwrapping as a special case of boxing/unboxing.
NB doesn't work for arrays of classes.
2016-03-04 10:14:21 +03:00
Alexander Udalov 647e188a08 Migrate bytecode text tests to multi-file framework
Get rid of BytecodeTextMultifileTestGenerated
2016-03-02 15:44:28 +03:00
Denis Zharkov 36e84ff23a Minor. Add tests for obsolete issues
#KT-8900 Obsolete
 #KT-8901 Obsolete
2016-02-25 08:31:58 +03:00
Denis Zharkov 914447b7eb Do not treat uninitialized value as a reason to retain boxing
See testData/simpleUnitializedMerge.kt
On exit from `if` we merge value in variable with slot 1 (x):
- from `if` body we get BoxedBasicValue
- from outer block we get UNITIALIZED_VALUE

So we just suppose `x` is unitialized after `if`
and there's no need to mark BoxedValue as unsafe to remove
because it's anyway can't be used after `if`

 #KT-6842 Fixed
2016-02-25 08:31:19 +03:00
Michael Bogdanov 0283fea835 Optimize recursive string concatenation 2016-02-17 16:53:19 +03:00
Michael Bogdanov 8835b0599a Inline preevaluated string and primitive only constants in compilation time, don't inline const references in non-annotation context, fix for KT-11025: Don't inline const val in compare instuctions
#KT-11025 Fixed
2016-02-17 16:53:18 +03:00
Stanislav Erokhin 341b251e4d Update copyright in generated tests. 2016-02-16 18:59:10 +03:00
Denis Zharkov 0efe28a12a Do not inline non-const vals
#KT-10425 Fixed
2016-02-05 17:43:55 +03:00
Michael Bogdanov b9c30c739e Test for obsolete KT-7224: Redundant result boxing on ?. call on a primitive
#KT-7224 Obsolete
2016-01-29 12:13:16 +03:00
Michael Bogdanov c9cc9c55cd Added assertion for super call with default arguments in function default impl body 2016-01-29 11:02:21 +03:00
Michael Bogdanov d4df7aaabc Fix for KT-10659: Debugger: Evaluate Expression and Watches fail for inline function parameter passed by reference
#KT-10659 Fixed
2016-01-28 14:23:24 +03:00
Michael Bogdanov 0274ce4619 Always generate ACC_SUPER flag for all classes; Fix for KT-10260: java.lang.VerifyError in Android 4.x when Instant Run is used
#KT-10260 Fixed
2016-01-11 09:55:56 +03:00
Dmitry Petrov b736880787 KT-6646, KT-10482:
when a method (or a property getter) returns Nothing, emit
  ACONST_NULL
  ATHROW
after a call so that class files verifier knows that this is an exit point in a method.
Note that if an inline method returning Nothing throws an exception explicitly
(or via a chain of inline methods), this code will be deleted by DCE.
2015-12-31 11:07:56 +03:00
Mikhail Glukhikh 7d6ccc40c2 Implicit exhaustive whens now have exception in else branch #KT-8700 Fixed 2015-12-26 10:46:39 +03:00
Michael Bogdanov f870e365fa Removed accessors for const properties 2015-12-25 11:28:10 +03:00
Michael Bogdanov 9cad1a912a Choose proper context for accessor generation: skip inline ones; Fix for KT-6102: Bypass synthetic accessor when inlining lambda which calls private member
#KT-6102 Fixed
2015-12-17 09:51:41 +03:00
Michael Bogdanov b950bf0e6e Fix for KT-10259: Proguard can't find generated lambda class of lambda nested inside object?.let lambda
#Fixed KT-10259
2015-12-11 16:14:59 +03:00
Michael Bogdanov 4b8017e34b Fix for KT-7999: Wrong result when use nullable types as reified parameter, KT-8043: Unsafe cast to reified parameter throws NPE instead of TypeCastException
#KT-7999 Fixed
  #KT-8043 Fixed

~
2015-12-03 15:09:54 +03:00
Michael Bogdanov 1bf521c645 Don't generate accessors for @JvmField properties in primary constructor 2015-11-30 16:24:05 +03:00
Yan Zhulanow 9d1af5a17e Fix tests: "infix modifier required" and "operator modifier required" errors 2015-11-27 15:51:11 +03:00
Michael Bogdanov 2d3d526ccd Fix for KT-10110: ClassReader$BadClassFile undeclared type variable: E
#KT-10110 Fixed
2015-11-26 13:29:30 +03:00
Denis Zharkov fa99ea1e98 Generate type-safe barrier in method body
In cases when signature of special bridge is the same as current method,
but type is not 'Any?'.

Also there is tiny optimization:
only null check needed if value parameter type is mapped to Object,
but it's not nullable.

 #KT-9973 Fixed
2015-11-17 16:27:02 +03:00
Denis Zharkov 1f704e0c4d Minor. Split BytecodeText tests about special builtin bridges 2015-11-17 16:27:02 +03:00
Mikhail Glukhikh 0d35033106 Introduction of CastedClassReceiver and its handling in codegen #KT-6744 Fixed
ClassReceiver converted to Kotlin
Also #KT-7617 Fixed
2015-11-10 20:20:51 +03:00
Dmitry Jemerov 19af88738b remove Jet from names of classes in tests: phase 2 2015-11-03 14:06:04 +01:00
Dmitry Petrov 882827bf04 KT-9717, KT-9603:
pass getter/setter-related flags to AccessorForPropertyDescriptor
2015-10-27 12:02:27 +03:00
Dmitry Petrov 3502c393fc Drop package facades: JVM BE tests passed. 2015-10-19 16:03:16 +03:00
Michael Bogdanov 3452fc8d02 Don't initialize const properties in constructor
#KT-9532 Fixed
2015-10-17 15:31:57 +03:00
Alexey Tsvetkov 62c25c0370 Replace is Array<T> with .isArrayOf<T>() 2015-10-14 18:36:53 +03:00
Denis Zharkov 89ded4ab1d Implement hack to support both remove() and removeAt() in MutableList<Int>
Also add couple of tests about CharSequence.get
2015-10-11 19:57:22 +03:00
Denis Zharkov 80da320c2c Customize JVM signature for Collection's members
- Do not write signature for `contains`
- Write signature for `containsAll` as it's declared like `containsAll(Collection<?>)`
2015-10-09 14:40:33 +03:00
Denis Zharkov 6a1566a6dc Make JVM backend work with Collection.size as val
0. Such properties are called special because their accessor JVM name differs from usual one
1. When making call to such property, always choose special name
2. When generating Kotlin class inheriting such property generate `final bridge int size() { return this.getSize(); }`
3. If there is no `size` declaration in current class generate `bridge int getSize() { // super-call }`
2015-10-07 08:46:35 +03:00
Michael Bogdanov cd78514b76 Code clean, small refactorings and tests
#KT-8987 Fixed
2015-10-03 10:53:22 +03:00
Dmitry Petrov 06d9ff6a71 KT-9377 Support is-checks for read-only collections
Generate better code for 'as?' with mutable collection types:
use CHECKCAST, do not introduce special intrinsics for safe-as.
2015-10-02 15:17:00 +03:00