Commit Graph

2763 Commits

Author SHA1 Message Date
Abduqodiri Qurbonzoda 64fd4ac510 Native Enum.hashCode() is not final #KT-61507
Merge-request: KT-MR-11937
Merged-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
2023-08-30 21:34:46 +00:00
Alexander Shabalin 1fa0ef6f56 [K/N] Refactor allocator modules ^KT-60928
- Move std_alloc, opt_alloc and custom_alloc into alloc/std,
  alloc/mimalloc and alloc/custom to mirror convention of gc,
  gcScheduler modules.
- Add alloc/common with common allocator API
- Add alloc/legacy with common implementation details of alloc/std and
  alloc/mimalloc. alloc/custom does not depend on alloc/legacy.
- Removes experimental_memory_manager_custom as it's now unused
- Additionally, renames experimental_memory_manager module into mm
2023-08-30 17:07:21 +00:00
Bogdan Mukvich 826297979d SBOM for native artifacts
^KTI-1240
2023-08-30 13:20:33 +00:00
Alexander Shabalin 3ec4f2e0ee [K/N] Remove jsinterop because K/N wasm32 target is removed ^KT-59008
See https://kotl.in/native-targets-tiers for details
2023-08-30 12:17:52 +00:00
Aleksei.Glushko 4eac193463 [K/N] Generalize GC-assistance pause logic
Merge-request: KT-MR-11790
Merged-by: Alexey Glushko <aleksei.glushko@jetbrains.com>
2023-08-29 19:31:02 +00:00
Aleksei.Glushko a99db60117 [K/N] Reenable mark&sweep statistics match assertion 2023-08-29 19:03:34 +00:00
Aleksei.Glushko 1437a9bb69 [K/N] Make GCStatistics handles movable 2023-08-29 19:03:34 +00:00
Igor Chevdar 2e02ee4ec8 [K/N] Fixed a corner case in escape analysis
#KT-61409 Fixed
2023-08-29 16:05:13 +00:00
Svyatoslav Scherbina b8e1349b72 Native: fix filecheck_constants_merge test after 4774912f
4774912f updated the patterns for the filecheck_constants_merge test,
because the commit slightly changed the code generated for TypeInfo.
But the test update was made with a copy-paste-related mistake.

As a result, the test didn't work with `-Ptest_with_cache_kind=static`.
This commit fixes this, buy reverting the unintended changes in
the filecheck patterns.
2023-08-29 13:48:30 +00:00
Johan Bay 0a612e4268 [klib] Add an option to write out header klibs
The header klib is supposed to only contain the public abi of the module
similar to jvm-abi-gen. It is intended to be used as a dependency for other
klib compilations instead of the full klib for compilation avoidance.

^KT-60807
2023-08-29 13:25:07 +00:00
Aleksei.Glushko 3efd98df1a [K/N] More work to do for weak-sweeper in weak ref benchmarks
Merge-request: KT-MR-11899
Merged-by: Alexey Glushko <aleksei.glushko@jetbrains.com>
2023-08-29 10:52:33 +00:00
Pavel Punegov ecb6b5dc58 [K/N][build] Remove obsolete kotlin-native-shared project
This project was replaced by the :native:kotlin-native-utils located at
native/utils. All sources were already merged.


Merge-request: KT-MR-11847
Merged-by: Pavel Punegov <Pavel.Punegov@jetbrains.com>
2023-08-28 14:57:16 +00:00
Alexander Shabalin 452e67f0e6 [K/N] Make kotlin-native:backend.native:tests:sanity same as run. 2023-08-28 09:27:58 +00:00
Aleksei.Glushko 0d04e170b1 [K/N] Prevent unmarked objects from appearing during concurrent weak processing
Merge-request: KT-MR-11614
Merged-by: Alexey Glushko <aleksei.glushko@jetbrains.com>
2023-08-26 16:00:12 +00:00
Bogdan Mukvich dbb5072a26 [Build] Update dependencies
Fix some reports from "Show Vulnerable Dependencies"

^KTI-1342
2023-08-25 14:10:37 +00:00
Ilya Chernikov b821009617 K2: add missing checks for integral parameter type on implicit coercion
#KT-61418 fixed
#KT-61442 fixed
#KT-61441 fixed
2023-08-25 08:55:58 +00:00
Abduqodiri Qurbonzoda 84c6333b23 Introduce Common String.toCharArray(destination) #KT-60657
Merge-request: KT-MR-11340
Merged-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
2023-08-25 03:11:13 +00:00
Svyatoslav Scherbina 4774912fdc Native: don't use aliases for kclass:* globals, fix KT-61417
Currently, when generating a TypeInfo with a vtable attached, the K/N
compiler generates two globals to the resulting LLVM module:
- "ktypeglobal:$fqName#internal" -- an internal global of the aggregate
type (TypeInfo+vtable)
- "kclass:$fqName" -- an internal or hidden alias pointing to the
TypeInfo part of that global

