Commit Graph

181 Commits

Author SHA1 Message Date
Nikolay Krasko
87b628a3f7 Generate 'nop' instruction on lambda call when everything on line is going to be eliminated by inliner (KT-6477)
(cherry picked from commit 462bdb2)

 #KT-6477 Fixed
2016-10-14 14:52:06 +03:00
Vsevolod
bd6f83b9b7 KT-5044 intrinsify all contains calls for primitive ranges from stdlib 2016-10-13 10:11:32 +03:00
Denis Zharkov
1df9724c0c Refine stack frames markup calculation
It fixes VerifyError with coroutines on Dalvik happening because of
variables spilling before/after suspension point

BasicInterpreter from ASM does not distinct 'int' types from other
int-like types like 'byte' or 'boolean', neither do HotSpot and JVM spec.
But it seems like Dalvik does not follow it, and spilling
boolean value into an 'int' field fails with VerifyError on Android 4,
so it's necessary to distinct int types for variables spilling

 #KT-13289 Fixed
2016-08-09 16:36:52 +03:00
Michael Bogdanov
99cdc41ab6 Fix for KT-13133: Incorrect InnerClasses attribute value for anonymous object copied from an inline function
#KT-13133 Fixed
2016-07-26 16:16:36 +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
Dmitry Petrov
3445fe0d30 KT-12985 Do not create range instances for 'for' loop in CharSequence.indices 2016-07-06 12:50:41 +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
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
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
Denis Zharkov
d259b91143 Add MutableMap.remove(K, V) as built-in declaration
Use PlatformDependent annotation to guarantee it's only be available for JDK8
Also adjust type-safe bridges and mutable collection stubs generation
2016-04-29 15:08:54 +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
c52c0e2c2d Write proper start label for inlined constructor parameters (start label was shifted by additional captured parameters injection) 2016-04-12 15:23:14 +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
Denis Zharkov
68f411395a Fix bridge generation for special builtin override
Use method itself signature as common bridge delegate

 #KT-11285 Fixed
2016-03-07 09:26:02 +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
Michael Bogdanov
384d2ea0d1 Use bipush, sipush for byte and short constants 2016-02-12 11:55:21 +03:00
Anton Sukhonosenko
0073257841 Fix for KT-10313: ClassCastException with Generics
#KT-10313 Fixed
2016-02-12 10:53:28 +03:00
Michael Bogdanov
848549dd5d Rollback "Fix for KT-10659: Debugger: Evaluate Expression and Watches fail for inline function parameter passed by reference" 2016-02-08 16:43:22 +03:00
Denis Zharkov
0efe28a12a Do not inline non-const vals
#KT-10425 Fixed
2016-02-05 17:43:55 +03:00
Ilya Gorbunov
801a26a544 Fix testData 2016-02-01 22:20:30 +03:00
Michael Bogdanov
328b9bfeda Removed old default generation 2016-02-01 18:32:12 +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
a76d16931c Temporary generate old default method 2016-01-22 10:10:32 +03:00
Ilya Gorbunov
4d5ec9be3f Drop identityEquals from builtins, compiler and tests. 2016-01-22 05:54:38 +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
b4db23a7b3 Removed 'INSTANCE' field from companions 2015-12-24 13:59:45 +03:00