Commit Graph

38909 Commits

Author SHA1 Message Date
Mikhail Zarechenskiy 7541a3754d Move SAM constructors to synthetic scope 2017-05-05 21:30:35 +03:00
Mikhail Zarechenskiy 429f0e4f68 Adapt changes in IDE after moving SAM adapters to synthetic scope
The main change is that now to get static sam adapters one should do it using synthetic scopes and static scope of container
2017-05-05 21:30:10 +03:00
Mikhail Zarechenskiy 8e233162ed Drop SamAdapterOverridabilityCondition as it became obsolete
There is no need in checking overridability of sam adapters as now we don't create fake synthesized methods for static sam adapters
2017-05-05 21:30:10 +03:00
Mikhail Zarechenskiy 95ede7fb67 Move SAM adapters from static scope to synthetic one 2017-05-05 21:30:10 +03:00
Alexey Tsvetkov 2ff28ebced Merge sequent filter and map calls into one loop
ScopeTowerProcessors.kt contains a few code snippets
that look like `collectCandidates(...).filter { ... }.map { ... }`.
Filter argument is always side-effect free, so it is safe
to merge `filter` and `map` calls into one for-loop.

The change also makes sense, because modified functions are quite hot.
For example `NoExplicitReceiverScopeTowerProcessor.simpleProcess`
produces 11,392,768 ArrayList instances (~1.08% of all objects)
when compiling the compiler according to aprof at the moment of writing.

On my machine the change improves compilation speed of the compiler up to 5%.
2017-05-05 20:02:04 +03:00
Alexey Tsvetkov e25060f8c9 Make closing artifact difference registry more robust
KT-16298
2017-05-05 18:42:33 +03:00
Alexey Tsvetkov b504f1eb45 Add test for KT-16298 2017-05-05 18:42:29 +03:00
Jonathan Leitschuh 0ed4b7f58a Avoid flushing cache removed by clean
#KT-16298 fixed
2017-05-05 18:42:24 +03:00
Ilya Gorbunov 180233b78e binary-compatibility-validator: use project version to disambiguate artifacts 2017-05-05 18:01:02 +03:00
Ilya Gorbunov ab70307cc0 Minor: refactor iterable tests 2017-05-05 18:01:02 +03:00
Ilya Gorbunov 2792dbf988 Import for buildSequence in generated code for sequences 2017-05-05 18:01:02 +03:00
Anton Bannykh 9bd562bf67 Prevent 'obsolete form' warnings by passing advanced (-X) arguments using the '-Xfoo=bar' syntax 2017-05-05 16:05:44 +03:00
Denis Zharkov 6e114a90dc Adjust debugger to the new suspend function strategy
Now it's impossible to determine by descriptor if there is
a state machine for function, but at the same time
it doesn't really matter here since there is no LINENUMBERs
in doResume of continuation implementations for named suspend
functions

 #KT-17585 Fixed
 #KT-16603 Fixed
2017-05-05 14:14:38 +03:00
Denis Zharkov 7c6a15ddfe Treat inline suspend functions as inline-only
Now their bodies don't have real state machines, thus they cannot
be called correctly from Java

 #KT-17585 In progress
 #KT-16603 In progress
2017-05-05 14:14:38 +03:00
Denis Zharkov ba200f5de1 Minor. Remove redundant kind of coroutine markers
It was necessary while the additional code was being inserted
outside of transformer, but now we can just remember where
the actual body starts
2017-05-05 14:14:37 +03:00
Denis Zharkov b3f66c7641 Remove $ character from fake continuation parameter
The reason is that when it gets captured into the field
having name $$continuation inliner fails with an exception
as it skips fields starting with '$$'

At the same time it doesn't really matter how to call
that parameter because it's only visible in Java

 #KT-17585 In Progress
 #KT-16603 In Progress