The reason for emitting two globals is to have everything strict-typed,
since other LLVM modules might import the kclass as a TypeInfo.
Importing an aggregate TypeInfo+vtable global as a TypeInfo global works
too, of course. It is just a little bit less clean.

The new Xcode 15 linker now emits symbols for the ktypeglobal to the
symbol table, including an STSYM. This happens for classes compiled to
cache, when the kclass is hidden, not internal.

The problem is: for some reason, such an STSYM for
"ktypeglobal:kotlin.String#internal" makes lldb find a wrong address
(0xffffffffffffffff) for "kclass:kotlin.String", despite those being
two different symbol names. This seems to be related to them having
the same address though.
The K/N lldb script, konan_lldb.py, uses "kclass:kotlin.String" to
determine if an object is a string, in order to display it properly.

Therefore, using the new Xcode 15 linker when compiling with caches
makes the debugger unable to display string variables properly. As a
side effect, this also breaks displaying array-typed variables (because
the script first checks if an object is a string).

This commit fixes this by removing ktypeglobals completely, making the
compiler emit only a kclass as an aggregate global directly.

Now, there are other ways to fix the problem. For example, making the
ktypeglobal private instead of internal, or making konan_lldb.py use a
runtime function instead of querying "kclass:kotlin.String" directly.
But it seems that LLVM aliases are not common on darwin platforms. For
example, Clang doesn't support `__attribute__((alias(...)))` on these
platforms.
So it is safer to just stop using aliases here.

^KT-61417
2023-08-24 15:03:27 +00:00
Ivan Kylchik ee973c0ede [Generator] Generate Char class 2023-08-24 08:59:49 +00:00
Ivan Kylchik 38e434bc07 [Generator] Generate Boolean class 2023-08-24 08:59:49 +00:00
Ilya Gorbunov 3f3cd2e87a [Generator] Set up body for rangeTo and rangeUntil by default
Also use expression body formatting for `rangeTo`.
2023-08-24 08:59:49 +00:00
Alexander Shabalin ba49879b5e [K/N] Disable tests with aux threads with tsan 2023-08-24 08:33:38 +00:00
Alexander Shabalin aac53b699e [K/N] Make hostRuntimeTests for arm64 macOS also run x64-tsan 2023-08-24 08:33:38 +00:00
Pavel Punegov 2b6ca6d8e1 [K/N] Exclude a part of the test that fails due to the ^KT-61418 2023-08-23 15:40:07 +00:00
Troels Bjerre Lund f67ec22c24 [K/N] Fix the native performance benchmark build
kotlin.native.concurrent.FreezableAtomicReference was depricated, so it
has been replaced by a kotlin.concurrent.AtomicReference
2023-08-23 14:29:29 +00:00
Alexander Shabalin efa59eb589 [K/N] Adjust values for the initial and minimum heap sizes ^KT-61092 2023-08-23 14:00:32 +00:00
Alexander Shabalin 18fb2ec476 [K/N] Don't build distribution for deprecated targets ^KT-59008 2023-08-23 11:46:59 +00:00
Pavel Kunyavskiy eefc51657a [K/N] Fix debug info for lambdas inside inline functions
^KT-57365
2023-08-23 08:18:56 +00:00
Aleksei.Glushko c5637ccc7e [K/N] Disable racy runtime test till better times
Merge-request: KT-MR-11788
Merged-by: Alexey Glushko <aleksei.glushko@jetbrains.com>
2023-08-22 21:04:26 +00:00
Alexander Shabalin deb13257c2 [K/N] Make Any.equals simpler 2023-08-22 17:16:43 +00:00
mvicsokolova 5f431e4e87 [K/N] Updated deprecations for native atomics
* Removed deprecated methods from the new atomics in kotlin.concurrent
* Changed deprecation level from WARNING to ERROR for the old atomics in kotlin.native.concurrent
* Removed FreezingIsDeprecated annotation from kotlin.concurrent.AtomicReference

See KT-58123

Merge-request: KT-MR-10650
Merged-by: Maria Sokolova <maria.sokolova@jetbrains.com>
2023-08-22 13:42:12 +00:00
Pavel Kunyavskiy 8bcd1f4efa [FIR/Native] Move fir-related code from backend.native module to new one
^KT-61249
2023-08-22 08:56:16 +00:00
Dmitrii Krasnov ade88e2b0f Fixed konan.data.dir with caches
Removed TODOs after updating to kotlin bootstrap version with konan.data.dir gradle property changes

