Commit Graph

48 Commits

Author SHA1 Message Date
Alexander Udalov 3c4b5529af Update year to 2023 in COPYRIGHT_HEADER.txt
This commit is the result of changing the year to 2023 in
COPYRIGHT_HEADER.txt and running all `generate*` tasks in
`generators/build.gradle.kts`.
2023-01-02 22:52:15 +01:00
Mikhail Glukhikh a22d7aea25 Native: don't set allWarningsAsErrors = true in K2 mode
Related to KT-54123
2022-09-29 15:32:01 +00:00
Alexander Udalov c410c5d3cd Do not reset freeCompilerArgs for some kotlin-native modules
Otherwise common compiler arguments which are set for all modules in the
project in `buildSrc/src/main/kotlin/common-configuration.gradle.kts`
are not applied. The most interesting of those are `-Xuse-k2` (if K2 is
enabled) and `-Xjvm-default=all`.
2022-09-27 11:04:31 +00:00
Nikita Bobko 2a4f3f41aa 2/5 Replace source dependency on kotlin-reflect with binary dependency
Review: https://jetbrains.team/p/kt/reviews/6753

Meaningful semantic change was splitted into 5 commits to simplify the
change review. Sinle commit would be too big.

Why replace source to binary: to get rid of kotlin-reflect in Kotlin
plugin artifact KTIJ-22276

Note: Kotlin Maven artifacts (./gradlew publish) changed their
dependency on kotlin-reflect
2022-08-22 15:43:49 +02:00
Svyatoslav Scherbina 2e8c25aeff Native: rewrite Kotlin_Interop_getObjCClass in Objective-C
This allows calling it in "Native" thread state.
2022-08-02 09:24:01 +00:00
Alexander Shabalin 29f3445721 [K/N] Deprecated freezing ^KT-50541
Starting with 1.7.20 freezing is deprecated. See https://github.com/JetBrains/kotlin/blob/master/kotlin-native/NEW_MM.md#freezing-deprecation for details.

Merge-request: KT-MR-6399
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2022-06-16 09:04:14 +00:00
Svyatoslav Scherbina 42ed0c5fe6 Native: add .alloc(value) for primitive types to interop runtime
^KT-50312 Fixed
2022-03-22 18:49:09 +03:00
Pavel Kirpichenkov 6674c3f482 [MPP] Apply @UnsafeNumber to functions and properties
KT-51224
KT-51215
2022-02-17 13:17:13 +03:00
Pavel Kirpichenkov f8a1395a03 [MPP] allow function and property targets for @UnsafeNumber annotation
KT-51224
KT-51215
2022-02-17 13:17:13 +03:00
Igor Chevdar f724b5c29d [K/N][gradle][interop] Workaround for loading readonly native libs 2022-01-14 10:29:12 +05:00
Igor Chevdar 993816a400 [K/N][runtime][interop] Refactoring to run cinterop in daemon 2022-01-14 10:29:05 +05:00
Igor Chevdar 353f82f9e6 Revert "[K/N][runtime][interop] Refactoring to run cinterop in daemon"
This reverts commit 47858126da.
2021-11-26 14:05:59 +05:00
Igor Chevdar 47858126da [K/N][runtime][interop] Refactoring to run cinterop in daemon 2021-11-25 23:42:09 +05:00
Svyatoslav Scherbina fb81ae0cd1 Native: fix deadlock in kotlinx.cinterop.typeOf impl for JVM
Don't use ConcurrentHashMap.computeIfAbsent for typeOf cache,
because the computation may call typeOf recursively for different type
(e.g. C enum var type computation calls typeOf for enum base integer type),
which might cause a deadlock in computeIfAbsent.
2021-09-22 07:31:22 +00:00
Pavel Kunyavskiy 91c6ee1ebb [K/N] Replace SymbolName with GCUnsafeCall in stdlib 2021-09-10 07:46:39 +00:00
Mikhail Glukhikh ed035d99ab Migrate -Xopt-in to -opt-in in Gradle Kotlin scripts 2021-09-03 15:40:47 +03:00
sebastian.sellmair bff62aba5f [Native] Implement 'kotlinx.cinterop.UnsafeNumber' interface
^KT-48459
2021-08-30 19:25:41 +00:00
Sergey Bogolepov 6e093b0beb [K/N] Update libffi for Windows
MinGW and MSVC are hardly compatible in case of static linkage, so we
need to use a native libffi.
2021-08-03 05:42:06 +00:00
Sergey Bogolepov a78fcd6b64 [K/N] Separate ClangArgs for jni and native
Since LLVM for Windows is now native instead on MinGW, we have to
compile code in a different environment in case of JNI. This commits
just separates ClangArgs into two subclasses without actual behavior
changes.
2021-08-03 05:42:05 +00:00
Alexander Gorshenev 9148094bbd Garbage collection capable wrappers for skia interop 2021-07-30 12:54:51 +03:00
Pavel Kunyavskiy d18ade088d [K/N] Help message for disabling quarantine flag on dylibs in distribution 2021-07-30 08:17:45 +00:00
Alexander Udalov 91c39ed01c Build: remove obsolete compiler arguments
These compiler arguments enable features which are enabled by default in
the current Kotlin anyway.

