Commit Graph

22 Commits

Author SHA1 Message Date
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
sebastian.sellmair bff62aba5f [Native] Implement 'kotlinx.cinterop.UnsafeNumber' interface
^KT-48459
2021-08-30 19:25:41 +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
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 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
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
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