Fixed warning of incorrect passing -Xkonan-data-dir arg in konanc from KGP and fixed setting konan-data-dir in SetupConfiguration#setupCommonOptionsForCaches

#KT-60660 Fixed

Merge-request: KT-MR-11299
Merged-by: Dmitrii Krasnov <Dmitrii.Krasnov@jetbrains.com>
2023-08-22 07:56:26 +00:00
Nikita Bobko 25c082f02b K1: Implement a checker that disallows to have different member scopes for expect open and its actual
^KT-22841 Fixed
Review: https://jetbrains.team/p/kt/reviews/11603/timeline

The commit also introduces `@AllowDifferentMembersInActual` annotation in
stdlib which allows to suppress the diagnostic
2023-08-21 19:51:08 +00:00
Igor Chevdar 9917c477e8 [K/N][linker] Name temp obj file the same as output binary
#KT-61270 Fixed
2023-08-21 18:06:02 +00:00
Svyatoslav Scherbina 04d01e381f Native: disable running cinterop in Gradle process when building K/N
Building Kotlin/Native itself involves running cinterop in the Gradle
daemon process to reduce build time.
But this optimization appears to be incorrect when reusing Gradle daemon
for subsequent builds.

This commit disables the optimization by default, keeping enabling it
possible using `kotlin.native.allowRunningCinteropInProcess=true`
project property.

For more details see ^KT-61300
2023-08-21 14:15:28 +00:00
Igor Chevdar c1874d0184 [K/N][codegen] Added debug info to virtual functions trampolines
#KT-61131 Fixed
2023-08-21 12:05:28 +00:00
Alexander Shabalin f459a6f6b5 [K/N] Configure runtime tests compilation parallelism 2023-08-16 22:02:02 +00:00
Dmitriy Novozhilov 697d0d5638 [IR] Mark IrSymbol.owner with OptIn annotation
^KT-60923 Fixed
2023-08-16 17:47:29 +00:00
Alexander Shabalin e380610ab0 [K/N] Add a note to identityHashCode() 2023-08-16 14:23:07 +00:00
Alexander Shabalin 431cc9e672 [K/N] Add division to kotlin::saturating
Additionally refactor unit tests.
2023-08-15 13:33:37 +00:00
Pavel Punegov f727934f6b [K/N] Test framework implementation refactoring
* Extract argument processor and settings out of TestRunner.
This makes it possible to add external runners to the framework.
* Add methods and docs to TestCase and TestSuite classes that
describe Kotlin test methods.
2023-08-15 10:05:09 +00:00
Dmitriy Dolovov b37bb0be16 [IR][Native] Drop KonanIrFileSerializer.expectDescriptorToSymbol parameter
^KT-61136
2023-08-14 15:13:44 +00:00
Dmitriy Dolovov f3c58bcfb3 [IR][Native] Drop KonanIrFileSerializer.skipExpects parameter
^KT-61136
2023-08-14 15:13:44 +00:00
Aleksei.Glushko 00d6ced263 [K/N] Add the license file for BoundedQueue.hpp
Merge-request: KT-MR-11619
Merged-by: Alexey Glushko <aleksei.glushko@jetbrains.com>
2023-08-14 14:47:07 +00:00
Leonid Startsev 8b821e1feb Deprecate KmProperty.hasGetter(hasSetter) in favor of KmProperty.getter(setter)
as a follow-up of flag deprecation.

#KT-59440
2023-08-14 12:36:34 +00:00
Svyatoslav Scherbina 4da8b0850e Native: make CompareDistributionSignatures task fail on klib tool errors
CompareDistributionSignatures task is used to compare Native platform
libraries contents against a previous version.

Under the hood, it runs the klib tool to get a library contents. But it
didn't check the exit code, so if klib tool failed, the task could
mistakenly indicate that there are no differences in platform libs.

Fix this by checking the klib tool exit code and failing if it is not
zero.
2023-08-11 12:13:21 +00:00
Alexander Shabalin 288163437d [K/N] Remove legacy MM runtime modules ^KT-59121 2023-08-10 13:20:41 +00:00
Alexander Shabalin 6b50d0a44f [K/N] Make GC scheduler pausing less aggressive ^KT-61091 2023-08-10 11:21:30 +00:00
Mark Mann 8a31e2ed82 [IR] Optimize a few hot spots to reduce total CPU time
^KT-61121
2023-08-10 09:57:06 +00:00