Commit Graph

39065 Commits

Author SHA1 Message Date
Mikhael Bogdanov 47c5e64ba5 Sort smap data by output file name 2017-05-17 10:19:43 +02:00
Mikhael Bogdanov 3e50203283 Add source mapping tests for default lambda inlining 2017-05-17 10:19:42 +02:00
Pavel V. Talanov 21b32b9de5 IDE Performance: skip resolver construction for non-relevant modules
Querying non-existent packages does not trigger module resolver computation
2017-05-16 22:15:07 +03:00
Pavel V. Talanov 55721e4f16 Test not creating resolvers for modules that have no relevant packages 2017-05-16 22:15:06 +03:00
Pavel V. Talanov 77e611b2e7 Minor: refactor PerModulePackageCacheService 2017-05-16 22:15:05 +03:00
Pavel V. Talanov f750d08350 Light classes: test extending Number and CharSequence 2017-05-16 22:01:06 +03:00
Pavel V. Talanov 1c5e7c4726 Make sure java completion doesn't suggest classes from builtIns
Fix an undesirable sideeffect of previous changes
2017-05-16 22:01:05 +03:00
Pavel V. Talanov 798c80ed07 Use wrappers around java.util.* to emulate kotlin.collection.* behaviour
Backend: If kotlin class extends kotlin.collection.List
    write it as it's super interface (light class mode only)
IDE: Provide wrapper classes to java resolve
    that try to emulate backend behaviour

For example if kotlin class implements kotlin.collections.Map,
    we provide a superinterface that has abstract 'getEntries' method
    and 'entrySet' method that is considered default.
In reality all those methods are generated in the class itself.

In IDE supporting this case without hacks is not feasible performance-wise
    since kotlin.collection.* may not be an immediate supertype and we need
    to compute all supertypes just to calculate own methods of the class
2017-05-16 22:01:03 +03:00
Pavel V. Talanov c56f74cc81 Do not generate bridge and stub methods in light class mode 2017-05-16 22:01:02 +03:00
Pavel V. Talanov 4bdfb8c646 Jvm backend: specify declaration origin of generated methods
Allow to distinguish collection stub methods and augmented kotlin api methods
2017-05-16 22:01:01 +03:00
Pavel V. Talanov eb3c20d630 Refactor constructing KOTLIN_MARKER_INTERFACES map 2017-05-16 22:01:00 +03:00
Pavel V. Talanov 1a04960ff0 J2K class map: expose classes having mutable/readonly kotlin equivalents
Refactor JavaToKotlinClassMap a little bit
2017-05-16 22:00:59 +03:00
Pavel V. Talanov 40561dabed J2K JavaToKotlinClassMap 2017-05-16 22:00:58 +03:00
Pavel V. Talanov 6701eb70fb Light classes, minor: introduce cannotModify() utility 2017-05-16 22:00:57 +03:00
Mikhail Glukhikh 51af18608f AbstractLocalInspectionTest: add LANGUAGE_VERSION support
Related to KT-17164
2017-05-16 20:44:12 +03:00
Mikhail Glukhikh 9990550429 Introduce inspection "replace arrayOf with literal" #KT-17164 Fixed 2017-05-16 20:44:11 +03:00
Zalim Bashorov fb9d88315a Don't print unnecessary empty line separators when generate tests 2017-05-16 19:42:47 +03:00
Gaetan Zoritchak c00918c9f8 KT-17853: Kotlin.js switched parameters of Math.atan2
https://youtrack.jetbrains.com/issue/KT-17853
The current exposition of the JavaScript [Math object] switched the parameters names. 
The correct version is `atan2(y,x)`.
2017-05-16 17:41:43 +02:00
Sergey Igushkin 74288ff8ae Fix main and test compilation tasks having different module name in
free compiler args.
2017-05-16 17:35:45 +03:00
Dmitry Petrov 899ad7bb53 Generate for-in-indices as a precondition loop
Precondition loops are better optimized by HotSpot
(and, quite likely, by ART).
Also, we generate more compact bytecode that way.

KT-17903 Generate 'for-in-indices' as a precondition loop
2017-05-16 17:28:43 +03:00
Dmitry Petrov 793fb65666 Introduce AbstractForInExclusiveRangeLoopGenerator 2017-05-16 17:28:43 +03:00
Dmitry Petrov 8903504334 Update test for incremental compilation after new DCE
Previous test had an inline setter that didn't produce any effect,
thus, corresponding code was removed by new DCE.
Make sure that changes made in the inline property are caught up by IC.
2017-05-16 17:28:43 +03:00
Dmitry Petrov 84e54124a2 More aggressive DCE should honor debugger invariants
- A LINENUMEBER node is "dead" if the corresponding instruction interval
 contains at least one "dead" bytecode instruction
 and no live bytecode instructions

- Observable local variable lifetimes should be taken into account
 when determining if a NOP is required for debugger.
