813 Commits

Author SHA1 Message Date
Mikhail Glukhikh abf72816e9 Fix property/enum entry ambiguity warning 2022-06-15 17:20:01 +00:00
Diego Gomez Olvera 9a430efbe7 [KT-52681] Remove unnecessary semicolon after Objective-C @end
Objective-c `@end` doesn't need a semicolon, however KMM exported header
file, for instance:
```
__attribute__((swift_name("KotlinIterator")))
@protocol MyProjectKotlinIterator
@required
- (BOOL)hasNext __attribute__((swift_name("hasNext()")));
- (id _Nullable)next __attribute__((swift_name("next()")));
@end;
```
This creates problems with some code checkers that will not expect it
there, so it seems best to remove it.
2022-06-10 15:46:27 +03:00
Alexander Shabalin ac395b21ea [K/N] Fix state switch in CAdapterGenerator ^KT-52692
Merge-request: KT-MR-6429
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2022-06-09 13:01:17 +00:00
Vladimir Sukharev 83d7524232 Fix KT-26478: Objective-C-objects-class-name-is-null-in-ClassCastExceptions-message
#KT-26478 Fixed

Merge-request: KT-MR-6405
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2022-06-09 12:57:11 +00:00
Vladimir Sukharev eabf6dac7f Fix "kotlin.TypeCastException has no message on Native"
#KT-35544 Fixed

Merge-request: KT-MR-6392
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2022-06-03 07:40:26 +00:00
Svyatoslav Scherbina 3f6b386681 Native: make debug interface handle uninitialized threads
Generally, debug interface is not called from uninitialized threads,
but let's be on the safe side here.
2022-05-30 15:21:57 +00:00
Alexander Shabalin 3630d7f770 [K/N] Address races in timer tests
Merge-request: KT-MR-6368
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2022-05-30 09:07:51 +00:00
Alexander Shabalin 1535ab8eed [K/N] Tweak aligned allocation on all platforms ^KT-37272
Merge-request: KT-MR-6341
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2022-05-27 15:10:32 +00:00
Vyacheslav Gerasimov 6a0fbce76a Build: Fix assemble task of :kotlin-native:runtime 2022-05-26 10:49:24 +00:00
Pavel Kunyavskiy be2c92a0bd [K/N] Patch mimalloc to avoid using clock_gettime on apple targets
^KT-52430
2022-05-26 10:32:12 +00:00
Ahmed El-Helw 93cb4d71d8 KT-51297: Allow suspend from any thread from ObjC
This patch adds a binary compiler argument to allow not crashing if a
suspend function is called from a non-Main dispatcher from ObjC or
Swift. This is relevant for people using the new memory model, in which
this restriction may be relaxed.
2022-05-25 09:24:22 +03:00
Ivan Kylchik 1ccd5d1a3a Add new internal annotation IntrinsicConstEvaluation to kotlin-native 2022-05-18 21:19:53 +03:00
Ilya Matveev 8493b955cc [K/N][runtime] Add a lock on finalizer thread creation
The finalizer thread can be created from the GC thread or from
any application thread during runtime shutdown. This may cause
a rare race when the GC starts the finalizer thread during runtime
shutdown. In this case two finalizer threads may be created and
the app will crash on attempt to assign the finalizerThread_ field
in FinalizerProcessor.
2022-05-18 13:48:50 +00:00
Ilya Matveev 78d179e9ab [K/N][runtime] Track safepoints in aggressive GC
Issue #KT-49188 Fixed
2022-05-18 13:48:49 +00:00
Pavel Kunyavskiy 134647169e [K/N] add custom builtin_mul_overflow to workaround llvm bug
^KT-52365
2022-05-14 06:49:32 +00:00
Alexander Shabalin d77041aad0 [K/N] Move all knowledge about CompileToBitcode to the plugin.
Merge-request: KT-MR-6215
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2022-05-12 12:20:31 +00:00
Alexander Shabalin 89afa4c5b5 [K/N] Use mimalloc for kotlin objects only ^KT-52130
Merge-request: KT-MR-5805
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2022-05-12 08:48:37 +00:00
Alexander Shabalin caf90de2b8 [K/N] Compile runtime tests in parallel.
Merge-request: KT-MR-6164
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2022-04-29 20:30:57 +00:00
Alexander Shabalin 4a66cd0c69 [K/N] Remove usage of legacy allocation stuff ^KT-52130
Merge-request: KT-MR-6182
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2022-04-29 10:12:44 +00:00
Alexander Shabalin 663e843544 [K/N] Refactor allocators ^KT-52130
Merge-request: KT-MR-6135
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2022-04-27 14:00:27 +00:00
Ilya Gorbunov a03999fe81 Rename DefaultTimeMark to TimeSource.Monotonic.ValueTimeMark 2022-04-14 16:54:32 +00:00
Ilya Gorbunov 4ab0f7deeb Provide specialized TimeSource.Monotonic for Native
KT-46132
2022-04-14 16:54:32 +00:00
Alexander Shabalin 46fc71ef1e [K/N] Use intrusive list for mark queue ^KT-51436
Merge-request: KT-MR-5912
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2022-04-14 08:19:05 +00:00
Alexander Shabalin 421ad77740 [K/N] Simplify ObjectFactory ^KT-51436
Merge-request: KT-MR-5958
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2022-03-31 09:43:47 +00:00
Svyatoslav Scherbina cf581738c3 Native: improve ClassCastException message for local classes
Previously it was like "null cannot be cast to MyObject" or
"MyObject cannot be cast to null", because `KClass.qualifiedName` is
`null` for local classes (including anonymous ones).

