Commit Graph

87246 Commits

Author SHA1 Message Date
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
Pavel Punegov a207a3e8fa [K/N][test] Don't use assertFailsWith on wasm32 in the test 2021-11-09 09:55:13 +00:00
Martin Petrov 416d12bce8 [Native] Lazily create dependency & cache directories. (#4627)
Previously initializing the DependencyProcessor will result in file IO.

In a fully-hermetic environment where all dependencies are local, this IO is redundant and may require the build system (e.g. Bazel) to do extra setup to ensure there is a local writable directory specified for these directories. This change will instead cause the dependency processor to bail early and skip downloading dependencies if all are local anyway.

Prior to this change kicking off a clean build with local dependencies would result in:

```
rm -rf ~/.konan/cache; fswatch -ax ~/.konan
~/.konan/cache Created IsDir
~/.konan/cache/.lock Created IsFile
```

After the change no FS operations are performed.
2021-11-09 11:30:30 +03:00
Sergey Bogolepov f43b5d32f9 Add tests for Char.isHighSurrogate() and Char.isLowSurrogate() 2021-11-09 08:27:59 +00:00
Sergey Bogolepov bc144887ea [K/N] Add native test for KT-48591
We can't rely on stdlib tests now, because they are not
executed with compiler caches.
2021-11-09 08:27:58 +00:00
Jinseong Jeon 08e181a543 FIR IDE: add tests about types of array/list and their element 2021-11-09 09:25:45 +01:00
Mads Ager e1f6c19c83 [FIR] Fix local variable tests.
- Mangle names for extension receivers in lambdas
 - Correctly mark anonymous variables and variables for arguments
   for destructuring declaration.

There is one failure remaining which is cause by lambda
type inference differences that leads to FIR having an explicit
return from the lambda whereas old frontend leads to an implicit
return. This difference is visible in debug stepping that the
local variables tests do because the implicit return has the line
number of the closing brace of the lambda. This change adds an
IrText test to make the difference clear.
2021-11-09 11:09:11 +03:00
Mads Ager 99293de6e9 [FIR] Enable local variable tests. 2021-11-09 11:09:00 +03:00
Ivan Kylchik 3adf80ed37 [TESTS] Replace IrBackendInput if check with require 2021-11-08 23:50:36 +03:00
Ivan Kylchik ef8199718e [JS TESTS] Move externals.js into main module in functionTypes.kt 2021-11-08 23:50:35 +03:00
Ivan Kylchik 81211acbc0 [JS TESTS] Extract common code responsible for getting dependencies 2021-11-08 23:50:35 +03:00
Ivan Kylchik fdf3288e3d [JS TESTS] Move dump of artifacts into js ir backend facade 2021-11-08 23:50:35 +03:00
Ivan Kylchik 7d00dd98d5 [JS TESTS] Suppress unused parameter in incremental handler 2021-11-08 23:50:35 +03:00
Ivan Kylchik db6c357e8e [JS TESTS] Enable diagnostic report for tailRecursion 2021-11-08 23:50:35 +03:00
Ivan Kylchik 54804417dd [JS TESTS] Rewrite js ir ic tests using new test infrastructure 2021-11-08 23:50:35 +03:00
Ivan Kylchik 982d10d127 [TESTS] Add IGNORE_ERROR directive to boxError tests
This is needed because now these tests use new test infrastructure
and here, after frontend facade, there is error check. We need to
disable such check in these tests.
2021-11-08 23:50:34 +03:00
Ivan Kylchik 9628412ff4 [TESTS] Remove ignore directive from some of tailrec tests for JS IR 2021-11-08 23:50:34 +03:00
Ivan Kylchik c59098df2f [JS TESTS] Rewrite js ir tests using new test infrastructure 2021-11-08 23:50:34 +03:00
Ivan Kylchik 0e4cf05d3e [JS TESTS] Fix es module test files for new test infrastructure 2021-11-08 23:50:34 +03:00
Ivan Kylchik 68c9156053 Add possibility to get line offsets from PsiIrFileEntry
This is needed for tests to be able to get offsets without explicit
file on disk.
2021-11-08 23:50:34 +03:00
Ivan Kylchik edd608446e [TESTS] Move WITH_RUNTIME directive to file level 2021-11-08 23:50:34 +03:00
Ivan Kylchik 37f02390ec [TESTS] Extract common backend directives into ConfigurationDirectives 2021-11-08 23:50:33 +03:00
Ivan Kylchik 108d6b63dd [TESTS] Add abstraction at IrBackendInput to work with several backends 2021-11-08 23:50:33 +03:00
Ivan Kylchik 701a10d643 Split some functions of js compiler to be able to use them in tests 2021-11-08 23:50:33 +03:00
Jinseong Jeon 4eec381d1b FIR IDE/LC: introduce/use KtTypeMappingMode 2021-11-08 20:12:17 +01:00
Jinseong Jeon 0da9ef873a FIR LC: use optimal type mapping mode for return type 2021-11-08 20:12:17 +01:00
Jinseong Jeon d3c34fa200 FIR LC: use optimal type mapping mode for value parameter 2021-11-08 20:12:17 +01:00
Jinseong Jeon 6d150fb7a5 FIR IDE: add APIs about FunctionClassKind 2021-11-08 20:12:17 +01:00
Jinseong Jeon d029e84b96 FIR LC: use proper use-site target for accessor's JVM name 2021-11-08 20:12:16 +01:00
Jinseong Jeon 8989378b02 FIR/LC: fix syntax error in import alias test 2021-11-08 20:12:16 +01:00
Ilya Kirillov 348403b1f3 FIR: do not inherit external modifier from super declaration 2021-11-08 19:01:35 +01:00
Konstantin Tskhovrebov d119976b46 Update K/N version to "1.6.20-dev-3759" 2021-11-08 16:57:22 +00:00
sebastian.sellmair 099a7525ab [Gradle][MPP] Improve error message for missing metadata extractor
^KT-46198
2021-11-08 16:43:54 +00:00
sebastian.sellmair e73273b139 [Gradle][MPP] Refine zipUtils.kt & implement ZipUtilsTest.kt
^KT-46198
2021-11-08 16:43:54 +00:00
sebastian.sellmair dea434b6d5 [Gradle][MPP] CompositeMetadataJar: Support omitted directory entries
^KT-46198
2021-11-08 16:43:54 +00:00
sebastian.sellmair 05364fa958 [Gradle][MPP] Implement CompositeMetadataJarTest
^KT-46198
2021-11-08 16:43:53 +00:00
sebastian.sellmair 911110188e [Gradle][MPP] Adjust CommonizerHierarchicalIT for published cinteorp metadata
^KT-46198
2021-11-08 16:43:53 +00:00
sebastian.sellmair 5f125006f7 [Gradle][MPP] MppCInteropDependencyTransformationIT
^KT-46198
2021-11-08 16:43:52 +00:00
sebastian.sellmair 86296a8ced [Gradle][MPP] Implement cinterop metadata dependency transformation
^KT-46198 Verification Pending
2021-11-08 16:43:52 +00:00
sebastian.sellmair 9e1fd37685 [Gradle][MPP] Include commonized cinterops in host specific metadata artifacts
^KT-46198
2021-11-08 16:43:51 +00:00
sebastian.sellmair 2dda5f6ed2 [Gradle][MPP] Bundle cinterop metadata in allMetadata klib
^KT-46198
2021-11-08 16:43:51 +00:00
sebastian.sellmair 94c68c99a0 [Gradle] Minor: KotlinNativeTargetConfigurator: Replace deprecated destinationDir
^KT-46198
2021-11-08 16:43:50 +00:00
sebastian.sellmair aee2894fa6 [Gradle] Minor: KotlinToolRunner: Replace deprecated 'setMain'
^KT-46198
2021-11-08 16:43:50 +00:00
sebastian.sellmair 78b168711c [Gradle] Minor: KotlinPlugin: Replace deprecated destinationDir
^KT-46198
2021-11-08 16:43:49 +00:00
sebastian.sellmair 5902e3d0fd [Gradle] Minor: Improve readability of GranularMetadataTransformation.kt
^KT-46198
2021-11-08 16:43:49 +00:00
sebastian.sellmair df7ab52505 [Gradle] Minor: Demote visibility of '.commonizeCInteropLibraries'
^KT-46198
2021-11-08 16:43:48 +00:00
sebastian.sellmair afa320a7b2 [Gradle] Minor: Move locateOrRegisterTask from CommonizerTasks.kt to TaskProviders.kt
^KT-46198
2021-11-08 16:43:48 +00:00
sebastian.sellmair 3bd36770cb [Gradle] Minor: Add return type for ModuleIds.fromDependency
^KT-46198
2021-11-08 16:43:48 +00:00
sebastian.sellmair 7c77ff83a7 [Gradle] Minor: Project.filesProvider add possibility to specify buildDependencies
^KT-46198
2021-11-08 16:43:47 +00:00