The only exception is in :compiler:cli which uses an old language
version.
2021-07-27 13:35:38 +02:00
Mikhail Glukhikh 47c8bab48e Replace -Xuse-experimental with -Xopt-in in codebase 2021-07-12 21:26:17 +03:00
Sergey Bogolepov 36386de9a2 [Native] Drop explicit -fPIC flag setup
We don't need to explicitly set -fPIC flag everywhere
because since d82109cc92
it is set by default for all ClangArgs users.
2021-06-11 12:18:14 +00:00
Svyatoslav Scherbina dc8934ab22 Native: fix crash in custom LLVM diagnostics handler
48a684c0 added custom LLVM diagnostic handler, using JvmCallbacks machinery,
thus triggered a bug in the latter: callbacks are cached and outlive the compilation session,
but rely on memory that is reclaimed at the end of the compilation session.
So during a subsequent compilation in the same process (e.g. when the compiler runs in the
Gradle daemon process), LLVM might call the callback which accesses the reclaimed memory, 
which in turn causes the crash.

Fix this by forcing JvmCallbacks to allocate memory that doesn't "expire" at the end of the compilation session.
2021-05-21 07:34:34 +00:00
Ilya Matveev 4d346d3735 [K/N][New MM] Support thread state switching
Including

* Support thread state switching in codegen
* Introduce and use GCUnsafeCall annotation
* Switch thread state in C++ runtime code

Also

* Register current thread in Mark&Sweep tests
* Store MemoryState in Worker instance
* Set worker tid in WorkerInit
2021-05-06 14:10:21 +00:00
Alexander Gorshenev 887032667d [Kotlin/Native][Interop] Skia interop plugin for cinterop 2021-04-29 21:43:26 +03:00
Abduqodiri Qurbonzoda 3a8d1c4b5e Remove redundant @OptIn 2021-04-16 19:01:28 +03:00
Ilya Gorbunov 7cd306950a Deprecate Char-to-Number conversions in stdlib (Native)
- Synchronize code of Ranges, Progressions, ProgressionIterators
- Suppress deprecations in regex implementation code

KT-23451
2021-04-07 18:30:21 +03:00
Ilya Gorbunov 833955e56d Migrate deprecations in Native compiler
Replacing deprecated Char.toInt() with Char.code and
Number.toChar() with Number.toInt().toChar(), where Number is not Int.

KT-23451
2021-04-07 18:30:21 +03:00
Svyatoslav Scherbina 65fa2f62bd Fix :kotlin-native:**:nativelibs Gradle tasks
These tasks did copy all files from build to build/nativelibs, thus
causing up-to-date checks to fail, and native libs and temporary build
files to be accumulated in recursive directories like
nativelibs/nativelibs/... in both build dirs and dist.

Fix this by copying only relevant files.
2021-04-02 14:13:48 +00:00
Svyatoslav Scherbina 1d96f810da Native: fix target for ReturnsRetained and ConsumesReceiver annotations
These annotations can be used on Objective-C property accessors imported
to Kotlin.
Note: the annotations aren't used in source code, only generated
directly to metadata by cinterop. So this commit doesn't in fact fix
anything but rather makes the implementation less fragile.

