Commit Graph

87294 Commits

Author SHA1 Message Date
Svyatoslav Kuzmich c0761bf34a [Wasm] Support callable references to external functions
1. Move jsInteropFunctionsLowering after callable reference lowering,
  so it can continue to deal with just functions and function calls.
2. Generate lowered closure class in JsInteropFunctionsLowering because
2021-11-10 19:48:10 +03:00
Dmitry Petrov 916379c0e7 JVM KT-49613 use adapter for indy reference to protected constructor 2021-11-10 19:37:27 +03:00
Dmitry Petrov 76bdf4ff1a JVM KT-49548 extra test 2021-11-10 19:37:25 +03:00
Dmitry Petrov 9a4cff0dc7 JVM KT-49548 progression iterators can be tainted 2021-11-10 19:37:24 +03:00
Ivan Kochurkin 646d156bde [FIR] Reuse calculated values and clean up code 2021-11-10 19:07:27 +03:00
Ivan Kochurkin 0dab39b6e3 [FIR] Get rid of unnecessary allocations 2021-11-10 19:07:27 +03:00
Ivan Kochurkin c9ad2b3bf9 [FIR] Ignore visited super types during bypass in FirInconsistentTypeParameterHelpers
Get rid of potential exponential complexity
2021-11-10 19:07:26 +03:00
Ivan Kochurkin 6e57341a3d [FIR] Remove not used FirNotASupertypeChecker 2021-11-10 19:07:26 +03:00
Ivan Kochurkin a57c8ee9e8 [FIR] Remove not used transformAllStatementsExceptLast from FirExpressionUtil 2021-11-10 19:07:25 +03:00
Ivan Kochurkin ee490128fc [FIR] Optimize FirDeprecationChecker 2021-11-10 19:07:25 +03:00
Ivan Kochurkin 13865e52f8 [FIR] Optimize FirJvmDefaultChecker 2021-11-10 19:07:24 +03:00
Ivan Kochurkin 6fd4c67bbb [FIR] Optimize FirInterfaceDefaultMethodCallChecker
Reduce calls of getClassLikeSymbolByClassId
2021-11-10 19:07:23 +03:00
Alexander Udalov bb390dca16 Minor, improve kdoc for KValueParameter.type/varargElementType
Slightly related to e77f72071d.
2021-11-10 16:12:56 +01:00
Alexander Udalov fbd20b6556 Remove unused JvmTypeAliasExtensionVisitor and JvmValueParameterExtensionVisitor
They were added in e4702bf438 and a08cf59017 but in fact they are not
needed on JVM until there are JVM-specific extensions in the metadata.