2017-05-16 17:28:43 +03:00
Dmitry Petrov 65799a5cb4 Fix debugger-related tests after dead code elimination improvements 2017-05-16 17:28:43 +03:00
Dmitry Petrov fe7870a1cd Minor: RedundantCoercionToUnit -> PopBackwardPropagation
It is actually more meaningful than just "coercion to unit elision":
it removes instructions without side effects with results that are
unused (popped from the stack).
2017-05-16 17:28:43 +03:00
Dmitry Petrov 1378b0cf05 Fix bytecode tests after new optimizations
- Turn some const conditions into non-const conditions
- Make sure inlined const values are used where required
(otherwise they are eliminated by POP backward propagation)
2017-05-16 17:28:43 +03:00
Dmitry Petrov 2051355d6a Optimize constant conditions
Using basic constant propagation (only integer constants, no arithmetic
calculations), rewrite conditional jump instructions with constant
arguments.

This covers problem description in KT-17007.
Note that it also works transparently with inline functions.
Partial evaluation is required to cover more "advanced" cases.

As a side effect, this also covers KT-3098:
rewrite IF_ICMP<cmp_op>(x, 0) to IF<cmp0_op>(x).
2017-05-16 17:28:43 +03:00
Dmitry Petrov 495fba43c0 Fuse primitive equality with safe call to avoid boxing
In code like 'a?.b == 42', we can immediately generate equality
comparison result when receiver is null (false for '==', true for '!='),
since the primitive value is definitely non-null.
Otherwise unnecessary boxing/unboxing is generated to handle possibly
null result of 'a?.b'.
2017-05-16 17:28:43 +03:00
Dmitry Petrov 55498b7f63 Minor: move around some optimization-related classes 2017-05-16 17:28:43 +03:00
Dmitry Petrov 847f889a0a Allow merging tracked values in ReferenceTrackingInterpreter subclasses
This is required for things like detupling.
2017-05-16 17:28:43 +03:00
Dmitry Petrov b445e0a049 Drop old null check optimizer 2017-05-16 17:28:43 +03:00
Dmitry Petrov 689298b11f CompositeMethodTransformer 2017-05-16 17:28:43 +03:00
Dmitry Petrov 0dbf383ce8 OptimizationMethodVisitor: convert to Kotlin 2017-05-16 17:28:43 +03:00
Dmitry Petrov a3a60db926 OptimizationMethodVisitor: .java -> .kt 2017-05-16 17:28:43 +03:00
Mikhail Glukhikh d185adfedd Fix UAST test 2017-05-16 16:43:29 +03:00
Dmitry Neverov bf4e69e17f Make semicolon in loop with empty body not redundant
So #KT-12805 Fixed
2017-05-16 16:43:28 +03:00
fitermay e30b9758f4 Introduce action to add missing when branches on sealed class
Made via diagnostics NON_EXHAUSTIVE_WHEN_FOR_SEALED_CLASS
with INFO severity and quick-fix
So #KT-17580 Fixed
2017-05-16 16:43:27 +03:00
Alexey Sedunov 1072495001 Copy: Support top-level declarations 2017-05-16 13:10:41 +03:00
Alexey Sedunov 4c1c1a989a Copy: Support multiple classes in the same file 2017-05-16 13:10:40 +03:00
Alexey Sedunov 92446df14a Copy: Support class copying
#KT-8180 Fixed
 #KT-9054 Fixed
2017-05-16 13:10:39 +03:00
Alexey Sedunov 405a28648f J2K: KtLabeledExpression 2017-05-16 13:10:38 +03:00
Alexey Sedunov 32c90c67c7 J2K: KtLabeledExpression (rename to .kt) 2017-05-16 13:10:37 +03:00
Alexey Sedunov f2bb6e4dac Rename: Support import aliases
#KT-4379 Fixed
2017-05-16 13:10:36 +03:00
Alexey Sedunov 5d87276cff PSI: Introduce KtImportAlias element 2017-05-16 13:10:35 +03:00
Alexey Sedunov 3c94184de9 Rename: Support labeled expressions
#KT-7107 Fixed
2017-05-16 13:10:34 +03:00
Dmitry Jemerov 63d32a524c Fix exception on new file creation when no file template is defined
#KT-17906 Fixed
2017-05-16 11:59:38 +02:00
Dmitry Jemerov f113a5ce99 Fix stdlib-jre7/8 configuration in new projects
#KT-17875 Fixed
 #KT-17876 Fixed
2017-05-16 11:45:35 +02:00
Denis Zharkov 57cb556efd Update rendered public API in coroutines package
- suspendCoroutine is not public anymore, since all of the
inline functions are generated as private
- `label` is public to allow update it from the named functions
2017-05-16 11:38:59 +03:00
Denis Zharkov 2c5baf6c08 Make companion object private to avoid its presence in public API 2017-05-16 11:38:59 +03:00
Denis Zharkov d24d3a73d7 Support open suspend members and super-calls
The problem was that the resume call (from doResume) for open members
was based on common INVOKEVIRTUAL to the original function
that lead to the invocation of the override when it was expected
to be the overridden (after super-call being suspended)

The solution is to generate method bodies for open members into
the special $suspendImpl synthetic function that may be called
from the doResume implementation

 #KT-17587 Fixed
2017-05-16 11:38:59 +03:00