Use `KClass.toString()` instead, for both object actual dynamic type
and cast target type. This string representation is generally more
meaningful for such cases, and contains useful details for local
classes.
2022-03-28 08:21:55 +00:00
Sergey Bogolepov 77c04e7d71 [K/N] Do not inline runtime functions in case of armv7 darwin targets
^KT-51649 fixed
2022-03-21 09:11:13 +00:00
Alexander Shabalin 3b2a318c7d [K/N] Generalize Mark queue handling ^KT-51436
Merge-request: KT-MR-5904
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2022-03-15 10:36:16 +00:00
Alexander Shabalin 53de23200d [K/N] Make GC scheduler parametrized by Clock. ^KT-48537 2022-03-14 13:21:40 +00:00
Alexander Shabalin e014e6b154 [K/N] Handle clock wrapping in RepeatedTimer. ^KT-48537 2022-03-14 13:21:39 +00:00
Alexander Shabalin eae9d05f50 [K/N] Add mockable clock. ^KT-48537 2022-03-14 13:21:39 +00:00
Alexander Shabalin e6b7a142b2 [K/N] Implicit constructors for saturating. ^KT-48537 2022-03-14 13:21:38 +00:00
Alexander Shabalin 03b09346a5 [K/N] Intrusive single linked list ^KT-51436
Merge-request: KT-MR-5854
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2022-03-14 13:20:41 +00:00
Pavel Kunyavskiy 42a2ce1610 [K/N] Fix currentFrame in smaller scope, to avoid gc while having incorrect shadow stack 2022-03-10 13:22:04 +00:00
Svyatoslav Scherbina 7470aaf06c Native build: don't read klib files in KonanCacheTask.cacheFile
It is `@OutputDirectory`, so Gradle can invoke it early, even before the
klib itself is built.

Instead of reading `uniqName` from klib files, require specifying it
explicitly.
2022-03-06 12:16:17 +00:00
Alexander Shabalin 964edbaf91 [K/N] Reuse mark queue ^KT-51436
Merge-request: KT-MR-5819
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2022-02-22 11:01:15 +00:00
Pavel Punegov 4f981ff745 [K/N] Use toBits() in Float and Double hashCode()
toBits() is aware of NaNs comparing to bits()
2022-02-10 16:25:18 +00:00
Svyatoslav Scherbina 76672a4abf Native: terminate if cinterop ObjC reference conversion throws exception
To avoid forwarding Obj-C exceptions to Kotlin or vice versa.
Otherwise this might lead to a crash or other undesirable behaviour.

^KT-50648 Fixed
2022-02-09 07:47:42 +00:00
Svyatoslav Scherbina d235fc4dbe Native: add thread state switches to blockToKotlinImp 2022-02-09 07:47:42 +00:00
Svyatoslav Scherbina 925e7801aa Native: improve message when Obj-C block can't be converted to Any 2022-02-09 07:47:41 +00:00
Svyatoslav Scherbina cd62b5b3b3 ObjCExport: optimize receiving autoreleased references from Obj-C/Swift
when the callee supports this.
2022-02-08 15:17:06 +00:00
Igor Yakovlev 195513d4f2 [WASM] Workaround about call toTypedArray on AbstractCollection 2022-02-03 21:25:58 +01:00
Alexander Shabalin 434213f416 [K/N] Add ScopedThread
* thread that by default joins in the destructor (like C++20 jthread)
* can be given a name

Merge-request: KT-MR-5619
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2022-02-03 15:38:07 +00:00
Pavel Kunyavskiy 85633771da [K/N] Replace escape analysis correctness check to RuntimeAssert to avoid checks in release mode 2022-02-03 08:08:21 +00:00
Ilya Matveev 23d606b053 [K/N][tests] Support setting GC scheduler in the new infra 2022-02-03 07:30:33 +00:00
Svyatoslav Scherbina 9a967952b5 ObjCExport: fix crash when KotlinBase +initialize is called before +load
This generally shouldn't happen, but sometimes it does.

^KT-50982 Fixed
2022-02-02 12:57:20 +00:00
Ilya Matveev 6c173b2b6c [K/N] Add mmap to thread state checker exclude list 2022-02-02 05:22:59 +00:00
Ilya Matveev c35b8342d8 [K/N][Runtime] Support equality and hashcode for stacktraces 2022-02-01 10:02:50 +00:00
Alexander Shabalin 4c97b55adf [K/N] Simplify SingleThreadExecutor
Merge-request: KT-MR-5591
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2022-01-28 12:11:44 +00:00
Svyatoslav Scherbina 4cd60090e0 ObjCExport: fix replacing Kotlin class methods by Swift extensions
^KT-49937 Fixed
2022-01-28 11:15:39 +00:00
Pavel Kunyavskiy 1bc8061667 [K/N] Refactor suspension to reduce generated code size 2022-01-28 06:44:47 +00:00