Moreover, there was a typo in JvmValueParameterExtensionVisitor's
superclass (see https://github.com/JetBrains/kotlin/pull/4613).
2021-11-10 16:12:56 +01:00
Svyatoslav Scherbina ea7160947a Native: enable lazy IR generation before running fake override builder
^KT-48816 Fixed

Native compiler uses lazy IR for declarations provided by cinterop.
The problem: `FakeOverrideBuilder` requests super types during
type checking, accessing `.owner` for them. So if a type and super type
are represented as lazy IR, and lazy IR generation is not enabled yet,
then the super type symbol won't be bound by this moment, and the access
will fail.

This happens in KT-48816: fake override builder tries to access `.owner`
for `IrClassSymbol` of `NSObject` (super type of `NSDate` and `NSUUID`).

Fix this by enabling lazy IR generation before building fake overrides.
2021-11-10 12:30:12 +00:00
Nikolay Krasko b76e670ad5 Allow disabling retry tests with parameters on CI 2021-11-10 02:49:54 +03:00
Mads Ager 604f217360 [FIR] Report properties from java methods in Fir2IrLazyClass.
This shows up in annotation instantiation tests where we need
to make sure to generate a property on the annotation implementation
class for such properties.
2021-11-09 23:51:49 +03:00
Mads Ager b79ca7d7df [FIR] Allow annotation instantiation.
This commit disables the frontend error reporting for supported cases.
2021-11-09 23:51:48 +03:00
Ilya Muradyan 56d472451c Mark packages for relocation to fix classpath interferring in main-kts
KT-49476 fixed
2021-11-09 23:04:05 +03:00
Svyatoslav Kuzmich 83c94cc944 [Wasm] Name section for globals and structs 2021-11-09 19:54:27 +00:00
Svyatoslav Kuzmich a5aee29baa [Wasm] Fix createDirectoryToRunInBrowser
Helper function to import stringFromWasm no longer needed.
2021-11-09 19:54:26 +00:00
Alexander Udalov 1071919706 Remove backend tests on old inference
Also remove any mentions of NewInference, and rename some tests.
2021-11-09 20:07:33 +01:00
Alexander Udalov 3626b1df44 Psi2ir: remove support for disabling SamConversionPerArgument 2021-11-09 20:04:29 +01:00
konstantin.tskhovrebov d5ab0382f6 Revert "Update K/N version to "1.6.20-dev-3759""
This reverts commit d119976b46.
2021-11-09 22:03:09 +03:00
Mikhail Glukhikh 8ac4507a1f FIR2IR: simplify/generify declaration caching code 2021-11-09 21:04:41 +03:00
Mikhail Glukhikh 3d60064310 Extract & reuse ConeKotlinType.findClassRepresentation in FIR2IR 2021-11-09 21:04:40 +03:00
Mikhail Glukhikh 6eaeada1e6 FIR: cache properties in use-site scope properly 2021-11-09 21:04:40 +03:00
Mikhail Glukhikh f2c734fc02 FIR2IR: add another fallback for simple synthetic property 2021-11-09 21:04:39 +03:00
Mikhail Glukhikh b50350f6a5 FIR2IR: add fallback for a synthetic property override situation 2021-11-09 21:04:39 +03:00
Mikhail Glukhikh 67a05883d6 FIR2IR: create local classes on the fly properly 2021-11-09 21:04:38 +03:00
Mikhail Glukhikh a05244eca1 FIR: don't enhance synthetic property if not needed 2021-11-09 21:04:38 +03:00
Mikhail Glukhikh 6b1da9eb70 Rename: generateAccessorSymbol -> generateSyntheticPropertySymbol 2021-11-09 21:04:37 +03:00
Mikhail Glukhikh 5a44fda42c FIR2IR: bind fake override calls via symbol table 2021-11-09 21:04:37 +03:00
Mikhail Glukhikh d4cdf874be FIR2IR: add fake override generation for built-in classes 2021-11-09 21:04:36 +03:00
Mikhail Glukhikh 0622a47493 FIR2IR: implement early f/o overridden symbols binding #KT-42784 Fixed
Related to KT-49288
2021-11-09 21:04:36 +03:00
Mikhail Glukhikh 5b6e21690b FIR2IR: call fake overrides properly #KT-49288 Fixed 2021-11-09 21:04:35 +03:00
Dmitriy Novozhilov ec079a2663 [Build] Add runtime dependency on descriptors.runtime to tests for low level api
This is needed to keep ability to run those tests using JPS
2021-11-09 20:06:11 +03:00
Dmitriy Novozhilov 0a902c1bef [Build] Remove dist_root artifact from JPS project configuration
This artifact was used to build compiler artifact during each project
  build, which is not needed for running compiler tests. Removal of
  this artifact from build chain reduces time of build for ~3 seconds
  which is a lot for rebuilds after minor changes (which are usually
  take only few seconds)
2021-11-09 20:06:08 +03:00
sebastian.sellmair 1a0e2ad074 [Gradle][MPP] Composite metadata jar: Use "$sourceSetName-cinterop" directory for cinterops
This convention seems to be more robust against clashes against user
specified source set names. We could potentially foresee users to
use "cinterop" as source set name, but the pattern
 $sourceSetName-cinterop seems robust enough.

^KT-49596 Verification Pending
2021-11-09 16:34:33 +00:00
sebastian.sellmair ea669ce076 [Gradle][MPP] Assert sourceSetCInteropMetadataDirectory on deserialized older metadata files
^KT-49596 Verification Pending
2021-11-09 16:34:33 +00:00
sebastian.sellmair bd8aa8ae3d [Gradle][MPP] Include cinterop metadata directory in kotlin-project-structure-metadata.json
- Also increase the KotlinProjectStructureMetadata's format
version to 0.3.2

- Move new default location into /cinterop/{sourceSetName}

^KT-49596 Verification Pending
2021-11-09 16:34:32 +00:00
Sergej Jaskiewicz 7b017fad90 [JS IR] Add tests for KT-41964 and KT-44981 2021-11-09 14:34:13 +00:00
Alexander Udalov f5dd0abb76 Render JVM default flags in kotlinp 2021-11-09 15:09:29 +01:00
Steven Schäfer c552b5f820 kotlinx-metadata-jvm: Handle the jvmClassFlags extension 2021-11-09 15:09:20 +01:00
Alexander Udalov 9bc87b17bd Build: suppress wasm stability warning
To prevent it from being displayed when configuring
`:kotlin-stdlib-wasm` and ':kotlin-test:kotlin-test-wasm' on each build.
2021-11-09 14:56:24 +01:00
Alexander Udalov 73f0540d5b Remove runtime jar files version checker
... and the compiler argument -Xskip-runtime-version-check.

The vast majority of warnings reported by this checker in practice has
proven to be false positives. In addition to that, it was needlessly
verbose, and also completely untested.

If we decide to reintroduce some of these checks, it's probably a better
idea to perform them in tools, such as Kotlin Gradle plugin, which
usually have slightly more information about the way the project is
built and can suggest some meaningful solutions (as opposed to "remove
this jar $HOME/.gradle/... from the classpath" which was the best
JvmRuntimeVersionsConsistencyChecker could do.)

 #KT-27256 Obsolete
 #KT-41664 Fixed
2021-11-09 14:56:10 +01:00
Svyatoslav Scherbina c929404fa4 Native: don't treat any compiler test task as up-to-date
There are number of problems with up-to-date checks in tests, leading to
a test binary not being rebuilt or rerun when a developer expects it to.

Things became worse after updating to Gradle 7+:
test binary run tasks are considered up-to-date if the test data
has been changed, even after clean.

Even before Gradle 7+, we've observed other similar undesirable effects:
for example, if the compiler has been changed, tasks building
test binaries are still up-to-date.

There are quite a lot of different tasks related to running the tests
for Native, many of them are misused and thus don't do what we expect.
Carefully fixing each particular kind seems counterproductive and
unreliable.

So instead workaround all possible similar problems by forcing all tasks
in the :kotlin-native:backend.native:tests project to be not up-to-date.

This project should contain only test tasks, so this workaround
seems pretty natural -- it is just "tests aren't up-to-date".
2021-11-09 11:18:08 +00:00
Svyatoslav Scherbina d5bf99f80c Native: make FrameworkTest implement Serializable
Gradle requires this when using it as task input.
2021-11-09 11:18:08 +00:00
Hung Nguyen bd7c2ae6d7 KT-45777: Snapshot Java classes using ASM analysis directly
This is faster than the current approach which creates
`JavaClassDescriptor`s, converts them to protos, and then snapshots
these protos.

- Refactor unit tests to faciliate further changes
- moves test data to a directory that matches the tests' package name
- moves expected snapshots to a separate directory
- adds public and private fields/properties to sample class
- Compute changes between ASM-based Java class snapshots
- Don't collect members of an added Java class as changes
as it's enough to report the name of the added Java class as changed (we
also do that for added Kotlin classes and Kotlin/Java removed classes).
- Add unit tests for impact analysis in advance
- Compute impacted symbols of changed symbols
Also do not collect added classes/class members as they don't impact
recompilation.
-Use ClassId when computing Java class changes
It is more precise than JvmClassName, which can be ambiguous around the
`$` character (e.g., ClassId "com/example/A$B.C" and "com/example/A.B$C"
both have the same JvmClassName "com/example/A$B$C").
- Compute impacted set of changed symbols across Kotlin and Java
- Add unit tests for impact analysis across Kotlin and Java
- Compute supertypes of Kotlin classes during snapshotting
- Handle inner classes when computing list of changed symbols.
For the reported symbols, always check all options:
class member, inner class, top level class, top level member.

Test: IncrementalJavaChangeClasspathSnapshotIT.testAddingInnerClass
2021-11-09 13:57:56 +03:00
Dmitry Petrov 271368ac53 JVM_IR prefer loop with inclusive bound for unsigned integer ranges
In general, we would rather prefer a range-based for loop to look like
a counter loop in Java ('for (i = start; i < end; ++i) { <BODY> }').
This corresponds to

    i = start;
    do {
        if (i >= end) break;
        <BODY>
    } while ( { ++i; true } )

However, HotSpot doesn't recognize Kotlin unsigned integer comparison
in 'if (i >= end) break;' as a counter loop condition. Thus, the loop
doesn't get optimized as a counter loop, resulting in a performance
regression.
If we use exclusive range-based for loop instead, then we actually use
unsigned integer equality instead of unsigned integer comparison, which
is Ok for HotSpot.

KT-49444
2021-11-09 13:25:06 +03:00