Commit Graph

49 Commits

Author SHA1 Message Date
Svyatoslav Scherbina 575c0fabb6 Native: add test for KT-38850
(the bug was fixed long ago, in 1.4-M1).
2021-12-08 13:00:15 +00:00
Elena Lepilkina c06875b8e9 [K/N] Added test for exceptions behaviour in case of dynamic libs (KT-47828) 2021-11-16 10:44:53 +00: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
Elena Lepilkina 23e5079391 [K/N] Added test for checking C callback set with Kotlin function throwing exception 2021-11-02 12:04:43 +00:00
Pavel Kunyavskiy 172373c57e [K/N] Add tests for flexible arrays in interop
^KT-48074
2021-10-19 13:45:00 +00:00
Mikhail Glukhikh 3febabe977 Use OPT_IN instead of EXPERIMENTAL in diagnostic names 2021-09-10 16:29:13 +03:00
Vladimir Ivanov 8ba164163c [K/N] cinterop: ignore CXIdxEntity_CXXClass in ObjC header
Unexpected behavior is caused by `@class` declaration in ObjC context.
This entity is not used in CPP context either.
2021-09-09 09:37:05 +00:00
Dmitriy Dolovov df208dc060 [Native][tests] Fix failing 'interop_objc_smoke_noopgc' test 2021-09-03 14:53:10 +03:00
Dmitriy Dolovov 1a863106e6 [Native][tests] Move golden data outside of Gradle build file 2021-09-01 10:14:01 +03:00
Sergey Bogolepov d4c91c96d3 [K/N] Fix objc_acr_contract test in two_stage mode 2021-08-31 12:52:42 +00:00
Ilya Matveev 463bc22bf3 [K/N] Enable callbackOnSeparateThread test since KT-44283 is fixed 2021-08-26 14:46:07 +00:00
Ilya Matveev 99bd26c2ef [K/N][Runtime] Switch thread states in termination handlers 2021-08-26 14:46:07 +00:00
Sergey Bogolepov 9dd8266bee [K/N] Add trivial test for llvm.objc.clang.arc.use lowering 2021-08-24 10:19:33 +03:00
Alexander Gorshenev 9148094bbd Garbage collection capable wrappers for skia interop 2021-07-30 12:54:51 +03:00
Sergey Bogolepov f05110f99b [K/N] Add some tests for https://youtrack.jetbrains.com/issue/KT-47605 2021-07-07 07:50:57 +00:00
Ilya Matveev dc8186cb83 [K/N][Interop] Fix throwing exceptions through bridges in opt mode
By default, C functions compiled to bitcode by clang have the
nounwind attribute. If such functions throws an exception, the
behaviour is undefined.

Our interop machinery can process foreign exceptions on call sites
(terminate or wrap them in Kotlin exceptions). But if the interop
bridges have the nounwind attribute, LLVM optimizations (particularly
inlining) may lead to the situation when a foreign exception is ignored by
our foreign exception handler.