2017-05-05 14:14:37 +03:00
Denis Zharkov 5b5f612a7c Support new strategy for suspend inline functions
The main idea is to leave all the inline functions as is, without
state machines (but keeping suspend-calls markers) and
determine whether we need a state machine from the bytecode
after inlining into a non-inline function

 #KT-17585 In Progress
 #KT-16603 In Progress
 #KT-16448 Fixed
2017-05-05 14:14:00 +03:00
Denis Zharkov 5d0aeb4ef6 Minor. Drop unused BindingContext slice 2017-05-05 14:01:50 +03:00
Denis Zharkov 0b99c5c54e Remove fix for tail-placed branch operations in suspend functions
It has been introduced in 2286027bed
and should've help to avoid verify error

Now it became both impossible and unnecessary:
- It's impossible now since we can't determine in codegen
if we'll needa state machine
(it depends from inline functions' contents)
- It's unnecessary since we'll introduce the state machines for cases
described in the 2286027bed tests

NB: There's still a problem that now we work a bit suboptimally
because actually these samples can be generated without state
machines
2017-05-05 14:01:50 +03:00
Denis Zharkov 7803c9c0ba Minor. Convert loop to 'removeIf' call 2017-05-05 14:01:50 +03:00
Denis Zharkov 00526f5934 Add optional JVM declarations rendering for box tests
This option will be used later to check if state machine has been
generated for suspend function
2017-05-05 14:01:50 +03:00
Denis Zharkov d92c403f9e Move helpers for coroutine tests in separate package
It will help to skip their content when rendering bytecode listing
for box tests
2017-05-05 14:01:50 +03:00
Denis Zharkov 035fcc2424 Minor. Rewrite part in CoroutineTransformer with 'run'
It helps to avoid unnecessary val customCoroutineStartMarker
in the scope of performTransformations
2017-05-05 14:01:50 +03:00
Denis Zharkov c3a032ea0b Generate state machine for named functions in their bodies
Inline functions aren't supported yet in the change

 #KT-17585 In Progress
2017-05-05 14:01:50 +03:00
Denis Zharkov 59d89a1ae3 Generate private suspend function in JVM as package-private
It helps to simplify implementation of generating state machines
into the named functions' bodies but of course has some flaws:
1. They may be called from the same package in Java
2. It may lead to problems when declaring clashing descriptor
in an inheritor

This change must be reverted at some moment, or these flaws
should be fixed in some other way

 #KT-17585 In Progress
 #KT-17584 Open
2017-05-05 14:01:50 +03:00
Denis Zharkov bb7a188f87 Minor. Weaken assertion in refined int type analysis
It's necessary because ASM remebers exact types obtained from
value parameters, and in the further commits we're going
to place code of suspend functions in their bodies, and there
we get already refined type for int-like slots
2017-05-05 14:01:50 +03:00
Denis Zharkov 0cd80d8b0e Get rid of class builder factory for coroutines
Initially it was a sort of hack: introducing another
interception class builder factory that will process all functions.

To differentiate suspend functions from the common ones
the fake annotation class has been used.

The problem is that now we should inject the different
class builder into the CoroutineTransformerMethodVisitor:
we need class builder for anonymous class representing state
for named function while currently it will be the one for the class
where the named function is defined
2017-05-05 14:01:50 +03:00
Mikhail Glukhikh 7271ca0b72 KT-13997 related: fix of JS relevant test 2017-05-05 11:17:52 +03:00
Kirill Rakhman cd07aea5e3 Add quickfix for adding 'lateinit'
Fixes #KT-17650
2017-05-05 11:09:07 +03:00
Mikhail Glukhikh 5de55e80ce KT-13997 related: fix of J2K relevant test 2017-05-05 10:55:26 +03:00
Dmitry Petrov e902cff937 Add 'getTypeArgumentOrDefault' extension for IrMemberAccessExpression 2017-05-05 09:59:30 +03:00
Dmitry Petrov f5fde2c24f Dump absent type arguments 2017-05-05 09:59:30 +03:00
Dmitry Petrov ddb2b7508b Generate property initializer within property scope 2017-05-05 09:59:30 +03:00
Dmitry Petrov 8e84862afa Generate do-while condition within loop body scope 2017-05-05 09:59:30 +03:00
Dmitry Petrov fdb4de355c Use original descriptors to create symbols for callable references 2017-05-05 09:59:30 +03:00
Dmitry Petrov c2601c947f Postpone call arguments generation in compound assignment expressions
Otherwise RHS is generated twice, causing ISE in symbol binding
2017-05-05 09:59:30 +03:00
Alexey Tsvetkov 6b956b3746 Fix exception "Unknown CompilerMessageSeverity: OUTPUT"
`CompilerMessageSeverity.OUTPUT` was removed from the enum set
`CompilerMessageSeverity.VERBOSE` in the commit d8d3bafbe9,
so `GradleMessageCollector` started to throw the exception.

    #KT-17711 fixed
2017-05-04 23:03:16 +03:00
Anton Bannykh 2e9a59819a JS: support internal visibility from friend modules
Friend modules should be provided using the -Xfriend-modules flag
in the same format as -libraries. No manual configuration required for
JPS, Gradle and Maven plugins.

Friend modules could be switched off using the -Xfriend-modules-disabled
flag. Doing that will
  * prevent internal declarations from being exported,
  * values provided by -Xfriend-modules ignored,
  * raise a compilation error on attemps to use internal declarations from other modules

Fixes #KT-15135 and #KT-16568.
2017-05-04 21:44:17 +03:00
Yan Zhulanow 7bbf9861d0 Kapt3: Simplify handling of annotation processing exceptions
The previous handling method was unreliable ("Don't know how to render diagnostic of type KAPT3_PROCESSING_ERROR", exceptions being lost).
2017-05-04 19:59:30 +03:00
Alexey Tsvetkov f8b785fc31 Test that Kapt3 IC removes stubs for dirty source files 2017-05-04 19:59:29 +03:00
Alexey Tsvetkov 5c041cb182 Kapt3: Remove source stubs together with the class files when .kt file is marked dirty (IC) 2017-05-04 19:59:29 +03:00
Yan Zhulanow 19c00abc62 Kapt3: Avoid annotation processing execution when possible (KT-17620)
Do not execute annotation processing if no stubs (and Java files) were changed since the previous execution.
2017-05-04 19:59:16 +03:00
Yan Zhulanow c8d7c339cf Kapt3: Modify kapt incremental tests in order to support kapt3 2017-05-04 19:00:43 +03:00
Yan Zhulanow c18bf5088d Kapt3: Support incremental compilation of Java stubs (KT-15151) 2017-05-04 19:00:42 +03:00
Yan Zhulanow 3bf534b392 Kapt3: Support apt modes
Allow to run kapt in "annotation processing only" and "stub generation only" modes in order to support incremental compilation in Gradle.
Unfortunately, annotation processing can't be done incrementally cause it uses all module files, but the stub generation can be done incrementally.
2017-05-04 19:00:41 +03:00
Yan Zhulanow 7a692b56f4 Add kapt3 module to non-compiler-tests 2017-05-04 18:46:44 +03:00
Yan Zhulanow 99a05f5d61 Kapt3: Convert reference to KMutableMap.Entry correctly (KT-17567) 2017-05-04 18:46:43 +03:00
Yan Zhulanow 254e8156ac NoArg: Initialize properties in noarg constructor (KT-16692) 2017-05-04 18:46:42 +03:00
Yan Zhulanow eba5baa7ff Kapt3: Add Maven integration test 2017-05-04 18:46:41 +03:00
Anton Bannykh 7503376731 JS: unmute box/test/coroutinessuspendFunctionAsCoroutine/inlineTwoReceivers.kt 2017-05-04 16:47:00 +03:00