Commit Graph

39042 Commits

Author SHA1 Message Date
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
Denis Zharkov e75b6c8404 Perform fix-stack transformation before method analysis
Otherwise it might fail on an "invalid" bytecode
2017-05-16 11:38:59 +03:00
Denis Zharkov dcaad530ce Make code generation in method transformer more stable
Do not mix references to label nodes and common ASM labels
as it may lead to different LabelNode instance (not defaultLabel)
being inserted into insns list

It's been working before because there was no `resetLabels` call
on insnList, and label/label nodes were bound to each other
2017-05-16 11:38:59 +03:00
Denis Zharkov 4033786902 Minor. Drop always-false parameter in fix-stack utils 2017-05-16 11:38:59 +03:00
Denis Zharkov d362fa6eea Minor. Use trailing lambda syntax in FixStackMethodTransformer 2017-05-16 11:38:59 +03:00
Dmitry Jemerov 675305fef3 Don't highlight 'this' references as deprecated
#KT-17613 Fixed
2017-05-15 14:57:52 +02:00
Yan Zhulanow 5d31e00d27 Allopen, Gradle: Fix JPS build on Windows (KT-17830)
Appears that plugin classpath can contain not only `File.separatorChar`, but also '/' on Windows. Without the proper handling of this case, Gradle importer may import the plugin JAR made for Gradle with shaded 'com.intellij' and cause an exception during the JPS build.
2017-05-15 14:42:01 +03:00
Sergey Mashkov fd0578b564 KT-10028 Support parallel builds in maven
Mark mojo's as thread safe as users confirmed that all related errors
seem to be fixed
2017-05-15 12:55:33 +03:00
Alexander Udalov 3f5b8b3f68 Refactor JvmDependenciesIndexImpl.search
- use nullable type "T?" instead of HandleResult consisting of the found
  value and the "should continue" flag
- inline all local functions because they don't add any value now
2017-05-15 12:17:46 +03:00
Alexander Udalov 939f969f12 Support .jar archives in friend paths (for internal visibility) 2017-05-15 12:17:45 +03:00
Mikhail Zarechenskiy ac8fbce249 Fix false "useless cast" when target type is flexible
#KT-17820 Fixed
2017-05-15 11:24:39 +03:00
Mikhail Zarechenskiy a8f1e32dec Refactoring: move utils related to casts to CastDiagnosticUtil 2017-05-15 11:24:37 +03:00
Mikhail Zarechenskiy b323d2b24a Refactoring: extract method to detect redundant is out 2017-05-15 11:24:36 +03:00
Dmitry Neverov cd24adac32 Detect redundant 'is' check
#KT-14187 Fixed
2017-05-15 11:24:35 +03:00
Mikhail Glukhikh 768e0fa738 Add forgotten KotlinAbstractUElement.hashCode() 2017-05-12 22:27:58 +03:00
Nikolay Krasko c5a8001aa4 Revert generated formatter tests 2017-05-12 20:16:22 +03:00
Simon Ogorodnik a0a6ef4f2e Use ModalityState.any() for J2K post processing
#KT-17870 fixed
2017-05-12 17:53:50 +03:00
Nikolay Krasko 861cac5b52 Better indent in multi-line strings (KT-17849)
Inspired by MultilineStringEnterHandler from https://github.com/JetBrains/intellij-scala
https://github.com/JetBrains/intellij-scala/blob/edb741f344afff063197b406ca0c7c266a26c436/src/org/jetbrains/plugins/scala/editor/enterHandler/MultilineStringEnterHandler.scala

 #KT-17849 Fixed
2017-05-12 17:34:05 +03:00
Nikolay Krasko 30639b0a5e Allow injection in strings with interpolation (KT-6610)
#KT-6610 In Progress
2017-05-12 17:33:37 +03:00
Dmitry Jemerov f53b9aa419 Improve diagnostics for EA-100849
KNPE: DeserializerForClassfileDecompilerKt.DeserializerForClassfileDecompiler
2017-05-12 12:34:54 +02:00
Dmitry Jemerov db1f8c7541 EA-100074 - SOE: ExpressionsOfTypeProcessor.containsTypeOrDerivedInside 2017-05-12 12:33:46 +02:00
Dmitry Jemerov ddcde3f688 EA-101095 NSEE: KotlinUsageToPsiElementProvider.getAppropriateParentFrom) 2017-05-12 12:33:45 +02:00
Dmitry Jemerov 4e58319d1b Revert "Deprecated setting was used for import optimization on the fly. (#1049)"
This reverts commit 75d231cc37.
The added API is available only in IDEA 2017.1.1, not in the original 2017.1 build.
2017-05-12 12:33:45 +02:00
Anton Bannykh e098de5e33 JS: fix char boxing in elvis expressions (#KT-17700 fixed) 2017-05-11 21:31:38 +03:00