See https://github.com/JetBrains/kotlin-native/issues/3336.
2021-03-30 20:23:59 +00:00
Svyatoslav Scherbina a9d0409f2e Don't use Function.reflect() in kotlin-native/Interop on JVM
Use inline functions and typeOf<T>() instead
2021-03-19 06:53:09 +00:00
Alexander Udalov d9a9bd0136 Fix compilation of Interop/Runtime after fc36178f3a 2021-03-15 20:34:24 +01:00
Alexander Udalov c56f719dcc Fix/suppress some warnings
(cherry picked from commit d8a43c216925b3a9e1475b786978436835a57927)
2021-03-15 15:54:50 +03:00
Svyatoslav Scherbina 27904c0fb9 Native compiler source: replace inline classes by value classes
The former are deprecated.
2021-03-05 12:15:22 +00:00
Vasily Levchenko 65dd798818 [build][native support] intoduced new native support. 2021-02-24 11:07:18 +01:00
Vasily Levchenko 7b73917217 [build][dist] global dist fixed 2021-02-24 11:07:17 +01:00
Vasily Levchenko c85c3ac123 [build] joint (step 1)
(cherry picked from commit 7d0775f7e69ab900200bcf1fa78b94d68e6bd4f6)
2021-02-24 11:04:59 +01:00
Svyatoslav Scherbina f766a3eae4 Optimize CPointer.toKStringFromUtf8 on Native
Use strlen and stop allocating intermediate ByteArray
to make the performance comparable to ByteArray.decodeToString().

Partially fix KT-44357.
2021-02-24 10:53:42 +01:00
Vasily Levchenko 40959c756d Revert "Temporary remove all -Werror flags"
This reverts commit 89c09214eeed951684405c10c233304834a89beb.
2021-02-01 16:54:15 +01:00
Dmitriy Novozhilov 29f68fe7ae Temporary remove all -Werror flags
This is needed for transational period of migrating kotlin repository to compiler with version 1.5

(cherry picked from commit 2836a17952dd47b5b8fe176a0b0374c23567b2ff)
2021-02-01 16:54:15 +01:00
Vasily Levchenko 8b2f0d644b [build] kotlin.*Compile: -Xskip-prerelease-check
(cherry picked from commit 57172ac6ead928b565fefaf49d8405a07c856e25)
2021-02-01 16:54:15 +01:00
Igor Chevdar e5f7cef594 [interop] Optimized unmanaged memory alloc/free 2020-11-28 21:12:15 +01:00
Ilya Gorbunov bf4e53ae06 Use Files API for creating temp files and directories
(cherry picked from commit b9df8591d043c79f2032b782efc7539c747c2625)
2020-11-28 21:01:56 +01:00
Igor Chevdar f8b4db21aa Merge pull request #4496 from JetBrains/small_backend_optimizations
Small backend optimizations
2020-11-28 20:57:39 +01:00
Campbell Jones 4c9bbe54d4 Improve compatibility with newer GCC+Clang, resolve some warnings 2020-11-28 20:53:03 +01:00
Stanislav Erokhin f624800b84 Move everything under kotlin-native folder
I was forced to manually do update the following files, because otherwise
they would be ignored according .gitignore settings. Probably they
should be deleted from repo.

Interop/.idea/compiler.xml
Interop/.idea/gradle.xml
Interop/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_3.xml
Interop/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_3.xml
Interop/.idea/modules.xml
Interop/.idea/modules/Indexer/Indexer.iml
Interop/.idea/modules/Runtime/Runtime.iml
Interop/.idea/modules/StubGenerator/StubGenerator.iml
backend.native/backend.native.iml
backend.native/bc.frontend/bc.frontend.iml
backend.native/cli.bc/cli.bc.iml
backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2Native.kt
backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2NativeCompilerArguments.kt
backend.native/tests/link/lib/foo.kt
backend.native/tests/link/lib/foo2.kt
backend.native/tests/teamcity-test.property
2020-10-27 21:00:28 +03:00