This patch fixes the issue by compiling bridges with -fexceptions flag.
This flag makes clang to not set the nounwind attribute, so exceptions
can be thrown through C frames.
2021-07-02 11:51:06 +00:00
Svyatoslav Scherbina e324c9b3fb Generate initRuntimeIfNeeded() at the beginning of staticCFunction
#KT-44283 Fixed
2021-06-16 06:39:51 +00:00
Svyatoslav Scherbina b13e7d1e28 Native: enable more Obj-C interop tests for new MM 2021-06-11 07:35:50 +00:00
Vladimir Ivanov 7c7905b55c [Native] Disable unaligned float test (not supported yet) (#4434) 2021-06-08 13:18:58 +03:00
Alexander Shabalin 73533e4b19 Make NoOp GC support multiple mutators 2021-05-21 06:31:09 +00:00
Alexander Shabalin eac3f507b6 Make Kotlin_initRuntimeIfNeeded switch to native state 2021-05-20 13:48:49 +00:00
Vladimir Ivanov 5a0f113e6d [cinterop] Fix type annotation for struct containing anonymous union … (#4289) 2021-05-18 14:34:56 +03: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
Vladimir Ivanov 5f582ad28a [Kotlin/Native][Interop] Provide pure c wrappers over cpp for skia interop 2021-04-29 21:43:25 +03:00
Pavel Punegov afdecef112 Use minOrNull instead of deprecated min in the interop_objc_test 2021-04-08 11:57:34 +03:00
Svyatoslav Scherbina 107129679e Native: fix interop_objc_tests after recent frontend change
b60056f11e raises a warning to an error,
fixing this error here.
2021-03-30 15:32:46 +00:00
Ilya Matveev e56ac775ca [K/N][tests] Do not propagate user.dir property to compiler/cinterop
In a Gradle process, the user.dir property is set to the directory
where the build was started. By default, if we start a child process
via project.javaexec, Gradle sets its working directory to the
directory of the current project. But passing Gradle's value of user.dir
to that process overrides this setting.

This makes tools started in a such way sensitive to directory the build
is started from. Thus a test using relative paths may fail if it is
started from a wrong directory.

This patch fixes this issue for Kotlin/Native tests.
2021-03-26 12:38:27 +03:00
Sergey Bogolepov ec23ebd1c5 Fix workerAutoreleasePool test on macos_arm64 using __autoreleasing
Also merge `createAutorelease` and `create. There is no need in
such separation since it was originally added to prevent
optimization `result`'s lifetime.
Turned out, it was still happening on Apple Silicon,
and only addition of __autoreleasing attribute solves the problem.
2021-03-22 14:02:39 +03:00
Vladimir Ivanov ba50a8275c Add test for [KT-3706]
Issue is already fixed by metadata-based cinterop

(cherry picked from commit fd4f5b2c07ebdc431d6243ac087f911ee30e88ca)
2021-03-15 15:54:48 +03:00
Vasily Levchenko 17fc4a087b [build] enable sanity tests (step 3) 2021-02-24 11:07:14 +01:00
Svyatoslav Scherbina dc2d014504 Add some tests for CPointer.toKStringFromUtf8 2021-02-24 10:53:42 +01:00
Sergey Bogolepov 0ecd76c3cb Make incompleteTypes test more robust.
Currently, Kotlin strings that are passed to C functions are copied under the hood on the callsite. These copies have a short lifetime which might cause problems if it should outlive current call.
2021-02-15 10:16:10 +01:00
Sergey Bogolepov 76cac9fba0 Fix KT-43502 testcase on windows 2021-02-09 09:00:47 +01:00
Sergey Bogolepov 0a33d9d2fc Add a test-case for KT-43502 2021-02-09 09:00:46 +01:00
Alexander Shabalin 77e2b9f9a0 Disable running checkers by default (#4644)
* Make checkers be disabled by default

* Allow running checkers in test launcher
2021-01-26 17:38:03 +03:00
Pavel Punegov 73297a4ef3 Remove obsolete comments in the test 2021-01-26 17:38:02 +03:00
Pavel Punegov 6cc74a1b66 Better fix for the test: check for NUSInteger size 2021-01-26 17:38:02 +03:00
Pavel Punegov b565562a1f Fix architecture check in the test 2021-01-26 17:38:02 +03:00
Pavel Punegov e241d1249c Fix NSUInteger size for Watchos x64 2021-01-26 17:38:02 +03:00
Alexander Shabalin c582612bd7 Restore runtimeState value in deinitRuntime (#4587) 2020-12-14 15:25:37 +01:00
Alexander Shabalin 783517dbe8 Fix unchecked runtime shutdown (#4575) 2020-12-14 15:25:37 +01:00
SvyatoslavScherbina 62272f54c1 Fix isa swizzling for Kotlin subclasses of Obj-C classes
Don't rely on indexed ivars of instance's isa since isa swizzling
replaces it. Use method instead, it works on the replacement too
(if it is a subclass of the original isa).

 #KT-42482 Fixed.
2020-12-14 15:25:37 +01:00
Alexander Shabalin ee508efb23 Add a switch to destroy runtime only on shutdown (#4482) 2020-11-28 21:01:54 +01:00
Sergey Bogolepov c0a83f48bf [KT-43265] Add reproducer to tests. 2020-11-28 20:58:15 +01:00
Alexander Shabalin cbdd6fd245 Fix interop_cleaners_second_thread 2020-11-28 20:54:08 +01:00
Alexander Shabalin fc7cf48798 Tests on migrating main thread and memory leaks with interop (#4494) 2020-11-28 20:54:06 +01:00
SvyatoslavScherbina 47c606f1eb Wrap worker jobs to autoreleasepool
#KT-42822 Fixed.
2020-11-28 19:44:18 +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