Commit Graph

240 Commits

Author SHA1 Message Date
Alexander Shabalin 1f1b26f2a5 [K/N] Split Weak and MemorySharedRefs between mm implementations ^KT-56233
* A separate RegularWeakReferenceImpl for the new mm. Name is chosen for
  better consistency with other WeakReferenceImpl implementations.
* KRefSharedHolder and BackRefFromAssociatedObject implementations are
  independent between the legacy and the new mm.
* Better support for WeakReference in runtime unit tests.
2023-04-06 11:40:45 +00:00
Alexander Shabalin dbe14a0a90 [K/N] Make gc::SweepExtraObjects similar to gc::Sweep. ^KT-56233 2023-04-06 11:40:44 +00:00
Alexander Shabalin eec3987e85 [K/N] Fix RunFinalizerHooks ^KT-56233 2023-04-06 11:40:43 +00:00
Alexander Shabalin aad6d2c8f8 [K/N] Add kotlin::ManuallyScoped<T> ^KT-56233
kotlin::ManuallyScoped<T> is a wrapper over T that pins T in place
and has a trivial constructor and destructor. Creation and destruction
of T must be carried out manually by construct and destroy methods.
2023-04-06 11:40:43 +00:00
Alexander Shabalin 6a0e6b11bd [K/N] Add kotlin::RWSpinLock ^KT-56233
Trivially constructible and destructible std::shared_mutex
implementation with additional guarantee that try_* methods fail only if
the mutex is locked.
2023-04-06 11:40:42 +00:00
Alexander Shabalin 9e5a2efb03 [K/N] Add kotlin::raw_ptr<T> helper class ^KT-56233
kotlin::raw_ptr<T> is exactly T* but with the default constructor
setting value to nullptr and with destructive move.
2023-04-06 11:40:42 +00:00
Pavel Kunyavskiy dc2e072af2 [K/N] Make exception handling in initializers more consistent with jvm
^KT-57091
2023-03-14 12:59:14 +00:00
Pavel Kunyavskiy a11f6fd9cb [K/N] Support of aligned fields
For now only alignment by at most 8 is supported for instance fields.

^KT-54944
2023-01-16 08:34:21 +00:00
Pavel Kunyavskiy 6da66649e7 [K/N] Hack for make 64-bit atomics working on mips
^KT-54944
2023-01-16 08:34:21 +00:00
Pavel Kunyavskiy 9dea349752 [K/N] Support of @Volatile annotation
^KT-54944
2023-01-16 08:34:20 +00:00
Aleksei.Glushko 20e80401b2 [K/N] Hide throwable constructor frames from stack traces.
Merge-request: KT-MR-8242
Merged-by: Alexey Glushko <aleksei.glushko@jetbrains.com>
2023-01-13 14:14:40 +00:00
Aleksei.Glushko c6d8af003d [K/N] Don't get out of bound during SSE hashCode calculation
Use loadl_epi64 to read vectors of u16x4.

Merge-request: KT-MR-7964
Merged-by: Alexey Glushko <aleksei.glushko@jetbrains.com>
2022-12-13 10:44:52 +00:00
Pavel Kunyavskiy d3adfec2fb [K/N] Rework object and enum classes initialization
Now it works with common logic for all static scope not with custom one.
2022-11-22 13:51:22 +00:00
Pavel Kunyavskiy cf80a86855 [K/N] Some strange fix to make wasm target happy 2022-11-22 13:51:20 +00:00
Alexander Shabalin 5ef9a5a240 [K/N] Crash with OOM on large array allocations ^KT-54659
Merge-request: KT-MR-7507
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2022-11-01 11:00:23 +00:00
Alexander Shabalin 5c9802ae84 [K/N] Optimize intrusive_forward_list usage in GCs ^KT-54163
* Add fallible push to intrusive_forward_list.
* Add fallible pop to intrusive_forward_list.
* Get rid of size_ member in intrusive_forward_list.
* Force all intrusive_forward_list items to have non-null next().
* Get rid of explicit colors in STMS and CMS.
* Do not queue weak reference for later processing in Mark.

Merge-request: KT-MR-7263
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2022-10-06 20:16:53 +00:00
Pavel Kunyavskiy 0959255379 [K/N] Refactor GC logging and statistics
Same code is now used for GC logging in all gc versions.

^KT-53064
2022-10-04 18:44:58 +00:00
Pavel Kunyavskiy c4e2901a1d [K/N] Avoid inlining of ignored check on external call 2022-10-04 18:44:58 +00:00
Alexander Shabalin 98251f42f2 [K/N] Specialize marking call for objects ^KT-54163
Merge-request: KT-MR-7232
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2022-10-04 09:51:08 +00:00
Alexander Shabalin f009d9b633 [K/N] Manually compact mimalloc heap ^KT-53182
Merge-request: KT-MR-7111
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2022-09-23 15:07:16 +00:00
Svyatoslav Scherbina 39c73e25a4 Native: improve thread state switches for NSSet/NSDictionary adapters
^KT-54119
2022-09-22 07:37:44 +00:00
Pavel Kunyavskiy 7293dd6d65 [K/N] Require small binaries for all watchos targets 2022-09-16 12:24:11 +00:00
Svyatoslav Scherbina 1b17dbff09 Native: compile runtime/src/cpp/math code only for wasm32 2022-09-15 09:32:32 +00:00
Alexander Shabalin e6e7feb985 [K/N] Do not check for external calls in SpinLock<Ignore>
Merge-request: KT-MR-7099
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2022-09-13 13:37:12 +00:00
Igor Chevdar 44010a04b1 [K/N][runtime] Extracted compiler interface from native runtime 2022-09-06 14:03:41 +00:00
Johan Bay f71931d04b [K/N] Parallelize marking in CMS GC
This change parallelizes marking by making each non-native Kotlin thread
mark its own view of the heap. To make this safe, we make flipping the
marking bit atomic which ensures that threads do not try to trace the
same objects.

Co-authored-by: Johan Bay <jobay@google.com>

Merge-request: KOTLIN-MR-423
Merged-by: Alexander Shabalin <alexander.shabalin@jetbrains.com>
2022-09-01 09:07:54 +00:00
Alexander Shabalin 0734456a87 [K/N] Enable extra option for mimalloc ^KT-53182
Merge-request: KT-MR-6952
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2022-09-01 09:02:23 +00:00
Vladimir Sukharev 7f1ab29668 Fix Windows targets has bad addresses in stacktrace
^KT-49240 Fixed

Merge-request: KT-MR-6883
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2022-08-24 09:05:06 +00:00
Alexander Shabalin 58569f2eee Fix pthread to number converstion ^KT-52429
Merge-request: KT-MR-6918
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2022-08-23 16:36:24 +00:00
Alexander Shabalin 6f844f15e0 [K/N] Worker API improvements ^KT-52429
Merge-request: KT-MR-6898
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2022-08-22 10:41:14 +00:00
Pavel Kunyavskiy de1dd47ab1 [K/N] Rework defines passing to runtime compilation 2022-08-17 08:32:47 +00:00
Pavel Kunyavskiy a082aeb29e [K/N] Make atomic ordering weaker for less performance harm 2022-08-10 08:36:08 +00:00
Pavel Kunyavskiy 18cda8844d [K/N] Fix possible data races found by thread sanitizer 2022-08-10 08:36:07 +00:00
Svyatoslav Scherbina ad1b10cdb0 Native: switch to "Native" thread state for some Obj-C runtime calls
A lot of calls to Objective-C runtime are potentially blocking. This
commit adds a number of thread state switches to ensure these Obj-C
runtime calls happen in "Native" thread state.

Also, remove a bunch of such functions from CallsChecker exclude list.
2022-08-02 09:24:02 +00: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 8b2f761c75 [K/N] Compile each cpp file separately.
Merge-request: KT-MR-6711
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2022-08-01 14:13:22 +00:00
Alexander Shabalin 29a0bbca4d [K/N] Fix ScopedThreadTest
Merge-request: KT-MR-6744
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2022-07-26 08:47:08 +00:00
Igor Chevdar 652f6923b3 [K/N][runtime][codegen] Fixed a problem with synchronization
During globals initialization proper synchronization is required for ARM cpus

 #KT-53243 Fixed
2022-07-22 16:53:07 +00:00
Pavel Kunyavskiy c7131a68ce [K/N] Support of collectReferenceFieldValues function 2022-07-19 08:40:14 +00:00
Alexander Shabalin d47193d36f [K/N] Add tracking of application state to the GC scheduler.
Merge-request: KT-MR-6435
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2022-06-28 06:38:36 +00:00
Johan Bay e380d7d495 [K/N] fix minor typos and outdated documentation 2022-06-24 20:27:33 +02:00
Sergey Bogolepov 26d09040a4 [K/N] Add own gettid implementation
Call-checker can't handle syscalls yet, so instead we wrap it
inside function.
2022-06-24 13:15:29 +00:00
Pavel Kunyavskiy 3932143ed0 [K/N] Fix copy-paste error in cbrtf signature
^KT-48232
2022-06-17 17:55:27 +00:00
Romain Guy 02a3915fdf KT-48232: Implement kotlin.math.cbrt() (cubic roots)
cbrt() is the standard cubic root function that provides several advantages over pow(x, 1.0/3.0):
- Better precision
- Faster
- Behaves better with negative values
2022-06-16 20:27:43 +03:00
Pavel Kunyavskiy a07066f98b [K/N] Make overridden runtime variables available during stdlib lto 2022-06-16 08:47:35 +00:00
Pavel Kunyavskiy f562c127af [K/N] Improve consistency of using setConst vs override RuntimeGlobals 2022-06-16 08:47:33 +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
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
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